Finishes implementation of tabs in collection list

This commit is contained in:
Mateus Machado Luna 2018-05-22 15:35:36 -03:00
parent 9e42291e34
commit c321cd0c93
6 changed files with 46 additions and 35 deletions

View File

@ -25,12 +25,12 @@
</a>
<figure class="image is-128x128">
<span
v-if="collection.thumbnail == undefined || collection.thumbnail == false"
v-if="collection.thumbnail.thumb == undefined || collection.thumbnail.thumb == false"
class="image-placeholder">{{ $i18n.get('label_empty_thumbnail') }}</span>
<img
id="thumbail-image"
:alt="$i18n.get('label_thumbnail')"
:src="(collection.thumbnail == undefined || collection.thumbnail == false) ? thumbPlaceholderPath : collection.thumbnail.thumb">
:src="(collection.thumbnail.thumb == undefined || collection.thumbnail.thumb == false) ? thumbPlaceholderPath : collection.thumbnail.thumb">
</figure>
<div class="thumbnail-buttons-row">
<a

View File

@ -235,7 +235,7 @@
<b-icon icon="pencil" />
</a>
<file-item
v-if="item.thumbnail != undefined && item.thumbnail != false"
v-if="item.thumbnail.thumb != undefined && item.thumbnail.thumb != false"
:show-name="false"
:file="{
media_type: 'image',
@ -243,7 +243,7 @@
title: { rendered: $i18n.get('label_thumbnail')},
description: { rendered: `<img alt='Thumbnail' src='` + item.thumbnail.full + `'/>` }}"/>
<figure
v-if="item.thumbnail == undefined || item.thumbnail == false"
v-if="item.thumbnail.thumb == undefined || item.thumbnail.thumb == false"
class="image">
<span class="image-placeholder">{{ $i18n.get('label_empty_thumbnail') }}</span>
<img

View File

@ -1,5 +1,7 @@
<template>
<div class="table-container">
<div
v-if="totalCollections > 0 && !isLoading"
class="table-container">
<div class="selection-control">
<div class="field select-all is-pulled-left">
<span>
@ -11,7 +13,7 @@
<div class="field is-pulled-right">
<b-dropdown
position="is-bottom-left"
v-if="collections.length > 0 && collections[0].current_user_can_edit"
v-if="collections[0].current_user_can_edit"
:disabled="!isSelectingCollections"
id="bulk-actions-dropdown">
<button
@ -139,28 +141,6 @@
</tbody>
</table>
</div>
<!-- Empty state image -->
<div v-if="!totalCollections || totalCollections <= 0">
<section class="section">
<div class="content has-text-grey has-text-centered">
<p>
<b-icon
icon="inbox"
size="is-large"/>
</p>
<p>{{ $i18n.get('info_no_collection_created') }}</p>
<router-link
id="button-create-collection"
tag="button"
class="button is-primary"
:to="{ path: $routerHelper.getNewCollectionPath() }">
{{ $i18n.getFrom('collections', 'new_item') }}
</router-link>
</div>
</section>
</div>
</div>
</template>
@ -319,8 +299,7 @@ export default {
// document.addEventListener('mouseup', function () {
// thElm = undefined;
// });
// })();
// })();
}
}
</script>
@ -331,7 +310,7 @@ export default {
.selection-control {
padding: 6px 0px 0px 12px;
padding: 6px 0px 0px 13px;
background: white;
height: 40px;

View File

@ -294,7 +294,7 @@ export default {
.selection-control {
padding: 6px 0px 0px 12px;
padding: 6px 0px 0px 13px;
background: white;
height: 40px;

View File

@ -3,7 +3,7 @@
<tainacan-title />
<div
class="sub-header"
v-if="totalCollections > 0">
v-if="checkIfUserCanEdit()">
<div class="header-item">
<b-dropdown id="collection-creation-options-dropdown">
<button
@ -49,7 +49,31 @@
:total-collections="totalCollections"
:page="page"
:collections-per-page="collectionsPerPage"
:collections="collections"/>
:collections="collections"/>
<!-- Empty state image -->
<div v-if="totalCollections <= 0 && !isLoading">
<section class="section">
<div class="content has-text-grey has-text-centered">
<p>
<b-icon
icon="inbox"
size="is-large"/>
</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 v-if="status == 'trash'">{{ $i18n.get('info_no_collection_trash') }}</p>
<router-link
v-if="status == undefined || status == ''"
id="button-create-collection"
tag="button"
class="button is-primary"
:to="{ path: $routerHelper.getNewCollectionPath() }">
{{ $i18n.getFrom('collections', 'new_item') }}
</router-link>
</div>
</section>
</div>
<!-- Footer -->
<div
class="pagination-area"
@ -122,6 +146,13 @@ export default {
this.status = status;
this.loadCollections();
},
checkIfUserCanEdit() {
for (let capability of tainacan_plugin.user_caps) {
if (capability == 'edit_tainacan-collections')
return true;
}
return false;
},
onChangeCollectionsPerPage(value) {
let prevValue = this.collectionsPerPage;
this.collectionsPerPage = value;
@ -151,7 +182,6 @@ export default {
},
computed: {
collections(){
let collectionsList = this.getCollections();
for (let collection of collectionsList)
collection['creation'] = this.$i18n.get('info_created_by') + collection['author_name'] + '<br>' + this.$i18n.get('info_date') + collection['creation_date'];

View File

@ -212,6 +212,8 @@ return [
// Info. Other feedback to user.
'info_name_is_required' => __( 'Name is required.', 'tainacan' ),
'info_no_collection_created' => __( 'No collection was created in this repository.', 'tainacan' ),
'info_no_collection_draft' => __( 'No draft collection found.', 'tainacan' ),
'info_no_collection_trash' => __( 'No collection on trash.', 'tainacan' ),
'info_no_category_created' => __( 'No taxonomy was created in this repository.', 'tainacan' ),
'info_no_item_created' => __( 'No item was created in this collection.', 'tainacan' ),
'info_no_page_found' => __( 'No page was found with this name.', 'tainacan' ),