--- 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