# HG changeset patch # User cavaliet # Date 1395397362 -3600 # Node ID 1d61b91b0b46f3768e3033023b21afcacd20c951 # Parent 68746521df51f1eef1336db8350a15ff63444a83 chapters from annotations diff -r 68746521df51 -r 1d61b91b0b46 src/spel/static/spel/css/spel.css --- a/src/spel/static/spel/css/spel.css Wed Mar 19 15:55:34 2014 +0100 +++ b/src/spel/static/spel/css/spel.css Fri Mar 21 11:22:42 2014 +0100 @@ -23,6 +23,7 @@ .chapter-results, .annotation-results{ border-top: 2px solid #BBBBBB; margin-top: 10px; + min-height: 50px; padding-top: 10px; } @@ -63,4 +64,11 @@ .searched-tag .glyphicon-remove:hover{ color: #FFF; cursor: pointer; +} +.multiline{ + white-space: normal; +} +.info{ + padding-left: 5px; + padding-right: 5px; } \ No newline at end of file diff -r 68746521df51 -r 1d61b91b0b46 src/spel/static/spel/js/spectacle.js --- a/src/spel/static/spel/js/spectacle.js Wed Mar 19 15:55:34 2014 +0100 +++ b/src/spel/static/spel/js/spectacle.js Fri Mar 21 11:22:42 2014 +0100 @@ -100,7 +100,24 @@ $("#btn-search-annotations").attr('disabled','disabled'); } }); - + + function buildChapterTable(html){ + $(".chapter-results").removeClass("loader"); + $(".chapter-results").html(html); + $('.popinfo').popover({ html: true }); + $(".tablesorter").tablesorter({ + theme : "bootstrap", + widthFixed: true, + headerTemplate : '{content} {icon}', + widgets : [ "uitheme"], + widgetOptions : { + zebra : ["even", "odd"], + filter_reset : ".reset" + }, + headers: { 3: { sorter: false } } + }); + } + // Search chapters management $("#btn-filter-chapters").click(function(e){ if($("#mulsel1").val()==null && $("#mulsel2").val()==null && $("#mulsel3").val()==null){ @@ -120,20 +137,7 @@ } }) .done(function( html ) { - $(".chapter-results").removeClass("loader"); - $(".chapter-results").html(html); - $('.popinfo').popover({ html: true }); - $(".tablesorter").tablesorter({ - theme : "bootstrap", - widthFixed: true, - headerTemplate : '{content} {icon}', - widgets : [ "uitheme"], - widgetOptions : { - zebra : ["even", "odd"], - filter_reset : ".reset" - }, - headers: { 3: { sorter: false } } - }); + buildChapterTable(html); }) .fail(function() { $(".chapter-results").removeClass("loader"); @@ -145,7 +149,6 @@ // click-to-remove-tag management for chapter $(".chapter-results").on("click", ".chapter-tag-list .glyphicon-remove", function(){ - console.log(this, $(this).parent().text().trim()); if($(this).parent().hasClass("type")){ $("#mulsel1").multiselect('deselect', $(this).parent().text().trim()); } @@ -214,7 +217,6 @@ $(".annotation-results").html("

Vous devez indiquer un terme pour la recherche.

"); return false; } - console.log("ICI 1"); searchAnnotations(); }); @@ -235,7 +237,6 @@ }); } else{ - console.log("ICI 2"); searchAnnotations(); } } @@ -262,12 +263,11 @@ } } // Update number displayed - $(".nb-annotations-found").html($('.annotation-results > div:visible').length); + $(".nb-annotations-found").html($('.annotation-results > div.searched-annot:visible').length); }); // click-to-remove-tag management for annotations $(".annotation-results").on("click", ".annot-tag-list .glyphicon-remove", function(){ - console.log(this, $(this).parent().text().trim()); if($(this).parent().children().first().hasClass("glyphicon-search")){ $("#search-input").val(""); } @@ -280,5 +280,38 @@ $(".annotation-results").html(''); } }); + + // Annotations to chapters management + $(".annotation-results").on("click", ".annot-to-chapter", function(){ + // First we unselect chapter filters + $('option', $('#mulsel1')).each(function(element) { $(this).removeAttr('selected').prop('selected', false); }); + $('#mulsel1').multiselect('refresh'); + $('option', $('#mulsel2')).each(function(element) { $(this).removeAttr('selected').prop('selected', false); }); + $('#mulsel2').multiselect('refresh'); + $('option', $('#mulsel3')).each(function(element) { $(this).removeAttr('selected').prop('selected', false); }); + $('#mulsel3').multiselect('refresh'); + // Then we request + $(".chapter-results").html("

"); + $(".chapter-results").addClass("loader"); + var bla = []; + $('.annotation-results > div.searched-annot:visible').each(function(index){ + bla.push({data: $(this).attr("data-start"), iri_id: $(this).attr("data-content") }); + }); + if(bla.length==0){ return; } + $.post( + urlChapters, + { + annotations: JSON.stringify(bla), + csrfmiddlewaretoken: csrf_token + }, + function( html ) { + buildChapterTable(html); + } + ) + .fail(function() { + $(".chapter-results").removeClass("loader"); + $(".chapter-results").html('

Erreur de chargement

'); + }); + }); }); diff -r 68746521df51 -r 1d61b91b0b46 src/spel/templates/partial/spel_annotations.html --- a/src/spel/templates/partial/spel_annotations.html Wed Mar 19 15:55:34 2014 +0100 +++ b/src/spel/templates/partial/spel_annotations.html Fri Mar 21 11:22:42 2014 +0100 @@ -1,15 +1,22 @@ {% load static %} {% load front_tags %} {% load spel_tags %} - -

{{ nb_annotations }} annotation(s) trouvée(s) sur {{ nb_contents }} vidéo(s)

+
+
+ +

{{ nb_annotations }} annotation(s) trouvée(s) sur {{ nb_contents }} vidéo(s)

+
+
+ +
+
{% for res in results %} {% for s in res.list %} {% with s.tags|get_tags:"type_inter" as tag_list %} -
+

{{ res.content.title }} / {{ s.start_ts|str_duration }} - {{ s.start_ts|add:s.duration|str_duration }} / {{ s.cutting_id }}

{{ s.tags|get_tags:"modscen_and_perso"|join:', ' }}


diff -r 68746521df51 -r 1d61b91b0b46 src/spel/templates/partial/spel_chapters.html --- a/src/spel/templates/partial/spel_chapters.html Wed Mar 19 15:55:34 2014 +0100 +++ b/src/spel/templates/partial/spel_chapters.html Fri Mar 21 11:22:42 2014 +0100 @@ -1,6 +1,9 @@ {% load static %} {% load front_tags %} {% load spel_tags %} +{% if annot_chapters %} +

Chapitres correspondant aux annotations :

+{% endif %}