Skip to content

Commit

Permalink
Changes in Toolbar, separate Save (and stay) button from Save button … (
Browse files Browse the repository at this point in the history
  • Loading branch information
drmenzelit authored and HLeithner committed Feb 21, 2019
1 parent 5ced70d commit 52a4168
Show file tree
Hide file tree
Showing 29 changed files with 83 additions and 75 deletions.
12 changes: 4 additions & 8 deletions administrator/components/com_admin/View/Profile/HtmlView.php
Original file line number Diff line number Diff line change
Expand Up @@ -89,14 +89,10 @@ protected function addToolbar()

ToolbarHelper::title(Text::_('COM_ADMIN_VIEW_PROFILE_TITLE'), 'user user-profile');

ToolbarHelper::saveGroup(
[
['apply', 'profile.apply'],
['save', 'profile.save']
],
'btn-success'
);

ToolbarHelper::apply('profile.apply');
ToolbarHelper::divider();
ToolbarHelper::save('profile.save');
ToolbarHelper::divider();
ToolbarHelper::cancel('profile.cancel', 'JTOOLBAR_CLOSE');
ToolbarHelper::divider();
ToolbarHelper::help('JHELP_ADMIN_USER_PROFILE_EDIT');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ protected function addToolbar()
// If not checked out, can save the item.
if (!$checkedOut && ($canDo->get('core.edit') || count($user->getAuthorisedCategories('com_banners', 'core.create')) > 0))
{
$toolbarButtons[] = ['apply', 'banner.apply'];
ToolbarHelper::apply('banner.apply');
$toolbarButtons[] = ['save', 'banner.save'];

if ($canDo->get('core.create'))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ protected function addToolbar()
// If not checked out, can save the item.
if (!$checkedOut && ($canDo->get('core.edit') || $canDo->get('core.create')))
{
$toolbarButtons[] = ['apply', 'client.apply'];
ToolbarHelper::apply('client.apply');
$toolbarButtons[] = ['save', 'client.save'];
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -186,9 +186,9 @@ protected function addToolbar()
// For new records, check the create permission.
if ($isNew && (count($user->getAuthorisedCategories($component, 'core.create')) > 0))
{
ToolbarHelper::apply('category.apply');
ToolbarHelper::saveGroup(
[
['apply', 'category.apply'],
['save', 'category.save'],
['save2new', 'category.save2new']
],
Expand All @@ -209,7 +209,8 @@ protected function addToolbar()
// Can't save the record if it's checked out and editable
if (!$checkedOut && $itemEditable)
{
$toolbarButtons[] = ['apply', 'category.apply'];
ToolbarHelper::apply('category.apply');

$toolbarButtons[] = ['save', 'category.save'];

if ($canDo->get('core.create'))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,13 +101,9 @@ public function display($tpl = null)
protected function addToolbar()
{
ToolbarHelper::title(Text::_('COM_CONFIG_GLOBAL_CONFIGURATION'), 'equalizer config');
ToolbarHelper::saveGroup(
[
['apply', 'application.apply'],
['save', 'application.save']
],
'btn-success'
);
ToolbarHelper::apply('application.apply');
ToolbarHelper::divider();
ToolbarHelper::save('application.save');
ToolbarHelper::divider();
ToolbarHelper::cancel('application.cancel', 'JTOOLBAR_CLOSE');
ToolbarHelper::divider();
Expand Down
10 changes: 3 additions & 7 deletions administrator/components/com_config/View/Component/HtmlView.php
Original file line number Diff line number Diff line change
Expand Up @@ -103,13 +103,9 @@ public function display($tpl = null)
protected function addToolbar()
{
ToolbarHelper::title(Text::_($this->component->option . '_configuration'), 'equalizer config');
ToolbarHelper::saveGroup(
[
['apply', 'component.apply'],
['save', 'component.save']
],
'btn-success'
);
ToolbarHelper::apply('component.apply');
ToolbarHelper::divider();
ToolbarHelper::save('component.save');
ToolbarHelper::divider();
ToolbarHelper::cancel('component.cancel', 'JTOOLBAR_CLOSE');
ToolbarHelper::divider();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,9 +112,10 @@ protected function addToolbar()
// For new records, check the create permission.
if ($isNew && (count($user->getAuthorisedCategories('com_contact', 'core.create')) > 0))
{
ToolbarHelper::apply('contact.apply');

ToolbarHelper::saveGroup(
[
['apply', 'contact.apply'],
['save', 'contact.save'],
['save2new', 'contact.save2new']
],
Expand All @@ -134,7 +135,8 @@ protected function addToolbar()
// Can't save the record if it's checked out and editable
if (!$checkedOut && $itemEditable)
{
$toolbarButtons[] = ['apply', 'contact.apply'];
ToolbarHelper::apply('contact.apply');

$toolbarButtons[] = ['save', 'contact.save'];

// We can save this record, but check the create permission to see if we can return to make a new one.
Expand Down
14 changes: 10 additions & 4 deletions administrator/components/com_content/View/Article/HtmlView.php
Original file line number Diff line number Diff line change
Expand Up @@ -138,15 +138,16 @@ protected function addToolbar()
'pencil-2 article-add'
);

$saveGroup = $toolbar->dropdownButton('save-group');

// For new records, check the create permission.
if ($isNew && (count($user->getAuthorisedCategories('com_content', 'core.create')) > 0))
{
$apply = $toolbar->apply('article.apply');

$saveGroup = $toolbar->dropdownButton('save-group');

$saveGroup->configure(
function (Toolbar $childBar)
{
$childBar->apply('article.apply');
$childBar->save('article.save');
$childBar->save2new('article.save2new');
}
Expand All @@ -157,13 +158,18 @@ function (Toolbar $childBar)
// Since it's an existing record, check the edit permission, or fall back to edit own if the owner.
$itemEditable = $canDo->get('core.edit') || ($canDo->get('core.edit.own') && $this->item->created_by == $userId);

if (!$checkedOut && $itemEditable)
{
$toolbar->apply('article.apply');
}
$saveGroup = $toolbar->dropdownButton('save-group');

$saveGroup->configure(
function (Toolbar $childBar) use ($checkedOut, $itemEditable, $canDo)
{
// Can't save the record if it's checked out and editable
if (!$checkedOut && $itemEditable)
{
$childBar->apply('article.apply');
$childBar->save('article.save');

// We can save this record, but check the create permission to see if we can return to make a new one.
Expand Down
6 changes: 4 additions & 2 deletions administrator/components/com_fields/View/Field/HtmlView.php
Original file line number Diff line number Diff line change
Expand Up @@ -117,9 +117,10 @@ protected function addToolbar()
// For new records, check the create permission.
if ($isNew)
{
ToolbarHelper::apply('field.apply');

ToolbarHelper::saveGroup(
[
['apply', 'field.apply'],
['save', 'field.save'],
['save2new', 'field.save2new']
],
Expand All @@ -138,7 +139,8 @@ protected function addToolbar()
// Can't save the record if it's checked out and editable
if (!$checkedOut && $itemEditable)
{
$toolbarButtons[] = ['apply', 'field.apply'];
ToolbarHelper::apply('field.apply');

$toolbarButtons[] = ['save', 'field.save'];

// We can save this record, but check the create permission to see if we can return to make a new one.
Expand Down
6 changes: 4 additions & 2 deletions administrator/components/com_fields/View/Group/HtmlView.php
Original file line number Diff line number Diff line change
Expand Up @@ -144,9 +144,10 @@ protected function addToolbar()
// For new records, check the create permission.
if ($isNew)
{
ToolbarHelper::apply('group.apply');

ToolbarHelper::saveGroup(
[
['apply', 'group.apply'],
['save', 'group.save'],
['save2new', 'group.save2new']
],
Expand All @@ -165,7 +166,8 @@ protected function addToolbar()
// Can't save the record if it's checked out and editable
if (!$checkedOut && $itemEditable)
{
$toolbarButtons[] = ['apply', 'group.apply'];
ToolbarHelper::apply('group.apply');

$toolbarButtons[] = ['save', 'group.save'];

// We can save this record, but check the create permission to see if we can return to make a new one.
Expand Down
6 changes: 4 additions & 2 deletions administrator/components/com_finder/View/Filter/HtmlView.php
Original file line number Diff line number Diff line change
Expand Up @@ -123,9 +123,10 @@ protected function addToolbar()
// For new records, check the create permission.
if ($canDo->get('core.create'))
{
ToolbarHelper::apply('filter.apply');

ToolbarHelper::saveGroup(
[
['apply', 'filter.apply'],
['save', 'filter.save'],
['save2new', 'filter.save2new']
],
Expand All @@ -143,7 +144,8 @@ protected function addToolbar()
// Since it's an existing record, check the edit permission.
if (!$checkedOut && $canDo->get('core.edit'))
{
$toolbarButtons[] = ['apply', 'filter.apply'];
ToolbarHelper::apply('filter.apply');

$toolbarButtons[] = ['save', 'filter.save'];

// We can save this record, but check the create permission to see if we can return to make a new one.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,8 @@ protected function addToolbar()

if (($isNew && $canDo->get('core.create')) || (!$isNew && $canDo->get('core.edit')))
{
$toolbarButtons[] = ['apply', 'language.apply'];
ToolbarHelper::apply('language.apply');

$toolbarButtons[] = ['save', 'language.save'];
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,8 @@ protected function addToolbar()

if ($canDo->get('core.edit'))
{
$toolbarButtons[] = ['apply', 'override.apply'];
ToolbarHelper::apply('override.apply');

$toolbarButtons[] = ['save', 'override.save'];
}

Expand Down
5 changes: 3 additions & 2 deletions administrator/components/com_menus/View/Item/HtmlView.php
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ protected function addToolbar()
{
if ($canDo->get('core.edit'))
{
$toolbarButtons[] = ['apply', 'item.apply'];
ToolbarHelper::apply('item.apply');
}

$toolbarButtons[] = ['save', 'item.save'];
Expand All @@ -147,7 +147,8 @@ protected function addToolbar()
// If not checked out, can save the item.
if (!$isNew && !$checkedOut && $canDo->get('core.edit'))
{
$toolbarButtons[] = ['apply', 'item.apply'];
ToolbarHelper::apply('item.apply');

$toolbarButtons[] = ['save', 'item.save'];
}

Expand Down
5 changes: 3 additions & 2 deletions administrator/components/com_menus/View/Menu/HtmlView.php
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ protected function addToolbar()
{
if ($this->canDo->get('core.edit'))
{
$toolbarButtons[] = ['apply', 'menu.apply'];
ToolbarHelper::apply('menu.apply');
}

$toolbarButtons[] = ['save', 'menu.save'];
Expand All @@ -111,7 +111,8 @@ protected function addToolbar()
// If user can edit, can save the item.
if (!$isNew && $this->canDo->get('core.edit'))
{
$toolbarButtons[] = ['apply', 'menu.apply'];
ToolbarHelper::apply('menu.apply');

$toolbarButtons[] = ['save', 'menu.save'];
}

Expand Down
6 changes: 4 additions & 2 deletions administrator/components/com_modules/View/Module/HtmlView.php
Original file line number Diff line number Diff line change
Expand Up @@ -98,9 +98,10 @@ protected function addToolbar()
// For new records, check the create permission.
if ($isNew && $canDo->get('core.create'))
{
ToolbarHelper::apply('module.apply');

ToolbarHelper::saveGroup(
[
['apply', 'module.apply'],
['save', 'module.save'],
['save2new', 'module.save2new']
],
Expand All @@ -119,7 +120,8 @@ protected function addToolbar()
// Since it's an existing record, check the edit permission.
if ($canDo->get('core.edit'))
{
$toolbarButtons[] = ['apply', 'module.apply'];
ToolbarHelper::apply('module.apply');

$toolbarButtons[] = ['save', 'module.save'];

// We can save this record, but check the create permission to see if we can return to make a new one.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,8 @@ protected function addToolbar()
// If not checked out, can save the item.
if (!$checkedOut && ($canDo->get('core.edit') || count($user->getAuthorisedCategories('com_newsfeeds', 'core.create')) > 0))
{
$toolbarButtons[] = ['apply', 'newsfeed.apply'];
ToolbarHelper::apply('newsfeed.apply');

$toolbarButtons[] = ['save', 'newsfeed.save'];
}

Expand Down
11 changes: 4 additions & 7 deletions administrator/components/com_plugins/View/Plugin/HtmlView.php
Original file line number Diff line number Diff line change
Expand Up @@ -86,13 +86,10 @@ protected function addToolbar()
// If not checked out, can save the item.
if ($canDo->get('core.edit'))
{
ToolbarHelper::saveGroup(
[
['apply', 'plugin.apply'],
['save', 'plugin.save']
],
'btn-success'
);
ToolbarHelper::apply('plugin.apply');

ToolbarHelper::save('plugin.save');

}

ToolbarHelper::cancel('plugin.cancel', 'JTOOLBAR_CLOSE');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ protected function addToolbar()
// If not checked out, can save the item.
if ($canDo->get('core.edit'))
{
$toolbarButtons[] = ['apply', 'link.apply'];
ToolbarHelper::apply('link.apply');
$toolbarButtons[] = ['save', 'link.save'];
}

Expand Down
4 changes: 2 additions & 2 deletions administrator/components/com_tags/View/Tag/HtmlView.php
Original file line number Diff line number Diff line change
Expand Up @@ -108,9 +108,9 @@ protected function addToolbar()
// Build the actions for new and existing records.
if ($isNew)
{
ToolbarHelper::apply('tag.apply');
ToolbarHelper::saveGroup(
[
['apply', 'tag.apply'],
['save', 'tag.save'],
['save2new', 'tag.save2new']
],
Expand All @@ -129,7 +129,7 @@ protected function addToolbar()
// Can't save the record if it's checked out and editable
if (!$checkedOut && $itemEditable)
{
$toolbarButtons[] = ['apply', 'tag.apply'];
ToolbarHelper::apply('tag.apply');
$toolbarButtons[] = ['save', 'tag.save'];

// We can save this record, but check the create permission to see if we can return to make a new one.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ protected function addToolbar()
// If not checked out, can save the item.
if ($canDo->get('core.edit'))
{
$toolbarButtons[] = ['apply', 'style.apply'];
ToolbarHelper::apply('style.apply');
$toolbarButtons[] = ['save', 'style.save'];
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -237,13 +237,8 @@ protected function addToolbar()
// Add an Apply and save button
if ($this->type == 'file')
{
ToolbarHelper::saveGroup(
[
['apply', 'template.apply'],
['save', 'template.save']
],
'btn-success'
);
ToolbarHelper::apply('template.apply');
ToolbarHelper::save('template.save');
}
// Add a Crop and Resize button
elseif ($this->type == 'image')
Expand Down
2 changes: 1 addition & 1 deletion administrator/components/com_users/View/Group/HtmlView.php
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ protected function addToolbar()

if ($canDo->get('core.edit') || $canDo->get('core.create'))
{
$toolbarButtons[] = ['apply', 'group.apply'];
ToolbarHelper::apply('group.apply');
$toolbarButtons[] = ['save', 'group.save'];
}

Expand Down
2 changes: 1 addition & 1 deletion administrator/components/com_users/View/Level/HtmlView.php
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ protected function addToolbar()

if ($canDo->get('core.edit') || $canDo->get('core.create'))
{
$toolbarButtons[] = ['apply', 'level.apply'];
ToolbarHelper::apply('level.apply');
$toolbarButtons[] = ['save', 'level.save'];
}

Expand Down
Loading

0 comments on commit 52a4168

Please sign in to comment.