New layout for sequence edit next buttons.

This commit is contained in:
Mateus Machado Luna 2019-08-02 11:46:56 -03:00
parent a889e68317
commit b7f9c6ba9d
2 changed files with 66 additions and 13 deletions

View File

@ -579,19 +579,41 @@
type="button" type="button"
class="button is-outlined">{{ $i18n.get('label_delete_permanently') }}</button> class="button is-outlined">{{ $i18n.get('label_delete_permanently') }}</button>
<button <button
v-if="isOnSequenceEdit && (group != null && group.items_count != undefined && group.items_count > itemPosition)"
@click="onNextInSequence();"
type="button"
class="button is-outlined">
<span>{{ $i18n.get('label_keep_on_trash' ) }}</span>
<span class="icon is-large">
<i class="tainacan-icon tainacan-icon-20px tainacan-icon-next"/>
</span>
</button>
<button
v-if="!isOnSequenceEdit || (group != null && group.items_count != undefined && group.items_count < itemPosition)"
@click="onSubmit('draft')" @click="onSubmit('draft')"
type="button" type="button"
class="button is-secondary">{{ $i18n.get('label_save_as_draft') }}</button> class="button is-secondary">{{ $i18n.get('label_save_as_draft') }}</button>
<button <button
v-else
@click="onSubmit('draft', 'next')"
type="button"
class="button is-secondary">
<span>{{ $i18n.get('label_save_as_draft') }}</span>
<span class="icon is-large">
<i class="tainacan-icon tainacan-icon-20px tainacan-icon-next"/>
</span>
</button>
<button
v-if="!isOnSequenceEdit || (group != null && group.items_count != undefined && group.items_count < itemPosition)"
@click="onSubmit(visibility)" @click="onSubmit(visibility)"
type="button" type="button"
class="button is-success">{{ $i18n.get('label_publish') }}</button> class="button is-success">{{ $i18n.get('label_publish') }}</button>
<button <button
v-if="isOnSequenceEdit && (group != null && group.items_count != undefined && group.items_count > itemPosition)" v-else
@click="onNextInSequence()" @click="onSubmit(visibility, 'next')"
type="button" type="button"
class="button sequence-button"> class="button is-success">
<span>{{ $i18n.get('next') }}</span> <span>{{ $i18n.get('label_publish') }}</span>
<span class="icon is-large"> <span class="icon is-large">
<i class="tainacan-icon tainacan-icon-20px tainacan-icon-next"/> <i class="tainacan-icon tainacan-icon-20px tainacan-icon-next"/>
</span> </span>
@ -631,19 +653,31 @@
type="button" type="button"
class="button is-outlined">{{ $i18n.get('label_discard') }}</button> class="button is-outlined">{{ $i18n.get('label_discard') }}</button>
<button <button
v-if="!isOnSequenceEdit || (group != null && group.items_count != undefined && group.items_count == itemPosition)"
@click="onSubmit('draft')" @click="onSubmit('draft')"
type="button" type="button"
class="button is-secondary">{{ form.status == 'draft' ? $i18n.get('label_update') : $i18n.get('label_save_as_draft') }}</button> class="button is-secondary">{{ form.status == 'draft' ? $i18n.get('label_update') : $i18n.get('label_save_as_draft') }}</button>
<button <button
v-else
@click="onSubmit('draft'); onNextInSequence();"
type="button"
class="button is-secondary">
<span>{{ $i18n.get('label_update_draft') }}</span>
<span class="icon is-large">
<i class="tainacan-icon tainacan-icon-20px tainacan-icon-next"/>
</span>
</button>
<button
v-if="!isOnSequenceEdit || (group != null && group.items_count != undefined && group.items_count == itemPosition)"
@click="onSubmit(visibility)" @click="onSubmit(visibility)"
type="button" type="button"
class="button is-success">{{ $i18n.get('label_publish') }}</button> class="button is-success">{{ $i18n.get('label_publish') }}</button>
<button <button
v-if="isOnSequenceEdit && (group != null && group.items_count != undefined && group.items_count > itemPosition)" v-else
@click="onNextInSequence()" @click="onSubmit(visibility, 'next')"
type="button" type="button"
class="button sequence-button"> class="button is-success">
<span>{{ $i18n.get('next') }}</span> <span>{{ $i18n.get('label_publish') }}</span>
<span class="icon is-large"> <span class="icon is-large">
<i class="tainacan-icon tainacan-icon-20px tainacan-icon-next"/> <i class="tainacan-icon tainacan-icon-20px tainacan-icon-next"/>
</span> </span>
@ -677,20 +711,33 @@
type="button" type="button"
class="button is-outlined">{{ $i18n.get('label_send_to_trash') }}</button> class="button is-outlined">{{ $i18n.get('label_send_to_trash') }}</button>
<button <button
v-if="!isOnSequenceEdit || (group != null && group.items_count != undefined && group.items_count == itemPosition)"
@click="onSubmit('draft')" @click="onSubmit('draft')"
type="button" type="button"
class="button is-secondary">{{ $i18n.get('label_return_to_draft') }}</button> class="button is-secondary">{{ $i18n.get('label_return_to_draft') }}</button>
<button <button
v-else
@click="onSubmit('draft', 'next')"
type="button"
class="button is-secondary">
<span>{{ $i18n.get('label_save_as_draft') }}</span>
<span class="icon is-large">
<i class="tainacan-icon tainacan-icon-20px tainacan-icon-next"/>
</span>
</button>
<button
v-if="!isOnSequenceEdit || (group != null && group.items_count != undefined && group.items_count == itemPosition)"
:disabled="formErrorMessage != undefined && formErrorMessage != ''" :disabled="formErrorMessage != undefined && formErrorMessage != ''"
@click="onSubmit(visibility)" @click="onSubmit(visibility)"
type="button" type="button"
class="button is-success">{{ $i18n.get('label_update') }}</button> class="button is-success">{{ $i18n.get('label_update') }}</button>
<button <button
v-if="isOnSequenceEdit && (group != null && group.items_count != undefined && group.items_count > itemPosition)" v-else
@click="onNextInSequence()" :disabled="formErrorMessage != undefined && formErrorMessage != ''"
@click="onSubmit(visibility, 'next')"
type="button" type="button"
class="button sequence-button"> class="button is-success">
<span>{{ $i18n.get('next') }}</span> <span>{{ $i18n.get('label_update') }}</span>
<span class="icon is-large"> <span class="icon is-large">
<i class="tainacan-icon tainacan-icon-20px tainacan-icon-next"/> <i class="tainacan-icon tainacan-icon-20px tainacan-icon-next"/>
</span> </span>
@ -847,7 +894,7 @@ export default {
'getItemIdInSequence', 'getItemIdInSequence',
'getGroup' 'getGroup'
]), ]),
onSubmit(status) { onSubmit(status, sequenceDirection) {
// Puts loading on Item edition // Puts loading on Item edition
this.isLoading = true; this.isLoading = true;
this.sequenceRightDirection = undefined; this.sequenceRightDirection = undefined;
@ -880,6 +927,11 @@ export default {
this.$router.push(this.$routerHelper.getItemPath(this.form.collectionId, this.itemId)); this.$router.push(this.$routerHelper.getItemPath(this.form.collectionId, this.itemId));
} else } else
this.$router.push(this.$routerHelper.getCollectionPath(this.form.collectionId)); this.$router.push(this.$routerHelper.getCollectionPath(this.form.collectionId));
} else {
if (sequenceDirection == 'next')
this.onNextInSequence();
else if (sequenceDirection == 'previous')
this.onPrevInSequence();
} }
}) })
.catch((errors) => { .catch((errors) => {

View File

@ -249,6 +249,7 @@ return apply_filters( 'tainacan-admin-i18n', [
'label_edit_selected_collections' => __( 'Edit selected collections', 'tainacan' ), 'label_edit_selected_collections' => __( 'Edit selected collections', 'tainacan' ),
'label_delete_permanently' => __( 'Delete permanently', 'tainacan' ), 'label_delete_permanently' => __( 'Delete permanently', 'tainacan' ),
'label_send_to_trash' => __( 'Send to trash', 'tainacan' ), 'label_send_to_trash' => __( 'Send to trash', 'tainacan' ),
'label_keep_on_trash' => __( 'Keep on trash', 'tainacan' ),
'label_delete_selected_taxonomies' => __( 'Delete selected taxonomies', 'tainacan' ), 'label_delete_selected_taxonomies' => __( 'Delete selected taxonomies', 'tainacan' ),
'label_bulk_edit_selected_items' => __( 'Bulk edit selected items', 'tainacan' ), 'label_bulk_edit_selected_items' => __( 'Bulk edit selected items', 'tainacan' ),
'label_sequence_edit_selected_items' => __( 'Edit selected items in sequence', 'tainacan' ), 'label_sequence_edit_selected_items' => __( 'Edit selected items in sequence', 'tainacan' ),