integration/js/edition.js
changeset 102 172abe53cf6c
parent 101 e40637c085b0
child 105 8645721dd9fc
equal deleted inserted replaced
101:e40637c085b0 102:172abe53cf6c
    34 });
    34 });
    35 
    35 
    36 $(document).on('mouseover', '.chapter-segment, .row-list-chapter' , function(){
    36 $(document).on('mouseover', '.chapter-segment, .row-list-chapter' , function(){
    37     if(!$(this).hasClass('shadow')) {
    37     if(!$(this).hasClass('shadow')) {
    38         var idChapter = $(this).attr('data-id');
    38         var idChapter = $(this).attr('data-id');
    39         $('#row-list-chapter-'+idChapter+', #'+idChapter).addClass('shadow');
    39         $('#row-list-chapter-'+idChapter+', #'+idChapter+', #form-chapter-edit-'+idChapter).addClass('shadow');
    40     }
    40     }
    41 });
    41 });
    42 
    42 
    43 $(document).on('mouseout', '.shadow' , function(){
    43 $(document).on('mouseout', '.shadow' , function(){
    44     $('.shadow').removeClass('shadow');
    44     $('.shadow').removeClass('shadow');
   299     }
   299     }
   300 //supprimer
   300 //supprimer
   301 $(document).on('click', '.btn-delete-chapter', function(e){
   301 $(document).on('click', '.btn-delete-chapter', function(e){
   302     e.preventDefault();
   302     e.preventDefault();
   303 
   303 
   304     if(chapters.length == 1){alert('Le projet doit contenir au moins un chapitre.'); return;}
   304     if(chapters.length == 1){
       
   305         $('#modal-alert .alert-message').hide();
       
   306         $('#modal-alert #alert-chapter-number').show();
       
   307         $('#modal-alert').modal('show');
       
   308         return;
       
   309     }
   305     var idChapter = $(this).attr('data-chapter-id'),
   310     var idChapter = $(this).attr('data-chapter-id'),
   306         btnDeleteModal = $("#modal-confirm #btn-delete-modal");
   311         btnDeleteModal = $("#modal-confirm #btn-delete-modal");
   307     btnDeleteModal.attr('data-type-delete', 'chapter');
   312     btnDeleteModal.attr('data-type-delete', 'chapter');
   308     btnDeleteModal.attr('data-id', idChapter);
   313     btnDeleteModal.attr('data-id', idChapter);
       
   314 
       
   315     var titleMedia = $(this).attr('data-title'),
       
   316         urlDelete = $(this).attr('href');
       
   317     $("#modal-confirm #btn-delete-modal").attr('href', urlDelete).focus();
       
   318     $("#modal-confirm .modal-body").find('.titleMedia').text(titleMedia);
       
   319     $("#modal-confirm").modal('show');
   309 
   320 
   310 });
   321 });
   311 $(document).on('click', '.btn-ok-chapter', function(e){
   322 $(document).on('click', '.btn-ok-chapter', function(e){
   312     e.preventDefault();
   323     e.preventDefault();
   313     $('.form-chapter-edit').remove();
   324     $('.form-chapter-edit').remove();
   360     $('.chapter-widget').on('click', '.btn-cut-chapter', function(e){
   371     $('.chapter-widget').on('click', '.btn-cut-chapter', function(e){
   361         e.preventDefault();
   372         e.preventDefault();
   362         var begin = myMedia.currentTime,
   373         var begin = myMedia.currentTime,
   363             end = organizeNewChapter(myMedia.currentTime);
   374             end = organizeNewChapter(myMedia.currentTime);
   364         if(!end){
   375         if(!end){
   365             alert('Les chapitres doivent durer au moins '+secMiniChapter+' secondes');
   376             $('#modal-alert .alert-message').hide();
       
   377             $('#modal-alert #alert-chapter-duration').show();
       
   378             $('#modal-alert #alert-chapter-duration strong').text(secMiniChapter);
       
   379             $('#modal-alert').modal('show');
   366             return;
   380             return;
   367         }
   381         }
   368         var dataChapter = {
   382         var dataChapter = {
   369             title : 'New',
   383             title : 'New',
   370             begin : begin,
   384             begin : begin,
   639                         labelAdd = $(tabContent).find('.label-add-video');
   653                         labelAdd = $(tabContent).find('.label-add-video');
   640                     if(viewType.content.url != ""){
   654                     if(viewType.content.url != ""){
   641                         var videoWrap = $(tabContent).find('.annotation-video-content');
   655                         var videoWrap = $(tabContent).find('.annotation-video-content');
   642                         renderVideoInfo(videoWrap, viewType.content);
   656                         renderVideoInfo(videoWrap, viewType.content);
   643                         labelModify.show();
   657                         labelModify.show();
       
   658 
   644                     }else{
   659                     }else{
   645                         labelAdd.show();
   660                         labelAdd.show();
   646                     }
   661                     }
   647                     break;
   662                     break;
   648                 case 'text': 
   663                 case 'text':