From 0becdb3cbf8b88a79dd3d2a8dcb38f266486d5bc Mon Sep 17 00:00:00 2001 From: Cameron Date: Sat, 2 Mar 2013 01:03:52 -0800 Subject: [PATCH] Fixes bootstrap reusable modal window issue. --- e107_themes/bootstrap/admin_style.css | 2 +- e107_web/js/core/admin.jquery.js | 45 +++++++++++++++++++++++++++ 2 files changed, 46 insertions(+), 1 deletion(-) diff --git a/e107_themes/bootstrap/admin_style.css b/e107_themes/bootstrap/admin_style.css index cc1edf418..549a10b07 100644 --- a/e107_themes/bootstrap/admin_style.css +++ b/e107_themes/bootstrap/admin_style.css @@ -83,7 +83,7 @@ a.brand:hover img { } -.modal { min-width:800px; } +.modal { min-width:800px } @media (min-width: 1500px) { diff --git a/e107_web/js/core/admin.jquery.js b/e107_web/js/core/admin.jquery.js index 45d256ed2..ea4765833 100644 --- a/e107_web/js/core/admin.jquery.js +++ b/e107_web/js/core/admin.jquery.js @@ -23,6 +23,51 @@ $(document).ready(function() $.fn.editable.defaults.mode = 'popup'; $('.e-editable').editable(); + // Fix for boostrap modal cache. + + // $('.modal').on('hidden',function(){ + // $(this).removeData('.modal'); + // $('#uiModal .modal-label').text('Loading'); + // $('#uiModal .modal-body').html('default_body'); + // }); + + $('body').on('hidden', '.modal', function () { + $(this).removeData('modal'); + $('#uiModal .modal-label').text('Loading...'); + $('#uiModal .modal-body').text(' '); + }); + + + /* + + $('a[data-toggle="modal"]').on('click', function() + { + $(this).removeData('modal'); + $('#uiModal .modal-header').text($(this).attr('title')); + var link = $(this).attr('href'); + alert(link); + $('#uiModal .modal-body').html( 'table' ); + //return false; + + return this; + + $('#uiModal .modal-body').load(link, function(response, status, xhr) + { + if (status === 'error') + { + //console.log('got here'); + $('#uiModal .modal-body').html('

Oh boy

Sorry, but there was an error:' + xhr.status + ' ' + xhr.statusText+ '

'); + } + return false; + return this; + } + ) + + }); + + */ + + // run tips on .field-help $("button,input,textarea,select,label,.e-tip").each(function(c) {