1 (function(){ |
1 $(function(){ |
2 |
2 |
3 $('.tab-behavior a').click(function (e) { |
3 $('.tab-behavior a').click(function (e) { |
4 e.preventDefault(); |
4 e.preventDefault(); |
5 $(this).tab('show'); |
5 $(this).tab('show'); |
6 }); |
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 |
7 |
15 switch(typeMedia){ |
8 }); |
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 $("#modal-template").find(".bibliotheque-link").hide(); |
|
24 }); |
|
25 |
|
26 }); |
|
27 |
|
28 //confirmation suppression |
|
29 $(document).on('click','.btn-delete', function(e){ |
|
30 e.preventDefault(); |
|
31 var titleMedia = $(this).attr('data-title'), |
|
32 textModal = $('<p>Êtes-vous sûr de vouloir supprimer <strong>'+titleMedia+'</strong> ?</p>'), |
|
33 eltDelete = $(this).attr('href'); |
|
34 $("#modal-confirm #btn-delete-modal").attr('data-id-elt-delete', eltDelete); |
|
35 $("#modal-confirm .modal-body").empty().append(textModal); |
|
36 $("#modal-confirm").modal('show'); |
|
37 }); |
|
38 |
|
39 $("#modal-confirm").on('click', '#btn-delete-modal', function(e){ |
|
40 e.preventDefault(); |
|
41 var idEltDelete = $(this).attr('data-id-elt-delete'); |
|
42 $(idEltDelete).remove(); |
|
43 $("#modal-confirm").modal('hide'); |
|
44 }); |
|
45 |
|
46 })(jQuery); |
|