518 $(tabContent).append(tpl); |
518 $(tabContent).append(tpl); |
519 $('.tab-content').append(tabContent); |
519 $('.tab-content').append(tabContent); |
520 |
520 |
521 //particularité selon type |
521 //particularité selon type |
522 switch(type){ |
522 switch(type){ |
523 case 'sound': |
523 case 'audio': |
524 break; |
524 break; |
525 case 'video': |
525 case 'video': |
526 break; |
526 break; |
527 case 'text': |
527 case 'text': |
528 var cledit = $(tabContent).find('.wysiwyg').cleditor(wysiwygConfig)[0]; |
528 var cledit = $(tabContent).find('.wysiwyg').cleditor(wysiwygConfig)[0]; |
529 break; |
529 break; |
530 case 'links': |
530 case 'links': |
|
531 var tbody = $(tabContent).find('tbody.links-rows'); |
|
532 addLinkRow(tbody); |
531 break; |
533 break; |
532 case 'slideshow': |
534 case 'slideshow': |
533 $(tabContent).find('.number-spin').spin(spinParam); |
535 $(tabContent).find('.number-spin').spin(spinParam); |
534 $(tabContent).find('.ui-sortable').sortable({ |
536 $(tabContent).find('.ui-sortable').sortable({ |
535 stop : function(event, ui){ |
537 stop : function(event, ui){ |
629 listDiaporama.find('tr.row-image-diaporama:first-child').find('.btn-sort.up').addClass('disabled'); |
631 listDiaporama.find('tr.row-image-diaporama:first-child').find('.btn-sort.up').addClass('disabled'); |
630 listDiaporama.find('tr.row-image-diaporama:last-child').find('.btn-sort.down').addClass('disabled'); |
632 listDiaporama.find('tr.row-image-diaporama:last-child').find('.btn-sort.down').addClass('disabled'); |
631 } |
633 } |
632 |
634 |
633 |
635 |
634 |
636 //links |
|
637 $('.tab-content').on('click', '.add-link', function(e){ |
|
638 e.preventDefault(); |
|
639 var tbody = $(this).parents('tfoot').siblings('tbody'); |
|
640 addLinkRow(tbody); |
|
641 }); |
|
642 $('.tab-content').on('click', '.delete-link', function(e){ |
|
643 e.preventDefault(); |
|
644 var row = $(this).parents('tr'), |
|
645 tbody = $(this).find('tbody'); |
|
646 row.remove(); |
|
647 updateLinks(tbody); |
|
648 }); |
|
649 function addLinkRow(tbody, dataView){ |
|
650 $.get('template.html', function(templates){ |
|
651 //head commun à tous |
|
652 var tplLinkRow = $(templates).filter('#tpl-links-row').html(); |
|
653 var output = Mustache.render(tplLinkRow, dataView); |
|
654 tbody.append(output); |
|
655 }); |
|
656 } |
|
657 $('.tab-content').on('keyup', '.links-rows input', function(e){ |
|
658 var tbody = $(this).parents('.links-rows'); |
|
659 updateLinks(tbody); |
|
660 }); |
|
661 function updateLinks(tbody){ |
|
662 links = new Array(); |
|
663 $.each(tbody.find('tr'), function(k, v){ |
|
664 var urlLink = $(v).find('.url-link').val(), |
|
665 titleLink = $(v).find('.title-link').val(), |
|
666 link = { |
|
667 uri : urlLink, |
|
668 title : titleLink |
|
669 }; |
|
670 links.push(link); |
|
671 }); |
|
672 currentAnnotation.content.links = links; |
|
673 } |
635 |
674 |
636 |
675 |
637 //annotation html |
676 //annotation html |
638 $('.tab-content').on('click', '.btn-html-apercu', function(e){ |
677 $('.tab-content').on('click', '.btn-html-apercu', function(e){ |
639 e.preventDefault(); |
678 e.preventDefault(); |