integration/js/common.js
changeset 78 5dddae65a99a
parent 74 22aca5b735a2
child 174 a1656f70f1c9
--- a/integration/js/common.js	Tue Jun 04 17:17:17 2013 +0200
+++ b/integration/js/common.js	Wed Jun 05 11:56:20 2013 +0200
@@ -12,6 +12,7 @@
             modalTitleInfo = $(this).attr('data-title'),
             hideBibliotheque = $(this).hasAttr('data-hide-bibliotheque') ? true : false,
             hideAddNew = $(this).hasAttr('data-hide-add-new') ? true : false,
+            isIframe = $(this).hasAttr('data-iframe') ? true : false,
             titleFront;
 
         switch(typeMedia){
@@ -19,15 +20,25 @@
             case 'image' : titleFront = '<i class="icon-picture"></i> Image - '+modalTitleInfo; break;
         }
         $('#modal-template .modal-header h3').html(titleFront);
-
-        $("#modal-template .modal-body").load(modalRemote, function() { 
-            $("#modal-template").modal("show"); 
+        
+        if(isIframe){
             if(hideBibliotheque)
                 $("#modal-template").find(".bibliotheque-link").hide();
             if(hideAddNew)
                 $("#modal-template").find(".add-new").hide();
-        });
 
+            $("#modal-template .modal-body").html('<iframe src="' + modalRemote + '" seamless="seamless" width="580" height="440"></iframe>');
+            $("#modal-template").modal("show");
+        }
+        else{
+            $("#modal-template .modal-body").load(modalRemote, function() { 
+                $("#modal-template").modal("show"); 
+                if(hideBibliotheque)
+                    $("#modal-template").find(".bibliotheque-link").hide();
+                if(hideAddNew)
+                    $("#modal-template").find(".add-new").hide();
+            });
+        }
     });
 
     $('.popup').on('click', '.popup-content a', function(e){
@@ -43,6 +54,11 @@
 
     });
 
+// empty modal when closed
+      $("#modal-template .modal-header .close").click(function(e){
+          $("#modal-template .modal-body").html('');
+      });
+
 //confirmation suppression
     $(document).on('click','.btn-delete', function(e){
         e.preventDefault();