Adds correct placeholders for thumbnail and coverpage in CollectinEditionForm. Begins implementation of Moderators List.
This commit is contained in:
parent
73b6b9493a
commit
2a6faae6bf
|
@ -63,7 +63,7 @@
|
|||
class="image-placeholder">{{ $i18n.get('label_empty_header_image') }}</span>
|
||||
<img
|
||||
:alt="$i18n.get('label_thumbnail')"
|
||||
:src="(collection.header_image == undefined || collection.header_image == false) ? thumbPlaceholderPath : collection.header_image">
|
||||
:src="(collection.header_image == undefined || collection.header_image == false) ? headerPlaceholderPath : collection.header_image">
|
||||
</figure>
|
||||
<div class="thumbnail-buttons-row">
|
||||
<a
|
||||
|
@ -168,7 +168,7 @@
|
|||
<template slot-scope="props">
|
||||
{{ props.option.title.rendered }}
|
||||
</template>
|
||||
<template slot="empty">No results found</template>
|
||||
<template slot="empty">{{ $i18n.get('info_no_page_found') }}</template>
|
||||
</b-autocomplete>
|
||||
|
||||
<div
|
||||
|
@ -178,19 +178,53 @@
|
|||
<span class="selected-cover-page-control">
|
||||
<a
|
||||
target="blank"
|
||||
:href="coverPageEditPath">Edit</a>
|
||||
:href="coverPageEditPath">{{ $i18n.get('edit') }}</a>
|
||||
|
||||
<a
|
||||
target="_blank"
|
||||
:href="coverPage.link">View</a>
|
||||
:href="coverPage.link">{{ $i18n.get('see') }}</a>
|
||||
|
||||
<button
|
||||
class="button is-secondary is-small"
|
||||
@click.prevent="removeCoverPage()">Remove</button>
|
||||
@click.prevent="removeCoverPage()">{{ $i18n.get('remove') }}</button>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
|
||||
</b-field>
|
||||
|
||||
<!-- Moderators List -------------------------------- -->
|
||||
<b-field
|
||||
:addons="false"
|
||||
:label="$i18n.get('label_moderators')"
|
||||
:type="editFormErrors['moderators'] != undefined ? 'is-danger' : ''"
|
||||
:message="editFormErrors['moderators'] != undefined ? editFormErrors['moderators'] : ''">
|
||||
<help-button
|
||||
:title="$i18n.getHelperTitle('collections', 'moderators')"
|
||||
:message="$i18n.getHelperMessage('collections', 'moderators')"/>
|
||||
<b-autocomplete
|
||||
id="tainacan-text-moderators-input"
|
||||
:data="users"
|
||||
v-model="newModerator"
|
||||
@select="onAddModerador($event)"
|
||||
:loading="isFetchingModerators"
|
||||
@input="fecthModerators($event)"
|
||||
@focus="clearErrors('moderators')">
|
||||
<template slot-scope="props">
|
||||
{{ props.option.name }}
|
||||
</template>
|
||||
<template slot="empty">{{ $i18n.get('info_no_user_found') }}</template>
|
||||
</b-autocomplete>
|
||||
<ul
|
||||
class="moderators-list"
|
||||
v-if="form.moderators.length > 0">
|
||||
<li
|
||||
:key="index"
|
||||
v-for="(moderator, index) of form.moderators">
|
||||
{{ moderator.name }}
|
||||
</li>
|
||||
</ul>
|
||||
<div v-else>
|
||||
{{ $i18n.get('info_no_moderator_on_collection') }}
|
||||
</div>
|
||||
</b-field>
|
||||
|
||||
<!-- Slug -------------------------------- -->
|
||||
|
@ -253,7 +287,8 @@ export default {
|
|||
enable_cover_page: '',
|
||||
featured_image: '',
|
||||
header_image: '',
|
||||
files:[]
|
||||
files:[],
|
||||
moderators: []
|
||||
},
|
||||
thumbnail: {},
|
||||
cover: {},
|
||||
|
@ -281,7 +316,11 @@ export default {
|
|||
isNewCollection: false,
|
||||
// Fream Uploader variables
|
||||
frameUploader: undefined,
|
||||
thumbPlaceholderPath: tainacan_plugin.base_url + '/admin/images/placeholder.png'
|
||||
thumbPlaceholderPath: tainacan_plugin.base_url + '/admin/images/placeholder_square.png',
|
||||
headerPlaceholderPath: tainacan_plugin.base_url + '/admin/images/placeholder_rectangle.png',
|
||||
isFetchingModerators: false,
|
||||
users: [],
|
||||
newModerator: ''
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
|
@ -293,7 +332,8 @@ export default {
|
|||
'updateThumbnail',
|
||||
'updateHeaderImage',
|
||||
'fetchPages',
|
||||
'fetchPage'
|
||||
'fetchPage',
|
||||
'fetchUsers'
|
||||
]),
|
||||
...mapActions('fields', [
|
||||
'fetchFields'
|
||||
|
@ -402,6 +442,21 @@ export default {
|
|||
this.coverPageTitle = this.coverPage.title.rendered;
|
||||
this.coverPageEditPath = tainacan_plugin.admin_url + '/post.php?post=' + selectedPage.id + '&action=edit';
|
||||
},
|
||||
fecthModerators(search) {
|
||||
this.isFetchingModerators = true;
|
||||
this.fetchUsers(search)
|
||||
.then((users) => {
|
||||
this.users = users;
|
||||
this.isFetchingModerators = false;
|
||||
})
|
||||
.catch((error) => {
|
||||
this.$console.error(error);
|
||||
this.isFetchingPages = false;
|
||||
});
|
||||
},
|
||||
onAddModerator(user) {
|
||||
this.form.moderators.push({'id': user.id, 'name': user.name});
|
||||
},
|
||||
removeCoverPage() {
|
||||
this.coverPage = {};
|
||||
this.coverPageTitle = '';
|
||||
|
@ -524,7 +579,7 @@ export default {
|
|||
this.$console.error(error);
|
||||
this.isFetchingPages = false;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
this.isLoading = false;
|
||||
});
|
||||
|
@ -540,6 +595,7 @@ export default {
|
|||
|
||||
.thumbnail-field {
|
||||
max-height: 128px;
|
||||
margin-bottom: 40px;
|
||||
|
||||
.content {
|
||||
padding: 10px;
|
||||
|
@ -554,6 +610,7 @@ export default {
|
|||
margin-right: 10px;
|
||||
bottom: 50%;
|
||||
font-size: 0.8rem;
|
||||
font-weight: bold;
|
||||
z-index: 99;
|
||||
text-align: center;
|
||||
color: gray;
|
||||
|
@ -601,6 +658,9 @@ export default {
|
|||
}
|
||||
|
||||
}
|
||||
.moderators-list {
|
||||
font-size: 0.85 rem;
|
||||
}
|
||||
|
||||
</style>
|
||||
|
||||
|
|
Binary file not shown.
Before Width: | Height: | Size: 2.5 KiB |
Binary file not shown.
After Width: | Height: | Size: 217 KiB |
Binary file not shown.
After Width: | Height: | Size: 161 KiB |
|
@ -25,6 +25,7 @@ return [
|
|||
'import' => __( 'Import', 'tainacan' ),
|
||||
'export' => __( 'Export', 'tainacan' ),
|
||||
'cancel' => __( 'Cancel', 'tainacan' ),
|
||||
'remove' => __( 'Remove', 'tainacan' ),
|
||||
'save' => __( 'Save', 'tainacan' ),
|
||||
'next' => __( 'Next', 'tainacan' ),
|
||||
'see' => __( 'See', 'tainacan' ),
|
||||
|
@ -89,6 +90,7 @@ return [
|
|||
'label_image' => __( 'Image', 'tainacan' ),
|
||||
'label_thumbnail' => __( 'Thumbnail', 'tainacan' ),
|
||||
'label_empty_thumbnail' => __( 'Empty Thumbnail', 'tainacan' ),
|
||||
'label_moderators' => __( 'Moderators', 'tainacan' ),
|
||||
'label_button_view' => __( 'Button View', 'tainacan' ),
|
||||
'label_button_edit' => __( 'Button Edit', 'tainacan' ),
|
||||
'label_button_delete' => __( 'Button Delete', 'tainacan' ),
|
||||
|
@ -167,7 +169,10 @@ return [
|
|||
'info_no_collection_created' => __( 'No collection was created in this repository.', 'tainacan' ),
|
||||
'info_no_category_created' => __( 'No category 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' ),
|
||||
'info_no_user_found' => __( 'No user was found with this name.', 'tainacan' ),
|
||||
'info_no_item_found' => __( 'No item was found here with these filters.', 'tainacan' ),
|
||||
'info_no_moderator_on_collection' => __( "This collection doesn't have any moderator yet.", 'tainacan' ),
|
||||
'info_error_deleting_collection' => __( 'Error on deleting collection.', 'tainacan' ),
|
||||
'info_error_deleting_category' => __( 'Error on deleting category', 'tainacan' ),
|
||||
'info_collection_deleted' => __( 'Collection deleted.', 'tainacan' ),
|
||||
|
|
|
@ -242,4 +242,18 @@ export const fetchPage = ({ commit }, pageId ) => {
|
|||
reject( error );
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
// Users for moderators configuration
|
||||
export const fetchUsers = ({ commit }, search ) => {
|
||||
return new Promise((resolve, reject) => {
|
||||
axios.wp.get('/users?search=' + search)
|
||||
.then(res => {
|
||||
let users = res.data;
|
||||
resolve( users );
|
||||
})
|
||||
.catch(error => {
|
||||
reject( error );
|
||||
});
|
||||
});
|
||||
};
|
Loading…
Reference in New Issue