# HG changeset patch # User Anthony Ly # Date 1369386152 -7200 # Node ID 6eb0de10e9f8e13df3582b0ec38655d4f0805038 # Parent e3a17ec94cd82b82561bc24f779695bc24098ffe delete / edit / new annotation head diff -r e3a17ec94cd8 -r 6eb0de10e9f8 integration/edition.html --- a/integration/edition.html Thu May 23 18:11:55 2013 +0200 +++ b/integration/edition.html Fri May 24 11:02:32 2013 +0200 @@ -257,6 +257,28 @@ + +
+

Son

+
+
+
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+
+

Vidéo

diff -r e3a17ec94cd8 -r 6eb0de10e9f8 integration/js/edition.js --- a/integration/js/edition.js Thu May 23 18:11:55 2013 +0200 +++ b/integration/js/edition.js Fri May 24 11:02:32 2013 +0200 @@ -98,17 +98,7 @@ $('.popup').modal('hide'); }); - $(document).on('click','.btn-delete-annotation', function(e){ - e.preventDefault(); - //si c'est une annotation et que la tab est ouverte, on la ferme - var type = $(this).attr('data-type'); - - var idAnnotation = $(this).attr('data-id'); - $('a[href=#tab-annotation-'+idAnnotation+']').closest('li').remove(); - $('.tab-content #annotation'+idAnnotation).remove(); - $('#tab-list-annotation').tab('show'); - - }); + //confirmation suppression $("#modal-confirm").on('click', '#btn-delete-modal', function(e){ @@ -327,6 +317,7 @@ }; newAnnotation(dataAnnotation); + renderAnnotation(); } function newAnnotation(dataAnnotation){ @@ -341,7 +332,8 @@ annotation.keywords = dataAnnotation.keywords; annotations.push(annotation); - renderAnnotation(); + + return annotation; } function renderAnnotation(){ @@ -404,6 +396,18 @@ } }); + //delete annotation + $(document).on('click','.btn-delete-annotation', function(e){ + e.preventDefault(); + + var idAnnotation = $(this).attr('data-id'); + annotations = _(annotations).reject(function(c) { return c.id == idAnnotation; }); + closeTab(idAnnotation); + if(!$(this).hasAttr('data-no-render'))//si on ferme à partir de la tab renderAnnotation sera appelé 2 fois + renderAnnotation(); + + }); + //tab $('#onglet-annotations').on('click', 'a', function(e){ e.preventDefault(); @@ -419,10 +423,18 @@ function openTab(type, data){ - var dataView = {}; + var dataView; if(_.isUndefined(data)){//nouveau - dataView.id = 'id' + (new Date()).getTime(); - dataView.title = 'New'; + var dataAnnotation = { + title : 'Nouveau', + begin : 60 * 1000, + end : 60 * 1000 * 2, + description : 'description', + type : type, + keywords : [] + }; + dataView = newAnnotation(dataAnnotation); + renderAnnotation(); }else{//édition dataView = data; } @@ -449,6 +461,8 @@ //particularité selon type switch(type){ + case 'son': iconTab = 'volume-up'; + break; case 'video': iconTab = 'film'; break; case 'text': diff -r e3a17ec94cd8 -r 6eb0de10e9f8 integration/template.html --- a/integration/template.html Thu May 23 18:11:55 2013 +0200 +++ b/integration/template.html Fri May 24 11:02:32 2013 +0200 @@ -31,6 +31,9 @@
+ + Delete + Ok @@ -49,6 +52,30 @@ + +