1
0
mirror of https://github.com/e107inc/e107.git synced 2025-01-17 20:58:30 +01:00

Fix for Menu Manager modal tooltips.

This commit is contained in:
lonalore 2017-02-14 16:59:52 +01:00
parent f6612410e0
commit 614963798a
3 changed files with 92 additions and 95 deletions

View File

@ -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; }

View File

@ -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 }

View File

@ -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.