diff -r 79c19e74a121 -r 5f42ac58d262 integration/js/edition.js --- a/integration/js/edition.js Fri Jun 07 11:32:20 2013 +0200 +++ b/integration/js/edition.js Fri Jun 07 12:41:45 2013 +0200 @@ -29,7 +29,11 @@ var idAnnotation = $(this).attr('data-id'), annotation = _.find(annotations, function(c){ return c.id == idAnnotation; }); myMedia.setCurrentTime(annotation.begin); - openTab(annotation.type, annotation); + if($('#tab-annotation-'+idAnnotation).length){ + $('a[href=#tab-annotation-'+idAnnotation+']').tab('show'); + }else{ + openTab(annotation.type, annotation); + } }); myProject.onLoad(function() { @@ -86,10 +90,10 @@ url_transform: function(src) { return [{ type: "video/mp4", - src: src.replace(/\.[\d\w]+$/,'.mp4') + src: src.replace(/\.[\d\w]+$/,'.mp4').replace('rtmp://media.iri.centrepompidou.fr/ddc_player', 'http://media.iri.centrepompidou.fr') }, { type: "video/webm", - src: src.replace(/\.[\d\w]+$/,'.webm') + src: src.replace(/\.[\d\w]+$/,'.webm').replace('rtmp://media.iri.centrepompidou.fr/ddc_player', 'http://media.iri.centrepompidou.fr') }]; } } @@ -125,19 +129,8 @@ if(v.begin <= t && v.end >= t){ currentAnnotationsDisplay.push(v.id); if(!$('#item-current-annotation-'+v.id).length){ - var itemAnnotation = - $('
  • ') - .attr('id', 'item-current-annotation-'+v.id) - .attr('data-id', v.id) - .append( - $('') - .css('backgroundColor', v.color) - .attr('data-id', v.id) - .attr('href', '#') - .append( - $('').addClass('icon-'+getIcon(v.type)) - ) - ); + var itemAnnotation = getTemplate('#tpl-item-annotation-display'); + itemAnnotation = Mustache.render(itemAnnotation, v); $('.list-current-annotations').append(itemAnnotation) } } @@ -158,8 +151,8 @@ } function showCurrentAnnotationInTimeline(idAnnotation){ - $('.timeline-annotations .annotation span').hide(); - $('#annotation-timeline-'+idAnnotation+' span').show(); + $('.annotation').removeClass('editing'); + $('#annotation-timeline-'+idAnnotation).addClass('editing'); } //display annotation view $('.list-current-annotations').on('click', 'a', function(e){ @@ -249,6 +242,7 @@ var idChapter = $(this).parents('form').attr('data-chapter-id'); $('.chapter-segments').find('#'+idChapter).text(value); $('#row-list-chapter-'+idChapter).find('td:first').text(value); + $(this).parents('form').find('.btn-delete-chapter').attr('data-title', value); } }); @@ -280,7 +274,7 @@ return $('#templates').find(idTpl).html(); } //supprimer -$('.list-chapter-wrap').on('click', '.btn-delete-chapter', function(e){ +$(document).on('click', '.btn-delete-chapter', function(e){ e.preventDefault(); if(chapters.length == 1){alert('Le projet doit contenir au moins un chapitre.'); return;} @@ -290,6 +284,10 @@ btnDeleteModal.attr('data-id', idChapter); }); +$(document).on('click', '.btn-ok-chapter', function(e){ + e.preventDefault(); + $('.form-chapter-edit').remove(); +}) function deleteChapter(idChapter){ disabledPreview(); @@ -339,12 +337,12 @@ e.preventDefault(); var dataChapter = { - title : 'New', - begin : myMedia.currentTime, - end : organizeNewChapter(myMedia.currentTime), - description : 'description', - keywords : ['tag1','tag2'] - }; + title : 'New', + begin : myMedia.currentTime, + end : organizeNewChapter(myMedia.currentTime), + description : 'description', + keywords : ['tag1','tag2'] + }; newChapter(dataChapter, true); @@ -447,20 +445,13 @@ left : left, width : width, color : v.color, - id : v.id + id : v.id, + title : v.title }, segment = getTemplate('#tpl-annotation-in-timeline'); segment = Mustache.render(segment, dataAnntim); - /* - segment = $('').css({ - left : left, - width : width, - backgroundColor : v.color - }).addClass('annotation') - .attr('data-id', v.id) - .attr('id', 'annotation-timeline-'+v.id); - */ + var isInTimeline = false; $.each(timeline.find('li'), function(a, b){ if(isInTimeline) return; @@ -525,6 +516,7 @@ var idAnnotation = $(this).parents('form').attr('data-id'); $('#onglet-title-'+idAnnotation).text(value); $(this).parents('form').find('.btn-delete-annotation').attr('data-title', value); + $('#annotation-timeline-'+ idAnnotation+' span').text(value); } }); @@ -564,6 +556,7 @@ var dataView; if(_.isUndefined(data)){//nouveau + var currentTimePlusUnMin = 60 * 1000 + myMedia.currentTime, endAnnotation = (currentTimePlusUnMin