Merge branch 'develop' into feature/bulk-edit-items
This commit is contained in:
commit
dc6e1028c3
|
@ -45,7 +45,7 @@
|
|||
</div>
|
||||
</b-field>
|
||||
|
||||
|
||||
<!-- Name -------------- -->
|
||||
<b-field
|
||||
:addons="false"
|
||||
:type="((formErrors.name !== '' || formErrors.repeated !== '') && (formErrors.name !== undefined || formErrors.repeated !== undefined )) ? 'is-danger' : ''"
|
||||
|
@ -63,6 +63,7 @@
|
|||
@focus="clearErrors({ name: 'name', repeated: 'repeated' })"/>
|
||||
</b-field>
|
||||
|
||||
<!-- Description -------------- -->
|
||||
<b-field
|
||||
:addons="false"
|
||||
:type="formErrors['description'] !== '' && formErrors['description'] !== undefined ? 'is-danger' : ''"
|
||||
|
@ -80,7 +81,48 @@
|
|||
@focus="clearErrors('description')"/>
|
||||
</b-field>
|
||||
|
||||
<!-- Parent -------------- -->
|
||||
<b-field
|
||||
:addons="false"
|
||||
:type="((formErrors.parent !== '' || formErrors.repeated !== '') && (formErrors.parent !== undefined || formErrors.repeated !== undefined )) ? 'is-danger' : ''"
|
||||
:message="formErrors.parent ? formErrors : formErrors.repeated">
|
||||
<label class="label is-inline">
|
||||
{{ $i18n.get('label_parent_term') }}
|
||||
<b-switch
|
||||
@input="showCheckboxesWarning = true; clearErrors('parent');"
|
||||
id="tainacan-checkbox-has-parent"
|
||||
size="is-small"
|
||||
v-model="hasParent" />
|
||||
<help-button
|
||||
:title="$i18n.get('label_parent_term')"
|
||||
:message="$i18n.get('info_help_parent_term')"/>
|
||||
</label>
|
||||
<b-autocomplete
|
||||
id="tainacan-text-cover-page"
|
||||
:placeholder="$i18n.get('instruction_parent_term')"
|
||||
:data="parentTerms"
|
||||
field="name"
|
||||
v-model="parentTermName"
|
||||
@select="onSelectParentTerm($event)"
|
||||
:loading="isFetchingParentTerms"
|
||||
@input="fecthParentTerms($event)"
|
||||
@focus="clearErrors('parent');"
|
||||
:disabled="!hasParent">
|
||||
<template slot-scope="props">
|
||||
{{ props.option.name }}
|
||||
</template>
|
||||
<template slot="empty">{{ $i18n.get('info_no_parent_term_found') }}</template>
|
||||
</b-autocomplete>
|
||||
<transition name="fade">
|
||||
<p
|
||||
class="checkboxes-warning"
|
||||
v-show="showCheckboxesWarning == true">
|
||||
{{ $i18n.get('info_warning_changing_parent_term') }}
|
||||
</p>
|
||||
</transition>
|
||||
</b-field>
|
||||
|
||||
<!-- Submit buttons -------------- -->
|
||||
<div class="field is-grouped form-submit">
|
||||
<div class="control">
|
||||
<button
|
||||
|
@ -121,7 +163,14 @@
|
|||
return {
|
||||
formErrors: {},
|
||||
headerPlaceholderPath: tainacan_plugin.base_url + '/admin/images/placeholder_rectangle.png',
|
||||
headerImageMediaFrame: undefined
|
||||
headerImageMediaFrame: undefined,
|
||||
isFetchingParentTerms: false,
|
||||
parentTerms: [],
|
||||
parentTermName: '',
|
||||
showCheckboxesWarning: false,
|
||||
hasParent: false,
|
||||
hasChangedParent: false,
|
||||
initialParentId: undefined
|
||||
}
|
||||
},
|
||||
props: {
|
||||
|
@ -132,6 +181,8 @@
|
|||
...mapActions('taxonomy', [
|
||||
'sendChildTerm',
|
||||
'updateChildTerm',
|
||||
'fetchParentName',
|
||||
'fetchPossibleParentTerms'
|
||||
]),
|
||||
...mapGetters('taxonomy', [
|
||||
'getTerms'
|
||||
|
@ -143,11 +194,11 @@
|
|||
taxonomyId: this.taxonomyId,
|
||||
name: this.editForm.name,
|
||||
description: this.editForm.description,
|
||||
parent: this.editForm.parent,
|
||||
parent: this.hasParent ? this.editForm.parent : 0,
|
||||
headerImageId: this.editForm.header_image_id,
|
||||
})
|
||||
.then((term) => {
|
||||
this.$emit('onEditionFinished', term);
|
||||
this.$emit('onEditionFinished', {term: term, hasChangedParent: this.hasChangedParent });
|
||||
this.editForm = {};
|
||||
this.formErrors = {};
|
||||
})
|
||||
|
@ -161,17 +212,18 @@
|
|||
});
|
||||
|
||||
} else {
|
||||
|
||||
this.updateChildTerm({
|
||||
taxonomyId: this.taxonomyId,
|
||||
termId: this.editForm.id,
|
||||
name: this.editForm.name,
|
||||
description: this.editForm.description,
|
||||
parent: this.editForm.parent,
|
||||
parent: this.hasParent ? this.editForm.parent : 0,
|
||||
headerImageId: this.editForm.header_image_id,
|
||||
})
|
||||
.then(() => {
|
||||
.then((term) => {
|
||||
this.formErrors = {};
|
||||
this.$emit('onEditionFinished', this.editForm);
|
||||
this.$emit('onEditionFinished', { term: term, hasChangedParent: this.hasChangedParent });
|
||||
})
|
||||
.catch((errors) => {
|
||||
for (let error of errors.errors) {
|
||||
|
@ -223,9 +275,52 @@
|
|||
this.formErrors[attributes] = undefined;
|
||||
}
|
||||
},
|
||||
fecthParentTerms(search) {
|
||||
this.isFetchingParentTerms = true;
|
||||
|
||||
this.fetchPossibleParentTerms({
|
||||
taxonomyId: this.taxonomyId,
|
||||
termId: this.editForm.id,
|
||||
search: search })
|
||||
.then((parentTerms) => {
|
||||
this.parentTerms = parentTerms;
|
||||
this.isFetchingParentTerms = false;
|
||||
})
|
||||
.catch((error) => {
|
||||
this.$console.error(error);
|
||||
this.isFetchingParentTerms = false;
|
||||
});
|
||||
},
|
||||
onSelectParentTerm(selectedParentTerm) {
|
||||
this.hasChangedParent = this.initialParentId != selectedParentTerm.id;
|
||||
this.editForm.parent = selectedParentTerm.id;
|
||||
this.selectedParentTerm = selectedParentTerm;
|
||||
this.parentTermName = selectedParentTerm.name;
|
||||
this.showCheckboxesWarning = true;
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
|
||||
this.showCheckboxesWarning = false;
|
||||
this.hasParent = this.editForm.parent != undefined && this.editForm.parent > 0;
|
||||
this.initialParentId = this.editForm.parent;
|
||||
this.initializeMediaFrames();
|
||||
|
||||
if (this.hasParent) {
|
||||
this.isFetchingParentTerms = true;
|
||||
this.showCheckboxesWarning = false;
|
||||
this.fetchParentName({ taxonomyId: this.taxonomyId, parentId: this.editForm.parent })
|
||||
.then((parentName) => {
|
||||
this.parentTermName = parentName;
|
||||
this.isFetchingParentTerms = false;
|
||||
this.showCheckboxesWarning = false;
|
||||
})
|
||||
.catch((error) => {
|
||||
this.$console.error(error);
|
||||
this.isFetchingParentTerms = false;
|
||||
this.showCheckboxesWarning = false;
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
@ -321,6 +416,11 @@
|
|||
position: relative;
|
||||
}
|
||||
}
|
||||
.checkboxes-warning {
|
||||
color: $gray5;
|
||||
font-style: italic;
|
||||
padding: 0.2rem 0.75rem;
|
||||
}
|
||||
}
|
||||
|
||||
</style>
|
||||
|
|
|
@ -88,7 +88,7 @@
|
|||
<!-- Thumbnail -->
|
||||
<td
|
||||
class="thumbnail-cell column-default-width"
|
||||
@click="goToCollectionPage(collection.id)"
|
||||
@click="onClickCollection($event, collection.id, index)"
|
||||
:label="$i18n.get('label_thumbnail')"
|
||||
:aria-label="$i18n.get('label_thumbnail')">
|
||||
<span>
|
||||
|
@ -100,7 +100,7 @@
|
|||
<!-- Name -->
|
||||
<td
|
||||
class="column-default-width column-main-content"
|
||||
@click="goToCollectionPage(collection.id)"
|
||||
@click="onClickCollection($event, collection.id, index)"
|
||||
:label="$i18n.get('label_name')"
|
||||
:aria-label="$i18n.get('label_name') + ': ' + collection.name">
|
||||
<p
|
||||
|
@ -114,7 +114,7 @@
|
|||
<!-- Description -->
|
||||
<td
|
||||
class="column-large-width"
|
||||
@click="goToCollectionPage(collection.id)"
|
||||
@click="onClickCollection($event, collection.id, index)"
|
||||
:label="$i18n.get('label_description')"
|
||||
:aria-label="$i18n.get('label_description') + ': ' + collection.description">
|
||||
<p
|
||||
|
@ -127,7 +127,7 @@
|
|||
</td>
|
||||
<!-- Creation Date -->
|
||||
<td
|
||||
@click="goToCollectionPage(collection.id)"
|
||||
@click="onClickCollection($event, collection.id, index)"
|
||||
class="table-creation column-default-width"
|
||||
:label="$i18n.get('label_creation_date')"
|
||||
:aria-label="$i18n.get('label_creation_date') + ': ' + collection.creation_date">
|
||||
|
@ -141,7 +141,7 @@
|
|||
</td>
|
||||
<!-- Created by -->
|
||||
<td
|
||||
@click="goToCollectionPage(collection.id)"
|
||||
@click="onClickCollection($event, collection.id, index)"
|
||||
class="table-creation column-default-width"
|
||||
:label="$i18n.get('label_created_by')"
|
||||
:aria-label="$i18n.get('label_created_by') + ': ' + collection.author_name">
|
||||
|
@ -155,7 +155,7 @@
|
|||
</td>
|
||||
<!-- Total items -->
|
||||
<td
|
||||
@click="goToCollectionPage(collection.id)"
|
||||
@click="onClickCollection($event, collection.id, index)"
|
||||
class="column-small-width column-align-right"
|
||||
:label="$i18n.get('label_total_items')"
|
||||
v-if="collection.total_items != undefined"
|
||||
|
@ -170,7 +170,7 @@
|
|||
</td>
|
||||
<!-- Actions -->
|
||||
<td
|
||||
@click="goToCollectionPage(collection.id)"
|
||||
@click="onClickCollection($event, collection.id, index)"
|
||||
class="actions-cell column-default-width"
|
||||
:label="$i18n.get('label_actions')">
|
||||
<div class="actions-container">
|
||||
|
@ -325,8 +325,12 @@ export default {
|
|||
}
|
||||
});
|
||||
},
|
||||
goToCollectionPage(collectionId) {
|
||||
this.$router.push(this.$routerHelper.getCollectionPath(collectionId));
|
||||
onClickCollection($event, collectionId, index) {
|
||||
if ($event.ctrlKey) {
|
||||
this.$set(this.selectedCollections, index, !this.selectedCollections[index]);
|
||||
} else {
|
||||
this.$router.push(this.$routerHelper.getCollectionPath(collectionId));
|
||||
}
|
||||
},
|
||||
goToCollectionEditPage(collectionId) {
|
||||
this.$router.push(this.$routerHelper.getCollectionEditPath(collectionId));
|
||||
|
|
|
@ -74,14 +74,14 @@
|
|||
autoHide: false,
|
||||
placement: 'auto-start'
|
||||
}"
|
||||
@click="goToItemPage(item)">
|
||||
@click="onClickItem($event, item, index)">
|
||||
{{ item.title != undefined ? item.title : '' }}
|
||||
</p>
|
||||
</div>
|
||||
<!-- Thumbnail -->
|
||||
<a
|
||||
v-if="item.thumbnail != undefined"
|
||||
@click="goToItemPage(item)">
|
||||
@click="onClickItem($event, item, index)">
|
||||
<img :src="item['thumbnail'].tainacan_medium ? item['thumbnail'].tainacan_medium : (item['thumbnail'].medium ? item['thumbnail'].medium : thumbPlaceholderPath)">
|
||||
</a>
|
||||
|
||||
|
@ -140,14 +140,14 @@
|
|||
|
||||
<!-- Title -->
|
||||
<div
|
||||
@click="goToItemPage(item)"
|
||||
@click="onClickItem($event, item, index)"
|
||||
class="metadata-title">
|
||||
<p>{{ item.title != undefined ? item.title : '' }}</p>
|
||||
</div>
|
||||
|
||||
<!-- Thumbnail -->
|
||||
<div
|
||||
@click="goToItemPage(item)"
|
||||
<div
|
||||
@click="onClickItem($event, item, index)"
|
||||
v-if="item.thumbnail != undefined"
|
||||
class="thumbnail"
|
||||
:style="{ backgroundImage: 'url(' + (item['thumbnail'].tainacan_medium_full ? item['thumbnail'].tainacan_medium_full : (item['thumbnail'].medium_large ? item['thumbnail'].medium_large : thumbPlaceholderPath)) + ')' }">
|
||||
|
@ -207,7 +207,7 @@
|
|||
autoHide: false,
|
||||
placement: 'auto-start'
|
||||
}"
|
||||
@click="goToItemPage(item)">
|
||||
@click="onClickItem($event, item, index)">
|
||||
{{ item.title != undefined ? item.title : '' }}
|
||||
</p>
|
||||
</div>
|
||||
|
@ -237,7 +237,7 @@
|
|||
<!-- Remaining metadata -->
|
||||
<div
|
||||
class="media"
|
||||
@click="goToItemPage(item)">
|
||||
@click="onClickItem($event, item, index)">
|
||||
|
||||
<img
|
||||
v-if="item.thumbnail != undefined"
|
||||
|
@ -321,9 +321,9 @@
|
|||
v-for="(column, index) in tableMetadata"
|
||||
:key="index"
|
||||
v-if="collectionId != undefined && column.display && column.metadata_type_object != undefined && (column.metadata_type_object.related_mapped_prop == 'title')"
|
||||
@click="goToItemPage(item)"
|
||||
v-html="item.metadata != undefined ? renderMetadata(item.metadata, column) : ''" />
|
||||
<p
|
||||
@click="onClickItem($event, item, index)"
|
||||
v-html="item.metadata != undefined ? renderMetadata(item.metadata, column) : ''" />
|
||||
<p
|
||||
v-tooltip="{
|
||||
content: item.title != undefined ? item.title : '',
|
||||
html: true,
|
||||
|
@ -333,8 +333,8 @@
|
|||
v-for="(column, index) in tableMetadata"
|
||||
:key="index"
|
||||
v-if="collectionId == undefined && column.display && column.metadata_type_object != undefined && (column.metadata_type_object.related_mapped_prop == 'title')"
|
||||
@click="goToItemPage(item)"
|
||||
v-html="item.title != undefined ? item.title : ''" />
|
||||
@click="onClickItem($event, item, index)"
|
||||
v-html="item.title != undefined ? item.title : ''" />
|
||||
</div>
|
||||
<!-- Actions -->
|
||||
<div
|
||||
|
@ -362,19 +362,19 @@
|
|||
<!-- Remaining metadata -->
|
||||
<div
|
||||
class="media"
|
||||
@click="goToItemPage(item)">
|
||||
@click="onClickItem($event, item, index)">
|
||||
<div class="list-metadata media-body">
|
||||
<div class="thumbnail">
|
||||
<img
|
||||
<img
|
||||
v-if="item.thumbnail != undefined"
|
||||
:src="item['thumbnail'].tainacan_medium_full ? item['thumbnail'].tainacan_medium_full : (item['thumbnail'].medium_large ? item['thumbnail'].medium_large : thumbPlaceholderPath)">
|
||||
:src="item['thumbnail'].tainacan_medium_full ? item['thumbnail'].tainacan_medium_full : (item['thumbnail'].medium_large ? item['thumbnail'].medium_large : thumbPlaceholderPath)">
|
||||
</div>
|
||||
<span
|
||||
<span
|
||||
v-for="(column, index) in tableMetadata"
|
||||
:key="index"
|
||||
v-if="collectionId == undefined && column.display && column.metadata_type_object != undefined && (column.metadata_type_object.related_mapped_prop == 'description')">
|
||||
<h3 class="metadata-label">{{ $i18n.get('label_description') }}</h3>
|
||||
<p
|
||||
<p
|
||||
v-html="item.description != undefined ? item.description : ''"
|
||||
class="metadata-value"/>
|
||||
</span>
|
||||
|
@ -383,7 +383,7 @@
|
|||
:key="index"
|
||||
v-if="column.display && column.slug != 'thumbnail' && column.metadata_type_object != undefined && (column.metadata_type_object.related_mapped_prop != 'title')">
|
||||
<h3 class="metadata-label">{{ column.name }}</h3>
|
||||
<p
|
||||
<p
|
||||
v-html="item.metadata != undefined ? renderMetadata(item.metadata, column) : ''"
|
||||
class="metadata-value"/>
|
||||
</span>
|
||||
|
@ -445,8 +445,8 @@
|
|||
|
||||
<!-- Item Displayed Metadata -->
|
||||
<td
|
||||
:key="index"
|
||||
v-for="(column, index) in tableMetadata"
|
||||
:key="columnIndex"
|
||||
v-for="(column, columnIndex) in tableMetadata"
|
||||
v-if="column.display"
|
||||
:label="column.name"
|
||||
class="column-default-width"
|
||||
|
@ -463,7 +463,7 @@
|
|||
column.metadata_type_object.primitive_type == 'compound') : false,
|
||||
'column-large-width' : column.metadata_type_object != undefined ? (column.metadata_type_object.primitive_type == 'long_string' || column.metadata_type_object.related_mapped_prop == 'description') : false,
|
||||
}"
|
||||
@click="goToItemPage(item)">
|
||||
@click="onClickItem($event, item, index)">
|
||||
|
||||
<p
|
||||
v-tooltip="{
|
||||
|
@ -473,7 +473,7 @@
|
|||
placement: 'auto-start'
|
||||
}"
|
||||
v-if="collectionId == undefined &&
|
||||
column.metadata_type_object != undefined &&
|
||||
column.metadata_type_object != undefined &&
|
||||
column.metadata_type_object.related_mapped_prop == 'title'"
|
||||
v-html="item.title != undefined ? item.title : ''"/>
|
||||
<p
|
||||
|
@ -484,7 +484,7 @@
|
|||
placement: 'auto-start'
|
||||
}"
|
||||
v-if="collectionId == undefined &&
|
||||
column.metadata_type_object != undefined &&
|
||||
column.metadata_type_object != undefined &&
|
||||
column.metadata_type_object.related_mapped_prop == 'description'"
|
||||
v-html="item.description != undefined ? item.description : ''"/>
|
||||
<p
|
||||
|
@ -717,8 +717,12 @@ export default {
|
|||
}
|
||||
});
|
||||
},
|
||||
goToItemPage(item) {
|
||||
this.$router.push(this.$routerHelper.getItemPath(item.collection_id, item.id));
|
||||
onClickItem($event, item, index) {
|
||||
if ($event.ctrlKey) {
|
||||
this.$set(this.selectedItems, index, !this.selectedItems[index]);
|
||||
} else {
|
||||
this.$router.push(this.$routerHelper.getItemPath(item.collection_id, item.id));
|
||||
}
|
||||
},
|
||||
goToItemEditPage(item) {
|
||||
this.$router.push(this.$routerHelper.getItemEditPath(item.collection_id, item.id));
|
||||
|
|
|
@ -79,7 +79,6 @@
|
|||
:index="childIndex"
|
||||
:taxonomy-id="taxonomyId"
|
||||
:order="order"/>
|
||||
|
||||
</div>
|
||||
<a
|
||||
class="view-more-terms"
|
||||
|
@ -334,7 +333,7 @@ export default {
|
|||
}
|
||||
}
|
||||
}
|
||||
.controls.is-disabled a, .children-dropdown.is-disabled {
|
||||
.controls.is-disabled a, .children-dropdown i.is-disabled {
|
||||
color: $gray4 !important;
|
||||
cursor: not-allowed !important;
|
||||
user-select: none;
|
||||
|
@ -342,7 +341,7 @@ export default {
|
|||
|
||||
&.opened-term:first-child {
|
||||
cursor: default;
|
||||
background-color: $blue1;
|
||||
background-color: $gray1;
|
||||
|
||||
&:before {
|
||||
content: '';
|
||||
|
@ -353,7 +352,7 @@ export default {
|
|||
width: 0;
|
||||
height: 0;
|
||||
border-style: solid;
|
||||
border-color: transparent transparent transparent $blue1;
|
||||
border-color: transparent transparent transparent $gray1;
|
||||
border-left-width: 24px;
|
||||
border-top-width: 20px;
|
||||
border-bottom-width: 20px;
|
||||
|
|
|
@ -75,7 +75,7 @@
|
|||
<!-- Name -->
|
||||
<td
|
||||
class="column-default-width column-main-content"
|
||||
@click="goToTaxonomyEditPage(taxonomy.id)"
|
||||
@click="onClickTaxonomy($event, taxonomy.id, index)"
|
||||
:label="$i18n.get('label_name')"
|
||||
:aria-label="$i18n.get('label_name') + ': ' + taxonomy.name">
|
||||
<p
|
||||
|
@ -89,7 +89,7 @@
|
|||
<!-- Description -->
|
||||
<td
|
||||
class="column-large-width"
|
||||
@click="goToTaxonomyEditPage(taxonomy.id)"
|
||||
@click="onClickTaxonomy($event, taxonomy.id, index)"
|
||||
:label="$i18n.get('label_description')"
|
||||
:aria-label="$i18n.get('label_description') + ': ' + taxonomy.description">
|
||||
<p
|
||||
|
@ -102,14 +102,14 @@
|
|||
</td>
|
||||
<!-- Actions -->
|
||||
<td
|
||||
@click="goToTaxonomyEditPage(taxonomy.id)"
|
||||
@click="onClickTaxonomy($event, taxonomy.id, index)"
|
||||
class="actions-cell column-default-width"
|
||||
:label="$i18n.get('label_actions')">
|
||||
<div class="actions-container">
|
||||
<a
|
||||
id="button-edit"
|
||||
:aria-label="$i18n.getFrom('taxonomies','edit_item')"
|
||||
@click="goToTaxonomyEditPage(taxonomy.id)">
|
||||
@click="onClickTaxonomy($event, taxonomy.id, index)">
|
||||
<b-icon
|
||||
type="is-secondary"
|
||||
icon="pencil"/>
|
||||
|
@ -254,12 +254,13 @@
|
|||
}
|
||||
});
|
||||
},
|
||||
goToTaxonomyPage(taxonomyId) {
|
||||
this.$router.push(this.$routerHelper.getTaxonomyPath(taxonomyId));
|
||||
},
|
||||
goToTaxonomyEditPage(taxonomyId) {
|
||||
this.$router.push(this.$routerHelper.getTaxonomyEditPath(taxonomyId));
|
||||
}
|
||||
onClickTaxonomy($event, taxonomyId, index) {
|
||||
if ($event.ctrlKey) {
|
||||
this.$set(this.selected, index, !this.selected[index]);
|
||||
} else {
|
||||
this.$router.push(this.$routerHelper.getTaxonomyEditPath(taxonomyId));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
|
|
@ -358,7 +358,7 @@ export default {
|
|||
}
|
||||
this.$termsListBus.$on('editTerm', (term) => {
|
||||
|
||||
// Position edit form in a visible area
|
||||
// Position edit form in a visible area
|
||||
let container = document.getElementById('repository-container');
|
||||
if (container && container.scrollTop && container.scrollTop > 80)
|
||||
this.termEditionFormTop = container.scrollTop - 80;
|
||||
|
@ -368,9 +368,12 @@ export default {
|
|||
this.editTerm = term;
|
||||
this.isEditingTerm = true;
|
||||
});
|
||||
this.$termsListBus.$on('termEditionSaved', () => {
|
||||
this.$termsListBus.$on('termEditionSaved', ({hasChangedParent}) => {
|
||||
this.isEditingTerm = false;
|
||||
this.editTerm = null;
|
||||
|
||||
if (hasChangedParent)
|
||||
this.loadTerms(0);
|
||||
});
|
||||
this.$termsListBus.$on('termEditionCanceled', () => {
|
||||
this.isEditingTerm = false;
|
||||
|
|
|
@ -297,7 +297,7 @@ export default {
|
|||
span {
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
overflow-x: hidden;
|
||||
overflow: hidden;
|
||||
max-width: 115px;
|
||||
margin: 0 0.1rem;
|
||||
display: inline-block;
|
||||
|
|
|
@ -176,7 +176,7 @@ export default {
|
|||
span {
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
overflow-x: hidden;
|
||||
overflow: hidden;
|
||||
max-width: 75%;
|
||||
margin: 0 0.1rem;
|
||||
display: inline-block;
|
||||
|
|
|
@ -46,7 +46,7 @@ export default {
|
|||
}
|
||||
.help-tooltip {
|
||||
z-index: 99999999999999999999;
|
||||
color: $blue5;
|
||||
color: $turquoise5;
|
||||
background-color: $turquoise2;
|
||||
border: none;
|
||||
display: block;
|
||||
|
|
|
@ -10,8 +10,8 @@ export default {
|
|||
onEditTerm(term) {
|
||||
this.$emit('editTerm', term);
|
||||
},
|
||||
onTermEditionSaved(term) {
|
||||
this.$emit('termEditionSaved', term);
|
||||
onTermEditionSaved({term, hasChangedParent}) {
|
||||
this.$emit('termEditionSaved', { term: term, hasChangedParent: hasChangedParent });
|
||||
},
|
||||
onTermEditionCanceled(term) {
|
||||
this.$emit('termEditionCanceled', term);
|
||||
|
|
|
@ -30,6 +30,7 @@
|
|||
white-space: nowrap;
|
||||
text-overflow: ellipsis;
|
||||
overflow: hidden;
|
||||
vertical-align: top;
|
||||
}
|
||||
.required-metadatum-asterisk {
|
||||
color: $gray3;
|
||||
|
@ -74,7 +75,7 @@
|
|||
padding-left: 0.8em;
|
||||
font-size: 12px;
|
||||
text-overflow: ellipsis;
|
||||
overflow-x: hidden;
|
||||
overflow: hidden;
|
||||
white-space: nowrap;
|
||||
}
|
||||
.select {
|
||||
|
|
|
@ -323,6 +323,7 @@ return apply_filters( 'tainacan-admin-i18n', [
|
|||
'instruction_select_max_options_to_show' => __( 'Select max options to show', 'tainacan' ),
|
||||
'instruction_select_collection_fetch_items' => __( 'Select a collection to fecth items', 'tainacan' ),
|
||||
'instruction_select_a_action' => __( 'Select a action', 'tainacan' ),
|
||||
'instruction_parent_term' => __( 'Type to search a Parent Term to choose.', 'tainacan' ),
|
||||
|
||||
// Info. Other feedback to user.
|
||||
'info_search_results' => __( 'Search Results', 'tainacan' ),
|
||||
|
@ -390,6 +391,7 @@ return apply_filters( 'tainacan-admin-i18n', [
|
|||
'info_possible_external_sources' => __( 'Possible external sources: CSV, Instagram, Youtube, etc.', 'tainacan' ),
|
||||
'info_help_term_name' => __( 'The term name', 'tainacan' ),
|
||||
'info_help_term_description' => __( 'The description of the Term.', 'tainacan' ),
|
||||
'info_help_parent_term' => __( 'The parent term', 'tainacan' ),
|
||||
'info_no_attachments_on_item_yet' => __( 'The are no attachments on this item so far.', 'tainacan' ),
|
||||
'info_repository_metadata_inheritance' => __( 'Repository Metadata will be inherited by all collections.', 'tainacan' ),
|
||||
'info_repository_filters_inheritance' => __( 'Repository Filters will be inherited by all collections.', 'tainacan' ),
|
||||
|
@ -424,6 +426,8 @@ return apply_filters( 'tainacan-admin-i18n', [
|
|||
'info_editing_items_in_bulk' => __( 'Editing items in bulk', 'tainacan' ),
|
||||
'info_by_inner' => __( 'by', 'tainacan' ),
|
||||
'info_items_selected' => __( 'items selected', 'tainacan' ),
|
||||
'info_no_parent_term_found' => __( 'No valid parent term was found with this name.', 'tainacan' ),
|
||||
'info_warning_changing_parent_term' => __( 'Warning! Changing parent term will reload the terms list, thus uncheking any selection.', 'tainacan' ),
|
||||
|
||||
// Tainacan Metadatum Types
|
||||
'tainacan-text' => __( 'Text', 'tainacan' ),
|
||||
|
|
|
@ -42,11 +42,9 @@ class REST_Controller extends \WP_REST_Controller {
|
|||
* @return \Tainacan\Entities\Entity
|
||||
*/
|
||||
protected function prepare_item_for_updating($object, $new_values){
|
||||
|
||||
foreach ($new_values as $key => $value) {
|
||||
$object->set($key, $value);
|
||||
}
|
||||
|
||||
return $object;
|
||||
}
|
||||
|
||||
|
@ -84,10 +82,10 @@ class REST_Controller extends \WP_REST_Controller {
|
|||
'postin' => 'post__in',
|
||||
'relation' => 'relation',
|
||||
'nopaging' => 'nopaging',
|
||||
'meta_key' => 'meta_key',
|
||||
'meta_type' => 'meta_type',
|
||||
'metatype' => 'meta_type',
|
||||
'hierarchical' => 'hierarchical',
|
||||
'exclude' => 'exclude'
|
||||
'exclude' => 'exclude',
|
||||
'excludetree' => 'exclude_tree'
|
||||
];
|
||||
|
||||
$meta_query = [
|
||||
|
|
|
@ -52,7 +52,7 @@ class Terms extends Repository {
|
|||
'type' => 'integer',
|
||||
'description' => __( 'The parent of the term', 'tainacan' ),
|
||||
'default' => 0,
|
||||
'validation' => ''
|
||||
//'validation' => ''
|
||||
],
|
||||
'description' => [
|
||||
'map' => 'description',
|
||||
|
@ -60,7 +60,7 @@ class Terms extends Repository {
|
|||
'type' => 'string',
|
||||
'description' => __( 'The term description', 'tainacan' ),
|
||||
'default' => '',
|
||||
'validation' => ''
|
||||
//'validation' => ''
|
||||
],
|
||||
'taxonomy' => [
|
||||
'map' => 'taxonomy',
|
||||
|
@ -139,10 +139,11 @@ class Terms extends Repository {
|
|||
if ( $mapped['map'] != 'termmeta' ) {
|
||||
$get_ = 'get_' . $prop;
|
||||
|
||||
if ( ! empty( $term->WP_Term->{$mapped['map']} ) ) {
|
||||
if ( $term->WP_Term->{$mapped['map']} ||
|
||||
($mapped['map'] == 'parent' && $term->WP_Term->{$mapped['map']} >= 0) ) {
|
||||
|
||||
$args[ $mapped['map'] ] = $term->$get_();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -84,20 +84,20 @@ class CSV extends Importer {
|
|||
$file->current();
|
||||
$file->next();
|
||||
|
||||
$this->add_log(' Delimiter to parse' . $this->get_option('delimiter') );
|
||||
//$this->add_log(' Delimiter to parse: ' . $this->get_option('delimiter') );
|
||||
$values = str_getcsv( $file->fgets(), $this->get_option('delimiter'), $this->get_option('enclosure') );
|
||||
}else{
|
||||
$this->add_log(' Delimiter to parse' . $this->get_option('delimiter') );
|
||||
//$this->add_log(' Delimiter to parse: ' . $this->get_option('delimiter') );
|
||||
$values = str_getcsv( rtrim($file->fgets()), $this->get_option('delimiter'), $this->get_option('enclosure') );
|
||||
}
|
||||
|
||||
if( count( $headers ) !== count( $values ) ){
|
||||
$string = (is_array($values)) ? implode('::', $values ) : $values;
|
||||
|
||||
$this->add_log(' Mismatch count headers and row columns ');
|
||||
$this->add_log(' Headers count: ' . count( $headers ) );
|
||||
$this->add_log(' Values count: ' . count( $values ) );
|
||||
$this->add_log(' Values string: ' . $string );
|
||||
$this->add_error_log(' Mismatch count headers and row columns ');
|
||||
$this->add_error_log(' Headers count: ' . count( $headers ) );
|
||||
$this->add_error_log(' Values count: ' . count( $values ) );
|
||||
$this->add_error_log(' Values string: ' . $string );
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -329,6 +329,7 @@ class CSV extends Importer {
|
|||
*/
|
||||
private function handle_document($column_value, $item_inserted){
|
||||
$TainacanMedia = \Tainacan\Media::get_instance();
|
||||
$this->items_repo->disable_logs();
|
||||
|
||||
if( strpos($column_value,'url:') === 0 ){
|
||||
$correct_value = trim(substr($column_value, 4));
|
||||
|
@ -393,6 +394,8 @@ class CSV extends Importer {
|
|||
$this->add_log('Setting item thumbnail: ' . $thumb_id);
|
||||
set_post_thumbnail( $item_inserted->get_id(), (int) $thumb_id );
|
||||
}
|
||||
|
||||
$this->items_repo->enable_logs();
|
||||
|
||||
return true;
|
||||
|
||||
|
@ -403,6 +406,8 @@ class CSV extends Importer {
|
|||
*/
|
||||
private function handle_attachment( $column_value, $item_inserted){
|
||||
$TainacanMedia = \Tainacan\Media::get_instance();
|
||||
|
||||
$this->items_repo->disable_logs();
|
||||
|
||||
$attachments = explode( $this->get_option('multivalued_delimiter'), $column_value);
|
||||
|
||||
|
@ -433,5 +438,8 @@ class CSV extends Importer {
|
|||
$this->add_log('Attachment file in Server imported from ' . $attachment);
|
||||
}
|
||||
}
|
||||
|
||||
$this->items_repo->enable_logs();
|
||||
|
||||
}
|
||||
}
|
|
@ -778,6 +778,7 @@ abstract class Importer {
|
|||
|
||||
$Tainacan_Items->disable_logs();
|
||||
$Tainacan_Metadata->disable_logs();
|
||||
$Tainacan_Item_Metadata->disable_logs();
|
||||
|
||||
$item = new Entities\Item();
|
||||
$itemMetadataArray = [];
|
||||
|
|
|
@ -272,7 +272,8 @@ class Old_Tainacan extends Importer{
|
|||
* @return Tainacan\Entities\Item Item inserted
|
||||
*/
|
||||
public function insert( $processed_item, $collection_index ) {
|
||||
$collection_id = $processed_item['collection_definition'];
|
||||
$this->items_repo->disable_logs();
|
||||
$collection_id = $processed_item['collection_definition'];
|
||||
$item_Old = $processed_item['item']->item;
|
||||
|
||||
$collection = new Entities\Collection($collection_id['id']);
|
||||
|
@ -321,6 +322,7 @@ class Old_Tainacan extends Importer{
|
|||
*/
|
||||
public function add_item_metadata( $item, $metadata_old, $collection_id ){
|
||||
$relationships = [];
|
||||
$this->item_metadata_repo->disable_logs();
|
||||
|
||||
foreach( $metadata_old as $metadatum ){
|
||||
|
||||
|
|
|
@ -79,16 +79,16 @@ export const setOrderBy = ({ state, commit }, orderBy ) => {
|
|||
} else if (orderBy.slug == 'author_name') {
|
||||
commit('setPostQueryAttribute', { attr: 'orderby', value: 'author_name' } );
|
||||
} else if (orderBy.metadata_type_object.primitive_type == 'float' || orderBy.metadata_type_object.primitive_type == 'int') {
|
||||
commit('setPostQueryAttribute', { attr: 'meta_key', value: orderBy.id } );
|
||||
commit('setPostQueryAttribute', { attr: 'metakey', value: orderBy.id } );
|
||||
commit('setPostQueryAttribute', { attr: 'orderby', value: 'meta_value_num' } );
|
||||
} else if (orderBy.metadata_type_object.primitive_type == 'date') {
|
||||
commit('setPostQueryAttribute', { attr: 'meta_key', value: orderBy.id } );
|
||||
commit('setPostQueryAttribute', { attr: 'meta_type', value: 'DATETIME' } );
|
||||
commit('setPostQueryAttribute', { attr: 'metakey', value: orderBy.id } );
|
||||
commit('setPostQueryAttribute', { attr: 'metatype', value: 'DATETIME' } );
|
||||
commit('setPostQueryAttribute', { attr: 'orderby', value: 'meta_value' } );
|
||||
} else if (orderBy.metadata_type_object.core) {
|
||||
commit('setPostQueryAttribute', { attr: 'orderby', value: orderBy.metadata_type_object.related_mapped_prop } );
|
||||
} else {
|
||||
commit('setPostQueryAttribute', { attr: 'meta_key', value: orderBy.id } );
|
||||
commit('setPostQueryAttribute', { attr: 'metakey', value: orderBy.id } );
|
||||
commit('setPostQueryAttribute', { attr: 'orderby', value: 'meta_value' } );
|
||||
}
|
||||
|
||||
|
|
|
@ -301,3 +301,28 @@ export const clearTerms = ({ commit }) => {
|
|||
commit('clearTerms');
|
||||
};
|
||||
|
||||
// Used only on Term Edition form, for autocomplete searhc for parents
|
||||
export const fetchPossibleParentTerms = ({ commit }, { taxonomyId, termId, search } ) => {
|
||||
return new Promise((resolve, reject) => {
|
||||
axios.tainacan.get('/taxonomy/' + taxonomyId + '/terms?searchterm=' + search + '&hierarchical=1&exclude_tree=' + termId + "&hideempty=0&offset=0&number=20")
|
||||
.then(res => {
|
||||
let parentTerms = res.data;
|
||||
resolve( parentTerms );
|
||||
})
|
||||
.catch(error => {
|
||||
reject( error );
|
||||
});
|
||||
});
|
||||
};
|
||||
export const fetchParentName = ({ commit }, { taxonomyId, parentId } ) => {
|
||||
return new Promise((resolve, reject) => {
|
||||
axios.tainacan.get('/taxonomy/' + taxonomyId + '/terms/' + parentId + '?fetch_only=name')
|
||||
.then(res => {
|
||||
let parentName = res.data.name;
|
||||
resolve( parentName );
|
||||
})
|
||||
.catch(error => {
|
||||
reject( error );
|
||||
});
|
||||
});
|
||||
};
|
||||
|
|
|
@ -125,9 +125,9 @@ export default {
|
|||
$tainacan-input-color: #1d1d1d;
|
||||
$gray1: #f2f2f2;
|
||||
$gray2: #e5e5e5;
|
||||
$gray4: #898d8f;
|
||||
$gray3: #dcdcdc;
|
||||
$gray4: #898d8f;
|
||||
$gray4: #898d8f;
|
||||
$gray5: #454647;
|
||||
|
||||
@import "../../src/admin/scss/_view-mode-cards.scss";
|
||||
|
||||
|
|
|
@ -127,9 +127,9 @@ export default {
|
|||
$tainacan-input-color: #1d1d1d;
|
||||
$gray1: #f2f2f2;
|
||||
$gray2: #e5e5e5;
|
||||
$gray4: #898d8f;
|
||||
$gray3: #dcdcdc;
|
||||
$gray4: #898d8f;
|
||||
$gray4: #898d8f;
|
||||
$gray5: #454647;
|
||||
|
||||
@import "../../src/admin/scss/_view-mode-records.scss";
|
||||
|
||||
|
|
Loading…
Reference in New Issue