# HG changeset patch # User Anthony Ly # Date 1369669697 -7200 # Node ID 827066f875c75dabe82bdce1cbfee8c33cf9c81c # Parent de95929867d00bc77a160dd7c02cc5efbc8faf00 annotation links diff -r de95929867d0 -r 827066f875c7 integration/css/style.css --- a/integration/css/style.css Mon May 27 16:18:05 2013 +0200 +++ b/integration/css/style.css Mon May 27 17:48:17 2013 +0200 @@ -96,6 +96,9 @@ .list-current-annotations a{text-align:center; line-height:20px; color:#FFF;display: inline-block; background-color: #589; width: 20px; height: 20px; } .list-current-annotations a:hover{text-decoration: none;} .annotation-son-content textarea{max-width: 206px;} + +.annotation-links-content .links-form:nth-child(n+2){border-top:1px solid; padding-top: 20px;} + /* Tangle */ .time-tangle { color: #2c3e50; cursor: w-resize; position: relative; diff -r de95929867d0 -r 827066f875c7 integration/edition.html --- a/integration/edition.html Mon May 27 16:18:05 2013 +0200 +++ b/integration/edition.html Mon May 27 17:48:17 2013 +0200 @@ -31,9 +31,9 @@
  • >
  • -
  • Titre du projet azerty
  • +
  • Titre du projet azerty
  • /
  • -
  • Ressources
  • +
  • Ressources
  • @@ -171,11 +171,11 @@

    Ajouter une annotation de type

    @@ -264,6 +264,44 @@
    + +
    +

    Liens

    +
    +

    Son

    @@ -286,7 +324,7 @@
    - +

    Vidéo

    @@ -445,7 +483,9 @@
    - + diff -r de95929867d0 -r 827066f875c7 integration/js/edition.js --- a/integration/js/edition.js Mon May 27 16:18:05 2013 +0200 +++ b/integration/js/edition.js Mon May 27 17:48:17 2013 +0200 @@ -520,7 +520,7 @@ //particularité selon type switch(type){ - case 'sound': + case 'audio': break; case 'video': break; @@ -528,6 +528,8 @@ var cledit = $(tabContent).find('.wysiwyg').cleditor(wysiwygConfig)[0]; break; case 'links': + var tbody = $(tabContent).find('tbody.links-rows'); + addLinkRow(tbody); break; case 'slideshow': $(tabContent).find('.number-spin').spin(spinParam); @@ -551,7 +553,7 @@ function getIcon(type){ var icon; switch(type){ - case 'sound': icon = 'volume-up'; + case 'audio': icon = 'volume-up'; break; case 'video': icon = 'film'; break; @@ -631,7 +633,44 @@ } - +//links +$('.tab-content').on('click', '.add-link', function(e){ + e.preventDefault(); + var tbody = $(this).parents('tfoot').siblings('tbody'); + addLinkRow(tbody); +}); +$('.tab-content').on('click', '.delete-link', function(e){ + e.preventDefault(); + var row = $(this).parents('tr'), + tbody = $(this).find('tbody'); + row.remove(); + updateLinks(tbody); +}); +function addLinkRow(tbody, dataView){ + $.get('template.html', function(templates){ + //head commun à tous + var tplLinkRow = $(templates).filter('#tpl-links-row').html(); + var output = Mustache.render(tplLinkRow, dataView); + tbody.append(output); + }); +} +$('.tab-content').on('keyup', '.links-rows input', function(e){ + var tbody = $(this).parents('.links-rows'); + updateLinks(tbody); +}); +function updateLinks(tbody){ + links = new Array(); + $.each(tbody.find('tr'), function(k, v){ + var urlLink = $(v).find('.url-link').val(), + titleLink = $(v).find('.title-link').val(), + link = { + uri : urlLink, + title : titleLink + }; + links.push(link); + }); + currentAnnotation.content.links = links; +} //annotation html @@ -736,9 +775,9 @@ function getContentAnnotationByType(type){ var content; switch(type){ - case 'sound': + case 'audio': content = { - mimetype : "application/x-ldt-sound", + mimetype : "application/x-ldt-audio", url : "", embedcode : "" }; @@ -794,4 +833,13 @@ $(".tag-it").tagit(); +$('.log-annotations').bind('click', function(e){ + e.preventDefault(); + console.log(annotations); +}); + +$('.log-chapters').bind('click', function(e){ + e.preventDefault(); + console.log(chapters); +}); });//ready \ No newline at end of file diff -r de95929867d0 -r 827066f875c7 integration/template.html --- a/integration/template.html Mon May 27 16:18:05 2013 +0200 +++ b/integration/template.html Mon May 27 17:48:17 2013 +0200 @@ -52,7 +52,7 @@ - + +