10 var modalRemote = $(this).attr('href'), |
10 var modalRemote = $(this).attr('href'), |
11 typeMedia = $(this).attr('data-type-media'), |
11 typeMedia = $(this).attr('data-type-media'), |
12 modalTitleInfo = $(this).attr('data-title'), |
12 modalTitleInfo = $(this).attr('data-title'), |
13 hideBibliotheque = $(this).hasAttr('data-hide-bibliotheque') ? true : false, |
13 hideBibliotheque = $(this).hasAttr('data-hide-bibliotheque') ? true : false, |
14 hideAddNew = $(this).hasAttr('data-hide-add-new') ? true : false, |
14 hideAddNew = $(this).hasAttr('data-hide-add-new') ? true : false, |
|
15 isIframe = $(this).hasAttr('data-iframe') ? true : false, |
15 titleFront; |
16 titleFront; |
16 |
17 |
17 switch(typeMedia){ |
18 switch(typeMedia){ |
18 case 'video' : titleFront = '<i class="icon-film"></i> Vidéo - '+modalTitleInfo; break; |
19 case 'video' : titleFront = '<i class="icon-film"></i> Vidéo - '+modalTitleInfo; break; |
19 case 'image' : titleFront = '<i class="icon-picture"></i> Image - '+modalTitleInfo; break; |
20 case 'image' : titleFront = '<i class="icon-picture"></i> Image - '+modalTitleInfo; break; |
20 } |
21 } |
21 $('#modal-template .modal-header h3').html(titleFront); |
22 $('#modal-template .modal-header h3').html(titleFront); |
22 |
23 |
23 $("#modal-template .modal-body").load(modalRemote, function() { |
24 if(isIframe){ |
24 $("#modal-template").modal("show"); |
|
25 if(hideBibliotheque) |
25 if(hideBibliotheque) |
26 $("#modal-template").find(".bibliotheque-link").hide(); |
26 $("#modal-template").find(".bibliotheque-link").hide(); |
27 if(hideAddNew) |
27 if(hideAddNew) |
28 $("#modal-template").find(".add-new").hide(); |
28 $("#modal-template").find(".add-new").hide(); |
29 }); |
|
30 |
29 |
|
30 $("#modal-template .modal-body").html('<iframe src="' + modalRemote + '" seamless="seamless" width="580" height="440"></iframe>'); |
|
31 $("#modal-template").modal("show"); |
|
32 } |
|
33 else{ |
|
34 $("#modal-template .modal-body").load(modalRemote, function() { |
|
35 $("#modal-template").modal("show"); |
|
36 if(hideBibliotheque) |
|
37 $("#modal-template").find(".bibliotheque-link").hide(); |
|
38 if(hideAddNew) |
|
39 $("#modal-template").find(".add-new").hide(); |
|
40 }); |
|
41 } |
31 }); |
42 }); |
32 |
43 |
33 $('.popup').on('click', '.popup-content a', function(e){ |
44 $('.popup').on('click', '.popup-content a', function(e){ |
34 |
45 |
35 if($(this).hasClass('no-prevent')){ |
46 if($(this).hasClass('no-prevent')){ |
40 if($(this).hasClass('btn-cancel')){ |
51 if($(this).hasClass('btn-cancel')){ |
41 $(this).parents('.popup').modal('hide'); |
52 $(this).parents('.popup').modal('hide'); |
42 } |
53 } |
43 |
54 |
44 }); |
55 }); |
|
56 |
|
57 // empty modal when closed |
|
58 $("#modal-template .modal-header .close").click(function(e){ |
|
59 $("#modal-template .modal-body").html(''); |
|
60 }); |
45 |
61 |
46 //confirmation suppression |
62 //confirmation suppression |
47 $(document).on('click','.btn-delete', function(e){ |
63 $(document).on('click','.btn-delete', function(e){ |
48 e.preventDefault(); |
64 e.preventDefault(); |
49 var titleMedia = $(this).attr('data-title'), |
65 var titleMedia = $(this).attr('data-title'), |