Several updates to status logic, to iterate over a global array of status options. Implements new status tabs layout on Collections and Taxonomies list Ref. #248.

This commit is contained in:
Mateus Machado Luna 2019-05-24 13:12:32 -03:00
parent 48865d3de4
commit 2058413064
17 changed files with 211 additions and 198 deletions

View File

@ -124,10 +124,10 @@
:placeholder="$i18n.get('instruction_select_a_status2')" :placeholder="$i18n.get('instruction_select_a_status2')"
@input="addToBulkEditionProcedures($event, 'newValue', criterion)"> @input="addToBulkEditionProcedures($event, 'newValue', criterion)">
<option <option
v-for="(status, key) in statuses" v-for="(statusOption, index) of $statusHelper.getStatuses().filter(option => { return option.value != 'trash' })"
:key="key" :key="index"
:value="status"> :value="statusOption.value">
{{ $i18n.get(status) }} {{ statusOption.label }}
</option> </option>
</b-select> </b-select>
</template> </template>

View File

@ -297,13 +297,13 @@
<div class="status-radios"> <div class="status-radios">
<b-radio <b-radio
v-model="form.status" v-model="form.status"
v-for="statusOption in statusOptions" v-for="(statusOption, index) of $statusHelper.getStatuses()"
:key="statusOption.value" :key="index"
:native-value="statusOption.value"> :native-value="statusOption.value">
<span class="icon has-text-gray"> <span class="icon has-text-gray">
<i <i
class="tainacan-icon tainacan-icon-18px" class="tainacan-icon tainacan-icon-18px"
:class="'tainacan-icon-' + getStatusIcon(statusOption.value)"/> :class="$statusHelper.getIcon(statusOption.value)"/>
</span> </span>
{{ statusOption.label }} {{ statusOption.label }}
</b-radio> </b-radio>
@ -555,20 +555,6 @@ export default {
}, },
thumbnail: {}, thumbnail: {},
cover: {}, cover: {},
// Can be obtained from api later
statusOptions: [{
value: 'publish',
label: this.$i18n.get('public')
}, {
value: 'private',
label: this.$i18n.get('private')
}, {
value: 'draft',
label: this.$i18n.get('draft')
}, {
value: 'trash',
label: this.$i18n.get('trash')
}],
isFetchingPages: false, isFetchingPages: false,
coverPages: [], coverPages: [],
coverPage: '', coverPage: '',
@ -876,15 +862,6 @@ export default {
} }
} }
); );
},
getStatusIcon(status) {
switch(status) {
case 'publish': return 'public';
case 'private': return 'private';
case 'draft': return 'draft';
case 'trash': return 'delete';
default: return 'item';
}
} }
}, },
mounted(){ mounted(){

View File

@ -718,20 +718,6 @@ export default {
comment_status: '' comment_status: ''
}, },
thumbnail: {}, thumbnail: {},
// Can be obtained from api later
statusOptions: [{
value: 'publish',
label: this.$i18n.get('public')
}, {
value: 'private',
label: this.$i18n.get('private')
}, {
value: 'draft',
label: this.$i18n.get('draft')
}, {
value: 'trash',
label: this.$i18n.get('trash')
}],
formErrorMessage: '', formErrorMessage: '',
thumbPlaceholderPath: tainacan_plugin.base_url + '/admin/images/placeholder_square.png', thumbPlaceholderPath: tainacan_plugin.base_url + '/admin/images/placeholder_square.png',
thumbnailMediaFrame: undefined, thumbnailMediaFrame: undefined,

View File

@ -94,7 +94,7 @@
native-value="draft"> native-value="draft">
<span class="icon"> <span class="icon">
<i class="tainacan-icon tainacan-icon-draft"/> <i class="tainacan-icon tainacan-icon-draft"/>
</span> {{ $i18n.get('draft') }} </span> {{ $i18n.get('status_draft') }}
</b-radio> </b-radio>
</div> </div>
</div> </div>

View File

@ -90,13 +90,13 @@
<div class="status-radios"> <div class="status-radios">
<b-radio <b-radio
v-model="form.status" v-model="form.status"
v-for="statusOption in statusOptions" v-for="(statusOption, index) of $statusHelper.getStatuses()"
:key="statusOption.value" :key="index"
:native-value="statusOption.value"> :native-value="statusOption.value">
<span class="icon has-text-gray"> <span class="icon has-text-gray">
<i <i
class="tainacan-icon tainacan-icon-18px" class="tainacan-icon tainacan-icon-18px"
:class="'tainacan-icon-' + getStatusIcon(statusOption.value)"/> :class="$statusHelper.getIcon(statusOption.value)"/>
</span> </span>
{{ statusOption.label }} {{ statusOption.label }}
</b-radio> </b-radio>
@ -224,19 +224,6 @@
allowInsert: String, allowInsert: String,
enabledPostTypes: Array enabledPostTypes: Array
}, },
statusOptions: [{
value: 'publish',
label: this.$i18n.get('public')
}, {
value: 'private',
label: this.$i18n.get('private')
}, {
value: 'draft',
label: this.$i18n.get('draft')
}, {
value: 'trash',
label: this.$i18n.get('trash')
}],
wpPostTypes: tainacan_plugin.wp_post_types, wpPostTypes: tainacan_plugin.wp_post_types,
editFormErrors: {}, editFormErrors: {},
formErrorMessage: '', formErrorMessage: '',
@ -415,15 +402,6 @@
}) })
.catch(error => this.$console.error(error)); .catch(error => this.$console.error(error));
}, },
getStatusIcon(status) {
switch(status) {
case 'publish': return 'public';
case 'private': return 'private';
case 'draft': return 'draft';
case 'trash': return 'delete';
default: return 'item';
}
},
clearErrors(attribute) { clearErrors(attribute) {
this.editFormErrors[attribute] = undefined; this.editFormErrors[attribute] = undefined;
}, },

View File

@ -46,7 +46,7 @@ import store from '../../js/store/store'
import router from './router' import router from './router'
import eventBusSearch from '../../js/event-bus-search'; import eventBusSearch from '../../js/event-bus-search';
import termsListBus from './terms-list-bus.js'; import termsListBus from './terms-list-bus.js';
import { I18NPlugin, UserPrefsPlugin, RouterHelperPlugin, ConsolePlugin, UserCapabilitiesPlugin } from './utilities'; import { I18NPlugin, UserPrefsPlugin, RouterHelperPlugin, ConsolePlugin, UserCapabilitiesPlugin, StatusHelperPlugin } from './utilities';
// Configure and Register Plugins // Configure and Register Plugins
Vue.use(Buefy); Vue.use(Buefy);
@ -56,6 +56,7 @@ Vue.use(I18NPlugin);
Vue.use(UserPrefsPlugin); Vue.use(UserPrefsPlugin);
Vue.use(RouterHelperPlugin); Vue.use(RouterHelperPlugin);
Vue.use(UserCapabilitiesPlugin); Vue.use(UserCapabilitiesPlugin);
Vue.use(StatusHelperPlugin);
Vue.use(ConsolePlugin, {visual: false}); Vue.use(ConsolePlugin, {visual: false});
Vue.use(VueTheMask); Vue.use(VueTheMask);

View File

@ -28,7 +28,7 @@ import ViewModeSlideshow from '../../theme-helper/view-mode-slideshow.vue';
import store from '../../js/store/store' import store from '../../js/store/store'
import routerTheme from './theme-router.js' import routerTheme from './theme-router.js'
import eventBusSearch from '../../js/event-bus-search'; import eventBusSearch from '../../js/event-bus-search';
import { I18NPlugin, UserPrefsPlugin, RouterHelperPlugin, ConsolePlugin } from './utilities'; import { I18NPlugin, UserPrefsPlugin, RouterHelperPlugin, ConsolePlugin, StatusHelperPlugin } from './utilities';
// Configure and Register Plugins // Configure and Register Plugins
Vue.use(Buefy); Vue.use(Buefy);
@ -37,6 +37,7 @@ Vue.use(VueMasonry);
Vue.use(I18NPlugin); Vue.use(I18NPlugin);
Vue.use(UserPrefsPlugin); Vue.use(UserPrefsPlugin);
Vue.use(RouterHelperPlugin); Vue.use(RouterHelperPlugin);
Vue.use(StatusHelperPlugin);
Vue.use(ConsolePlugin, {visual: false}); Vue.use(ConsolePlugin, {visual: false});

View File

@ -339,3 +339,33 @@ UserCapabilitiesPlugin.install = function (Vue, options = {}) {
} }
} }
}; };
// STATUS ICONS PLUGIN - Sets icon for status option
export const StatusHelperPlugin = {};
StatusHelperPlugin.install = function (Vue, options = {}) {
Vue.prototype.$statusHelper = {
getIcon(status) {
switch (status) {
case 'publish': return 'tainacan-icon-public';
case 'private': return 'tainacan-icon-private';
case 'draft': return 'tainacan-icon-draft';
case 'trash': return 'tainacan-icon-delete';
default: '';
}
},
hasIcon(status) {
return ['publish', 'private', 'draft', 'trash'].includes(status);
},
getStatuses() {
return [
{ label: tainacan_plugin.i18n['status_publish'], value: 'publish' },
{ label: tainacan_plugin.i18n['status_private'], value: 'private' },
{ label: tainacan_plugin.i18n['status_draft'], value: 'draft' },
{ label: tainacan_plugin.i18n['status_trash'], value: 'trash' }
]
}
}
};

View File

@ -127,21 +127,44 @@
<ul> <ul>
<li <li
@click="onChangeTab('')" @click="onChangeTab('')"
:class="{ 'is-active': status == undefined || status == ''}"> :class="{ 'is-active': status == undefined || status == ''}"
<a>{{ `${$i18n.get('label_all_collections')}` }}<span class="has-text-gray">&nbsp;{{ `${` ${repositoryTotalCollections ? `(${Number(repositoryTotalCollections.private) + Number(repositoryTotalCollections.publish)})` : '' }`}` }}</span></a> v-tooltip="{
content: $i18n.getWithVariables('info_%s_tab_all',[$i18n.get('collections')]),
autoHide: true,
placement: 'auto',
}">
<a :style="{ fontWeight: 'bold', color: '#454647 !important', lineHeight: '1.5rem' }">
{{ `${$i18n.get('label_all_collections')}` }}
<span class="has-text-gray">&nbsp;{{ `${` ${repositoryTotalCollections ? `(${Number(repositoryTotalCollections.private) + Number(repositoryTotalCollections.publish)})` : '' }`}` }}</span>
</a>
</li> </li>
<li <li
@click="onChangeTab('draft')" v-for="(statusOption, index) of $statusHelper.getStatuses()"
:class="{ 'is-active': status == 'draft'}"> :key="index"
<a>{{ `${$i18n.get('label_draft_items')}` }}<span class="has-text-gray">&nbsp;{{ `${` ${repositoryTotalCollections ? `(${repositoryTotalCollections.draft})` : '' }`}` }}</span></a> @click="onChangeTab(statusOption.value)"
</li> :class="{ 'is-active': status == statusOption.value}"
<li :style="{ marginLeft: statusOption.value == 'draft' ? 'auto' : '' }"
@click="onChangeTab('trash')" v-tooltip="{
:class="{ 'is-active': status == 'trash'}"> content: $i18n.getWithVariables('info_%s_tab_' + statusOption.value,[$i18n.get('collections')]),
<a>{{ `${$i18n.get('label_trash_items')}` }}<span class="has-text-gray">&nbsp;{{ `${` ${repositoryTotalCollections ? `(${repositoryTotalCollections.trash})` : '' }`}` }}</span></a> autoHide: true,
placement: 'auto',
}">
<a>
<span
v-if="$statusHelper.hasIcon(statusOption.value)"
class="icon has-text-gray">
<i
class="tainacan-icon tainacan-icon-18px"
:class="$statusHelper.getIcon(statusOption.value)"
/>
</span>
{{ statusOption.label }}
<span class="has-text-gray">&nbsp;{{ `${` ${repositoryTotalCollections ? `(${repositoryTotalCollections[statusOption.value]})` : '' }`}` }}</span>
</a>
</li> </li>
</ul> </ul>
</div> </div>
<div> <div>
<collections-list <collections-list
:is-loading="isLoading" :is-loading="isLoading"
@ -161,8 +184,12 @@
</span> </span>
</p> </p>
<p v-if="status == undefined || status == ''">{{ $i18n.get('info_no_collection_created') }}</p> <p v-if="status == undefined || status == ''">{{ $i18n.get('info_no_collection_created') }}</p>
<p v-if="status == 'draft'">{{ $i18n.get('info_no_collection_draft') }}</p> <p
<p v-if="status == 'trash'">{{ $i18n.get('info_no_collection_trash') }}</p> v-for="(statusOption, index) of $statusHelper.getStatuses()"
:key="index"
v-if="status == statusOption.value">
{{ $i18n.getWithVariables('info_no_%s_' + statusOption.value,['collection']) }}
</p>
<div v-if="$userCaps.hasCapability('edit_tainacan-collections') && status == undefined || status == ''"> <div v-if="$userCaps.hasCapability('edit_tainacan-collections') && status == undefined || status == ''">
<b-dropdown <b-dropdown

View File

@ -614,7 +614,7 @@
@click="onChangeTab('')" @click="onChangeTab('')"
:class="{ 'is-active': status == undefined || status == ''}" :class="{ 'is-active': status == undefined || status == ''}"
v-tooltip="{ v-tooltip="{
content: $i18n.get('info_items_tab_all'), content: $i18n.getWithVariables('info_%s_tab_all',[$i18n.get('items')]),
autoHide: true, autoHide: true,
placement: 'auto', placement: 'auto',
}"> }">
@ -624,70 +624,27 @@
</a> </a>
</li> </li>
<li <li
@click="onChangeTab('publish')" v-for="(statusOption, index) of $statusHelper.getStatuses()"
:class="{ 'is-active': status == 'publish'}" :key="index"
@click="onChangeTab(statusOption.value)"
:class="{ 'is-active': status == statusOption.value}"
:style="{ marginLeft: statusOption.value == 'draft' ? 'auto' : '' }"
v-tooltip="{ v-tooltip="{
content: $i18n.get('info_items_tab_publish'), content: $i18n.getWithVariables('info_%s_tab_' + statusOption.value,[$i18n.get('items')]),
autoHide: true, autoHide: true,
placement: 'auto', placement: 'auto',
}"> }">
<a> <a>
<span class="icon has-text-gray"> <span
<i class="tainacan-icon tainacan-icon-18px tainacan-icon-public"/> v-if="$statusHelper.hasIcon(statusOption.value)"
class="icon has-text-gray">
<i
class="tainacan-icon tainacan-icon-18px"
:class="$statusHelper.getIcon(statusOption.value)"
/>
</span> </span>
{{ $i18n.get('label_publish_items') }} {{ statusOption.label }}
<span class="has-text-gray">&nbsp;{{ collection && collection.total_items ? ` (${collection.total_items.publish})` : (isRepositoryLevel && repositoryTotalItems) ? ` (${ repositoryTotalItems.publish })` : '' }}</span> <span class="has-text-gray">&nbsp;{{ collection && collection.total_items ? ` (${collection.total_items[statusOption.value]})` : (isRepositoryLevel && repositoryTotalItems) ? ` (${ repositoryTotalItems[statusOption.value] })` : '' }}</span>
</a>
</li>
<li
v-if="!isRepositoryLevel"
@click="onChangeTab('private')"
:class="{ 'is-active': status == 'private'}"
style="margin-right: auto"
v-tooltip="{
content: $i18n.get('info_items_tab_private'),
autoHide: true,
placement: 'auto',
}">
<a>
<span class="icon has-text-gray">
<i class="tainacan-icon tainacan-icon-18px tainacan-icon-private"/>
</span>
{{ $i18n.get('label_private_items') }}
<span class="has-text-gray">&nbsp;{{ collection && collection.total_items ? ` (${collection.total_items.private})` : (isRepositoryLevel && repositoryTotalItems) ? ` (${ repositoryTotalItems.private })` : '' }}</span>
</a>
</li>
<li
@click="onChangeTab('draft')"
:class="{ 'is-active': status == 'draft'}"
v-tooltip="{
content: $i18n.get('info_items_tab_draft'),
autoHide: true,
placement: 'auto',
}">
<a>
<span class="icon has-text-gray">
<i class="tainacan-icon tainacan-icon-18px tainacan-icon-draft"/>
</span>
{{ $i18n.get('label_draft_items') }}
<span class="has-text-gray">&nbsp;{{ collection && collection.total_items ? ` (${collection.total_items.draft})` : (isRepositoryLevel && repositoryTotalItems) ? ` (${ repositoryTotalItems.draft })` : '' }}</span>
</a>
</li>
<li
v-if="!isRepositoryLevel"
@click="onChangeTab('trash')"
:class="{ 'is-active': status == 'trash'}"
v-tooltip="{
content: $i18n.get('info_items_tab_trash'),
autoHide: true,
placement: 'auto',
}">
<a>
<span class="icon has-text-gray">
<i class="tainacan-icon tainacan-icon-18px tainacan-icon-delete"/>
</span>
{{ $i18n.get('label_trash_items') }}
<span class="has-text-gray">&nbsp;{{ collection && collection.total_items ? ` (${collection.total_items.trash})` : (isRepositoryLevel && repositoryTotalItems) ? ` (${ repositoryTotalItems.trash })` : '' }}</span>
</a> </a>
</li> </li>
</ul> </ul>
@ -784,10 +741,12 @@
</span> </span>
</p> </p>
<p v-if="status == undefined || status == ''">{{ hasFiltered ? $i18n.get('info_no_item_found_filter') : $i18n.get('info_no_item_created') }}</p> <p v-if="status == undefined || status == ''">{{ hasFiltered ? $i18n.get('info_no_item_found_filter') : $i18n.get('info_no_item_created') }}</p>
<p v-if="status == 'publish'">{{ $i18n.get('info_no_item_publish') }}</p> <p
<p v-if="status == 'private'">{{ $i18n.get('info_no_item_priavte') }}</p> v-for="(statusOption, index) of $statusHelper.getStatuses()"
<p v-if="status == 'draft'">{{ $i18n.get('info_no_item_draft') }}</p> :key="index"
<p v-if="status == 'trash'">{{ $i18n.get('info_no_item_trash') }}</p> v-if="status == statusOption.value">
{{ $i18n.getWithVariables('info_no_%s_' + statusOption.value,['item']) }}
</p>
<router-link <router-link
v-if="!hasFiltered && (status == undefined || status == '') && !$route.query.iframemode" v-if="!hasFiltered && (status == undefined || status == '') && !$route.query.iframemode"

View File

@ -94,18 +94,40 @@
<ul> <ul>
<li <li
@click="onChangeTab('')" @click="onChangeTab('')"
:class="{ 'is-active': status == undefined || status == ''}"> :class="{ 'is-active': status == undefined || status == ''}"
<a>{{ `${$i18n.get('label_all_taxonomies')}` }}<span class="has-text-gray">&nbsp;{{ `${` ${repositoryTotalTaxonomies ? `(${Number(repositoryTotalTaxonomies.private) + Number(repositoryTotalTaxonomies.publish)})` : '' }`}` }}</span></a> v-tooltip="{
content: $i18n.getWithVariables('info_%s_tab_all',[$i18n.get('taxonomies')]),
autoHide: true,
placement: 'auto',
}">
<a :style="{ fontWeight: 'bold', color: '#454647 !important', lineHeight: '1.5rem' }">
{{ `${$i18n.get('label_all_taxonomies')}` }}
<span class="has-text-gray">&nbsp;{{ repositoryTotalTaxonomies ? `(${Number(repositoryTotalTaxonomies.private) + Number(repositoryTotalTaxonomies.publish)})` : '' }}</span>
</a>
</li> </li>
<li <li
@click="onChangeTab('draft')" v-for="(statusOption, index) of $statusHelper.getStatuses()"
:class="{ 'is-active': status == 'draft'}"> :key="index"
<a>{{ `${$i18n.get('label_draft_items')}` }}<span class="has-text-gray">&nbsp;{{ `${` ${repositoryTotalTaxonomies ? `(${repositoryTotalTaxonomies.draft})` : '' }`}` }}</span></a> @click="onChangeTab(statusOption.value)"
</li> :class="{ 'is-active': status == statusOption.value}"
<li :style="{ marginLeft: statusOption.value == 'draft' ? 'auto' : '' }"
@click="onChangeTab('trash')" v-tooltip="{
:class="{ 'is-active': status == 'trash'}"> content: $i18n.getWithVariables('info_%s_tab_' + statusOption.value,[$i18n.get('taxonomies')]),
<a>{{ `${$i18n.get('label_trash_items')}` }}<span class="has-text-gray">&nbsp;{{ `${` ${repositoryTotalTaxonomies ? `(${repositoryTotalTaxonomies.trash})` : '' }`}` }}</span></a> autoHide: true,
placement: 'auto',
}">
<a>
<span
v-if="$statusHelper.hasIcon(statusOption.value)"
class="icon has-text-gray">
<i
class="tainacan-icon tainacan-icon-18px"
:class="$statusHelper.getIcon(statusOption.value)"
/>
</span>
{{ statusOption.label }}
<span class="has-text-gray">&nbsp;{{ repositoryTotalTaxonomies ? `(${repositoryTotalTaxonomies[statusOption.value]})` : '' }}</span>
</a>
</li> </li>
</ul> </ul>
</div> </div>
@ -126,8 +148,12 @@
<i class="tainacan-icon tainacan-icon-36px tainacan-icon-terms"/> <i class="tainacan-icon tainacan-icon-36px tainacan-icon-terms"/>
</span> </span>
<p v-if="status == undefined || status == ''">{{ $i18n.get('info_no_taxonomy_created') }}</p> <p v-if="status == undefined || status == ''">{{ $i18n.get('info_no_taxonomy_created') }}</p>
<p v-if="status == 'draft'">{{ $i18n.get('info_no_taxonomy_draft') }}</p> <p
<p v-if="status == 'trash'">{{ $i18n.get('info_no_taxonomy_trash') }}</p> v-for="(statusOption, index) of $statusHelper.getStatuses()"
:key="index"
v-if="status == statusOption.value">
{{ $i18n.getWithVariables('info_no_%s_' + statusOption.value,['taxonomy']) }}
</p>
<router-link <router-link
v-if="status == undefined || status == ''" v-if="status == undefined || status == ''"
id="button-create-taxonomy" id="button-create-taxonomy"

View File

@ -597,13 +597,41 @@
<ul> <ul>
<li <li
@click="onChangeTab('')" @click="onChangeTab('')"
:class="{ 'is-active': status == undefined || status == ''}"><a>{{ $i18n.get('label_all_published_items') }}</a></li> :class="{ 'is-active': status == undefined || status == ''}"
v-tooltip="{
content: $i18n.getWithVariables('info_%s_tab_all',[$i18n.get('items')]),
autoHide: true,
placement: 'auto',
}">
<a :style="{ fontWeight: 'bold', color: '#454647 !important', lineHeight: '1.5rem' }">
{{ $i18n.get('label_all_published_items') }}
<span class="has-text-gray">&nbsp;{{ collection && collection.total_items ? ` (${Number(collection.total_items.private) + Number(collection.total_items.publish)})` : (isRepositoryLevel && repositoryTotalItems) ? ` (${ repositoryTotalItems.private + repositoryTotalItems.publish })` : '' }}</span>
</a>
</li>
<li <li
@click="onChangeTab('draft')" v-for="(statusOption, index) of $statusHelper.getStatuses()"
:class="{ 'is-active': status == 'draft'}"><a>{{ $i18n.get('label_draft_items') }}</a></li> :key="index"
<li @click="onChangeTab(statusOption.value)"
@click="onChangeTab('trash')" :class="{ 'is-active': status == statusOption.value}"
:class="{ 'is-active': status == 'trash'}"><a>{{ $i18n.get('label_trash_items') }}</a></li> :style="{ marginLeft: statusOption.value == 'draft' ? 'auto' : '' }"
v-tooltip="{
content: $i18n.getWithVariables('info_%s_tab_' + statusOption.value,[$i18n.get('items')]),
autoHide: true,
placement: 'auto',
}">
<a>
<span
v-if="$statusHelper.hasIcon(statusOption.value)"
class="icon has-text-gray">
<i
class="tainacan-icon tainacan-icon-18px"
:class="$statusHelper.getIcon(statusOption.value)"
/>
</span>
{{ statusOption.label }}
<span class="has-text-gray">&nbsp;{{ collection && collection.total_items ? ` (${collection.total_items[statusOption.value]})` : (isRepositoryLevel && repositoryTotalItems) ? ` (${ repositoryTotalItems[statusOption.value] })` : '' }}</span>
</a>
</li>
</ul> </ul>
</div> </div>
@ -697,8 +725,12 @@
</span> </span>
</p> </p>
<p v-if="status == undefined || status == ''">{{ hasFiltered ? $i18n.get('info_no_item_found_filter') : $i18n.get('info_no_item_created') }}</p> <p v-if="status == undefined || status == ''">{{ hasFiltered ? $i18n.get('info_no_item_found_filter') : $i18n.get('info_no_item_created') }}</p>
<p v-if="status == 'draft'">{{ $i18n.get('info_no_item_draft') }}</p> <p
<p v-if="status == 'trash'">{{ $i18n.get('info_no_item_trash') }}</p> v-for="(statusOption, index) of $statusHelper.getStatuses()"
:key="index"
v-if="status == statusOption.value">
{{ $i18n.getWithVariables('info_no_%s_' + statusOption.value,['items']) }}
</p>
<router-link <router-link
v-if="!hasFiltered && (status == undefined || status == '')" v-if="!hasFiltered && (status == undefined || status == '')"

View File

@ -7,9 +7,11 @@
<div class="tainacan-page-title"> <div class="tainacan-page-title">
<h1> <h1>
<span <span
v-if="(item != null && item != undefined && item.status != undefined && !isLoading)" v-if="(item != null && item != undefined && item.status != undefined && !isLoading)"
class="status-tag">{{ $i18n.get(item.status) }}</span> class="status-tag">
{{ $i18n.get('status_' + item.status) }}
</span>
{{ $i18n.get('title_item_page') + ' ' }} {{ $i18n.get('title_item_page') + ' ' }}
<span style="font-weight: 600;">{{ (item != null && item != undefined) ? item.title : '' }}</span> <span style="font-weight: 600;">{{ (item != null && item != undefined) ? item.title : '' }}</span>
</h1> </h1>

View File

@ -82,12 +82,12 @@ return apply_filters( 'tainacan-admin-i18n', [
'delete' => __( 'Delete', 'tainacan' ), 'delete' => __( 'Delete', 'tainacan' ),
// Wordpress Status // Wordpress Status
'publish' => __( 'Publish', 'tainacan' ), 'status_publish' => __( 'Publish', 'tainacan' ),
'public' => __( 'Public', 'tainacan' ), 'status_public' => __( 'Public', 'tainacan' ),
'draft' => __( 'Draft', 'tainacan' ), 'status_draft' => __( 'Draft', 'tainacan' ),
'private' => __( 'Private', 'tainacan' ), 'status_private' => __( 'Private', 'tainacan' ),
'trash' => __( 'Trash', 'tainacan' ), 'status_trash' => __( 'Trash', 'tainacan' ),
'auto-draft' => __( 'Automatic Draft', 'tainacan' ), 'status_auto-draft' => __( 'Automatic Draft', 'tainacan' ),
'publish_visibility' => __( 'Visible to everyone', 'tainacan' ), 'publish_visibility' => __( 'Visible to everyone', 'tainacan' ),
'private_visibility' => __( 'Visible only for editors', 'tainacan' ), 'private_visibility' => __( 'Visible only for editors', 'tainacan' ),
@ -239,10 +239,6 @@ return apply_filters( 'tainacan-admin-i18n', [
'label_all_published_items' => __( 'All published items', 'tainacan' ), 'label_all_published_items' => __( 'All published items', 'tainacan' ),
'label_all_collections' => __( 'All collections', 'tainacan' ), 'label_all_collections' => __( 'All collections', 'tainacan' ),
'label_all_taxonomies' => __( 'All taxonomies', 'tainacan' ), 'label_all_taxonomies' => __( 'All taxonomies', 'tainacan' ),
'label_publish_items' => __( 'Public', 'tainacan' ),
'label_private_items' => __( 'Private', 'tainacan' ),
'label_draft_items' => __( 'Draft', 'tainacan' ),
'label_trash_items' => __( 'Trash', 'tainacan' ),
'label_bulk_actions' => __( 'Bulk actions', 'tainacan' ), 'label_bulk_actions' => __( 'Bulk actions', 'tainacan' ),
'label_delete_selected_collections' => __( 'Delete selected collections', 'tainacan' ), 'label_delete_selected_collections' => __( 'Delete selected collections', 'tainacan' ),
'label_edit_selected_collections' => __( 'Edit selected collections', 'tainacan' ), 'label_edit_selected_collections' => __( 'Edit selected collections', 'tainacan' ),
@ -454,32 +450,28 @@ return apply_filters( 'tainacan-admin-i18n', [
'instruction_drag_and_drop_filter_sort' => __( 'Drag and drop to change filter order', 'tainacan' ), 'instruction_drag_and_drop_filter_sort' => __( 'Drag and drop to change filter order', 'tainacan' ),
'instruction_drag_and_drop_metadatum_sort' => __( 'Drag and drop to change metadatum order', 'tainacan' ), 'instruction_drag_and_drop_metadatum_sort' => __( 'Drag and drop to change metadatum order', 'tainacan' ),
'instruction_select_step_options_to_show' => __( 'Select which Step values to show', 'tainacan' ), 'instruction_select_step_options_to_show' => __( 'Select which Step values to show', 'tainacan' ),
'instruction_select_maximum_options_to_show' => __( 'Select which Maximum of options to show', 'tainacan' ), 'instruction_select_maximum_options_to_show' => __( 'Select which amount of maximum of options to show', 'tainacan' ),
// Info. Other feedback to user. // Info. Other feedback to user.
'info_items_tab_all' => __( 'Every published item of this collection, including those visible only to editors.', 'tainacan' ), 'info_%s_tab_all' => __( 'Every published %s, including those visible only to editors.', 'tainacan' ),
'info_items_tab_publish' => __( 'Only items that are visible to everyone.', 'tainacan' ), 'info_%s_tab_publish' => __( 'Only %s that are visible to everyone.', 'tainacan' ),
'info_items_tab_private' => __( 'Items visible only to editors.', 'tainacan' ), 'info_%s_tab_private' => __( '%s visible only to editors.', 'tainacan' ),
'info_items_tab_draft' => __( 'Draft items, not published.', 'tainacan' ), 'info_%s_tab_draft' => __( 'Draft %s, not published.', 'tainacan' ),
'info_items_tab_trash' => __( 'Items that were sent to trash.', 'tainacan' ), 'info_%s_tab_trash' => __( '%s that were sent to trash.', 'tainacan' ),
'info_error_invalid_date' => __( 'Invalid date', 'tainacan' ), 'info_error_invalid_date' => __( 'Invalid date', 'tainacan' ),
'info_search_results' => __( 'Search Results', 'tainacan' ), 'info_search_results' => __( 'Search Results', 'tainacan' ),
'info_search_criteria' => __( 'Search Criteria', 'tainacan' ), 'info_search_criteria' => __( 'Search Criteria', 'tainacan' ),
'info_name_is_required' => __( 'Name is required.', 'tainacan' ), 'info_name_is_required' => __( 'Name is required.', 'tainacan' ),
'info_no_collection_created' => __( 'No collection was created in this repository.', 'tainacan' ), 'info_no_collection_created' => __( 'No collection was created in this repository.', 'tainacan' ),
'info_no_collection_draft' => __( 'No draft collection found.', 'tainacan' ), 'info_no_%s_publish' => __( 'No public %s found.', 'tainacan' ),
'info_no_collection_trash' => __( 'No collection in trash.', 'tainacan' ), 'info_no_%s_private' => __( 'No private %s found.', 'tainacan' ),
'info_no_taxonomy_draft' => __( 'No draft taxonomy found.', 'tainacan' ), 'info_no_%s_draft' => __( 'No draft %s found.', 'tainacan' ),
'info_no_taxonomy_trash' => __( 'No taxonomy in trash.', 'tainacan' ), 'info_no_%s_trash' => __( 'No %s found on trash.', 'tainacan' ),
'info_no_taxonomy_created' => __( 'No taxonomy was created in this repository.', 'tainacan' ), 'info_no_taxonomy_created' => __( 'No taxonomy was created in this repository.', 'tainacan' ),
'info_no_terms_created_on_taxonomy' => __( 'No term was created for this taxonomy.', 'tainacan' ), 'info_no_terms_created_on_taxonomy' => __( 'No term was created for this taxonomy.', 'tainacan' ),
'info_no_terms_found' => __( 'No term was found here', 'tainacan' ), 'info_no_terms_found' => __( 'No term was found here', 'tainacan' ),
'info_no_more_terms_found' => __( 'No more terms found', 'tainacan' ), 'info_no_more_terms_found' => __( 'No more terms found', 'tainacan' ),
'info_no_item_created' => __( 'No item was created in this collection.', 'tainacan' ), 'info_no_item_created' => __( 'No item was created in this collection.', 'tainacan' ),
'info_no_item_publish' => __( 'No public item found.', 'tainacan' ),
'info_no_item_private' => __( 'No private item found.', 'tainacan' ),
'info_no_item_draft' => __( 'No draft item found.', 'tainacan' ),
'info_no_item_trash' => __( 'No item in trash.', 'tainacan' ),
'info_no_page_found' => __( 'No page was found with this name.', 'tainacan' ), 'info_no_page_found' => __( 'No page was found with this name.', 'tainacan' ),
'info_no_user_found' => __( 'No user was found with this name.', 'tainacan' ), 'info_no_user_found' => __( 'No user was found with this name.', 'tainacan' ),
'info_no_item_found_filter' => __( 'No item was found here with these filters.', 'tainacan' ), 'info_no_item_found_filter' => __( 'No item was found here with these filters.', 'tainacan' ),

View File

@ -124,7 +124,7 @@ class Filter extends Entity {
function get_filter_type_object(){ function get_filter_type_object(){
$class_name = $this->get_filter_type(); $class_name = $this->get_filter_type();
if (empty($class_name)) { if( !class_exists( $class_name ) ){
return null; return null;
} }

View File

@ -172,9 +172,11 @@ class Metadatum extends Entity {
*/ */
function get_metadata_type_object(){ function get_metadata_type_object(){
$class_name = $this->get_metadata_type(); $class_name = $this->get_metadata_type();
if (empty($class_name)) {
if( !class_exists( $class_name ) ){
return null; return null;
} }
$object_type = new $class_name(); $object_type = new $class_name();
$object_type->set_options( $this->get_metadata_type_options() ); $object_type->set_options( $this->get_metadata_type_options() );
return $object_type; return $object_type;

View File

@ -105,7 +105,7 @@ class Numeric extends Filter_Type {
if ( empty($this->get_option('step')) ) { if ( empty($this->get_option('step')) ) {
return [ return [
'step' => __('Required step','tainacan') 'step' => __('"Step" value is required','tainacan')
]; ];
} }