mirror of
https://github.com/processwire/processwire.git
synced 2025-08-20 05:21:29 +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:
@@ -693,6 +693,13 @@ $(document).ready(function() {
|
|||||||
var $lastAction = null;
|
var $lastAction = null;
|
||||||
var $extrasLink = null; // link that toggles extra actions
|
var $extrasLink = null; // link that toggles extra actions
|
||||||
var extras = {}; // 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) {
|
$(links).each(function(n, action) {
|
||||||
var actionName;
|
var actionName;
|
||||||
@@ -702,7 +709,8 @@ $(document).ready(function() {
|
|||||||
actionName = 'Select';
|
actionName = 'Select';
|
||||||
} else {
|
} else {
|
||||||
actionName = action.cn; // cn = className
|
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
|
// move non-edit/view actions to extras when in narrow mode
|
||||||
extras[actionName] = action;
|
extras[actionName] = action;
|
||||||
return;
|
return;
|
||||||
@@ -719,13 +727,13 @@ $(document).ready(function() {
|
|||||||
$a.addClass('pw-modal pw-modal-large pw-modal-longclick');
|
$a.addClass('pw-modal pw-modal-large pw-modal-longclick');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(typeof action.extras != "undefined") {
|
if(typeof action.extras != "undefined") {
|
||||||
for(var key in action.extras) {
|
for(var key in action.extras) {
|
||||||
extras[key] = action.extras[key];
|
extras[key] = action.extras[key];
|
||||||
}
|
}
|
||||||
$extrasLink = $a;
|
$extrasLink = $a;
|
||||||
}
|
}
|
||||||
|
|
||||||
var $action = $("<li></li>").addClass('PageListAction' + actionName).append($a);
|
var $action = $("<li></li>").addClass('PageListAction' + actionName).append($a);
|
||||||
if(actionName == 'Extras') $lastAction = $action;
|
if(actionName == 'Extras') $lastAction = $action;
|
||||||
else $actions.append($action);
|
else $actions.append($action);
|
||||||
|
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user