Merge with 99d281de4f3145f325917061553a3995671e6876
authorcavaliet
Thu, 06 Jun 2013 18:04:50 +0200
changeset 91 e6c653f9960c
parent 90 3d4b40a75ecd (current diff)
parent 89 99d281de4f31 (diff)
child 92 14b9fc4a4a3d
Merge with 99d281de4f3145f325917061553a3995671e6876
--- a/integration/edition.html	Thu Jun 06 17:58:16 2013 +0200
+++ b/integration/edition.html	Thu Jun 06 18:04:50 2013 +0200
@@ -555,7 +555,7 @@
 			<div data-id="{{id}}" id="" class="slider-duration"></div>
 		</div>
 		<div class="span6 text-right">
-			<a class="btn btn-danger btn-delete btn-delete-annotation" data-id="{{id}}" data-no-render>
+			<a class="btn btn-danger btn-delete btn-delete-annotation" data-title="{{title}}" data-id="{{id}}" data-no-render>
 				<i class="icon-trash"></i> Delete
 			</a>
 			<a class="btn btn-primary btn-save-annotation" data-id="{{id}}">
@@ -722,7 +722,7 @@
 
 <script id="tpl-diaporama-row" type="text/html">
 <tr id="rid-{{ridid}}" class="row-image-diaporama">
-	<td class="image-slideshow-row"><img data-url="{{url}}" src="{{url}}" alt=""> </td>
+	<td class="image-slideshow-row"><img data-url="{{url}}" src="{{url}}?width=60&height=60" alt=""> </td>
 	<td class="title-slideshow-row" data-input="input" data-name="title">
 		<span>{{title}}</span> <i class="icon-pencil"></i>
 	</td>
--- a/integration/js/edition.js	Thu Jun 06 17:58:16 2013 +0200
+++ b/integration/js/edition.js	Thu Jun 06 18:04:50 2013 +0200
@@ -24,8 +24,9 @@
     }
 });
 
-$('.timeline-annotations').bind('click', function(e){
-    var x = e.pageX - $(this).offset().left;
+$('.timeline-annotations').on('click', '.annotation', function(e){
+    e.preventDefault();
+
     myMedia.setCurrentTime(myMedia.duration * x / $(this).width());
 });
 
@@ -301,7 +302,8 @@
         //var newEnd = new IriSP.Model.Time(chapter.end)
         chapterModify.setEnd(chapter.end);
     }
-    chapters = _(chapters).reject(function(c) { return c.id == idChapter; });
+    chapters.removeId(idChapter);
+    myProject.getAnnotations().removeId(idChapter, true);
     renderChapter();
     //si le formulaire est visible
     if($('#form-chapter-edit-'+idChapter).length){
@@ -325,6 +327,7 @@
             chapter.color = getRandomColor();
     
         chapters.push(chapter);
+        myProject.getAnnotations().push(chapter);
         renderChapter();
         loadFormChapter(chapter.id);
     }
@@ -366,7 +369,7 @@
             wChapterSegmentWrap = chapterSegmentWrap.width(),
             chapterList = $('.list-chapter-rows-wrap');
 
-        chapters = _.sortBy(chapters, function(c){
+        chapters = chapters.sortBy(function(c){
             return c.begin;
         });
 
@@ -412,6 +415,7 @@
             annotation.keywords = dataAnnotation.keywords;
             annotation.content = getContentAnnotationByType(dataAnnotation.type);
 
+        myProject.getAnnotations().push(annotation);
         annotations.push(annotation);
         
         return annotation;
@@ -424,7 +428,7 @@
             wTimeline = timeline.width(),
             annotationList = $('#list-annotations-rows');
 
-        annotations = _.sortBy(annotations, function(c){
+        annotations = annotations.sortBy(function(c){
             return c.begin;
         });
 
@@ -440,7 +444,9 @@
                     left : left,
                     width : width,
                     backgroundColor : v.color
-                }).addClass('annotation').attr('id', 'annotation-timeline-'+v.id);
+                }).addClass('annotation')
+                .attr('data-id', v.id)
+                .attr('id', 'annotation-timeline-'+v.id);
 
             var isInTimeline = false;
             $.each(timeline.find('li'), function(a, b){
@@ -505,6 +511,7 @@
         if(name == 'title'){
             var idAnnotation = $(this).parents('form').attr('data-id');
             $('#onglet-title-'+idAnnotation).text(value);
+            $(this).parents('form').find('.btn-delete-annotation').attr('data-title', value);
         }
     });
 
@@ -521,7 +528,8 @@
     function deleteAnnotation(idAnnotation){
         disabledPreview();
         $("#modal-confirm").modal('hide');
-        annotations = _(annotations).reject(function(c) { return c.id == idAnnotation; });
+        annotations.removeId(idAnnotation);
+        myProject.getAnnotations().removeId(idAnnotation, true);
         closeTab(idAnnotation);
         renderAnnotation();
     }
@@ -706,7 +714,7 @@
         getVideoPlayer(dataVideo.url, videoWrap);
      
     }
-    $('.popup').on('click', '.bibliotheque-video a', function(e){
+    $('.popup').on('click', '.bibliotheque-video a:not(.pagination a)', function(e){
         e.preventDefault();
 
         var url = $(this).attr('data-url'),
@@ -721,14 +729,13 @@
 
         var videoWrap = $('#tab-annotation-'+currentAnnotation.id).find('.annotation-video-content');
         renderVideoInfo(videoWrap, currentAnnotation.content);
-
         
     });
 
 //diaporama
 
     //bibliotheque
-    $('.popup').on('click', '.bibliotheque-image a', function(e){
+    $('.popup').on('click', '.bibliotheque-image a:not(.pagination a)', function(e){
         e.preventDefault();
 
         var url = $(this).attr('data-url'),
@@ -891,7 +898,7 @@
 $('.btn-save-project').bind('click', function(e){
     $('.btn-apercu-projet').removeClass('disabled');
 
-    console.log(myProject.serialize());
+    console.log(JSON.parse(myProject.serialize()));
 /*
     $.ajax({
         type: "POST",
@@ -950,7 +957,7 @@
     fonts:        "Arial,Arial Black,Comic Sans MS,Courier New,Narrow,Garamond," +
                     "Georgia,Impact,Sans Serif,Serif,Tahoma,Trebuchet MS,Verdana",
     sizes:        "1,2,3,4,5,6,7",
-    styles:       [["Paragraph", "<p>"], ["Header 1", "<h1>"], ["Header 2", "<h2>"],
+    styles:       [["Paragraph", "<p>"], ["Header 2", "<h2>"],
                     ["Header 3", "<h3>"],  ["Header 4","<h4>"],  ["Header 5","<h5>"],
                     ["Header 6","<h6>"]],
     docType:      '<!DOCTYPE HTML>',
--- a/integration/js/metadataplayer-core.js	Thu Jun 06 17:58:16 2013 +0200
+++ b/integration/js/metadataplayer-core.js	Thu Jun 06 18:04:50 2013 +0200
@@ -1180,7 +1180,10 @@
             return (_e.elementType === _listId);
         });
     } else {
-        return this.contents[_listId] || new IriSP.List(this.directory);
+        if (typeof this.contents[_listId] === "undefined") {
+            this.contents[_listId] = new IriSP.List(this.directory);
+        }
+        return this.contents[_listId];
     }
 };