From 614963798a967d5899361e3ead4d5d20da8794b9 Mon Sep 17 00:00:00 2001 From: lonalore Date: Tue, 14 Feb 2017 16:59:52 +0100 Subject: [PATCH] Fix for Menu Manager modal tooltips. --- e107_admin/menus.php | 101 ++++++++++--------------- e107_themes/bootstrap3/admin_style.css | 2 + e107_web/js/core/admin.jquery.js | 84 +++++++++++--------- 3 files changed, 92 insertions(+), 95 deletions(-) diff --git a/e107_admin/menus.php b/e107_admin/menus.php index 1f11dc872..8aca416d5 100644 --- a/e107_admin/menus.php +++ b/e107_admin/menus.php @@ -177,72 +177,63 @@ TEMPL; e107::getJs()->footerInline(" $(function() { - // Visibility/Instance Options etc. - $('.e-menumanager-option').on('click', function(){ - - var link = $(this).attr('href'); + var link = $(this).attr('href'); var caption = $(this).attr('data-modal-caption'); - window.parent.$('#uiModal .modal-caption').text(caption); - window.parent.$('#uiModal .modal-body').load(link, function(){ - - window.parent.$('.modal-body :input').on('change', function(){ + window.parent.$('#uiModal .modal-caption').text(caption); + + window.parent.$('#uiModal .modal-body').load(link, function(){ + window.parent.$('.modal-body :input').on('change', function(){ var target = window.parent.$('#e-save-form').attr('action'); var data = window.parent.$('#e-save-form').serialize(); - - // alert(data); - // alert(target); + $.post(target, data ,function(ret) { - // alert('Posted: '+ret); - // console.log('Posted: '+ ret); - if(ret == '') { return false; } - - var a = $.parseJSON(ret); - + + var a = $.parseJSON(ret); + if(a.error) { alert(a.msg); } - }); - - }); + }); + + // Attach all registered behaviors to the new content. + window.parent.e107.attachBehaviors(); }); - - + window.parent.$('#uiModal').modal('show'); - - return false; - - }) ; - - - - // Delete Button (Remove Menu) Function - - $('.e-menumanager-delete').on('click', function(e){ - e.preventDefault(); - var area = 'remove'; - var remove = $(this).attr('id'); - var opt = remove.split('-'); - var hidem = '#block-' + opt[1] +'-' + opt[2]; - $(hidem).hide('slow'); - // alert(hidem); - $.ajax({ - type: 'POST', - url: 'menus.php', - data: { removeid: remove, area: area, mode: 'delete' } - - }).done(function( data ) { - + return false; + }); + + // Delete Button (Remove Menu) Function + $('.e-menumanager-delete').on('click', function(e) { + e.preventDefault(); + + var area = 'remove'; + var remove = $(this).attr('id'); + var opt = remove.split('-'); + var hidem = '#block-' + opt[1] +'-' + opt[2]; + + $(hidem).hide('slow'); + + $.ajax({ + type: 'POST', + url: 'menus.php', + data: { + removeid: remove, + area: area, + mode: 'delete' + } + }).done(function(data) { var a = $.parseJSON(data); if(a.error) @@ -251,21 +242,11 @@ TEMPL; } }); }); - - - - - + }); - - - - - - "); - - + + e107::getJs()->inlineCSS(" .column { width:100%; padding-bottom: 100px; } @@ -475,7 +456,7 @@ TEMPL; .regularMenu { border-bottom:1px dotted silver; margin-bottom:6px; padding-left:3px; padding-right:3px; padding-top:10px; padding-bottom:10px;background-color: #E0EBF1; border-radius: 5px; } .regularMenu span {padding:3px; font-weight:bold; color:#2F2F2F;text-align:left; } - .ui-draggable { background-color: rgb(245, 245, 245); min-width:100px;} + .ui-draggable { min-width:100px;} .regularMenu:hover { background-color: #B1D7EA; } diff --git a/e107_themes/bootstrap3/admin_style.css b/e107_themes/bootstrap3/admin_style.css index 6e7d9ad5e..d4dff57c6 100644 --- a/e107_themes/bootstrap3/admin_style.css +++ b/e107_themes/bootstrap3/admin_style.css @@ -18,6 +18,8 @@ button, button:active { outline: 0; } .tooltip { font-size: 13px; } .tooltip-inner { } +/* Fix for tooltips inside modal. */ +.modal-open .tooltip { z-index: 10002; } /* Core Formatting */ .left { text-align: left } diff --git a/e107_web/js/core/admin.jquery.js b/e107_web/js/core/admin.jquery.js index 031b3738f..fc3292653 100644 --- a/e107_web/js/core/admin.jquery.js +++ b/e107_web/js/core/admin.jquery.js @@ -51,6 +51,55 @@ var e107 = e107 || {'settings': {}, 'behaviors': {}}; } }; + /** + * Run tips on .field-help. + * + * @type {{attach: e107.behaviors.fieldHelpTooltip.attach}} + */ + e107.behaviors.fieldHelpTooltip = { + attach: function (context, settings) + { + var selector = 'div.tbox,div.checkboxes,input,textarea,select,label,.e-tip,div.form-control'; + + $(context).find(selector).once('field-help-tooltip').each(function () + { + var $this = $(this); + var $fieldHelp = $this.nextAll(".field-help"); + var placement = 'bottom'; + + if($this.is("textarea")) + { + placement = 'top'; + } + + var custPlace = $fieldHelp.attr('data-placement'); // ie top|left|bottom|right + + if(custPlace !== undefined) + { + placement = custPlace; + } + + $fieldHelp.hide(); + + $this.tooltip({ + title: function () + { + return $fieldHelp.html(); + }, + fade: true, + html: true, + opacity: 1.0, + placement: placement, + container: 'body', + delay: { + show: 300, + hide: 600 + } + }); + }); + } + }; + })(jQuery); (function (jQuery) @@ -453,42 +502,7 @@ $(document).ready(function() }); - // run tips on .field-help - $("div.tbox,div.checkboxes,input,textarea,select,label,.e-tip,div.form-control").each(function(c) { - - var t = $(this).nextAll(".field-help"); - var placement = 'bottom'; - - if($(this).is("textarea")) - { - var placement = 'top'; - } - - var custplace = $(t).attr('data-placement'); // ie top|left|bottom|right - - if(custplace !== undefined) - { - placement = custplace; - } - - - t.hide(); - // alert('hello'); - $(this).tooltip({ - title: function() { - var tip = t.html(); - return tip; - }, - fade: true, - html: true, - opacity: 1.0, - placement: placement, - container: 'body', - delay: { show: 300, hide: 600 } - }); - - }); // $(".e-spinner").spinner(); //FIXME breaks tooltips etc.