1
0
mirror of https://github.com/processwire/processwire.git synced 2025-08-19 13:01:26 +02:00

Fix issue processwire/processwire-issues#534 PageList narrow mode didn't show 'New' action for home, or 'Empty' action for trash

This commit is contained in:
Ryan Cramer
2018-03-15 08:48:21 -04:00
parent d9b30167c7
commit eb95498183
2 changed files with 11 additions and 3 deletions

View File

@@ -693,6 +693,13 @@ $(document).ready(function() {
var $lastAction = null;
var $extrasLink = null; // link that toggles extra actions
var extras = {}; // extra actions
var hasExtrasLink = false; // only referenced if options.useNarrowActions
if(options.useNarrowActions) {
for(var n = 0; n < links.length; n++) {
if(typeof links[n].extras != "undefined") hasExtrasLink = true;
}
}
$(links).each(function(n, action) {
var actionName;
@@ -702,7 +709,8 @@ $(document).ready(function() {
actionName = 'Select';
} else {
actionName = action.cn; // cn = className
if(options.useNarrowActions && (actionName != 'Edit' && actionName != 'View' && actionName != 'Extras')) {
if(options.useNarrowActions && hasExtrasLink
&& (actionName != 'Edit' && actionName != 'View' && actionName != 'Extras')) {
// move non-edit/view actions to extras when in narrow mode
extras[actionName] = action;
return;
@@ -719,13 +727,13 @@ $(document).ready(function() {
$a.addClass('pw-modal pw-modal-large pw-modal-longclick');
}
}
if(typeof action.extras != "undefined") {
for(var key in action.extras) {
extras[key] = action.extras[key];
}
$extrasLink = $a;
}
var $action = $("<li></li>").addClass('PageListAction' + actionName).append($a);
if(actionName == 'Extras') $lastAction = $action;
else $actions.append($action);

File diff suppressed because one or more lines are too long