Brings metadata and filter sorting back. #274,

This commit is contained in:
Mateus Machado Luna 2019-12-12 14:17:58 -03:00
parent 74f89c724b
commit 0042acef6c
7 changed files with 25 additions and 18 deletions

View File

@ -42,7 +42,7 @@
:class="{'filters-area-receive': isDraggingFromAvailable}"
v-model="activeFilterList"
:group="{ name:'filters', pull: false, put: true }"
:sort="(openedFilterId == '' || openedFilterId == undefined) && !isRepositoryLevel && collection && collection.current_user_can_edit"
:sort="(openedFilterId == '' || openedFilterId == undefined) && !isRepositoryLevel"
:handle="'.handle'"
ghost-class="sortable-ghost"
filter="not-sortable-item"
@ -50,7 +50,7 @@
<div
class="active-filter-item"
:class="{
'not-sortable-item': (isSelectingFilterType || filter.id == undefined || openedFilterId != '' || choosenMetadatum.name == filter.name || isUpdatingFiltersOrder == true || (collection && !collection.current_user_can_edit)),
'not-sortable-item': (isSelectingFilterType || filter.id == undefined || openedFilterId != '' || choosenMetadatum.name == filter.name || isUpdatingFiltersOrder == true),
'not-focusable-item': openedFilterId == filter.id,
'disabled-filter': filter.enabled == false,
'inherited-filter': filter.collection_id != collectionId || isRepositoryLevel
@ -61,7 +61,7 @@
<span
v-if="!(isSelectingFilterType || filter.id == undefined || openedFilterId != '' || choosenMetadatum.name == filter.name || isUpdatingFiltersOrder == true || isRepositoryLevel)"
v-tooltip="{
content: (isSelectingFilterType || filter.id == undefined || openedFilterId != '' || choosenMetadatum.name == filter.name || isUpdatingFiltersOrder == true || (collection && !collection.current_user_can_edit)) ? $i18n.get('info_not_allowed_change_order_filters') : $i18n.get('instruction_drag_and_drop_filter_sort'),
content: (isSelectingFilterType || filter.id == undefined || openedFilterId != '' || choosenMetadatum.name == filter.name || isUpdatingFiltersOrder == true) ? $i18n.get('info_not_allowed_change_order_filters') : $i18n.get('instruction_drag_and_drop_filter_sort'),
autoHide: true,
classes: ['tooltip', isRepositoryLevel ? 'repository-tooltip' : ''],
placement: 'auto-start'

View File

@ -46,7 +46,7 @@
@change="handleChange"
:class="{'metadata-area-receive': isDraggingFromAvailable}"
:group="{ name:'metadata', pull: false, put: true }"
:sort="(openedMetadatumId == '' || openedMetadatumId == undefined) && !isRepositoryLevel && collection && collection.current_user_can_edit"
:sort="(openedMetadatumId == '' || openedMetadatumId == undefined) && !isRepositoryLevel"
:handle="'.handle'"
ghost-class="sortable-ghost"
chosen-class="sortable-chosen"
@ -55,7 +55,7 @@
<div
class="active-metadatum-item"
:class="{
'not-sortable-item': isRepositoryLevel || metadatum.id == undefined || openedMetadatumId != '' || isUpdatingMetadataOrder || (collection && !collection.current_user_can_edit),
'not-sortable-item': isRepositoryLevel || metadatum.id == undefined || openedMetadatumId != '' || isUpdatingMetadataOrder,
'not-focusable-item': openedMetadatumId == metadatum.id,
'disabled-metadatum': metadatum.enabled == false,
'inherited-metadatum': (metadatum.collection_id != collectionId && metadatum.parent == 0) || isRepositoryLevel
@ -66,7 +66,7 @@
<span
v-if="!(isRepositoryLevel || metadatum.id == undefined || openedMetadatumId != '' || isUpdatingMetadataOrder)"
v-tooltip="{
content: isRepositoryLevel || metadatum.id == undefined || openedMetadatumId != '' || isUpdatingMetadataOrder || (collection && !collection.current_user_can_edit) ? $i18n.get('info_not_allowed_change_order_metadata') : $i18n.get('instruction_drag_and_drop_metadatum_sort'),
content: isRepositoryLevel || metadatum.id == undefined || openedMetadatumId != '' || isUpdatingMetadataOrder ? $i18n.get('info_not_allowed_change_order_metadata') : $i18n.get('instruction_drag_and_drop_metadatum_sort'),
autoHide: true,
classes: ['tooltip', isRepositoryLevel ? 'repository-tooltip' : ''],
placement: 'auto-start'

View File

@ -13,7 +13,7 @@
<transition name="appear-from-right">
<div
v-if="showNotice"
class="notice notice-success">
class="notice notice-success notice-alt">
<p>{{ $i18n.get('User Role Saved') }}</p>
</div>
</transition>
@ -183,7 +183,8 @@
</div>
</div>
</template>
<p><span class="dashicons dashicons-info" />&nbsp; {{ $i18n.get('Some capabilities, such as "Manage Tainacan" and any related to All Collections shall affect other Collections capabilities.') }}</p>
<p><span class="dashicons dashicons-info" />&nbsp; {{ $i18n.get('The capability "Manage Tainacan" may affect other capabilities related to repository and collections.') }}</p>
<p><span class="dashicons dashicons-info" />&nbsp; {{ $i18n.get('Capabilities related to All Collections shall affect other Collections capabilities.') }}</p>
</div> <!-- End of Collections Tab -->
</div> <!-- End of Tabs-->
@ -419,6 +420,14 @@
justify-content: space-between;
align-content: center;
margin: 2rem 0 1rem 0;
p {
margin: 0;
padding: 0;
}
.button {
padding: 2px 16px;
}
}
.name-edition-box label {
margin-right: 2rem;

View File

@ -694,8 +694,8 @@ return apply_filters( 'tainacan-admin-i18n', [
'info_can_not_read_activities' => __( 'You are not allowed to read activities.', 'tainacan' ),
'info_can_not_edit_item' => __( 'You are not allowed to edit this item.', 'tainacan' ),
'info_can_not_bulk_edit_items_collection' => __( 'You are not allowed to bulk edit items from this collection.', 'tainacan' ),
'info_not_allowed_change_order_metadata' => __( 'You are not allowed to change metadata order since you can\'t edit the collection.', 'tainacan' ),
'info_not_allowed_change_order_filters' => __( 'You are not allowed to change filters order since you can\'t edit the collection.', 'tainacan' ),
'info_not_allowed_change_order_metadata' => __( 'Can not change metadata order now.', 'tainacan' ),
'info_not_allowed_change_order_filters' => __( 'Can not change filters order now.', 'tainacan' ),
// Datepicker months
'datepicker_month_january' => __( 'January', 'tainacan' ),

View File

@ -258,10 +258,8 @@ export const updateCollection = ({ commit }, {
collection
}) => {
return new Promise((resolve, reject) => {
axios.tainacan.patch('/collections/' + collection_id, collection).then( res => {
axios.tainacan.patch('/collections/' + collection_id + '?context=edit', collection).then( res => {
commit('setCollection', collection);
commit('setCollectionName', res.data.name);
commit('setCollectionURL', res.data.url);
resolve( res.data );
}).catch( error => {
reject({ error_message: error['response']['data'].error_message, errors: error['response']['data'].errors });
@ -274,7 +272,7 @@ export const sendCollection = ( { commit }, collection) => {
return new Promise(( resolve, reject ) => {
let param = collection;
param[tainacan_plugin.exposer_mapper_param] = collection.mapper;
axios.tainacan.post('/collections/', param)
axios.tainacan.post('/collections/?context=edit', param)
.then( res => {
let collection = res.data;
commit('setCollection', collection);
@ -328,7 +326,7 @@ export const fetchAttachments = ({ commit }, collection_id) => {
export const updateThumbnail = ({ commit }, { collectionId, thumbnailId }) => {
return new Promise((resolve, reject) => {
axios.tainacan.patch('/collections/' + collectionId, {
axios.tainacan.patch('/collections/' + collectionId + '?context=edit', {
_thumbnail_id: thumbnailId
}).then( res => {
let collection = res.data
@ -343,7 +341,7 @@ export const updateThumbnail = ({ commit }, { collectionId, thumbnailId }) => {
export const updateHeaderImage = ({ commit }, { collectionId, headerImageId }) => {
return new Promise((resolve, reject) => {
axios.tainacan.patch('/collections/' + collectionId, {
axios.tainacan.patch('/collections/' + collectionId + '?context=edit', {
header_image_id: headerImageId + ''
}).then( res => {
let collection = res.data

View File

@ -128,7 +128,7 @@ export const addTemporaryFilter = ({ commit }, filter ) => {
export const updateCollectionFiltersOrder = ({ commit }, { collectionId, filtersOrder }) => {
return new Promise((resolve, reject) => {
axios.tainacan.patch('/collections/' + collectionId, {
axios.tainacan.patch('/collections/' + collectionId + '/filters_order?context=edit', {
filters_order: filtersOrder
}).then( res => {
commit('collection/setCollection', res.data, { root: true });

View File

@ -136,7 +136,7 @@ export const cleanMetadata = ({commit}) => {
export const updateCollectionMetadataOrder = ({ commit }, {collectionId, metadataOrder}) => {
return new Promise((resolve, reject) => {
axios.tainacan.patch('/collections/' + collectionId, {
axios.tainacan.patch('/collections/' + collectionId + '/metadata_order?context=edit', {
metadata_order: metadataOrder
}).then(res => {
commit('collection/setCollection', res.data, { root: true });