Merge remote-tracking branch 'origin/develop' into develop

This commit is contained in:
fabs balvedi 2019-03-20 15:42:56 -03:00
commit 380a0e0d91
4 changed files with 10 additions and 5 deletions

View File

@ -1067,9 +1067,13 @@ export default {
// Initializes Media Frames now that itemId exists
this.initializeMediaFrames();
this.fetchItem(this.itemId).then(res => {
this.fetchItem({ itemId: this.itemId, contextEdit: true }).then(res => {
this.item = res;
// Checks if user has permission to edit
if (!this.item.current_user_can_edit)
this.$router.push(this.$routerHelper.getCollectionPath(this.collectionId));
// Updates Collection BreadCrumb
if (this.isOnSequenceEdit) {
this.$root.$emit('onCollectionBreadCrumbUpdate', [

View File

@ -336,6 +336,7 @@
<div class="footer">
<div class="form-submission-footer">
<router-link
v-if="item.current_user_can_edit"
class="button is-secondary"
:to="{ path: $routerHelper.getItemEditPath(collectionId, itemId)}">
{{ $i18n.getFrom('items','edit_item') }}
@ -464,7 +465,7 @@
});
// Obtains Item
this.fetchItem(this.itemId).then((item) => {
this.fetchItem({ itemId: this.itemId, contextEdit: true }).then((item) => {
this.$root.$emit('onCollectionBreadCrumbUpdate', [
{path: this.$routerHelper.getCollectionPath(this.collectionId), label: this.$i18n.get('items')},
{path: '', label: item.title}

View File

@ -62,10 +62,10 @@ export const setLastUpdated = ({ commit}, value) => {
};
// Actions directly related to Item
export const fetchItem = ({ commit }, item_id) => {
export const fetchItem = ({ commit }, { itemId, contextEdit } ) => {
commit('cleanItem')
return new Promise((resolve, reject) => {
axios.tainacan.get('/items/'+item_id)
axios.tainacan.get('/items/'+ itemId + (contextEdit ? '?context=edit' : ''))
.then(res => {
let item = res.data;
commit('setItem', item);

View File

@ -559,7 +559,7 @@ export default {
this.$nextTick(() => this.isLoadingItem = false);
} else {
// Loads current item
this.fetchItem(this.slideItems[this.slideIndex].id)
this.fetchItem({ itemId: this.slideItems[this.slideIndex].id, contextEdit: true })
.then(() => {
this.isLoadingItem = false;
})