Adds button 'Create another item' to item page when comming from a recently created item. Ref. #237.

This commit is contained in:
Mateus Machado Luna 2019-05-30 15:25:47 -03:00
parent 84d785c03a
commit a3f8ddcb97
3 changed files with 14 additions and 3 deletions

View File

@ -845,9 +845,12 @@ export default {
this.isLoading = false; this.isLoading = false;
if (!this.isOnSequenceEdit) { if (!this.isOnSequenceEdit) {
if (this.form.status != 'trash') if (this.form.status != 'trash') {
this.$router.push(this.$routerHelper.getItemPath(this.form.collectionId, this.itemId)); if (previousStatus == 'auto-draft')
this.$router.push({ path: this.$routerHelper.getItemPath(this.form.collectionId, this.itemId), query: { recent: true } });
else else
this.$router.push(this.$routerHelper.getItemPath(this.form.collectionId, this.itemId));
} else
this.$router.push(this.$routerHelper.getCollectionPath(this.form.collectionId)); this.$router.push(this.$routerHelper.getCollectionPath(this.form.collectionId));
} }
}) })

View File

@ -339,6 +339,13 @@
</div> </div>
<div class="footer"> <div class="footer">
<div class="form-submission-footer"> <div class="form-submission-footer">
<router-link
v-if="item.current_user_can_edit && $route.query.recent == true"
class="button is-secondary"
style="margin-right: auto;"
:to="{ path: $routerHelper.getNewItemPath(collectionId)}">
{{ $i18n.get('label_create_another_item') }}
</router-link>
<router-link <router-link
v-if="item.current_user_can_edit" v-if="item.current_user_can_edit"
class="button is-secondary" class="button is-secondary"

View File

@ -409,6 +409,7 @@ return apply_filters( 'tainacan-admin-i18n', [
'label_comparator' => __( 'Comparator', 'tainacan' ), 'label_comparator' => __( 'Comparator', 'tainacan' ),
'label_table_of_items' => __( 'Table of Items', 'tainacan' ), 'label_table_of_items' => __( 'Table of Items', 'tainacan' ),
'label_duplicate_item' => __( 'Duplicate item', 'tainacan' ), 'label_duplicate_item' => __( 'Duplicate item', 'tainacan' ),
'label_create_another_item' => __( 'Create another item', 'tainacan' ),
// Instructions. More complex sentences to guide user and placeholders // Instructions. More complex sentences to guide user and placeholders
'instruction_delete_selected_collections' => __( 'Delete selected collections', 'tainacan' ), 'instruction_delete_selected_collections' => __( 'Delete selected collections', 'tainacan' ),