mirror of
https://github.com/e107inc/e107.git
synced 2025-07-28 10:20:45 +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';
|
||||
|
||||
$data = array(
|
||||
'tabs' => $this->getTabs(),
|
||||
'legend' => '',
|
||||
'fields' => $this->getFields(),
|
||||
'tabs' => $this->getTabs(),
|
||||
'legend' => '',
|
||||
'fields' => $this->getFields(),
|
||||
);
|
||||
|
||||
$text = $this->getUI()->renderCreateFieldset($elid, $data, $model, $tabId);
|
||||
$displayMode = 'inline-block';
|
||||
|
||||
$ajax = e107::getAjax();
|
||||
$commands = array();
|
||||
|
||||
if(empty($text))
|
||||
{
|
||||
$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));
|
||||
// Show/hide tab.
|
||||
$commands[] = $ajax->commandInvoke('a[href="#tab' . $tabId . '"]', 'css', array('display', $displayMode));
|
||||
|
||||
$ajax->response($commands);
|
||||
exit;
|
||||
|
@@ -53,6 +53,39 @@ var e107 = e107 || {'settings': {}, 'behaviors': {}};
|
||||
|
||||
})(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()
|
||||
{
|
||||
|
Reference in New Issue
Block a user