1
0
mirror of https://github.com/e107inc/e107.git synced 2025-08-05 22:27:34 +02:00

Merge pull request #2738 from lonalore/admin_ui

Quickfix for Media Manager filtering.
This commit is contained in:
Cameron
2017-07-21 13:32:36 -07:00
committed by GitHub
2 changed files with 36 additions and 10 deletions

View File

@@ -6731,13 +6731,12 @@ class e_admin_form_ui extends e_form
",'prototype');
// TODO implement ajax queue
// FIXME - dirty way to register events after ajax update - DO IT RIGHT - see all.jquery, create object
// and use handler, re-register them global after ajax update (context)
// FIXME
// dirty way to register events after ajax update - DO IT RIGHT - see all.jquery, create object and use handler,
// re-register them global after ajax update (context)... use behaviors and call e107.attachBehaviors();
e107::js('footer-inline',"
var filterRunning = false, request;
var applyAfterAjax = function(context) {
\$('.e-hideme', context).hide();
\$('.e-expandit', context).show();
\$('.e-expandit', context).click(function () {
var href = (\$(this).is('a')) ? \$(this).attr('href') : '';
if(href == '' && \$(this).attr('data-target'))
@@ -6786,7 +6785,10 @@ class e_admin_form_ui extends e_form
return;
}
cont.html(data).css({ opacity: 1 });
// TODO remove applyAfterAjax() and use behaviors!
applyAfterAjax(cont);
// Attach behaviors to the newly loaded contents.
e107.attachBehaviors();
}, 700);
}, 'html')
.error(function() {

View File

@@ -315,6 +315,36 @@ var e107 = e107 || {'settings': {}, 'behaviors': {}};
}
};
/**
* Behavior to hide elements.
*
* @type {{attach: e107.behaviors.eHideMe.attach}}
*/
e107.behaviors.eHideMe = {
attach: function (context, settings)
{
$(context).find('.e-hideme').once('e-hide-me').each(function ()
{
$(this).hide();
});
}
};
/**
* Behavior to show elements.
*
* @type {{attach: e107.behaviors.eExpandIt.attach}}
*/
e107.behaviors.eExpandIt = {
attach: function (context, settings)
{
$(context).find('.e-expandit').once('e-expand-it').each(function ()
{
$(this).show();
});
}
};
/**
* Check if the selector is valid.
*
@@ -715,12 +745,6 @@ $.ajaxSetup({
$(document).ready(function()
{
$(".e-hideme").hide();
$(".e-expandit").show();
// $(".e-spinner").spinner(); //FIXME breaks tooltips
//check all
$("#check-all").click(function(event){
var val = $(this).val(), selector = '.field-spacer';