Skip to content

Commit 770a1e9

Browse files
committed
Merge branch 'develop'
2 parents a7e2318 + b8ef902 commit 770a1e9

8 files changed

+51
-14
lines changed

Dashboard.css

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Dashboard.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

DashboardPanelCollection.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

DashboardPanelCollection.module

100755100644
Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -135,17 +135,21 @@ class DashboardPanelCollection extends DashboardPanel
135135
if ($markup === 'actions__') {
136136
$content = $this->renderPageActions($page);
137137
}
138+
// Special case: page icon
139+
elseif ($markup === 'page_icon') {
140+
$content = $this->renderIcon($page->getIcon());
141+
}
138142
// Special case: page status
139143
elseif ($markup === 'status__') {
140144
$content = $this->renderStatusIcon($page);
141145
}
142146
// Special case: published status toggle
143-
elseif (in_array($markup, ['published__', 'visible__'])) {
144-
$content = $this->renderStatusToggle($page, $markup);
147+
elseif ($markup === 'published__') {
148+
$content = $this->renderStatusToggle($page, 'published');
145149
}
146-
// Special case: page icon
147-
elseif ($markup === 'page_icon') {
148-
$content = $this->renderIcon($page->getIcon());
150+
// Special case: visible status toggle
151+
elseif ($markup === 'visible__') {
152+
$content = $this->renderStatusToggle($page, 'visible');
149153
}
150154
// Special case: system timestamps
151155
elseif (in_array($markup, ['modified', 'created'])) {
@@ -285,6 +289,8 @@ class DashboardPanelCollection extends DashboardPanel
285289
{
286290
parent::setup();
287291

292+
$this->wire()->modules->get('JqueryUI')->use('vex');
293+
288294
$this->editUrl = $this->config->urls->admin.'page/edit/';
289295
$this->addUrl = $this->config->urls->admin.'page/add/';
290296
$this->listUrl = $this->config->urls->admin.'page/list/';
@@ -307,6 +313,8 @@ class DashboardPanelCollection extends DashboardPanel
307313
$this->editMode = $this->data['editMode'] ?? self::windowModeBlank;
308314
$this->viewMode = $this->data['viewMode'] ?? self::windowModeBlank;
309315
$this->addUrlParams = $this->data['addUrlParams'] ?? [];
316+
$this->confirmTrash = $this->data['confirmTrash'] ?? true;
317+
$this->confirmTrashMessage = $this->data['confirmTrashMessage'] ?? $this->_('Are you sure?');
310318

311319
if (is_string($this->collection)) {
312320
$this->collection = $this->pages->find($this->collection);
@@ -504,7 +512,9 @@ class DashboardPanelCollection extends DashboardPanel
504512
'attributes' => [
505513
'data-action' => "[trash][{$page}]",
506514
'data-action-value' => "1",
507-
],
515+
] + ($this->confirmTrash ? [
516+
'data-action-confirm' => $this->confirmTrashMessage,
517+
] : []),
508518
];
509519
}
510520
}

DashboardPanelShortcuts.css

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/Dashboard.css

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,16 +17,31 @@
1717
--dashboard-color-body-bg: #f0f3f7;
1818
--dashboard-color-panel-bg: #fff;
1919
--dashboard-color-separator: #e5e5e5;
20+
2021
--dashboard-color-text-light: #97aab4;
22+
2123
--dashboard-color-icon: #97aab4;
24+
2225
--dashboard-color-button-bg: #f0f3f7;
2326
--dashboard-color-button-border: #d7dadf;
2427
--dashboard-color-button-text: #354b60;
2528
--dashboard-color-button-hover-bg: #6c8dae;
2629
--dashboard-color-button-hover-text: #fff;
30+
2731
--dashboard-color-th-bg: #fafbfc;
32+
2833
--dashboard-color-list-hover-bg: #fafbfc;
2934

35+
--dashboard-color-success: hsl(151, 45%, 47%);
36+
--dashboard-color-success-bg: hsl(151, 45%, 95%);
37+
--dashboard-color-warning: hsl(26, 84%, 51%);
38+
--dashboard-color-warning-bg: hsl(26, 84%, 94%);
39+
--dashboard-color-error: hsl(4, 74%, 57%);
40+
--dashboard-color-error-bg: hsl(4, 74%, 96%);
41+
--dashboard-color-progress: #354b60;
42+
--dashboard-color-progress-bg: hsl(201, 16%, 80%);
43+
44+
/* Font sizes */
3045
--dashboard-fontsize-icon: 1.25em;
3146

3247
/* Panels */

src/DashboardPanelCollection.js

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
/* global $ */
22

33
function initPanel($panel) {
4+
5+
const submitParamsAndReload = (params) => {
6+
$panel.trigger('reload', { animate: false, params });
7+
};
8+
49
const $reloadlinks = $panel.find('.pw-modal[data-reload-on-close]');
510
if ($reloadlinks.length) {
611
const page = $panel.data('page') || 1;
@@ -16,9 +21,8 @@ function initPanel($panel) {
1621
event.preventDefault();
1722
const url = event.currentTarget.href;
1823
const page = (url.match(/\d+$/) || [])[0] || 1;
19-
const params = { page };
2024
$panel.data('page', page);
21-
$panel.trigger('reload', { animate: false, params });
25+
submitParamsAndReload({ page });
2226
});
2327
}
2428

@@ -27,10 +31,16 @@ function initPanel($panel) {
2731
$actionButtons.on('click', (event) => {
2832
event.preventDefault();
2933
const action = event.currentTarget.dataset.action;
34+
const confirm = event.currentTarget.dataset.actionConfirm;
3035
const key = `actions${action}`
3136
const value = event.currentTarget.dataset.actionValue;
3237
const params = { [key]: value };
33-
$panel.trigger('reload', { animate: false, params });
38+
console.log(confirm);
39+
if (confirm) {
40+
ProcessWire.confirm(confirm, () => submitParamsAndReload(params));
41+
} else {
42+
submitParamsAndReload(params);
43+
}
3444
});
3545
}
3646

@@ -42,7 +52,7 @@ function initPanel($panel) {
4252
const checked = event.target.checked;
4353
const value = checked ? 1 : '';
4454
const params = { [name]: value };
45-
$panel.trigger('reload', { animate: false, params });
55+
submitParamsAndReload(params);
4656
});
4757
}
4858
}

src/DashboardPanelShortcuts.css

100755100644
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,8 @@
5959
padding: var(--dashboard-card-padding-list-y) var(--dashboard-card-padding-content-x);
6060
border-bottom: 1px solid var(--dashboard-color-separator);
6161
white-space: nowrap;
62+
overflow: hidden;
63+
text-overflow: ellipsis;
6264
&:hover {
6365
background: var(--dashboard-color-list-hover-bg);
6466
}

0 commit comments

Comments
 (0)