integration/js/editor.js
changeset 123 679809037606
parent 118 7ad8b85dbd57
child 131 e2d1478c843f
--- a/integration/js/editor.js	Wed Dec 05 15:39:12 2012 +0100
+++ b/integration/js/editor.js	Thu Dec 06 12:38:34 2012 +0100
@@ -19,8 +19,8 @@
         segmenttemplate = _.template(
             '<li class="item-video annotation" data-segment-id="<%= annotation.id %>" data-media-id="<%= annotation.getMedia().id %>">'
             + '<img class="thumbnail" src="<%= annotation.thumbnail %>" alt="<%= annotation.getMedia().title %>" />'
-            + '<div class="validate <%= annotation.status %>"><div class="validate-tooltip"><ul><li><%= annotation.status_messages.join("</li><li>") %></li></ul></div></div><div class="video-info"><h3 class="title-video"><%= annotation.getMedia().title %></h3>'
-            + '<p class="subtitle"><%= annotation.title %></p><p class="duration"><%= annotation.begin.toString() %> - <%= annotation.end.toString() %> (<%= annotation.getDuration().toString() %>)</p>'
+            + '<div class="validate <%= annotation.status %>"><div class="validate-tooltip"><ul><li><%= annotation.status_messages.join("</li><li>") %></li></ul></div></div><div class="video-info"><h3 class="segment-title"><%= annotation.title %></h3>'
+            + '<p class="title-video"><%= annotation.getMedia().title %></p><p class="duration"><%= annotation.begin.toString() %> - <%= annotation.end.toString() %> (<%= annotation.getDuration().toString() %>)</p>'
             + '<ul class="tools"><li><a class="edit" href="#" title="<%= gettext("Edit segment") %>"></a></li><li><a class="bottom" href="#" title="<%= gettext("Move segment down") %>"></a></li>'
             + '<li><a class="top" href="#" title="<%= gettext("Move segment up") %>"></a></li><li><a class="delete" href="#" title="<%= gettext("Delete segment") %>"></a></li></ul></div></li>'
         ),
@@ -28,7 +28,9 @@
             '<div class="media-segment">'
             + '<div class="media-segment-section" style="left:<%= left %>px; width:<%= width %>px; background:<%= color %>; top: <%= top %>px;" data-segment-id="<%= annotation.id %>"></div>'
             + '<div class="popin media-segment-popin" style="left:<%= popleft %>px; top: <%= 5+top %>px;"><div style="left:<%= pointerpos %>px;" class="pointer"></div><div class="popin-content">'
-            + '<h3><%= annotation.title %></h3><a href="#" class="button reprendre-segment" data-segment-id="<%= annotation.id %>"><%= gettext("Clone segment") %></a>'
+            + '<h3 class="segment-title"><%= annotation.title %></h3>'
+            + '<p><%= annotation.description %></p><% if (annotation.keywords.length) { console.log(annotation.keywords); print("<p><strong>" + gettext("Tags:") + "</strong> " + annotation.keywords.join(", ") + "</p>"); } %>'
+            + '<a href="#" class="button reprendre-segment" data-segment-id="<%= annotation.id %>"><%= gettext("Clone segment") %></a>'
             + '<p><%= gettext("From:") %> <span><%= annotation.begin.toString() %></span> <%= gettext("to:") %> <span><%= annotation.end.toString() %></span> (<%= gettext("duration:") %> <span><%= annotation.getDuration().toString() %></span>)</p>'
             + '</div></div></div>'
         ),
@@ -38,7 +40,9 @@
         mediafoundtemplate = _.template(
             '<div class="media-segment"><div class="media-segment-section" style="left:<%= left %>px; width:<%= width %>px; background:<%= color %>; top: <%= top %>px;"></div>'
             + '<div class="popin media-found-popin" style="left:<%= popleft %>px; top: <%= 5+top %>px;"><div style="left:<%= pointerpos %>px;" class="pointer"></div><div class="popin-content">'
-            + '<h3><%= title %></h3><a href="#" class="button clone-segment" data-segment-id="<%= annotation.id %>"><%= gettext("Clone segment") %></a>'
+            + '<h3 class="segment-title"><%= title %></h3>'
+            + '<p><%= description %></p><% if (tags) { print("<p><strong>" + gettext("Tags:") + "</strong> " + tags + "</p>"); } %>'
+            + '<a href="#" class="button clone-segment" data-segment-id="<%= annotation.id %>"><%= gettext("Clone segment") %></a>'
             + '</div></div></div>'
         ),
         mediafoundlisttemplate = _.template(
@@ -150,6 +154,9 @@
     
     $(".col-left input").on("keyup change input paste", function() {
         var val = $(this).val();
+        if (val.length < 2) {
+            val = false;
+        }
         if (val) {
             var find = IriSP.Model.regexpFromTextOrArray(val, true),
                 replace = IriSP.Model.regexpFromTextOrArray(val, false);
@@ -169,7 +176,7 @@
                     var annotations = apimedia.getAnnotations().searchByTextFields(val);
                 } else {
                     var annotations = [];
-                }   
+                }
                 var found = find.test(media.title) || find.test(media.description) || annotations.length;
                 if (found) {
                     li.find(".title-video").html(media.title.replace(replace, '<span style="background: #fc00ff; color: #ffffff;">$1</span>'));
@@ -197,6 +204,8 @@
                             top: 8 * line.index,
                             color: IriSP.vizcolors[i % IriSP.vizcolors.length],
                             title: _a.title.replace(replace, '<span style="background: #fc00ff; color: #ffffff;">$1</span>'),
+                            description: _a.description.replace(replace, '<span style="background: #fc00ff; color: #ffffff;">$1</span>'),
+                            tags: _a.keywords.join(", ").replace(replace, '<span style="background: #fc00ff; color: #ffffff;">$1</span>'),
                             popleft : corrpos,
                             pointerpos : (pos - corrpos),
                         }
@@ -226,7 +235,7 @@
             }
         });
         if (critical) {
-            messages.push("One or more segments are invalid");
+            messages.push(gettext("One or more segments are invalid"));
         }
         
         _(mashupcritical).each(function(sc) {
@@ -243,7 +252,7 @@
         });
         mashup.status = critical ? "critical" : (warning ? "warning" : "valid");
         if (!messages.length) {
-            messages.push("Your hashcut is valid!");
+            messages.push(gettext("Your hashcut is valid!"));
         }
         mashupstatus = ' - ' + _(messages).join('\n - ');
         
@@ -348,7 +357,7 @@
             });
             currentSegment.status = critical ? "critical" : (warning ? "warning" : "valid");
             if (!messages.length) {
-                messages.push("This segment is valid!")
+                messages.push(gettext("This segment is valid!"))
             }
             currentSegment.status_messages = _(messages);