equal
deleted
inserted
replaced
96 var listDiaporama = $('#'+global.diaporama); |
96 var listDiaporama = $('#'+global.diaporama); |
97 addImageToDiaporama(listDiaporama); |
97 addImageToDiaporama(listDiaporama); |
98 $('.popup').modal('hide'); |
98 $('.popup').modal('hide'); |
99 }); |
99 }); |
100 |
100 |
101 $(document).on('click','.btn-delete-annotation', function(e){ |
101 |
102 e.preventDefault(); |
|
103 //si c'est une annotation et que la tab est ouverte, on la ferme |
|
104 var type = $(this).attr('data-type'); |
|
105 |
|
106 var idAnnotation = $(this).attr('data-id'); |
|
107 $('a[href=#tab-annotation-'+idAnnotation+']').closest('li').remove(); |
|
108 $('.tab-content #annotation'+idAnnotation).remove(); |
|
109 $('#tab-list-annotation').tab('show'); |
|
110 |
|
111 }); |
|
112 |
102 |
113 //confirmation suppression |
103 //confirmation suppression |
114 $("#modal-confirm").on('click', '#btn-delete-modal', function(e){ |
104 $("#modal-confirm").on('click', '#btn-delete-modal', function(e){ |
115 |
105 |
116 }); |
106 }); |
325 type : 'video', |
315 type : 'video', |
326 keywords : ['ideal', 'tag'] |
316 keywords : ['ideal', 'tag'] |
327 }; |
317 }; |
328 |
318 |
329 newAnnotation(dataAnnotation); |
319 newAnnotation(dataAnnotation); |
|
320 renderAnnotation(); |
330 } |
321 } |
331 |
322 |
332 function newAnnotation(dataAnnotation){ |
323 function newAnnotation(dataAnnotation){ |
333 var annotation = new IriSP.Model.Annotation(false, myProject); |
324 var annotation = new IriSP.Model.Annotation(false, myProject); |
334 annotation.setMedia(myMedia.id); |
325 annotation.setMedia(myMedia.id); |
339 annotation.type = dataAnnotation.type; |
330 annotation.type = dataAnnotation.type; |
340 annotation.color = global.colors[(global.colorsIndex<global.colors.length) ? global.colorsIndex++ : (global.colorsIndex=0)]; |
331 annotation.color = global.colors[(global.colorsIndex<global.colors.length) ? global.colorsIndex++ : (global.colorsIndex=0)]; |
341 annotation.keywords = dataAnnotation.keywords; |
332 annotation.keywords = dataAnnotation.keywords; |
342 |
333 |
343 annotations.push(annotation); |
334 annotations.push(annotation); |
344 renderAnnotation(); |
335 |
|
336 return annotation; |
345 } |
337 } |
346 |
338 |
347 function renderAnnotation(){ |
339 function renderAnnotation(){ |
348 var timeline = $('.timeline-annotations'), |
340 var timeline = $('.timeline-annotations'), |
349 wTimeline = timeline.width(), |
341 wTimeline = timeline.width(), |
402 var idAnnotation = $(this).parents('form').attr('data-id'); |
394 var idAnnotation = $(this).parents('form').attr('data-id'); |
403 $('#onglet-title-'+idAnnotation).text(value); |
395 $('#onglet-title-'+idAnnotation).text(value); |
404 } |
396 } |
405 }); |
397 }); |
406 |
398 |
|
399 //delete annotation |
|
400 $(document).on('click','.btn-delete-annotation', function(e){ |
|
401 e.preventDefault(); |
|
402 |
|
403 var idAnnotation = $(this).attr('data-id'); |
|
404 annotations = _(annotations).reject(function(c) { return c.id == idAnnotation; }); |
|
405 closeTab(idAnnotation); |
|
406 if(!$(this).hasAttr('data-no-render'))//si on ferme à partir de la tab renderAnnotation sera appelé 2 fois |
|
407 renderAnnotation(); |
|
408 |
|
409 }); |
|
410 |
407 //tab |
411 //tab |
408 $('#onglet-annotations').on('click', 'a', function(e){ |
412 $('#onglet-annotations').on('click', 'a', function(e){ |
409 e.preventDefault(); |
413 e.preventDefault(); |
410 $(this).tab('show'); |
414 $(this).tab('show'); |
411 }); |
415 }); |
417 openTab(type); |
421 openTab(type); |
418 }); |
422 }); |
419 |
423 |
420 function openTab(type, data){ |
424 function openTab(type, data){ |
421 |
425 |
422 var dataView = {}; |
426 var dataView; |
423 if(_.isUndefined(data)){//nouveau |
427 if(_.isUndefined(data)){//nouveau |
424 dataView.id = 'id' + (new Date()).getTime(); |
428 var dataAnnotation = { |
425 dataView.title = 'New'; |
429 title : 'Nouveau', |
|
430 begin : 60 * 1000, |
|
431 end : 60 * 1000 * 2, |
|
432 description : 'description', |
|
433 type : type, |
|
434 keywords : [] |
|
435 }; |
|
436 dataView = newAnnotation(dataAnnotation); |
|
437 renderAnnotation(); |
426 }else{//édition |
438 }else{//édition |
427 dataView = data; |
439 dataView = data; |
428 } |
440 } |
429 |
441 |
430 var idAnnotation = dataView.id, |
442 var idAnnotation = dataView.id, |
447 $(tabContent).append(tpl); |
459 $(tabContent).append(tpl); |
448 $('.tab-content').append(tabContent); |
460 $('.tab-content').append(tabContent); |
449 |
461 |
450 //particularité selon type |
462 //particularité selon type |
451 switch(type){ |
463 switch(type){ |
|
464 case 'son': iconTab = 'volume-up'; |
|
465 break; |
452 case 'video': iconTab = 'film'; |
466 case 'video': iconTab = 'film'; |
453 break; |
467 break; |
454 case 'text': |
468 case 'text': |
455 iconTab = 'align-left'; |
469 iconTab = 'align-left'; |
456 $(tabContent).find('.wysiwyg').cleditor(wysiwygConfig); |
470 $(tabContent).find('.wysiwyg').cleditor(wysiwygConfig); |