Skip to content

Commit

Permalink
v0996
Browse files Browse the repository at this point in the history
  • Loading branch information
rolandtoth committed Nov 6, 2016
1 parent 2b8eee3 commit 1c83e83
Show file tree
Hide file tree
Showing 6 changed files with 109 additions and 36 deletions.
2 changes: 1 addition & 1 deletion AdminOnSteroids.css

Large diffs are not rendered by default.

12 changes: 12 additions & 0 deletions AdminOnSteroids.js
Expand Up @@ -1293,6 +1293,18 @@ $(document).ready(function () {
// });


// ListerTWeaks
if (AOSsettings.enabledSubmodules.indexOf('ListerTweaks') !== -1) {

//if (AOSsettings.ListerTweaks_options.indexOf('listerHoverBtn') !== -1) {
if ($('html').hasClass('listerHoverBtn')) {
$(document).on('mousedown', '.PageExtras', function () {
$(this).parents('td').find('.actions_toggle').trigger('click');
});
}
}


// ModuleTweaks
if (AOSsettings.enabledSubmodules.indexOf('ModuleTweaks') !== -1) {

Expand Down
100 changes: 65 additions & 35 deletions AdminOnSteroids.module
Expand Up @@ -29,7 +29,7 @@ class AdminOnSteroids extends WireData implements Module, ConfigurableModule {
return array(
'title' => 'AdminOnSteroids',
'class' => 'AdminOnSteroids',
'version' => '0.9.95',
'version' => '0.9.96',
'summary' => __('Various ProcessWire admin tweaks to boost productivity'),
'author' => 'Roland Toth',
'autoload' => 'template=admin',
Expand Down Expand Up @@ -66,11 +66,11 @@ class AdminOnSteroids extends WireData implements Module, ConfigurableModule {
'AdminTweaks',
'NavItems',
'RenoTweaks',
'ListerTweaks',
'LongClickDuration',
'HoverDropdown',
'Hotkeys',
'InputfieldURLChecker',
'ListerTweaks',
'PageListThumbs',
'PageListUnselect',
'PageListTweaks',
Expand All @@ -83,9 +83,18 @@ class AdminOnSteroids extends WireData implements Module, ConfigurableModule {
'restore' => '',
'AdminStyle' => '',
'AdminScript' => '',
'AdminTweaks' => array(
'headSticky',
'pListFullRowHover',
'wide'
),
'AsmTweaks' => array(
'asmCollapse',
'fieldMiddleEdit'
// 'asmLeftX'
),
'CKEStyle' => '',
'CKEScript' => '',
'NavItems' => 1,
'CKEaddons_plugins' => array(
'autogrow',
'justify',
Expand All @@ -96,11 +105,7 @@ class AdminOnSteroids extends WireData implements Module, ConfigurableModule {
'DeselectRadios' => array(
'adminOnly'
),
'AsmTweaks' => array(
'asmCollapse',
'fieldMiddleEdit'
// 'asmLeftX'
),
'FieldAndTemplateEditLinks' => 'pw-blank',
'FileFieldTweaks' => array(
'filterbox',
'downloadAssetButton',
Expand All @@ -109,11 +114,22 @@ class AdminOnSteroids extends WireData implements Module, ConfigurableModule {
'FocusInputOnLangTabSwitch' => array(
'focus'
),
'FocusInputOnLangTabSwitchCKE' => array(
'focus'
),
'Hotkeys' => array(
'save',
'focusSearch',
'breadcrumbTweaks'
),
'IUC_mode' => array(
'button'
),
'IUC_buttonPosition' => 'button-left',
'IUC_target' => 'pw-blank',
'IUC_forceHttp' => 1,
'IUC_enabledTemplates' => array(),
'IUC_enabledFields' => array(),
'ListerTweaks' => '',
'ListerTweaks_find' => array(
'title',
Expand All @@ -127,6 +143,10 @@ class AdminOnSteroids extends WireData implements Module, ConfigurableModule {
'email',
'roles'
),
'ListerTweaks_options' => array(
'listerHoverBtn',
'hideTemplateEditAction'
),
'LongClickDuration' => 600,
'Misc' => array(
'removeAllFieldsBtn',
Expand All @@ -142,26 +162,10 @@ class AdminOnSteroids extends WireData implements Module, ConfigurableModule {
'moduleFilter',
// 'moduleModal'
),
'NavItems' => 1,
'NavItems_pages' => array(),
'NavItems_custom' => array(),
'Tooltips' => array(
'tooltipDesc',
'tooltipNotes'
// 'tooltipOverlay'
),
'IUC_mode' => array(
'button'
),
'IUC_buttonPosition' => 'button-left',
'IUC_target' => 'pw-blank',
'IUC_forceHttp' => 1,
'IUC_enabledTemplates' => array(),
'IUC_enabledFields' => array(),
'FocusInputOnLangTabSwitchCKE' => array(
'focus'
),
'PagePreviewBtn' => 'pw-blank',
'FieldAndTemplateEditLinks' => 'pw-blank',
'PageListThumbs' => array(),
'PageListThumbs_style' => 'circle',
'PageListThumbs_items' => '',
Expand Down Expand Up @@ -192,10 +196,10 @@ class AdminOnSteroids extends WireData implements Module, ConfigurableModule {
'noticeLeftX',
'hoverTopSubmenus'
),
'AdminTweaks' => array(
'headSticky',
'pListFullRowHover',
'wide'
'Tooltips' => array(
'tooltipDesc',
'tooltipNotes'
// 'tooltipOverlay'
)
);
}
Expand Down Expand Up @@ -274,6 +278,7 @@ class AdminOnSteroids extends WireData implements Module, ConfigurableModule {
'headSticky',
'headStickyCompact',
'HoverDropdown',
'listerHoverBtn',
'moduleCompact',
'moduleModal',
'noAnim',
Expand All @@ -295,7 +300,11 @@ class AdminOnSteroids extends WireData implements Module, ConfigurableModule {
'wide'
);

foreach ($this->enabledSubmodules as $submodule) {
// eg. checkboxes inside fieldsets
$itemsToTreatAsSubmodule = array('ListerTweaks_options');

foreach (array_merge($this->enabledSubmodules, $itemsToTreatAsSubmodule) as $submodule) {

$this->addDOMClass($submodule);

if (isset(self::$configData[$submodule]) && is_array(self::$configData[$submodule])) {
Expand Down Expand Up @@ -409,10 +418,16 @@ class AdminOnSteroids extends WireData implements Module, ConfigurableModule {

$this->addHookAfter("ProcessPageListRender::getPageActions", function ($event) {

// return if template edit action button is disabled for Lister
if(in_array('hideTemplateEditAction', self::$configData['ListerTweaks_options']) && $this->page->process == 'ProcessPageLister') {
return false;
}

$page = $event->arguments("page");
$actions = $event->return;
$template = $page->template;


$templateEditUrl = $this->config->urls->httpAdmin . 'setup/template/edit?id=' . $template->id;

$editTemplateAction = array(
Expand All @@ -427,6 +442,11 @@ class AdminOnSteroids extends WireData implements Module, ConfigurableModule {
// need to put the template edit action before the Extras (
$key_extras = array_search('extras', array_keys($actions));

// home, trash, etc doesn't have 'extras', add the button to the end
if(!$key_extras) {
$key_extras = count($actions);
}

$actions = array_slice($actions, 0, $key_extras, true) +
$editTemplateAction +
array_slice($actions, $key_extras, null, true);
Expand Down Expand Up @@ -1903,18 +1923,28 @@ HTML;
$f->addOption($fieldname);
}

// foreach ($lister_fieldnames as $ff) {
// $f->addOption($ff->name, self::getFormattedOptionName($ff));
// }

if (isset($data[$f->name]) && $data[$f->name]) {
$f->attr('value', $data[$f->name]);
}

$fsetLT->add($f);

$fset->add($fsetLT);
// hoverActions

$f = wire('modules')->get("InputfieldCheckboxes");
$f->attr('name', 'ListerTweaks_options');
$f->label = __('Lister options', __FILE__);
$f->collapsed = Inputfield::collapsedNever;

$f->addOption('listerHoverBtn', __('Show action buttons on hover', __FILE__));
$f->addOption('hideTemplateEditAction', __('Hide template edit action', __FILE__));

$f->attr('value', isset($data[$f->name]) ? $data[$f->name] : $defaultData[$f->name]);

$fsetLT->add($f);


$fset->add($fsetLT);

// DeselectRadios ----------------------------------------------- //

Expand Down
8 changes: 8 additions & 0 deletions CHANGELOG.md
@@ -1,6 +1,14 @@
#Changelog


### 0.9.96 (2016-11-06)

- show pagelist action buttons on hovering lister rows (requested by adrian)
- ListerTweaks: option to disable template edit action (requested by szabesz)
- fix: add TemplateEditLink to the end of pagelist actions if no extra actions exist (reported by adrian)



### 0.9.95 (2016-11-06)

- hide submodule config jumplink if submodule is disabled
Expand Down
3 changes: 3 additions & 0 deletions README.md
Expand Up @@ -449,6 +449,9 @@ This submodule lets you set the default columns in the Find and Users listers.

- **Find lister columns**: here you can select the fields for the Find lister (found under the Pages section in the sidebar/topnav).
- **Users lister columns**: here you can select the fields for the Users lister (found under the Access section in the sidebar/topnav).
- **Lister options**:
- Show action buttons on hover: action buttons will appear on hovering on lister rows (instead on click)
- Hide template edit action: by default if you enable the FieldAndTemplateEditLinks submodule listers will also have an extra template edit action button. Here you can disable it.

**[DEFAULTS] field**

Expand Down
20 changes: 20 additions & 0 deletions src/AdminOnSteroids.scss
Expand Up @@ -3363,6 +3363,26 @@ html.AdminThemeReno {

}


// ListerTweaks listerHoverBtn
@media only screen and (min-width: 960px) {
html.listerHoverBtn {
.ProcessListerTable tr:hover td:first-child {
.PageListerActions {
display: inline-block !important;
.PageExtras ~ a {
display: none;
}
.PageExtras.extras-open,
.PageExtras.extras-open ~ a {
display: inline-block;
}
}
}
}
}


@media only screen and (min-width: 960px) {
li.navItem {
position: relative;
Expand Down

0 comments on commit 1c83e83

Please sign in to comment.