integration/js/editor.js
brancheditorjs
changeset 18 c85b323f5174
parent 15 56937307d7f4
child 22 bd904d592881
--- a/integration/js/editor.js	Thu Oct 25 14:53:29 2012 +0200
+++ b/integration/js/editor.js	Thu Oct 25 16:40:20 2012 +0200
@@ -5,7 +5,7 @@
                 url: "data/bpidata.json",
                 serializer: IriSP.serializers.medialist
             }),
-            mediatemplate = '<li class="item-video"><img src="{{thumbnail}}" alt="aperçu" />'
+            mediatemplate = '<li class="item-video"><img src="{{thumbnail}}" alt="{{title}}" />'
                 + '<span class="video-info"><span class="title-video">{{title}}</span><span class="author">{{description}}</span>'
                 + '<span class="time-length">Durée : <span>{{duration}}</span></span></span></li>';
         project.onLoad(function() {
@@ -49,6 +49,30 @@
             return false;
         });
         
+        function disableMoveItemVideo() {
+            $(".organize-segments .top, .organize-segments .bottom").removeClass("disable");
+            $(".organize-segments .item-video:last-child .bottom, .organize-segments .item-video:first-child .top").addClass("disable");
+        }
+        
+        $(".organize-segments").sortable({
+            stop : function(){
+                disableMoveItemVideo();
+            }
+        });
+        
+        $(".organize-segments .top").click(function(e){
+            var currentItem = $(this).parents(".item-video");
+            currentItem.insertBefore(currentItem.prev());
+            disableMoveItemVideo();
+        });
+        
+        $(".organize-segments .bottom").click(function(e){
+            var currentItem = $(this).parents(".item-video");
+            currentItem.insertAfter(currentItem.next());
+            disableMoveItemVideo();
+        });
+        
+        
     }
     
     IriSP.Hashcut = Hashcut;