integration/js/edition.js
changeset 48 827066f875c7
parent 42 95e64fb6730f
child 49 06627f23df42
equal deleted inserted replaced
47:de95929867d0 48:827066f875c7
   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){
   549     }//openTab()
   551     }//openTab()
   550 
   552 
   551     function getIcon(type){
   553     function getIcon(type){
   552         var icon;
   554         var icon;
   553         switch(type){
   555         switch(type){
   554             case 'sound': icon = 'volume-up';
   556             case 'audio': icon = 'volume-up';
   555                 break;
   557                 break;
   556             case 'video': icon = 'film';
   558             case 'video': icon = 'film';
   557                 break;
   559                 break;
   558             case 'text': 
   560             case 'text': 
   559                 icon = 'align-left';
   561                 icon = 'align-left';
   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();
   734 }
   773 }
   735 
   774 
   736 function getContentAnnotationByType(type){
   775 function getContentAnnotationByType(type){
   737     var content;
   776     var content;
   738     switch(type){
   777     switch(type){
   739         case 'sound':
   778         case 'audio':
   740             content = {
   779             content = {
   741                 mimetype : "application/x-ldt-sound",
   780                 mimetype : "application/x-ldt-audio",
   742                 url : "",
   781                 url : "",
   743                 embedcode : ""
   782                 embedcode : ""
   744             };
   783             };
   745             break;
   784             break;
   746         case 'video':
   785         case 'video':
   792 
   831 
   793 $('.slider-duration').slider(configSlider);
   832 $('.slider-duration').slider(configSlider);
   794 
   833 
   795 $(".tag-it").tagit();
   834 $(".tag-it").tagit();
   796 
   835 
       
   836 $('.log-annotations').bind('click', function(e){
       
   837     e.preventDefault();
       
   838     console.log(annotations);
       
   839 });
       
   840 
       
   841 $('.log-chapters').bind('click', function(e){
       
   842     e.preventDefault();
       
   843     console.log(chapters);
       
   844 });
   797 });//ready
   845 });//ready