|
1 (function(){ |
|
2 |
|
3 $('.tab-behavior a').click(function (e) { |
|
4 e.preventDefault(); |
|
5 $(this).tab('show'); |
|
6 }); |
|
7 |
|
8 $(document).on('click', 'a.open-modal', function(e){ |
|
9 e.preventDefault(); |
|
10 var modalRemote = $(this).attr('href'), |
|
11 typeMedia = $(this).attr('data-type-media'), |
|
12 modalTitleInfo = $(this).attr('data-title'), |
|
13 titleFront; |
|
14 |
|
15 switch(typeMedia){ |
|
16 case 'video' : titleFront = '<i class="icon-film"></i> Vidéo - '+modalTitleInfo; break; |
|
17 case 'image' : titleFront = '<i class="icon-picture"></i> Image - '+modalTitleInfo; break; |
|
18 } |
|
19 $('#modal-template .modal-header h3').html(titleFront); |
|
20 |
|
21 $("#modal-template .modal-body").load(modalRemote, function() { |
|
22 $("#modal-template").modal("show"); |
|
23 }); |
|
24 |
|
25 }); |
|
26 |
|
27 //confirmation suppression |
|
28 $(document).on('click','.btn-delete', function(e){ |
|
29 e.preventDefault(); |
|
30 var titleMedia = $(this).attr('data-title'), |
|
31 textModal = $('<p>Êtes-vous sûr de vouloir supprimer <strong>'+titleMedia+'</strong> ?</p>'), |
|
32 eltDelete = $(this).attr('href'); |
|
33 $("#modal-confirm #btn-delete-modal").attr('data-id-elt-delete', eltDelete); |
|
34 $("#modal-confirm .modal-body").empty().append(textModal); |
|
35 $("#modal-confirm").modal('show'); |
|
36 }); |
|
37 |
|
38 $("#modal-confirm").on('click', '#btn-delete-modal', function(e){ |
|
39 e.preventDefault(); |
|
40 var idEltDelete = $(this).attr('data-id-elt-delete'); |
|
41 $(idEltDelete).remove(); |
|
42 $("#modal-confirm").modal('hide'); |
|
43 }); |
|
44 |
|
45 })(jQuery); |