From b27a4606602f4e0ce0d235beef88f3913cd1a4c4 Mon Sep 17 00:00:00 2001 From: Mateus Machado Luna Date: Wed, 10 Jul 2019 10:23:42 -0300 Subject: [PATCH] Forces draft and trash status to always appear. Adjusts draft tab margin when private is not available. --- src/admin/js/utilities.js | 20 ++++++++++++-------- src/admin/pages/lists/collections-page.vue | 2 +- src/admin/pages/lists/items-page.vue | 2 +- src/admin/pages/lists/taxonomies-page.vue | 2 +- src/admin/pages/lists/term-items-page.vue | 2 +- 5 files changed, 16 insertions(+), 12 deletions(-) diff --git a/src/admin/js/utilities.js b/src/admin/js/utilities.js index c5f887159..33da89e80 100644 --- a/src/admin/js/utilities.js +++ b/src/admin/js/utilities.js @@ -352,8 +352,8 @@ StatusHelperPlugin.install = function (Vue, options = {}) { statuses: [ { name: tainacan_plugin.i18n['status_publish'], slug: 'publish' }, // { name: tainacan_plugin.i18n['status_private'], slug: 'private' }, - // { name: tainacan_plugin.i18n['status_draft'], slug: 'draft' }, - // { name: tainacan_plugin.i18n['status_trash'], slug: 'trash' } + { name: tainacan_plugin.i18n['status_draft'], slug: 'draft' }, + { name: tainacan_plugin.i18n['status_trash'], slug: 'trash' } ], getIcon(status) { switch (status) { @@ -383,14 +383,18 @@ StatusHelperPlugin.install = function (Vue, options = {}) { this.statuses.push(loadedStatus['private']); this.statuses.concat(Object.values(loadedStatus).filter((status) => { - return !['publish','private','draft','trash'].includes(status.slug); + return !['publish','private', 'draft', 'trash'].includes(status.slug); })); - if (loadedStatus['draft'] != undefined) - this.statuses.push(loadedStatus['draft']); - - if (loadedStatus['trash'] != undefined) - this.statuses.push(loadedStatus['trash']); + // We always show draft and trash + this.statuses.push({ + name: tainacan_plugin.i18n['status_draft'], + slug: 'draft' + }); + this.statuses.push({ + name: tainacan_plugin.i18n['status_trash'], + slug: 'trash'} + ); }) .catch(error => { console.error( error ); diff --git a/src/admin/pages/lists/collections-page.vue b/src/admin/pages/lists/collections-page.vue index 8ce6c689c..4eeacbc6b 100644 --- a/src/admin/pages/lists/collections-page.vue +++ b/src/admin/pages/lists/collections-page.vue @@ -143,7 +143,7 @@ :key="index" @click="onChangeTab(statusOption.slug)" :class="{ 'is-active': status == statusOption.slug}" - :style="{ marginRight: statusOption.slug == 'private' ? 'auto' : '' }" + :style="{ marginRight: statusOption.slug == 'private' ? 'auto' : '', marginLeft: statusOption.slug == 'draft' ? 'auto' : '' }" v-tooltip="{ content: $i18n.getWithVariables('info_%s_tab_' + statusOption.slug,[$i18n.get('collections')]), autoHide: true, diff --git a/src/admin/pages/lists/items-page.vue b/src/admin/pages/lists/items-page.vue index 8268da3e5..157ded7a4 100644 --- a/src/admin/pages/lists/items-page.vue +++ b/src/admin/pages/lists/items-page.vue @@ -636,7 +636,7 @@ :key="index" @click="onChangeTab(statusOption.slug)" :class="{ 'is-active': status == statusOption.slug}" - :style="{ marginRight: statusOption.slug == 'private' ? 'auto' : '' }" + :style="{ marginRight: statusOption.slug == 'private' ? 'auto' : '', marginLeft: statusOption.slug == 'draft' ? 'auto' : '' }" v-tooltip="{ content: $i18n.getWithVariables('info_%s_tab_' + statusOption.slug,[$i18n.get('items')]), autoHide: true, diff --git a/src/admin/pages/lists/taxonomies-page.vue b/src/admin/pages/lists/taxonomies-page.vue index 905d3ead7..4aa119c5d 100644 --- a/src/admin/pages/lists/taxonomies-page.vue +++ b/src/admin/pages/lists/taxonomies-page.vue @@ -110,7 +110,7 @@ :key="index" @click="onChangeTab(statusOption.slug)" :class="{ 'is-active': status == statusOption.slug}" - :style="{ marginRight: statusOption.slug == 'private' ? 'auto' : '' }" + :style="{ marginRight: statusOption.slug == 'private' ? 'auto' : '', marginLeft: statusOption.slug == 'draft' ? 'auto' : '' }" v-tooltip="{ content: $i18n.getWithVariables('info_%s_tab_' + statusOption.slug,[$i18n.get('taxonomies')]), autoHide: true, diff --git a/src/admin/pages/lists/term-items-page.vue b/src/admin/pages/lists/term-items-page.vue index a40f2e41a..6aeb80007 100644 --- a/src/admin/pages/lists/term-items-page.vue +++ b/src/admin/pages/lists/term-items-page.vue @@ -614,7 +614,7 @@ :key="index" @click="onChangeTab(statusOption.slug)" :class="{ 'is-active': status == statusOption.slug}" - :style="{ marginRight: statusOption.slug == 'private' ? 'auto' : '' }" + :style="{ marginRight: statusOption.slug == 'private' ? 'auto' : '', marginLeft: statusOption.slug == 'draft' ? 'auto' : '' }" v-tooltip="{ content: $i18n.getWithVariables('info_%s_tab_' + statusOption.slug,[$i18n.get('items')]), autoHide: true,