mirror of
https://github.com/e107inc/e107.git
synced 2025-07-27 18:00:30 +02:00
Use fadeIn and fadeOut for tab visibility...
This commit is contained in:
@@ -796,26 +796,27 @@ class page_admin_ui extends e_admin_ui
|
|||||||
$tabId = 'additional';
|
$tabId = 'additional';
|
||||||
|
|
||||||
$data = array(
|
$data = array(
|
||||||
'tabs' => $this->getTabs(),
|
'tabs' => $this->getTabs(),
|
||||||
'legend' => '',
|
'legend' => '',
|
||||||
'fields' => $this->getFields(),
|
'fields' => $this->getFields(),
|
||||||
);
|
);
|
||||||
|
|
||||||
$text = $this->getUI()->renderCreateFieldset($elid, $data, $model, $tabId);
|
$text = $this->getUI()->renderCreateFieldset($elid, $data, $model, $tabId);
|
||||||
$displayMode = 'inline-block';
|
|
||||||
|
$ajax = e107::getAjax();
|
||||||
|
$commands = array();
|
||||||
|
|
||||||
if(empty($text))
|
if(empty($text))
|
||||||
{
|
{
|
||||||
$text = ""; // There are no additional fields for the selected chapter.
|
$text = ""; // There are no additional fields for the selected chapter.
|
||||||
$displayMode = 'none';
|
$commands[] = $ajax->commandInvoke('a[href="#tab' . $tabId . '"]', 'fadeOut');
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$commands[] = $ajax->commandInvoke('a[href="#tab' . $tabId . '"]', 'fadeInAdminTab');
|
||||||
}
|
}
|
||||||
|
|
||||||
$ajax = e107::getAjax();
|
|
||||||
|
|
||||||
$commands = array();
|
|
||||||
$commands[] = $ajax->commandInvoke('#tab' . $tabId, 'html', array($text));
|
$commands[] = $ajax->commandInvoke('#tab' . $tabId, 'html', array($text));
|
||||||
// Show/hide tab.
|
|
||||||
$commands[] = $ajax->commandInvoke('a[href="#tab' . $tabId . '"]', 'css', array('display', $displayMode));
|
|
||||||
|
|
||||||
$ajax->response($commands);
|
$ajax->response($commands);
|
||||||
exit;
|
exit;
|
||||||
|
@@ -53,6 +53,39 @@ var e107 = e107 || {'settings': {}, 'behaviors': {}};
|
|||||||
|
|
||||||
})(jQuery);
|
})(jQuery);
|
||||||
|
|
||||||
|
(function (jQuery)
|
||||||
|
{
|
||||||
|
|
||||||
|
/**
|
||||||
|
* jQuery extension to make admin tab 'fadeIn' with 'display: inline-block'.
|
||||||
|
*
|
||||||
|
* @param displayMode
|
||||||
|
* A string determining display mode for element after the animation.
|
||||||
|
* Default: 'inline-block'.
|
||||||
|
* @param duration
|
||||||
|
* A string or number determining how long the animation will run.
|
||||||
|
* Default: 400.
|
||||||
|
*/
|
||||||
|
jQuery.fn.fadeInAdminTab = function (displayMode, duration)
|
||||||
|
{
|
||||||
|
var $this = $(this);
|
||||||
|
|
||||||
|
if($this.css('display') !== 'none')
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
displayMode = displayMode || 'inline-block';
|
||||||
|
duration = duration || 400;
|
||||||
|
|
||||||
|
$this.fadeIn(duration, function ()
|
||||||
|
{
|
||||||
|
$this.css('display', displayMode);
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
})(jQuery);
|
||||||
|
|
||||||
|
|
||||||
$(document).ready(function()
|
$(document).ready(function()
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user