Merge remote-tracking branch 'origin/develop' into issue-#92
This commit is contained in:
commit
7ed94e5ae4
|
@ -45,7 +45,7 @@
|
||||||
</div>
|
</div>
|
||||||
</b-field>
|
</b-field>
|
||||||
|
|
||||||
|
<!-- Name -------------- -->
|
||||||
<b-field
|
<b-field
|
||||||
:addons="false"
|
:addons="false"
|
||||||
:type="((formErrors.name !== '' || formErrors.repeated !== '') && (formErrors.name !== undefined || formErrors.repeated !== undefined )) ? 'is-danger' : ''"
|
:type="((formErrors.name !== '' || formErrors.repeated !== '') && (formErrors.name !== undefined || formErrors.repeated !== undefined )) ? 'is-danger' : ''"
|
||||||
|
@ -63,6 +63,7 @@
|
||||||
@focus="clearErrors({ name: 'name', repeated: 'repeated' })"/>
|
@focus="clearErrors({ name: 'name', repeated: 'repeated' })"/>
|
||||||
</b-field>
|
</b-field>
|
||||||
|
|
||||||
|
<!-- Description -------------- -->
|
||||||
<b-field
|
<b-field
|
||||||
:addons="false"
|
:addons="false"
|
||||||
:type="formErrors['description'] !== '' && formErrors['description'] !== undefined ? 'is-danger' : ''"
|
:type="formErrors['description'] !== '' && formErrors['description'] !== undefined ? 'is-danger' : ''"
|
||||||
|
@ -80,7 +81,48 @@
|
||||||
@focus="clearErrors('description')"/>
|
@focus="clearErrors('description')"/>
|
||||||
</b-field>
|
</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="onToggleSwitch()"
|
||||||
|
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="field is-grouped form-submit">
|
||||||
<div class="control">
|
<div class="control">
|
||||||
<button
|
<button
|
||||||
|
@ -121,7 +163,14 @@
|
||||||
return {
|
return {
|
||||||
formErrors: {},
|
formErrors: {},
|
||||||
headerPlaceholderPath: tainacan_plugin.base_url + '/admin/images/placeholder_rectangle.png',
|
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: {
|
props: {
|
||||||
|
@ -132,6 +181,8 @@
|
||||||
...mapActions('taxonomy', [
|
...mapActions('taxonomy', [
|
||||||
'sendChildTerm',
|
'sendChildTerm',
|
||||||
'updateChildTerm',
|
'updateChildTerm',
|
||||||
|
'fetchParentName',
|
||||||
|
'fetchPossibleParentTerms'
|
||||||
]),
|
]),
|
||||||
...mapGetters('taxonomy', [
|
...mapGetters('taxonomy', [
|
||||||
'getTerms'
|
'getTerms'
|
||||||
|
@ -143,11 +194,11 @@
|
||||||
taxonomyId: this.taxonomyId,
|
taxonomyId: this.taxonomyId,
|
||||||
name: this.editForm.name,
|
name: this.editForm.name,
|
||||||
description: this.editForm.description,
|
description: this.editForm.description,
|
||||||
parent: this.editForm.parent,
|
parent: this.hasParent ? this.editForm.parent : 0,
|
||||||
headerImageId: this.editForm.header_image_id,
|
headerImageId: this.editForm.header_image_id,
|
||||||
})
|
})
|
||||||
.then((term) => {
|
.then((term) => {
|
||||||
this.$emit('onEditionFinished', term);
|
this.$emit('onEditionFinished', {term: term, hasChangedParent: this.hasChangedParent });
|
||||||
this.editForm = {};
|
this.editForm = {};
|
||||||
this.formErrors = {};
|
this.formErrors = {};
|
||||||
})
|
})
|
||||||
|
@ -161,17 +212,18 @@
|
||||||
});
|
});
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
this.updateChildTerm({
|
this.updateChildTerm({
|
||||||
taxonomyId: this.taxonomyId,
|
taxonomyId: this.taxonomyId,
|
||||||
termId: this.editForm.id,
|
termId: this.editForm.id,
|
||||||
name: this.editForm.name,
|
name: this.editForm.name,
|
||||||
description: this.editForm.description,
|
description: this.editForm.description,
|
||||||
parent: this.editForm.parent,
|
parent: this.hasParent ? this.editForm.parent : 0,
|
||||||
headerImageId: this.editForm.header_image_id,
|
headerImageId: this.editForm.header_image_id,
|
||||||
})
|
})
|
||||||
.then(() => {
|
.then((term) => {
|
||||||
this.formErrors = {};
|
this.formErrors = {};
|
||||||
this.$emit('onEditionFinished', this.editForm);
|
this.$emit('onEditionFinished', { term: term, hasChangedParent: this.hasChangedParent });
|
||||||
})
|
})
|
||||||
.catch((errors) => {
|
.catch((errors) => {
|
||||||
for (let error of errors.errors) {
|
for (let error of errors.errors) {
|
||||||
|
@ -223,9 +275,63 @@
|
||||||
this.formErrors[attributes] = undefined;
|
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;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
onToggleSwitch() {
|
||||||
|
|
||||||
|
if (this.editForm.parent == 0) {
|
||||||
|
this.hasChangedParent = this.hasParent;
|
||||||
|
} else {
|
||||||
|
this.hasChangedParent = !this.hasParent;
|
||||||
|
}
|
||||||
|
|
||||||
|
this.showCheckboxesWarning = true;
|
||||||
|
this.clearErrors('parent');
|
||||||
|
},
|
||||||
|
onSelectParentTerm(selectedParentTerm) {
|
||||||
|
this.hasChangedParent = this.initialParentId != selectedParentTerm.id;
|
||||||
|
this.editForm.parent = selectedParentTerm.id;
|
||||||
|
this.selectedParentTerm = selectedParentTerm;
|
||||||
|
this.parentTermName = selectedParentTerm.name;
|
||||||
|
this.showCheckboxesWarning = true;
|
||||||
|
}
|
||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
|
|
||||||
|
this.showCheckboxesWarning = false;
|
||||||
|
this.hasParent = this.editForm.parent != undefined && this.editForm.parent > 0;
|
||||||
|
this.initialParentId = this.editForm.parent;
|
||||||
this.initializeMediaFrames();
|
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>
|
</script>
|
||||||
|
@ -321,6 +427,11 @@
|
||||||
position: relative;
|
position: relative;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
.checkboxes-warning {
|
||||||
|
color: $gray5;
|
||||||
|
font-style: italic;
|
||||||
|
padding: 0.2rem 0.75rem;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
</style>
|
</style>
|
||||||
|
|
|
@ -88,7 +88,7 @@
|
||||||
<!-- Thumbnail -->
|
<!-- Thumbnail -->
|
||||||
<td
|
<td
|
||||||
class="thumbnail-cell column-default-width"
|
class="thumbnail-cell column-default-width"
|
||||||
@click="goToCollectionPage(collection.id)"
|
@click="onClickCollection($event, collection.id, index)"
|
||||||
:label="$i18n.get('label_thumbnail')"
|
:label="$i18n.get('label_thumbnail')"
|
||||||
:aria-label="$i18n.get('label_thumbnail')">
|
:aria-label="$i18n.get('label_thumbnail')">
|
||||||
<span>
|
<span>
|
||||||
|
@ -100,7 +100,7 @@
|
||||||
<!-- Name -->
|
<!-- Name -->
|
||||||
<td
|
<td
|
||||||
class="column-default-width column-main-content"
|
class="column-default-width column-main-content"
|
||||||
@click="goToCollectionPage(collection.id)"
|
@click="onClickCollection($event, collection.id, index)"
|
||||||
:label="$i18n.get('label_name')"
|
:label="$i18n.get('label_name')"
|
||||||
:aria-label="$i18n.get('label_name') + ': ' + collection.name">
|
:aria-label="$i18n.get('label_name') + ': ' + collection.name">
|
||||||
<p
|
<p
|
||||||
|
@ -114,7 +114,7 @@
|
||||||
<!-- Description -->
|
<!-- Description -->
|
||||||
<td
|
<td
|
||||||
class="column-large-width"
|
class="column-large-width"
|
||||||
@click="goToCollectionPage(collection.id)"
|
@click="onClickCollection($event, collection.id, index)"
|
||||||
:label="$i18n.get('label_description')"
|
:label="$i18n.get('label_description')"
|
||||||
:aria-label="$i18n.get('label_description') + ': ' + collection.description">
|
:aria-label="$i18n.get('label_description') + ': ' + collection.description">
|
||||||
<p
|
<p
|
||||||
|
@ -127,7 +127,7 @@
|
||||||
</td>
|
</td>
|
||||||
<!-- Creation Date -->
|
<!-- Creation Date -->
|
||||||
<td
|
<td
|
||||||
@click="goToCollectionPage(collection.id)"
|
@click="onClickCollection($event, collection.id, index)"
|
||||||
class="table-creation column-default-width"
|
class="table-creation column-default-width"
|
||||||
:label="$i18n.get('label_creation_date')"
|
:label="$i18n.get('label_creation_date')"
|
||||||
:aria-label="$i18n.get('label_creation_date') + ': ' + collection.creation_date">
|
:aria-label="$i18n.get('label_creation_date') + ': ' + collection.creation_date">
|
||||||
|
@ -141,7 +141,7 @@
|
||||||
</td>
|
</td>
|
||||||
<!-- Created by -->
|
<!-- Created by -->
|
||||||
<td
|
<td
|
||||||
@click="goToCollectionPage(collection.id)"
|
@click="onClickCollection($event, collection.id, index)"
|
||||||
class="table-creation column-default-width"
|
class="table-creation column-default-width"
|
||||||
:label="$i18n.get('label_created_by')"
|
:label="$i18n.get('label_created_by')"
|
||||||
:aria-label="$i18n.get('label_created_by') + ': ' + collection.author_name">
|
:aria-label="$i18n.get('label_created_by') + ': ' + collection.author_name">
|
||||||
|
@ -155,7 +155,7 @@
|
||||||
</td>
|
</td>
|
||||||
<!-- Total items -->
|
<!-- Total items -->
|
||||||
<td
|
<td
|
||||||
@click="goToCollectionPage(collection.id)"
|
@click="onClickCollection($event, collection.id, index)"
|
||||||
class="column-small-width column-align-right"
|
class="column-small-width column-align-right"
|
||||||
:label="$i18n.get('label_total_items')"
|
:label="$i18n.get('label_total_items')"
|
||||||
v-if="collection.total_items != undefined"
|
v-if="collection.total_items != undefined"
|
||||||
|
@ -170,7 +170,7 @@
|
||||||
</td>
|
</td>
|
||||||
<!-- Actions -->
|
<!-- Actions -->
|
||||||
<td
|
<td
|
||||||
@click="goToCollectionPage(collection.id)"
|
@click="onClickCollection($event, collection.id, index)"
|
||||||
class="actions-cell column-default-width"
|
class="actions-cell column-default-width"
|
||||||
:label="$i18n.get('label_actions')">
|
:label="$i18n.get('label_actions')">
|
||||||
<div class="actions-container">
|
<div class="actions-container">
|
||||||
|
@ -325,8 +325,12 @@ export default {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
goToCollectionPage(collectionId) {
|
onClickCollection($event, collectionId, index) {
|
||||||
|
if ($event.ctrlKey) {
|
||||||
|
this.$set(this.selectedCollections, index, !this.selectedCollections[index]);
|
||||||
|
} else {
|
||||||
this.$router.push(this.$routerHelper.getCollectionPath(collectionId));
|
this.$router.push(this.$routerHelper.getCollectionPath(collectionId));
|
||||||
|
}
|
||||||
},
|
},
|
||||||
goToCollectionEditPage(collectionId) {
|
goToCollectionEditPage(collectionId) {
|
||||||
this.$router.push(this.$routerHelper.getCollectionEditPath(collectionId));
|
this.$router.push(this.$routerHelper.getCollectionEditPath(collectionId));
|
||||||
|
|
|
@ -64,14 +64,14 @@
|
||||||
autoHide: false,
|
autoHide: false,
|
||||||
placement: 'auto-start'
|
placement: 'auto-start'
|
||||||
}"
|
}"
|
||||||
@click="goToItemPage(item)">
|
@click="onClickItem($event, item, index)">
|
||||||
{{ item.title != undefined ? item.title : '' }}
|
{{ item.title != undefined ? item.title : '' }}
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
<!-- Thumbnail -->
|
<!-- Thumbnail -->
|
||||||
<a
|
<a
|
||||||
v-if="item.thumbnail != undefined"
|
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)">
|
<img :src="item['thumbnail'].tainacan_medium ? item['thumbnail'].tainacan_medium : (item['thumbnail'].medium ? item['thumbnail'].medium : thumbPlaceholderPath)">
|
||||||
</a>
|
</a>
|
||||||
|
|
||||||
|
@ -130,14 +130,14 @@
|
||||||
|
|
||||||
<!-- Title -->
|
<!-- Title -->
|
||||||
<div
|
<div
|
||||||
@click="goToItemPage(item)"
|
@click="onClickItem($event, item, index)"
|
||||||
class="metadata-title">
|
class="metadata-title">
|
||||||
<p>{{ item.title != undefined ? item.title : '' }}</p>
|
<p>{{ item.title != undefined ? item.title : '' }}</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- Thumbnail -->
|
<!-- Thumbnail -->
|
||||||
<div
|
<div
|
||||||
@click="goToItemPage(item)"
|
@click="onClickItem($event, item, index)"
|
||||||
v-if="item.thumbnail != undefined"
|
v-if="item.thumbnail != undefined"
|
||||||
class="thumbnail"
|
class="thumbnail"
|
||||||
:style="{ backgroundImage: 'url(' + (item['thumbnail'].tainacan_medium_full ? item['thumbnail'].tainacan_medium_full : (item['thumbnail'].medium_large ? item['thumbnail'].medium_large : thumbPlaceholderPath)) + ')' }">
|
:style="{ backgroundImage: 'url(' + (item['thumbnail'].tainacan_medium_full ? item['thumbnail'].tainacan_medium_full : (item['thumbnail'].medium_large ? item['thumbnail'].medium_large : thumbPlaceholderPath)) + ')' }">
|
||||||
|
@ -197,7 +197,7 @@
|
||||||
autoHide: false,
|
autoHide: false,
|
||||||
placement: 'auto-start'
|
placement: 'auto-start'
|
||||||
}"
|
}"
|
||||||
@click="goToItemPage(item)">
|
@click="onClickItem($event, item, index)">
|
||||||
{{ item.title != undefined ? item.title : '' }}
|
{{ item.title != undefined ? item.title : '' }}
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
|
@ -227,7 +227,7 @@
|
||||||
<!-- Remaining metadata -->
|
<!-- Remaining metadata -->
|
||||||
<div
|
<div
|
||||||
class="media"
|
class="media"
|
||||||
@click="goToItemPage(item)">
|
@click="onClickItem($event, item, index)">
|
||||||
|
|
||||||
<img
|
<img
|
||||||
v-if="item.thumbnail != undefined"
|
v-if="item.thumbnail != undefined"
|
||||||
|
@ -244,7 +244,6 @@
|
||||||
}"
|
}"
|
||||||
class="metadata-description"
|
class="metadata-description"
|
||||||
v-html="item.description != undefined ? getLimitedDescription(item.description) : ''" />
|
v-html="item.description != undefined ? getLimitedDescription(item.description) : ''" />
|
||||||
<br>
|
|
||||||
<!-- Author-->
|
<!-- Author-->
|
||||||
<p
|
<p
|
||||||
v-tooltip="{
|
v-tooltip="{
|
||||||
|
@ -312,7 +311,7 @@
|
||||||
v-for="(column, index) in tableMetadata"
|
v-for="(column, index) in tableMetadata"
|
||||||
:key="index"
|
:key="index"
|
||||||
v-if="collectionId != undefined && column.display && column.metadata_type_object != undefined && (column.metadata_type_object.related_mapped_prop == 'title')"
|
v-if="collectionId != undefined && column.display && column.metadata_type_object != undefined && (column.metadata_type_object.related_mapped_prop == 'title')"
|
||||||
@click="goToItemPage(item)"
|
@click="onClickItem($event, item, index)"
|
||||||
v-html="item.metadata != undefined ? renderMetadata(item.metadata, column) : ''" />
|
v-html="item.metadata != undefined ? renderMetadata(item.metadata, column) : ''" />
|
||||||
<p
|
<p
|
||||||
v-tooltip="{
|
v-tooltip="{
|
||||||
|
@ -324,7 +323,7 @@
|
||||||
v-for="(column, index) in tableMetadata"
|
v-for="(column, index) in tableMetadata"
|
||||||
:key="index"
|
:key="index"
|
||||||
v-if="collectionId == undefined && column.display && column.metadata_type_object != undefined && (column.metadata_type_object.related_mapped_prop == 'title')"
|
v-if="collectionId == undefined && column.display && column.metadata_type_object != undefined && (column.metadata_type_object.related_mapped_prop == 'title')"
|
||||||
@click="goToItemPage(item)"
|
@click="onClickItem($event, item, index)"
|
||||||
v-html="item.title != undefined ? item.title : ''" />
|
v-html="item.title != undefined ? item.title : ''" />
|
||||||
</div>
|
</div>
|
||||||
<!-- Actions -->
|
<!-- Actions -->
|
||||||
|
@ -353,7 +352,7 @@
|
||||||
<!-- Remaining metadata -->
|
<!-- Remaining metadata -->
|
||||||
<div
|
<div
|
||||||
class="media"
|
class="media"
|
||||||
@click="goToItemPage(item)">
|
@click="onClickItem($event, item, index)">
|
||||||
<div class="list-metadata media-body">
|
<div class="list-metadata media-body">
|
||||||
<div class="thumbnail">
|
<div class="thumbnail">
|
||||||
<img
|
<img
|
||||||
|
@ -436,8 +435,8 @@
|
||||||
|
|
||||||
<!-- Item Displayed Metadata -->
|
<!-- Item Displayed Metadata -->
|
||||||
<td
|
<td
|
||||||
:key="index"
|
:key="columnIndex"
|
||||||
v-for="(column, index) in tableMetadata"
|
v-for="(column, columnIndex) in tableMetadata"
|
||||||
v-if="column.display"
|
v-if="column.display"
|
||||||
:label="column.name"
|
:label="column.name"
|
||||||
class="column-default-width"
|
class="column-default-width"
|
||||||
|
@ -454,7 +453,7 @@
|
||||||
column.metadata_type_object.primitive_type == 'compound') : false,
|
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,
|
'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
|
<p
|
||||||
v-tooltip="{
|
v-tooltip="{
|
||||||
|
@ -669,8 +668,12 @@ export default {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
goToItemPage(item) {
|
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));
|
this.$router.push(this.$routerHelper.getItemPath(item.collection_id, item.id));
|
||||||
|
}
|
||||||
},
|
},
|
||||||
goToItemEditPage(item) {
|
goToItemEditPage(item) {
|
||||||
this.$router.push(this.$routerHelper.getItemEditPath(item.collection_id, item.id));
|
this.$router.push(this.$routerHelper.getItemEditPath(item.collection_id, item.id));
|
||||||
|
@ -688,7 +691,8 @@ export default {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
getLimitedDescription(description) {
|
getLimitedDescription(description) {
|
||||||
return description.length > 120 ? description.substring(0, 117) + '...' : description;
|
let maxCharacter = (window.innerWidth || document.documentElement.clientWidth || document.body.clientWidth) <= 480 ? 100 : 220;
|
||||||
|
return description.length > maxCharacter ? description.substring(0, maxCharacter - 3) + '...' : description;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -79,7 +79,6 @@
|
||||||
:index="childIndex"
|
:index="childIndex"
|
||||||
:taxonomy-id="taxonomyId"
|
:taxonomy-id="taxonomyId"
|
||||||
:order="order"/>
|
:order="order"/>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
<a
|
<a
|
||||||
class="view-more-terms"
|
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;
|
color: $gray4 !important;
|
||||||
cursor: not-allowed !important;
|
cursor: not-allowed !important;
|
||||||
user-select: none;
|
user-select: none;
|
||||||
|
@ -342,7 +341,7 @@ export default {
|
||||||
|
|
||||||
&.opened-term:first-child {
|
&.opened-term:first-child {
|
||||||
cursor: default;
|
cursor: default;
|
||||||
background-color: $blue1;
|
background-color: $gray1;
|
||||||
|
|
||||||
&:before {
|
&:before {
|
||||||
content: '';
|
content: '';
|
||||||
|
@ -353,7 +352,7 @@ export default {
|
||||||
width: 0;
|
width: 0;
|
||||||
height: 0;
|
height: 0;
|
||||||
border-style: solid;
|
border-style: solid;
|
||||||
border-color: transparent transparent transparent $blue1;
|
border-color: transparent transparent transparent $gray1;
|
||||||
border-left-width: 24px;
|
border-left-width: 24px;
|
||||||
border-top-width: 20px;
|
border-top-width: 20px;
|
||||||
border-bottom-width: 20px;
|
border-bottom-width: 20px;
|
||||||
|
|
|
@ -75,7 +75,7 @@
|
||||||
<!-- Name -->
|
<!-- Name -->
|
||||||
<td
|
<td
|
||||||
class="column-default-width column-main-content"
|
class="column-default-width column-main-content"
|
||||||
@click="goToTaxonomyEditPage(taxonomy.id)"
|
@click="onClickTaxonomy($event, taxonomy.id, index)"
|
||||||
:label="$i18n.get('label_name')"
|
:label="$i18n.get('label_name')"
|
||||||
:aria-label="$i18n.get('label_name') + ': ' + taxonomy.name">
|
:aria-label="$i18n.get('label_name') + ': ' + taxonomy.name">
|
||||||
<p
|
<p
|
||||||
|
@ -89,7 +89,7 @@
|
||||||
<!-- Description -->
|
<!-- Description -->
|
||||||
<td
|
<td
|
||||||
class="column-large-width"
|
class="column-large-width"
|
||||||
@click="goToTaxonomyEditPage(taxonomy.id)"
|
@click="onClickTaxonomy($event, taxonomy.id, index)"
|
||||||
:label="$i18n.get('label_description')"
|
:label="$i18n.get('label_description')"
|
||||||
:aria-label="$i18n.get('label_description') + ': ' + taxonomy.description">
|
:aria-label="$i18n.get('label_description') + ': ' + taxonomy.description">
|
||||||
<p
|
<p
|
||||||
|
@ -102,14 +102,14 @@
|
||||||
</td>
|
</td>
|
||||||
<!-- Actions -->
|
<!-- Actions -->
|
||||||
<td
|
<td
|
||||||
@click="goToTaxonomyEditPage(taxonomy.id)"
|
@click="onClickTaxonomy($event, taxonomy.id, index)"
|
||||||
class="actions-cell column-default-width"
|
class="actions-cell column-default-width"
|
||||||
:label="$i18n.get('label_actions')">
|
:label="$i18n.get('label_actions')">
|
||||||
<div class="actions-container">
|
<div class="actions-container">
|
||||||
<a
|
<a
|
||||||
id="button-edit"
|
id="button-edit"
|
||||||
:aria-label="$i18n.getFrom('taxonomies','edit_item')"
|
:aria-label="$i18n.getFrom('taxonomies','edit_item')"
|
||||||
@click="goToTaxonomyEditPage(taxonomy.id)">
|
@click="onClickTaxonomy($event, taxonomy.id, index)">
|
||||||
<b-icon
|
<b-icon
|
||||||
type="is-secondary"
|
type="is-secondary"
|
||||||
icon="pencil"/>
|
icon="pencil"/>
|
||||||
|
@ -254,14 +254,15 @@
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
goToTaxonomyPage(taxonomyId) {
|
onClickTaxonomy($event, taxonomyId, index) {
|
||||||
this.$router.push(this.$routerHelper.getTaxonomyPath(taxonomyId));
|
if ($event.ctrlKey) {
|
||||||
},
|
this.$set(this.selected, index, !this.selected[index]);
|
||||||
goToTaxonomyEditPage(taxonomyId) {
|
} else {
|
||||||
this.$router.push(this.$routerHelper.getTaxonomyEditPath(taxonomyId));
|
this.$router.push(this.$routerHelper.getTaxonomyEditPath(taxonomyId));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
|
|
|
@ -368,9 +368,12 @@ export default {
|
||||||
this.editTerm = term;
|
this.editTerm = term;
|
||||||
this.isEditingTerm = true;
|
this.isEditingTerm = true;
|
||||||
});
|
});
|
||||||
this.$termsListBus.$on('termEditionSaved', () => {
|
this.$termsListBus.$on('termEditionSaved', ({hasChangedParent}) => {
|
||||||
this.isEditingTerm = false;
|
this.isEditingTerm = false;
|
||||||
this.editTerm = null;
|
this.editTerm = null;
|
||||||
|
|
||||||
|
if (hasChangedParent)
|
||||||
|
this.loadTerms(0);
|
||||||
});
|
});
|
||||||
this.$termsListBus.$on('termEditionCanceled', () => {
|
this.$termsListBus.$on('termEditionCanceled', () => {
|
||||||
this.isEditingTerm = false;
|
this.isEditingTerm = false;
|
||||||
|
|
|
@ -297,7 +297,7 @@ export default {
|
||||||
span {
|
span {
|
||||||
text-overflow: ellipsis;
|
text-overflow: ellipsis;
|
||||||
white-space: nowrap;
|
white-space: nowrap;
|
||||||
overflow-x: hidden;
|
overflow: hidden;
|
||||||
max-width: 115px;
|
max-width: 115px;
|
||||||
margin: 0 0.1rem;
|
margin: 0 0.1rem;
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
|
|
|
@ -176,7 +176,7 @@ export default {
|
||||||
span {
|
span {
|
||||||
text-overflow: ellipsis;
|
text-overflow: ellipsis;
|
||||||
white-space: nowrap;
|
white-space: nowrap;
|
||||||
overflow-x: hidden;
|
overflow: hidden;
|
||||||
max-width: 75%;
|
max-width: 75%;
|
||||||
margin: 0 0.1rem;
|
margin: 0 0.1rem;
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
|
|
|
@ -46,7 +46,7 @@ export default {
|
||||||
}
|
}
|
||||||
.help-tooltip {
|
.help-tooltip {
|
||||||
z-index: 99999999999999999999;
|
z-index: 99999999999999999999;
|
||||||
color: $blue5;
|
color: $turquoise5;
|
||||||
background-color: $turquoise2;
|
background-color: $turquoise2;
|
||||||
border: none;
|
border: none;
|
||||||
display: block;
|
display: block;
|
||||||
|
|
|
@ -10,8 +10,8 @@ export default {
|
||||||
onEditTerm(term) {
|
onEditTerm(term) {
|
||||||
this.$emit('editTerm', term);
|
this.$emit('editTerm', term);
|
||||||
},
|
},
|
||||||
onTermEditionSaved(term) {
|
onTermEditionSaved({term, hasChangedParent}) {
|
||||||
this.$emit('termEditionSaved', term);
|
this.$emit('termEditionSaved', { term: term, hasChangedParent: hasChangedParent });
|
||||||
},
|
},
|
||||||
onTermEditionCanceled(term) {
|
onTermEditionCanceled(term) {
|
||||||
this.$emit('termEditionCanceled', term);
|
this.$emit('termEditionCanceled', term);
|
||||||
|
|
|
@ -186,7 +186,8 @@ export default {
|
||||||
this.loadCollections();
|
this.loadCollections();
|
||||||
},
|
},
|
||||||
onChangeCollectionsPerPage(value) {
|
onChangeCollectionsPerPage(value) {
|
||||||
this.collectionsPerPage = value;
|
|
||||||
|
if (value != this.collectionsPerPage) {
|
||||||
this.$userPrefs.set('collections_per_page', value)
|
this.$userPrefs.set('collections_per_page', value)
|
||||||
.then((newValue) => {
|
.then((newValue) => {
|
||||||
this.collectionsPerPage = newValue;
|
this.collectionsPerPage = newValue;
|
||||||
|
@ -194,6 +195,8 @@ export default {
|
||||||
.catch(() => {
|
.catch(() => {
|
||||||
this.$console.log("Error settings user prefs for collection per page")
|
this.$console.log("Error settings user prefs for collection per page")
|
||||||
});
|
});
|
||||||
|
}
|
||||||
|
this.collectionsPerPage = value;
|
||||||
this.loadCollections();
|
this.loadCollections();
|
||||||
},
|
},
|
||||||
onPageChange(page) {
|
onPageChange(page) {
|
||||||
|
|
|
@ -183,7 +183,8 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
onChangeEventsPerPage(value) {
|
onChangeEventsPerPage(value) {
|
||||||
this.eventsPerPage = value;
|
|
||||||
|
if (value != this.eventsPerPage) {
|
||||||
this.$userPrefs.set('events_per_page', value)
|
this.$userPrefs.set('events_per_page', value)
|
||||||
.then((newValue) => {
|
.then((newValue) => {
|
||||||
this.eventsPerPage = newValue;
|
this.eventsPerPage = newValue;
|
||||||
|
@ -191,10 +192,13 @@
|
||||||
.catch(() => {
|
.catch(() => {
|
||||||
this.$console.log("Error settings user prefs for events per page")
|
this.$console.log("Error settings user prefs for events per page")
|
||||||
});
|
});
|
||||||
|
}
|
||||||
|
this.eventsPerPage = value;
|
||||||
this.loadEvents();
|
this.loadEvents();
|
||||||
},
|
},
|
||||||
onChangeProcessesPerPage(value) {
|
onChangeProcessesPerPage(value) {
|
||||||
this.processesPerPage = value;
|
|
||||||
|
if (value != this.processesPerPage) {
|
||||||
this.$userPrefs.set('processes_per_page', value)
|
this.$userPrefs.set('processes_per_page', value)
|
||||||
.then((newValue) => {
|
.then((newValue) => {
|
||||||
this.processesPerPage = newValue;
|
this.processesPerPage = newValue;
|
||||||
|
@ -202,6 +206,8 @@
|
||||||
.catch(() => {
|
.catch(() => {
|
||||||
this.$console.log("Error settings user prefs for processes per page")
|
this.$console.log("Error settings user prefs for processes per page")
|
||||||
});
|
});
|
||||||
|
}
|
||||||
|
this.processesPerPage = value;
|
||||||
this.loadProcesses();
|
this.loadProcesses();
|
||||||
},
|
},
|
||||||
onPageChange(page) {
|
onPageChange(page) {
|
||||||
|
|
|
@ -9,8 +9,7 @@
|
||||||
v-if="!openAdvancedSearch"
|
v-if="!openAdvancedSearch"
|
||||||
class="is-hidden-mobile"
|
class="is-hidden-mobile"
|
||||||
id="filter-menu-compress-button"
|
id="filter-menu-compress-button"
|
||||||
:class="{'filter-menu-compress-button-top-repo': isRepositoryLevel}"
|
:style="{ top: !isOnTheme ? (isRepositoryLevel ? '172px' : '120px') : '76px' }"
|
||||||
:style="{ top: !isOnTheme ? '120px' : '76px' }"
|
|
||||||
@click="isFiltersMenuCompressed = !isFiltersMenuCompressed">
|
@click="isFiltersMenuCompressed = !isFiltersMenuCompressed">
|
||||||
<b-icon :icon="isFiltersMenuCompressed ? 'menu-right' : 'menu-left'" />
|
<b-icon :icon="isFiltersMenuCompressed ? 'menu-right' : 'menu-left'" />
|
||||||
</button>
|
</button>
|
||||||
|
@ -19,8 +18,7 @@
|
||||||
v-if="!openAdvancedSearch"
|
v-if="!openAdvancedSearch"
|
||||||
class="is-hidden-tablet"
|
class="is-hidden-tablet"
|
||||||
id="filter-menu-compress-button"
|
id="filter-menu-compress-button"
|
||||||
:class="{'filter-menu-compress-button-top-repo': isRepositoryLevel}"
|
:style="{ top: !isOnTheme ? (isRepositoryLevel ? (searchControlHeight + 100) : (searchControlHeight + 70) + 'px') : (searchControlHeight - 25) + 'px' }"
|
||||||
:style="{ top: !isOnTheme ? (searchControlHeight + 70) + 'px' : (searchControlHeight - 25) + 'px' }"
|
|
||||||
@click="isFilterModalActive = !isFilterModalActive">
|
@click="isFilterModalActive = !isFilterModalActive">
|
||||||
<b-icon :icon="isFiltersMenuCompressed ? 'menu-right' : 'menu-left'" />
|
<b-icon :icon="isFiltersMenuCompressed ? 'menu-right' : 'menu-left'" />
|
||||||
<span class="text">{{ $i18n.get('filters') }}</span>
|
<span class="text">{{ $i18n.get('filters') }}</span>
|
||||||
|
@ -770,7 +768,7 @@
|
||||||
'getAdminViewMode'
|
'getAdminViewMode'
|
||||||
]),
|
]),
|
||||||
onSwipeFiltersMenu($event) {
|
onSwipeFiltersMenu($event) {
|
||||||
let screenWidth = window.screen.width;
|
let screenWidth = (window.innerWidth || document.documentElement.clientWidth || document.body.clientWidth);
|
||||||
|
|
||||||
if ($event.offsetDirection == 4 && screenWidth <= 768) {
|
if ($event.offsetDirection == 4 && screenWidth <= 768) {
|
||||||
if (!this.isFilterModalActive)
|
if (!this.isFilterModalActive)
|
||||||
|
@ -1274,9 +1272,6 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
.filter-menu-compress-button-top-repo {
|
|
||||||
top: 123px !important;
|
|
||||||
}
|
|
||||||
#filter-menu-compress-button {
|
#filter-menu-compress-button {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
z-index: 99;
|
z-index: 99;
|
||||||
|
@ -1287,7 +1282,7 @@
|
||||||
width: 23px;
|
width: 23px;
|
||||||
border: none;
|
border: none;
|
||||||
background-color: $turquoise1;
|
background-color: $turquoise1;
|
||||||
color: $blue5;
|
color: $turquoise5;
|
||||||
padding: 0;
|
padding: 0;
|
||||||
border-top-right-radius: 2px;
|
border-top-right-radius: 2px;
|
||||||
border-bottom-right-radius: 2px;
|
border-bottom-right-radius: 2px;
|
||||||
|
|
|
@ -141,7 +141,7 @@
|
||||||
this.load();
|
this.load();
|
||||||
},
|
},
|
||||||
onChangePerPage(value) {
|
onChangePerPage(value) {
|
||||||
this.taxonomiesPerPage = value;
|
if (value != this.taxonomiesPerPage) {
|
||||||
this.$userPrefs.set('taxonomies_per_page', value)
|
this.$userPrefs.set('taxonomies_per_page', value)
|
||||||
.then((newValue) => {
|
.then((newValue) => {
|
||||||
this.taxonomiesPerPage = newValue;
|
this.taxonomiesPerPage = newValue;
|
||||||
|
@ -149,6 +149,9 @@
|
||||||
.catch(() => {
|
.catch(() => {
|
||||||
this.$console.log("Error settings user prefs for taxonomies per page")
|
this.$console.log("Error settings user prefs for taxonomies per page")
|
||||||
});
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
this.taxonomiesPerPage = value;
|
||||||
this.load();
|
this.load();
|
||||||
},
|
},
|
||||||
onPageChange(page) {
|
onPageChange(page) {
|
||||||
|
|
|
@ -771,7 +771,7 @@
|
||||||
'getAdminViewMode'
|
'getAdminViewMode'
|
||||||
]),
|
]),
|
||||||
onSwipeFiltersMenu($event) {
|
onSwipeFiltersMenu($event) {
|
||||||
let screenWidth = window.screen.width;
|
let screenWidth = (window.innerWidth || document.documentElement.clientWidth || document.body.clientWidth);
|
||||||
|
|
||||||
if ($event.offsetDirection == 4 && screenWidth <= 768) {
|
if ($event.offsetDirection == 4 && screenWidth <= 768) {
|
||||||
if (!this.isFilterModalActive)
|
if (!this.isFilterModalActive)
|
||||||
|
@ -1289,7 +1289,7 @@
|
||||||
width: 23px;
|
width: 23px;
|
||||||
border: none;
|
border: none;
|
||||||
background-color: $turquoise1;
|
background-color: $turquoise1;
|
||||||
color: $blue5;
|
color: $turquoise5;
|
||||||
padding: 0;
|
padding: 0;
|
||||||
border-top-right-radius: 2px;
|
border-top-right-radius: 2px;
|
||||||
border-bottom-right-radius: 2px;
|
border-bottom-right-radius: 2px;
|
||||||
|
|
|
@ -0,0 +1,91 @@
|
||||||
|
// Repository-level pages
|
||||||
|
// This garantees that any component inside a .repository-level-page
|
||||||
|
// will have a blue color instead of a turquoise.
|
||||||
|
.repository-level-page {
|
||||||
|
|
||||||
|
margin-top: 94px;
|
||||||
|
height: $page-height !important;
|
||||||
|
|
||||||
|
@media screen and (max-width: 769px) {
|
||||||
|
margin-top: 42px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.is-primary:not(.upload-draggable), .is-primary:hover, .is-primary:focus {
|
||||||
|
background-color: $blue4 !important;
|
||||||
|
color: white !important;
|
||||||
|
}
|
||||||
|
.is-secondary, .is-secondary:hover, .is-secondary:focus {
|
||||||
|
background-color: $blue5 !important;
|
||||||
|
color: white !important;
|
||||||
|
}
|
||||||
|
.has-text-primary, .has-text-primary:hover, .is-has-text-primary:focus {
|
||||||
|
color: $blue4 !important;
|
||||||
|
}
|
||||||
|
a, a:hover,
|
||||||
|
.has-text-secondary, .has-text-secondary:hover, .is-has-text-secondary:focus {
|
||||||
|
color: $blue3 !important;
|
||||||
|
}
|
||||||
|
.tainacan-page-title hr{
|
||||||
|
background-color: $blue3;
|
||||||
|
}
|
||||||
|
.button[disabled]:not(.is-white), .button:hover[disabled]:not(.is-white) {
|
||||||
|
border: none !important;
|
||||||
|
cursor: not-allowed !important;
|
||||||
|
color: $gray4 !important;
|
||||||
|
background-color: $gray2 !important;
|
||||||
|
}
|
||||||
|
.button.is-outlined {
|
||||||
|
color: $blue5 !important;
|
||||||
|
}
|
||||||
|
.tabs {
|
||||||
|
li.is-active a {
|
||||||
|
border-bottom: 5px solid $blue5;
|
||||||
|
color: $blue5;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.select:not(.is-multiple)::after {
|
||||||
|
color: $blue5;
|
||||||
|
|
||||||
|
option:checked, option:hover {
|
||||||
|
background-color: $gray2 !important;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.tainacan-table {
|
||||||
|
tr.selected-row {
|
||||||
|
background-color: $blue1 !important;
|
||||||
|
.checkbox-cell .checkbox, .actions-cell .actions-container {
|
||||||
|
background-color: $blue2 !important;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.dropdown-trigger {
|
||||||
|
.button .icon {
|
||||||
|
color: $blue5;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.dropdown-menu .dropdown-content {
|
||||||
|
.dropdown-item.is-active { background-color: $blue2; }
|
||||||
|
}
|
||||||
|
|
||||||
|
.switch {
|
||||||
|
&:hover input[type="checkbox"]:checked + .check {
|
||||||
|
background-color: $blue2;
|
||||||
|
}
|
||||||
|
input[type="checkbox"]:checked + .check {
|
||||||
|
border: 2px solid $blue5;
|
||||||
|
|
||||||
|
&::before {
|
||||||
|
background-color: $blue5;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
&.is-small {
|
||||||
|
input[type="checkbox"]:checked + .check {
|
||||||
|
border: 1.5px solid $blue5;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#filter-menu-compress-button {
|
||||||
|
background-color: $blue1 !important;
|
||||||
|
color: $blue5 !important;
|
||||||
|
}
|
||||||
|
}
|
|
@ -30,6 +30,7 @@
|
||||||
white-space: nowrap;
|
white-space: nowrap;
|
||||||
text-overflow: ellipsis;
|
text-overflow: ellipsis;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
|
vertical-align: top;
|
||||||
}
|
}
|
||||||
.required-metadatum-asterisk {
|
.required-metadatum-asterisk {
|
||||||
color: $gray3;
|
color: $gray3;
|
||||||
|
@ -74,7 +75,7 @@
|
||||||
padding-left: 0.8em;
|
padding-left: 0.8em;
|
||||||
font-size: 12px;
|
font-size: 12px;
|
||||||
text-overflow: ellipsis;
|
text-overflow: ellipsis;
|
||||||
overflow-x: hidden;
|
overflow: hidden;
|
||||||
white-space: nowrap;
|
white-space: nowrap;
|
||||||
}
|
}
|
||||||
.select {
|
.select {
|
||||||
|
|
|
@ -20,24 +20,26 @@
|
||||||
padding: 0px;
|
padding: 0px;
|
||||||
flex-basis: 0;
|
flex-basis: 0;
|
||||||
margin: 0.75rem;
|
margin: 0.75rem;
|
||||||
max-width: 410px;
|
max-width: 425px;
|
||||||
min-width: 410px;
|
min-width: 425px;
|
||||||
min-height: 218px;
|
min-height: 218px;
|
||||||
max-height: 218px;
|
max-height: 218px;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
|
|
||||||
@media screen and (max-width: 450px) {
|
@media screen and (max-width: 480px) {
|
||||||
max-width: 100%;
|
max-width: 100%;
|
||||||
min-width: 100%;
|
min-width: 100%;
|
||||||
|
min-height: 176px;
|
||||||
|
max-height: 176px;
|
||||||
|
|
||||||
img {
|
img {
|
||||||
width: 33.333333% !important;
|
width: 130px !important;
|
||||||
height: 33.333333% !important;
|
height: 130px !important;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
&:hover {
|
&:hover {
|
||||||
background-color: #f2f2f2 !important;
|
background-color: $gray1 !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
.card-checkbox {
|
.card-checkbox {
|
||||||
|
@ -109,7 +111,7 @@
|
||||||
p.metadata-description {
|
p.metadata-description {
|
||||||
font-size: 0.6875rem !important;
|
font-size: 0.6875rem !important;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
margin-bottom: 1.5rem;
|
margin-bottom: 1rem;
|
||||||
max-height: 152px;
|
max-height: 152px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -17,6 +17,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
.tainacan-record {
|
.tainacan-record {
|
||||||
|
background-color: #f6f6f6;
|
||||||
padding: 0px;
|
padding: 0px;
|
||||||
flex-basis: 0;
|
flex-basis: 0;
|
||||||
margin: 0 auto 42px auto;
|
margin: 0 auto 42px auto;
|
||||||
|
@ -28,7 +29,7 @@
|
||||||
display: block;
|
display: block;
|
||||||
|
|
||||||
&:hover {
|
&:hover {
|
||||||
background-color: #f2f2f2 !important;
|
background-color: $gray1 !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
.record-checkbox {
|
.record-checkbox {
|
||||||
|
@ -86,6 +87,7 @@
|
||||||
text-overflow: ellipsis;
|
text-overflow: ellipsis;
|
||||||
white-space: nowrap;
|
white-space: nowrap;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
|
transition: background-color 0.3s;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
&:hover .metadata-title {
|
&:hover .metadata-title {
|
||||||
|
|
|
@ -23,6 +23,7 @@
|
||||||
@import "../scss/_tags.scss";
|
@import "../scss/_tags.scss";
|
||||||
@import "../scss/_notices.scss";
|
@import "../scss/_notices.scss";
|
||||||
@import "../scss/_filters-menu-modal.scss";
|
@import "../scss/_filters-menu-modal.scss";
|
||||||
|
@import "../scss/_repository-level-overrides.scss";
|
||||||
|
|
||||||
// Clears wordpress content
|
// Clears wordpress content
|
||||||
body.tainacan-admin-page #adminmenumain, body.tainacan-admin-page #wpfooter, body.tainacan-admin-page #wp-auth-check-wrap {
|
body.tainacan-admin-page #adminmenumain, body.tainacan-admin-page #wpfooter, body.tainacan-admin-page #wp-auth-check-wrap {
|
||||||
|
@ -65,92 +66,6 @@ a:hover {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Repository-level pages
|
|
||||||
.repository-level-page {
|
|
||||||
margin-top: 94px;
|
|
||||||
height: $page-height !important;
|
|
||||||
|
|
||||||
@media screen and (max-width: 769px) {
|
|
||||||
margin-top: 42px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.is-primary:not(.upload-draggable), .is-primary:hover, .is-primary:focus {
|
|
||||||
background-color: $blue4 !important;
|
|
||||||
color: white !important;
|
|
||||||
}
|
|
||||||
.is-secondary, .is-secondary:hover, .is-secondary:focus {
|
|
||||||
background-color: $blue5 !important;
|
|
||||||
color: white !important;
|
|
||||||
}
|
|
||||||
.has-text-primary, .has-text-primary:hover, .is-has-text-primary:focus {
|
|
||||||
color: $blue4 !important;
|
|
||||||
}
|
|
||||||
a, a:hover,
|
|
||||||
.has-text-secondary, .has-text-secondary:hover, .is-has-text-secondary:focus {
|
|
||||||
color: $blue5 !important;
|
|
||||||
}
|
|
||||||
.tainacan-page-title {
|
|
||||||
h1 {
|
|
||||||
color: $blue5 !important;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
.button[disabled]:not(.is-white), .button:hover[disabled]:not(.is-white) {
|
|
||||||
border: none !important;
|
|
||||||
cursor: not-allowed !important;
|
|
||||||
color: $gray4 !important;
|
|
||||||
background-color: $gray2 !important;
|
|
||||||
}
|
|
||||||
.button.is-outlined {
|
|
||||||
color: $blue5 !important;
|
|
||||||
}
|
|
||||||
.tabs {
|
|
||||||
li.is-active a {
|
|
||||||
border-bottom: 5px solid $blue5;
|
|
||||||
color: $blue5;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
.select:not(.is-multiple)::after {
|
|
||||||
color: $blue5;
|
|
||||||
|
|
||||||
option:checked, option:hover {
|
|
||||||
background-color: $gray2 !important;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
.tainacan-table {
|
|
||||||
tr.selected-row {
|
|
||||||
background-color: $blue1 !important;
|
|
||||||
.checkbox-cell .checkbox, .actions-cell .actions-container {
|
|
||||||
background-color: $blue2 !important;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
.dropdown-trigger {
|
|
||||||
.button .icon {
|
|
||||||
color: $blue5;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
.dropdown-menu .dropdown-content {
|
|
||||||
.dropdown-item.is-active { background-color: $blue2; }
|
|
||||||
}
|
|
||||||
|
|
||||||
.switch {
|
|
||||||
&:hover input[type="checkbox"]:checked + .check {
|
|
||||||
background-color: $blue2;
|
|
||||||
}
|
|
||||||
input[type="checkbox"]:checked + .check {
|
|
||||||
border: 2px solid $blue5;
|
|
||||||
|
|
||||||
&::before {
|
|
||||||
background-color: $blue5;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
&.is-small {
|
|
||||||
input[type="checkbox"]:checked + .check {
|
|
||||||
border: 1.5px solid $blue5;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// Generic page container
|
// Generic page container
|
||||||
.page-container {
|
.page-container {
|
||||||
padding: $page-top-padding $page-side-padding;
|
padding: $page-top-padding $page-side-padding;
|
||||||
|
|
|
@ -317,6 +317,7 @@ return apply_filters( 'tainacan-admin-i18n', [
|
||||||
'instruction_insert_mapper_metadatum_info' => __( 'Insert the new mapper\'s metadatum info', 'tainacan' ),
|
'instruction_insert_mapper_metadatum_info' => __( 'Insert the new mapper\'s metadatum info', 'tainacan' ),
|
||||||
'instruction_select_max_options_to_show' => __( 'Select max options to show', 'tainacan' ),
|
'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_collection_fetch_items' => __( 'Select a collection to fecth items', 'tainacan' ),
|
||||||
|
'instruction_parent_term' => __( 'Type to search a Parent Term to choose.', 'tainacan' ),
|
||||||
|
|
||||||
// Info. Other feedback to user.
|
// Info. Other feedback to user.
|
||||||
'info_search_results' => __( 'Search Results', 'tainacan' ),
|
'info_search_results' => __( 'Search Results', 'tainacan' ),
|
||||||
|
@ -384,6 +385,7 @@ return apply_filters( 'tainacan-admin-i18n', [
|
||||||
'info_possible_external_sources' => __( 'Possible external sources: CSV, Instagram, Youtube, etc.', 'tainacan' ),
|
'info_possible_external_sources' => __( 'Possible external sources: CSV, Instagram, Youtube, etc.', 'tainacan' ),
|
||||||
'info_help_term_name' => __( 'The term name', 'tainacan' ),
|
'info_help_term_name' => __( 'The term name', 'tainacan' ),
|
||||||
'info_help_term_description' => __( 'The description of the Term.', '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_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_metadata_inheritance' => __( 'Repository Metadata will be inherited by all collections.', 'tainacan' ),
|
||||||
'info_repository_filters_inheritance' => __( 'Repository Filters will be inherited by all collections.', 'tainacan' ),
|
'info_repository_filters_inheritance' => __( 'Repository Filters will be inherited by all collections.', 'tainacan' ),
|
||||||
|
@ -415,6 +417,8 @@ return apply_filters( 'tainacan-admin-i18n', [
|
||||||
'info_there_are_no_metadata_in_repository_level' => __( 'There are no metadata in repository level', 'tainacan' ),
|
'info_there_are_no_metadata_in_repository_level' => __( 'There are no metadata in repository level', 'tainacan' ),
|
||||||
'info_import_collection' => __( 'Import from external sources.', 'tainacan' ),
|
'info_import_collection' => __( 'Import from external sources.', 'tainacan' ),
|
||||||
'info_import_items' => __( 'Import items from external sources.', 'tainacan' ),
|
'info_import_items' => __( 'Import items from external sources.', '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 Metadatum Types
|
||||||
'tainacan-text' => __( 'Text', 'tainacan' ),
|
'tainacan-text' => __( 'Text', 'tainacan' ),
|
||||||
|
|
|
@ -42,11 +42,9 @@ class REST_Controller extends \WP_REST_Controller {
|
||||||
* @return \Tainacan\Entities\Entity
|
* @return \Tainacan\Entities\Entity
|
||||||
*/
|
*/
|
||||||
protected function prepare_item_for_updating($object, $new_values){
|
protected function prepare_item_for_updating($object, $new_values){
|
||||||
|
|
||||||
foreach ($new_values as $key => $value) {
|
foreach ($new_values as $key => $value) {
|
||||||
$object->set($key, $value);
|
$object->set($key, $value);
|
||||||
}
|
}
|
||||||
|
|
||||||
return $object;
|
return $object;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -84,8 +82,10 @@ class REST_Controller extends \WP_REST_Controller {
|
||||||
'postin' => 'post__in',
|
'postin' => 'post__in',
|
||||||
'relation' => 'relation',
|
'relation' => 'relation',
|
||||||
'nopaging' => 'nopaging',
|
'nopaging' => 'nopaging',
|
||||||
'meta_key' => 'meta_key',
|
'metatype' => 'meta_type',
|
||||||
'meta_type' => 'meta_type'
|
'hierarchical' => 'hierarchical',
|
||||||
|
'exclude' => 'exclude',
|
||||||
|
'excludetree' => 'exclude_tree'
|
||||||
];
|
];
|
||||||
|
|
||||||
$meta_query = [
|
$meta_query = [
|
||||||
|
|
|
@ -82,6 +82,21 @@ class REST_Bulkedit_Controller extends REST_Controller {
|
||||||
'permission_callback' => array($this, 'bulk_edit_permissions_check'),
|
'permission_callback' => array($this, 'bulk_edit_permissions_check'),
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
|
);
|
||||||
|
register_rest_route($this->namespace, '/collection/(?P<collection_id>[\d]+)/' . $this->rest_base . '/(?P<group_id>[0-9a-f]+)/set_status',
|
||||||
|
array(
|
||||||
|
array(
|
||||||
|
'methods' => \WP_REST_Server::CREATABLE,
|
||||||
|
'callback' => array($this, 'set_status'),
|
||||||
|
'permission_callback' => array($this, 'bulk_edit_permissions_check'),
|
||||||
|
'args' => [
|
||||||
|
'value' => [
|
||||||
|
'type' => 'string',
|
||||||
|
'description' => __( 'The new status value', 'tainacan' ),
|
||||||
|
],
|
||||||
|
],
|
||||||
|
),
|
||||||
|
)
|
||||||
);
|
);
|
||||||
register_rest_route($this->namespace, '/collection/(?P<collection_id>[\d]+)/' . $this->rest_base . '/(?P<group_id>[0-9a-f]+)/set',
|
register_rest_route($this->namespace, '/collection/(?P<collection_id>[\d]+)/' . $this->rest_base . '/(?P<group_id>[0-9a-f]+)/set',
|
||||||
array(
|
array(
|
||||||
|
@ -221,6 +236,33 @@ class REST_Bulkedit_Controller extends REST_Controller {
|
||||||
|
|
||||||
return $this->generic_action('replace_value', $request, ['old_value', 'new_value']);
|
return $this->generic_action('replace_value', $request, ['old_value', 'new_value']);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public function set_status($request) {
|
||||||
|
$body = json_decode($request->get_body(), true);
|
||||||
|
|
||||||
|
if( !isset($body['value']) ){
|
||||||
|
return new \WP_REST_Response([
|
||||||
|
'error_message' => __('Value must be provided', 'tainacan'),
|
||||||
|
], 400);
|
||||||
|
}
|
||||||
|
|
||||||
|
$group_id = $request['group_id'];
|
||||||
|
|
||||||
|
$args = ['id' => $group_id];
|
||||||
|
|
||||||
|
$bulk = new \Tainacan\Bulk_Edit($args);
|
||||||
|
|
||||||
|
$action = $bulk->set_status($body['value']);
|
||||||
|
|
||||||
|
if ( is_wp_error($action) ) {
|
||||||
|
return new \WP_REST_Response([
|
||||||
|
'error_message' => $action->get_error_message(),
|
||||||
|
], 400);
|
||||||
|
} else {
|
||||||
|
return new \WP_REST_Response($action, 200);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function trash_items($request) {
|
public function trash_items($request) {
|
||||||
|
|
|
@ -142,6 +142,33 @@ class Bulk_Edit {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the status to all items in the current group
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public function set_status($value) {
|
||||||
|
|
||||||
|
if (!$this->get_id()) {
|
||||||
|
return new \WP_Error( 'no_id', __( 'Bulk Edit group not initialized', 'tainacan' ) );
|
||||||
|
}
|
||||||
|
|
||||||
|
$possible_values = ['draft', 'publish', 'private'];
|
||||||
|
|
||||||
|
// Specific validation
|
||||||
|
if (!in_array($value, $possible_values)) {
|
||||||
|
return new \WP_Error( 'invalid_action', __( 'Invalid status', 'tainacan' ) );
|
||||||
|
}
|
||||||
|
|
||||||
|
global $wpdb;
|
||||||
|
|
||||||
|
$select_q = $this->_build_select( 'post_id' );
|
||||||
|
|
||||||
|
$query = $wpdb->prepare("UPDATE $wpdb->posts SET post_status = %s WHERE ID IN ($select_q)", $value);
|
||||||
|
|
||||||
|
return $wpdb->query($query);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Adds a value to a metadatum to all items in the current group
|
* Adds a value to a metadatum to all items in the current group
|
||||||
* Must be used with a multiple metadatum
|
* Must be used with a multiple metadatum
|
||||||
|
|
|
@ -452,7 +452,7 @@ if ( ! class_exists( 'WP_Background_Process' ) ) {
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->handle();
|
$this->dispatch();
|
||||||
|
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
|
@ -245,13 +245,9 @@ class Collections extends Repository {
|
||||||
$args = array(
|
$args = array(
|
||||||
'labels' => $labels,
|
'labels' => $labels,
|
||||||
'hierarchical' => true,
|
'hierarchical' => true,
|
||||||
//'supports' => array('title'),
|
|
||||||
//'taxonomies' => array(self::TAXONOMY),
|
|
||||||
'public' => true,
|
'public' => true,
|
||||||
'show_ui' => tnc_enable_dev_wp_interface(),
|
'show_ui' => tnc_enable_dev_wp_interface(),
|
||||||
'show_in_menu' => tnc_enable_dev_wp_interface(),
|
'show_in_menu' => tnc_enable_dev_wp_interface(),
|
||||||
//'menu_position' => 5,
|
|
||||||
//'show_in_nav_menus' => false,
|
|
||||||
'publicly_queryable' => true,
|
'publicly_queryable' => true,
|
||||||
'exclude_from_search' => true,
|
'exclude_from_search' => true,
|
||||||
'has_archive' => true,
|
'has_archive' => true,
|
||||||
|
|
|
@ -125,13 +125,9 @@ class Filters extends Repository {
|
||||||
$args = array(
|
$args = array(
|
||||||
'labels' => $labels,
|
'labels' => $labels,
|
||||||
'hierarchical' => true,
|
'hierarchical' => true,
|
||||||
//'supports' => array('title'),
|
|
||||||
//'taxonomies' => array(self::TAXONOMY),
|
|
||||||
'public' => true,
|
'public' => true,
|
||||||
'show_ui' => tnc_enable_dev_wp_interface(),
|
'show_ui' => tnc_enable_dev_wp_interface(),
|
||||||
'show_in_menu' => tnc_enable_dev_wp_interface(),
|
'show_in_menu' => tnc_enable_dev_wp_interface(),
|
||||||
//'menu_position' => 5,
|
|
||||||
//'show_in_nav_menus' => false,
|
|
||||||
'publicly_queryable' => true,
|
'publicly_queryable' => true,
|
||||||
'exclude_from_search' => true,
|
'exclude_from_search' => true,
|
||||||
'has_archive' => true,
|
'has_archive' => true,
|
||||||
|
|
|
@ -425,7 +425,7 @@ class Items extends Repository {
|
||||||
$TainacanMedia = \Tainacan\Media::get_instance();
|
$TainacanMedia = \Tainacan\Media::get_instance();
|
||||||
$thumb_blob = $TainacanMedia->get_pdf_cover( $filepath );
|
$thumb_blob = $TainacanMedia->get_pdf_cover( $filepath );
|
||||||
if ( $thumb_blob ) {
|
if ( $thumb_blob ) {
|
||||||
$thumb_id = $TainacanMedia->insert_attachment_from_blob( $thumb_blob, basename( $filepath ) . '-cover.jpg', $item->get_id() );
|
$thumb_id = $TainacanMedia->insert_attachment_from_blob( $thumb_blob, basename( $filepath ) . '-cover.jpg' );
|
||||||
|
|
||||||
return $thumb_id;
|
return $thumb_id;
|
||||||
}
|
}
|
||||||
|
@ -443,7 +443,7 @@ class Items extends Repository {
|
||||||
return $existing_thumb;
|
return $existing_thumb;
|
||||||
} else {
|
} else {
|
||||||
$TainacanMedia = \Tainacan\Media::get_instance();
|
$TainacanMedia = \Tainacan\Media::get_instance();
|
||||||
$thumb_id = $TainacanMedia->insert_attachment_from_url( $thumb_url, $item->get_id() );
|
$thumb_id = $TainacanMedia->insert_attachment_from_url( $thumb_url );
|
||||||
update_post_meta( $item->get_id(), $meta_key, $thumb_id );
|
update_post_meta( $item->get_id(), $meta_key, $thumb_id );
|
||||||
|
|
||||||
return $thumb_id;
|
return $thumb_id;
|
||||||
|
|
|
@ -141,13 +141,10 @@ class Logs extends Repository {
|
||||||
$args = array(
|
$args = array(
|
||||||
'labels' => $labels,
|
'labels' => $labels,
|
||||||
'hierarchical' => true,
|
'hierarchical' => true,
|
||||||
//'supports' => array('title'),
|
|
||||||
//'taxonomies' => array(self::TAXONOMY),
|
|
||||||
'public' => false,
|
'public' => false,
|
||||||
'show_ui' => tnc_enable_dev_wp_interface(),
|
'show_ui' => tnc_enable_dev_wp_interface(),
|
||||||
'show_in_menu' => tnc_enable_dev_wp_interface(),
|
'show_in_menu' => tnc_enable_dev_wp_interface(),
|
||||||
//'menu_position' => 5,
|
'show_in_nav_menus' => false,
|
||||||
//'show_in_nav_menus' => false,
|
|
||||||
'publicly_queryable' => false,
|
'publicly_queryable' => false,
|
||||||
'exclude_from_search' => true,
|
'exclude_from_search' => true,
|
||||||
'has_archive' => false,
|
'has_archive' => false,
|
||||||
|
|
|
@ -227,13 +227,9 @@ class Metadata extends Repository {
|
||||||
$args = array(
|
$args = array(
|
||||||
'labels' => $labels,
|
'labels' => $labels,
|
||||||
'hierarchical' => true,
|
'hierarchical' => true,
|
||||||
//'supports' => array('title'),
|
|
||||||
//'taxonomies' => array(self::TAXONOMY),
|
|
||||||
'public' => true,
|
'public' => true,
|
||||||
'show_ui' => tnc_enable_dev_wp_interface(),
|
'show_ui' => tnc_enable_dev_wp_interface(),
|
||||||
'show_in_menu' => tnc_enable_dev_wp_interface(),
|
'show_in_menu' => tnc_enable_dev_wp_interface(),
|
||||||
//'menu_position' => 5,
|
|
||||||
//'show_in_nav_menus' => false,
|
|
||||||
'publicly_queryable' => true,
|
'publicly_queryable' => true,
|
||||||
'exclude_from_search' => true,
|
'exclude_from_search' => true,
|
||||||
'has_archive' => true,
|
'has_archive' => true,
|
||||||
|
|
|
@ -105,13 +105,9 @@ class Taxonomies extends Repository {
|
||||||
$args = array(
|
$args = array(
|
||||||
'labels' => $labels,
|
'labels' => $labels,
|
||||||
'hierarchical' => true,
|
'hierarchical' => true,
|
||||||
//'supports' => array('title'),
|
|
||||||
//'taxonomies' => array(self::TAXONOMY),
|
|
||||||
'public' => true,
|
'public' => true,
|
||||||
'show_ui' => tnc_enable_dev_wp_interface(),
|
'show_ui' => tnc_enable_dev_wp_interface(),
|
||||||
'show_in_menu' => tnc_enable_dev_wp_interface(),
|
'show_in_menu' => tnc_enable_dev_wp_interface(),
|
||||||
//'menu_position' => 5,
|
|
||||||
//'show_in_nav_menus' => false,
|
|
||||||
'publicly_queryable' => false,
|
'publicly_queryable' => false,
|
||||||
'exclude_from_search' => true,
|
'exclude_from_search' => true,
|
||||||
'has_archive' => false,
|
'has_archive' => false,
|
||||||
|
@ -119,6 +115,7 @@ class Taxonomies extends Repository {
|
||||||
'can_export' => true,
|
'can_export' => true,
|
||||||
'rewrite' => true,
|
'rewrite' => true,
|
||||||
'map_meta_cap' => true,
|
'map_meta_cap' => true,
|
||||||
|
'show_in_nav_menus' => false,
|
||||||
'capability_type' => Entities\Taxonomy::get_capability_type(),
|
'capability_type' => Entities\Taxonomy::get_capability_type(),
|
||||||
'supports' => [
|
'supports' => [
|
||||||
'title',
|
'title',
|
||||||
|
|
|
@ -52,7 +52,7 @@ class Terms extends Repository {
|
||||||
'type' => 'integer',
|
'type' => 'integer',
|
||||||
'description' => __( 'The parent of the term', 'tainacan' ),
|
'description' => __( 'The parent of the term', 'tainacan' ),
|
||||||
'default' => 0,
|
'default' => 0,
|
||||||
'validation' => ''
|
//'validation' => ''
|
||||||
],
|
],
|
||||||
'description' => [
|
'description' => [
|
||||||
'map' => 'description',
|
'map' => 'description',
|
||||||
|
@ -60,7 +60,7 @@ class Terms extends Repository {
|
||||||
'type' => 'string',
|
'type' => 'string',
|
||||||
'description' => __( 'The term description', 'tainacan' ),
|
'description' => __( 'The term description', 'tainacan' ),
|
||||||
'default' => '',
|
'default' => '',
|
||||||
'validation' => ''
|
//'validation' => ''
|
||||||
],
|
],
|
||||||
'taxonomy' => [
|
'taxonomy' => [
|
||||||
'map' => 'taxonomy',
|
'map' => 'taxonomy',
|
||||||
|
@ -139,10 +139,11 @@ class Terms extends Repository {
|
||||||
if ( $mapped['map'] != 'termmeta' ) {
|
if ( $mapped['map'] != 'termmeta' ) {
|
||||||
$get_ = 'get_' . $prop;
|
$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_();
|
$args[ $mapped['map'] ] = $term->$get_();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -29,11 +29,10 @@ class CSV extends Importer {
|
||||||
* @inheritdoc
|
* @inheritdoc
|
||||||
*/
|
*/
|
||||||
public function get_source_metadata(){
|
public function get_source_metadata(){
|
||||||
$file = new \SplFileObject( $this->tmp_file, 'r' );
|
if (($handle = fopen($this->tmp_file, "r")) !== false) {
|
||||||
$file->seek(0);
|
|
||||||
|
|
||||||
|
$rawColumns = fgetcsv($handle, 0, $this->get_option('delimiter'));
|
||||||
$columns = [];
|
$columns = [];
|
||||||
$rawColumns = str_getcsv( $file->fgets(), $this->get_option('delimiter'), $this->get_option('enclosure') );
|
|
||||||
|
|
||||||
if( $rawColumns ){
|
if( $rawColumns ){
|
||||||
foreach( $rawColumns as $index => $rawColumn ){
|
foreach( $rawColumns as $index => $rawColumn ){
|
||||||
|
@ -53,6 +52,7 @@ class CSV extends Importer {
|
||||||
|
|
||||||
return $columns;
|
return $columns;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
|
@ -62,9 +62,12 @@ class CSV extends Importer {
|
||||||
* returns all header including special
|
* returns all header including special
|
||||||
*/
|
*/
|
||||||
public function raw_source_metadata(){
|
public function raw_source_metadata(){
|
||||||
$file = new \SplFileObject( $this->tmp_file, 'r' );
|
|
||||||
$file->seek(0);
|
if (($handle = fopen($this->tmp_file, "r")) !== false) {
|
||||||
return $file->fgetcsv( $this->get_option('delimiter') );
|
return fgetcsv($handle, 0, $this->get_option('delimiter'));
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -75,29 +78,42 @@ class CSV extends Importer {
|
||||||
$headers = $this->raw_source_metadata();
|
$headers = $this->raw_source_metadata();
|
||||||
|
|
||||||
$this->add_log('Proccessing item index ' . $index . ' in collection ' . $collection_definition['id'] );
|
$this->add_log('Proccessing item index ' . $index . ' in collection ' . $collection_definition['id'] );
|
||||||
// search the index in the file and get values
|
|
||||||
$file = new \SplFileObject( $this->tmp_file, 'r' );
|
if (($handle = fopen($this->tmp_file, "r")) !== false) {
|
||||||
$file->setFlags(\SplFileObject::SKIP_EMPTY);
|
$file = $handle;
|
||||||
$file->seek( $index );
|
|
||||||
|
} else {
|
||||||
|
$this->add_error_log(' Error reading the file ');
|
||||||
|
return false;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
if( $index === 0 ){
|
if( $index === 0 ){
|
||||||
$file->current();
|
|
||||||
$file->next();
|
|
||||||
|
|
||||||
$this->add_log(' Delimiter to parse' . $this->get_option('delimiter') );
|
// moves the pointer forward
|
||||||
$values = str_getcsv( $file->fgets(), $this->get_option('delimiter'), $this->get_option('enclosure') );
|
fgetcsv($file, 0, $this->get_option('delimiter'));
|
||||||
}else{
|
|
||||||
$this->add_log(' Delimiter to parse' . $this->get_option('delimiter') );
|
} else {
|
||||||
$values = str_getcsv( rtrim($file->fgets()), $this->get_option('delimiter'), $this->get_option('enclosure') );
|
//get the pointer
|
||||||
|
$csv_pointer= $this->get_transient('csv_pointer');
|
||||||
|
|
||||||
|
if( $csv_pointer ){
|
||||||
|
fseek($file, $csv_pointer);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->add_transient('csv_last_pointer', ftell($file)); // add reference to post_process item in after_inserted_item()
|
||||||
|
$values = fgetcsv($file, 0, $this->get_option('delimiter'), $this->get_option('enclosure'));
|
||||||
|
$this->add_transient('csv_pointer', ftell($file)); // add reference for insert
|
||||||
|
|
||||||
if( count( $headers ) !== count( $values ) ){
|
if( count( $headers ) !== count( $values ) ){
|
||||||
$string = (is_array($values)) ? implode('::', $values ) : $values;
|
$string = (is_array($values)) ? implode('::', $values ) : $values;
|
||||||
|
|
||||||
$this->add_log(' Mismatch count headers and row columns ');
|
$this->add_error_log(' Mismatch count headers and row columns ');
|
||||||
$this->add_log(' Headers count: ' . count( $headers ) );
|
$this->add_error_log(' Headers count: ' . count( $headers ) );
|
||||||
$this->add_log(' Values count: ' . count( $values ) );
|
$this->add_error_log(' Values count: ' . count( $values ) );
|
||||||
$this->add_log(' Values string: ' . $string );
|
$this->add_error_log(' enclosure : ' . $enclosure );
|
||||||
|
$this->add_error_log(' Values string: ' . $string );
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -120,7 +136,6 @@ class CSV extends Importer {
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->add_log('Success to proccess index: ' . $index );
|
$this->add_log('Success to proccess index: ' . $index );
|
||||||
$this->add_transient('actual_index', $index); // add reference for insert
|
|
||||||
return $processedItem;
|
return $processedItem;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -133,17 +148,17 @@ class CSV extends Importer {
|
||||||
|
|
||||||
if( !empty($column_document) || !empty( $column_attachment ) ){
|
if( !empty($column_document) || !empty( $column_attachment ) ){
|
||||||
|
|
||||||
$index = $this->get_transient('actual_index');
|
if (($handle = fopen($this->tmp_file, "r")) !== false) {
|
||||||
$file = new \SplFileObject( $this->tmp_file, 'r' );
|
$file = $handle;
|
||||||
$file->setFlags(\SplFileObject::SKIP_EMPTY);
|
} else {
|
||||||
$file->seek( $index );
|
$this->add_error_log(' Error reading the file ');
|
||||||
|
return false;
|
||||||
if( $index === 0 ){
|
|
||||||
$file->current();
|
|
||||||
$file->next();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$values = str_getcsv( rtrim($file->fgets()), $this->get_option('delimiter'), $this->get_option('enclosure') );
|
$csv_pointer= $this->get_transient('csv_last_pointer');
|
||||||
|
fseek($file, $csv_pointer);
|
||||||
|
|
||||||
|
$values = fgetcsv($file, 0, $this->get_option('delimiter'), $this->get_option('enclosure'));
|
||||||
|
|
||||||
if( is_array($values) && !empty($column_document) ){
|
if( is_array($values) && !empty($column_document) ){
|
||||||
$this->handle_document( $values[$column_document], $inserted_item);
|
$this->handle_document( $values[$column_document], $inserted_item);
|
||||||
|
@ -159,14 +174,17 @@ class CSV extends Importer {
|
||||||
* @inheritdoc
|
* @inheritdoc
|
||||||
*/
|
*/
|
||||||
public function get_source_number_of_items(){
|
public function get_source_number_of_items(){
|
||||||
if (isset($this->tmp_file) && file_exists($this->tmp_file)) {
|
if ( isset($this->tmp_file) && file_exists($this->tmp_file) && ($handle = fopen($this->tmp_file, "r")) !== false) {
|
||||||
$file = new \SplFileObject( $this->tmp_file, 'r' );
|
$cont = 0;
|
||||||
$file->seek(PHP_INT_MAX);
|
|
||||||
// -1 removing header
|
while ( ($data = fgetcsv($handle, 0, $this->get_option('delimiter')) ) !== false ) {
|
||||||
return $this->total_items = $file->key() - 1;
|
$cont++;
|
||||||
|
}
|
||||||
|
|
||||||
|
// does not count the header
|
||||||
|
return $cont - 1;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -329,6 +347,7 @@ class CSV extends Importer {
|
||||||
*/
|
*/
|
||||||
private function handle_document($column_value, $item_inserted){
|
private function handle_document($column_value, $item_inserted){
|
||||||
$TainacanMedia = \Tainacan\Media::get_instance();
|
$TainacanMedia = \Tainacan\Media::get_instance();
|
||||||
|
$this->items_repo->disable_logs();
|
||||||
|
|
||||||
if( strpos($column_value,'url:') === 0 ){
|
if( strpos($column_value,'url:') === 0 ){
|
||||||
$correct_value = trim(substr($column_value, 4));
|
$correct_value = trim(substr($column_value, 4));
|
||||||
|
@ -394,6 +413,8 @@ class CSV extends Importer {
|
||||||
set_post_thumbnail( $item_inserted->get_id(), (int) $thumb_id );
|
set_post_thumbnail( $item_inserted->get_id(), (int) $thumb_id );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$this->items_repo->enable_logs();
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -404,6 +425,8 @@ class CSV extends Importer {
|
||||||
private function handle_attachment( $column_value, $item_inserted){
|
private function handle_attachment( $column_value, $item_inserted){
|
||||||
$TainacanMedia = \Tainacan\Media::get_instance();
|
$TainacanMedia = \Tainacan\Media::get_instance();
|
||||||
|
|
||||||
|
$this->items_repo->disable_logs();
|
||||||
|
|
||||||
$attachments = explode( $this->get_option('multivalued_delimiter'), $column_value);
|
$attachments = explode( $this->get_option('multivalued_delimiter'), $column_value);
|
||||||
|
|
||||||
if( $attachments ){
|
if( $attachments ){
|
||||||
|
@ -433,5 +456,8 @@ class CSV extends Importer {
|
||||||
$this->add_log('Attachment file in Server imported from ' . $attachment);
|
$this->add_log('Attachment file in Server imported from ' . $attachment);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$this->items_repo->enable_logs();
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -763,6 +763,7 @@ abstract class Importer {
|
||||||
*/
|
*/
|
||||||
public function insert( $processed_item, $collection_index ) {
|
public function insert( $processed_item, $collection_index ) {
|
||||||
|
|
||||||
|
remove_action( 'post_updated', 'wp_save_post_revision' );
|
||||||
$collections = $this->get_collections();
|
$collections = $this->get_collections();
|
||||||
$collection_definition = isset($collections[$collection_index]) ? $collections[$collection_index] : false;
|
$collection_definition = isset($collections[$collection_index]) ? $collections[$collection_index] : false;
|
||||||
if ( !$collection_definition || !is_array($collection_definition) || !isset($collection_definition['id']) || !isset($collection_definition['mapping']) ) {
|
if ( !$collection_definition || !is_array($collection_definition) || !isset($collection_definition['id']) || !isset($collection_definition['mapping']) ) {
|
||||||
|
@ -778,6 +779,7 @@ abstract class Importer {
|
||||||
|
|
||||||
$Tainacan_Items->disable_logs();
|
$Tainacan_Items->disable_logs();
|
||||||
$Tainacan_Metadata->disable_logs();
|
$Tainacan_Metadata->disable_logs();
|
||||||
|
$Tainacan_Item_Metadata->disable_logs();
|
||||||
|
|
||||||
$item = new Entities\Item();
|
$item = new Entities\Item();
|
||||||
$itemMetadataArray = [];
|
$itemMetadataArray = [];
|
||||||
|
|
|
@ -272,6 +272,7 @@ class Old_Tainacan extends Importer{
|
||||||
* @return Tainacan\Entities\Item Item inserted
|
* @return Tainacan\Entities\Item Item inserted
|
||||||
*/
|
*/
|
||||||
public function insert( $processed_item, $collection_index ) {
|
public function insert( $processed_item, $collection_index ) {
|
||||||
|
$this->items_repo->disable_logs();
|
||||||
$collection_id = $processed_item['collection_definition'];
|
$collection_id = $processed_item['collection_definition'];
|
||||||
$item_Old = $processed_item['item']->item;
|
$item_Old = $processed_item['item']->item;
|
||||||
|
|
||||||
|
@ -321,6 +322,7 @@ class Old_Tainacan extends Importer{
|
||||||
*/
|
*/
|
||||||
public function add_item_metadata( $item, $metadata_old, $collection_id ){
|
public function add_item_metadata( $item, $metadata_old, $collection_id ){
|
||||||
$relationships = [];
|
$relationships = [];
|
||||||
|
$this->item_metadata_repo->disable_logs();
|
||||||
|
|
||||||
foreach( $metadata_old as $metadatum ){
|
foreach( $metadata_old as $metadatum ){
|
||||||
|
|
||||||
|
|
|
@ -287,7 +287,7 @@ class Test_Importer extends Importer {
|
||||||
<h5><?php _e('Keyword Search', 'tainacan'); ?></h5>
|
<h5><?php _e('Keyword Search', 'tainacan'); ?></h5>
|
||||||
</div>
|
</div>
|
||||||
<div class="help-tooltip-body">
|
<div class="help-tooltip-body">
|
||||||
<p><?php _e('Type one keyword which it will be used to find images in flickr (e.g. dogs, cat)', 'tainacan'); ?></p>
|
<p><?php _e('Optionally ype one keyword which it will be used to find images in flickr (e.g. dogs, cat). Default is "kitten".', 'tainacan'); ?></p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</span>
|
</span>
|
||||||
|
@ -595,6 +595,10 @@ class Test_Importer extends Importer {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Example of a method that takes a long time to run
|
||||||
|
* and may run through multiple requests
|
||||||
|
*/
|
||||||
public function finish_processing() {
|
public function finish_processing() {
|
||||||
|
|
||||||
$this->add_log('finish_processing');
|
$this->add_log('finish_processing');
|
||||||
|
@ -651,7 +655,7 @@ class Test_Importer extends Importer {
|
||||||
|
|
||||||
$inserted_item->set_document( $id );
|
$inserted_item->set_document( $id );
|
||||||
$inserted_item->set_document_type( 'attachment' );
|
$inserted_item->set_document_type( 'attachment' );
|
||||||
$this->add_log('Document URL imported from ' . $correct_value);
|
$this->add_log('Document URL imported from ' . $url);
|
||||||
|
|
||||||
if( $inserted_item->validate() ) {
|
if( $inserted_item->validate() ) {
|
||||||
$inserted_item = $this->items_repo->update($inserted_item);
|
$inserted_item = $this->items_repo->update($inserted_item);
|
||||||
|
|
|
@ -160,7 +160,6 @@ export default {
|
||||||
|
|
||||||
this.loadItems(to);
|
this.loadItems(to);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
@ -192,15 +191,14 @@ export default {
|
||||||
this.updateURLQueries();
|
this.updateURLQueries();
|
||||||
},
|
},
|
||||||
addFetchOnly( metadatum ){
|
addFetchOnly( metadatum ){
|
||||||
let prefsFetchOnly = this.collectionId != undefined ? 'fetch_only_' + this.collectionId : 'fetch_only';
|
|
||||||
|
|
||||||
if(this.$userPrefs.get(prefsFetchOnly) != metadatum) {
|
|
||||||
this.$userPrefs.set(prefsFetchOnly, metadatum)
|
|
||||||
.catch(() => {});
|
|
||||||
}
|
|
||||||
|
|
||||||
this.$store.dispatch('search/add_fetchonly', metadatum );
|
this.$store.dispatch('search/add_fetchonly', metadatum );
|
||||||
this.updateURLQueries();
|
this.updateURLQueries();
|
||||||
|
|
||||||
|
let prefsFetchOnly = this.collectionId != undefined ? 'fetch_only_' + this.collectionId : 'fetch_only';
|
||||||
|
if (JSON.stringify(this.$userPrefs.get(prefsFetchOnly)) != JSON.stringify(metadatum)) {
|
||||||
|
this.$userPrefs.set(prefsFetchOnly, metadatum)
|
||||||
|
.catch(() => { this.$console.log("Error setting user prefs for fetch_only"); });
|
||||||
|
}
|
||||||
},
|
},
|
||||||
cleanFetchOnly() {
|
cleanFetchOnly() {
|
||||||
this.$store.dispatch('search/cleanFetchOnly');
|
this.$store.dispatch('search/cleanFetchOnly');
|
||||||
|
@ -228,14 +226,14 @@ export default {
|
||||||
this.updateURLQueries();
|
this.updateURLQueries();
|
||||||
},
|
},
|
||||||
setItemsPerPage(itemsPerPage) {
|
setItemsPerPage(itemsPerPage) {
|
||||||
|
this.$store.dispatch('search/setItemsPerPage', itemsPerPage);
|
||||||
|
this.updateURLQueries();
|
||||||
|
|
||||||
let prefsPerPage = this.collectionId != undefined ? 'items_per_page_' + this.collectionId : 'items_per_page';
|
let prefsPerPage = this.collectionId != undefined ? 'items_per_page_' + this.collectionId : 'items_per_page';
|
||||||
if(this.$userPrefs.get(prefsPerPage) != itemsPerPage) {
|
if(this.$userPrefs.get(prefsPerPage) != itemsPerPage) {
|
||||||
this.$userPrefs.set(prefsPerPage, itemsPerPage)
|
this.$userPrefs.set(prefsPerPage, itemsPerPage)
|
||||||
.catch(() => {});
|
.catch(() => {});
|
||||||
}
|
}
|
||||||
|
|
||||||
this.$store.dispatch('search/setItemsPerPage', itemsPerPage);
|
|
||||||
this.updateURLQueries();
|
|
||||||
},
|
},
|
||||||
setOrderBy(orderBy) {
|
setOrderBy(orderBy) {
|
||||||
let prefsOrderBy = this.collectionId != undefined ? 'order_by_' + this.collectionId : 'order_by';
|
let prefsOrderBy = this.collectionId != undefined ? 'order_by_' + this.collectionId : 'order_by';
|
||||||
|
@ -265,24 +263,24 @@ export default {
|
||||||
this.updateURLQueries();
|
this.updateURLQueries();
|
||||||
},
|
},
|
||||||
setViewMode(viewMode) {
|
setViewMode(viewMode) {
|
||||||
|
this.$store.dispatch('search/setViewMode', viewMode);
|
||||||
|
this.updateURLQueries();
|
||||||
|
|
||||||
let prefsViewMode = this.collectionId != undefined ? 'view_mode_' + this.collectionId : 'view_mode';
|
let prefsViewMode = this.collectionId != undefined ? 'view_mode_' + this.collectionId : 'view_mode';
|
||||||
if(this.$userPrefs.get(prefsViewMode) != viewMode) {
|
if(this.$userPrefs.get(prefsViewMode) != viewMode) {
|
||||||
this.$userPrefs.set(prefsViewMode, viewMode)
|
this.$userPrefs.set(prefsViewMode, viewMode)
|
||||||
.catch(() => {});
|
.catch(() => {});
|
||||||
}
|
}
|
||||||
|
|
||||||
this.$store.dispatch('search/setViewMode', viewMode);
|
|
||||||
this.updateURLQueries();
|
|
||||||
},
|
},
|
||||||
setAdminViewMode(adminViewMode) {
|
setAdminViewMode(adminViewMode) {
|
||||||
|
this.$store.dispatch('search/setAdminViewMode', adminViewMode);
|
||||||
|
this.updateURLQueries();
|
||||||
|
|
||||||
let prefsAdminViewMode = this.collectionId != undefined ? 'admin_view_mode_' + this.collectionId : 'admin_view_mode';
|
let prefsAdminViewMode = this.collectionId != undefined ? 'admin_view_mode_' + this.collectionId : 'admin_view_mode';
|
||||||
if(this.$userPrefs.get(prefsAdminViewMode) != adminViewMode) {
|
if(this.$userPrefs.get(prefsAdminViewMode) != adminViewMode) {
|
||||||
this.$userPrefs.set(prefsAdminViewMode, adminViewMode)
|
this.$userPrefs.set(prefsAdminViewMode, adminViewMode)
|
||||||
.catch(() => { });
|
.catch(() => { });
|
||||||
}
|
}
|
||||||
|
|
||||||
this.$store.dispatch('search/setAdminViewMode', adminViewMode);
|
|
||||||
this.updateURLQueries();
|
|
||||||
},
|
},
|
||||||
setInitialViewMode(viewMode) {
|
setInitialViewMode(viewMode) {
|
||||||
this.$store.dispatch('search/setViewMode', viewMode);
|
this.$store.dispatch('search/setViewMode', viewMode);
|
||||||
|
|
|
@ -79,16 +79,16 @@ export const setOrderBy = ({ state, commit }, orderBy ) => {
|
||||||
} else if (orderBy.slug == 'author_name') {
|
} else if (orderBy.slug == 'author_name') {
|
||||||
commit('setPostQueryAttribute', { attr: 'orderby', value: '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') {
|
} 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' } );
|
commit('setPostQueryAttribute', { attr: 'orderby', value: 'meta_value_num' } );
|
||||||
} else if (orderBy.metadata_type_object.primitive_type == 'date') {
|
} else if (orderBy.metadata_type_object.primitive_type == 'date') {
|
||||||
commit('setPostQueryAttribute', { attr: 'meta_key', value: orderBy.id } );
|
commit('setPostQueryAttribute', { attr: 'metakey', value: orderBy.id } );
|
||||||
commit('setPostQueryAttribute', { attr: 'meta_type', value: 'DATETIME' } );
|
commit('setPostQueryAttribute', { attr: 'metatype', value: 'DATETIME' } );
|
||||||
commit('setPostQueryAttribute', { attr: 'orderby', value: 'meta_value' } );
|
commit('setPostQueryAttribute', { attr: 'orderby', value: 'meta_value' } );
|
||||||
} else if (orderBy.metadata_type_object.core) {
|
} else if (orderBy.metadata_type_object.core) {
|
||||||
commit('setPostQueryAttribute', { attr: 'orderby', value: orderBy.metadata_type_object.related_mapped_prop } );
|
commit('setPostQueryAttribute', { attr: 'orderby', value: orderBy.metadata_type_object.related_mapped_prop } );
|
||||||
} else {
|
} else {
|
||||||
commit('setPostQueryAttribute', { attr: 'meta_key', value: orderBy.id } );
|
commit('setPostQueryAttribute', { attr: 'metakey', value: orderBy.id } );
|
||||||
commit('setPostQueryAttribute', { attr: 'orderby', value: 'meta_value' } );
|
commit('setPostQueryAttribute', { attr: 'orderby', value: 'meta_value' } );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -301,3 +301,28 @@ export const clearTerms = ({ commit }) => {
|
||||||
commit('clearTerms');
|
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 );
|
||||||
|
});
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
|
@ -70,7 +70,7 @@ function tainacan_get_the_document() {
|
||||||
if (!$item)
|
if (!$item)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
return $item->get_document_html();
|
return apply_filters('tainacan-get-the-document', $item->get_document_html(), $item);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -140,7 +140,7 @@ function tainacan_get_the_collection_name() {
|
||||||
if ( $collection ) {
|
if ( $collection ) {
|
||||||
$name = $collection->get_name();
|
$name = $collection->get_name();
|
||||||
}
|
}
|
||||||
return $name;
|
return apply_filters('tainacan-get-collection-name', $name, $collection);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -163,7 +163,7 @@ function tainacan_get_the_collection_description() {
|
||||||
if ( $collection ) {
|
if ( $collection ) {
|
||||||
$description = $collection->get_description();
|
$description = $collection->get_description();
|
||||||
}
|
}
|
||||||
return $description;
|
return apply_filters('tainacan-get-collection-description', $description, $collection);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -221,6 +221,52 @@ function tainacan_get_term() {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* When visiting a taxonomy archive, returns the term name
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
function tainacan_get_the_term_name() {
|
||||||
|
$term = tainacan_get_term();
|
||||||
|
$name = '';
|
||||||
|
if ( $term ) {
|
||||||
|
$name = $term->name;
|
||||||
|
}
|
||||||
|
return apply_filters('tainacan-get-term-name', $name, $term);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* When visiting a taxonomy archive, prints the term name
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
function tainacan_the_term_name() {
|
||||||
|
echo tainacan_get_the_term_name();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* When visiting a taxonomy archive, returns the term description
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
function tainacan_get_the_term_description() {
|
||||||
|
$term = tainacan_get_term();
|
||||||
|
$description = '';
|
||||||
|
if ( $term ) {
|
||||||
|
$description = $term->description;
|
||||||
|
}
|
||||||
|
return apply_filters('tainacan-get-term-description', $description, $term);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* When visiting a taxonomy archive, prints the term description
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
function tainacan_the_term_description() {
|
||||||
|
echo tainacan_get_the_term_description();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see \Tainacan\Theme_Helper->register_view_mode()
|
* @see \Tainacan\Theme_Helper->register_view_mode()
|
||||||
*/
|
*/
|
||||||
|
@ -310,5 +356,6 @@ function tainacan_get_initials($string, $one = false) {
|
||||||
$second = $words[ sizeof($words) - 1 ][0];
|
$second = $words[ sizeof($words) - 1 ][0];
|
||||||
}
|
}
|
||||||
|
|
||||||
return strtoupper($first . $second);
|
$result = strtoupper($first . $second);
|
||||||
|
return apply_filters('tainacan-get-initials', $result, $string, $one);
|
||||||
}
|
}
|
|
@ -87,7 +87,8 @@ export default {
|
||||||
collectionId: Number,
|
collectionId: Number,
|
||||||
displayedMetadata: Array,
|
displayedMetadata: Array,
|
||||||
items: Array,
|
items: Array,
|
||||||
isLoading: false
|
isLoading: false,
|
||||||
|
shouldUseSmallCard: false
|
||||||
},
|
},
|
||||||
data () {
|
data () {
|
||||||
return {
|
return {
|
||||||
|
@ -111,7 +112,8 @@ export default {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
getLimitedDescription(description) {
|
getLimitedDescription(description) {
|
||||||
return description.length > 300 ? description.substring(0, 297) + '...' : description;
|
let maxCharacter = (window.innerWidth || document.documentElement.clientWidth || document.body.clientWidth) <= 480 ? 155 : 330;
|
||||||
|
return description.length > maxCharacter ? description.substring(0, maxCharacter - 3) + '...' : description;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -121,10 +123,11 @@ export default {
|
||||||
$turquoise1: #e6f6f8;
|
$turquoise1: #e6f6f8;
|
||||||
$turquoise2: #d1e6e6;
|
$turquoise2: #d1e6e6;
|
||||||
$tainacan-input-color: #1d1d1d;
|
$tainacan-input-color: #1d1d1d;
|
||||||
|
$gray1: #f2f2f2;
|
||||||
$gray2: #e5e5e5;
|
$gray2: #e5e5e5;
|
||||||
$gray4: #898d8f;
|
|
||||||
$gray3: #dcdcdc;
|
$gray3: #dcdcdc;
|
||||||
$gray4: #898d8f;
|
$gray4: #898d8f;
|
||||||
|
$gray5: #454647;
|
||||||
|
|
||||||
@import "../../src/admin/scss/_view-mode-cards.scss";
|
@import "../../src/admin/scss/_view-mode-cards.scss";
|
||||||
|
|
||||||
|
|
|
@ -125,10 +125,11 @@ export default {
|
||||||
$turquoise1: #e6f6f8;
|
$turquoise1: #e6f6f8;
|
||||||
$turquoise2: #d1e6e6;
|
$turquoise2: #d1e6e6;
|
||||||
$tainacan-input-color: #1d1d1d;
|
$tainacan-input-color: #1d1d1d;
|
||||||
|
$gray1: #f2f2f2;
|
||||||
$gray2: #e5e5e5;
|
$gray2: #e5e5e5;
|
||||||
$gray4: #898d8f;
|
|
||||||
$gray3: #dcdcdc;
|
$gray3: #dcdcdc;
|
||||||
$gray4: #898d8f;
|
$gray4: #898d8f;
|
||||||
|
$gray5: #454647;
|
||||||
|
|
||||||
@import "../../src/admin/scss/_view-mode-records.scss";
|
@import "../../src/admin/scss/_view-mode-records.scss";
|
||||||
|
|
||||||
|
|
|
@ -606,6 +606,35 @@ class BulkEdit extends TAINACAN_UnitApiTestCase {
|
||||||
$this->assertEquals(20, $items->found_posts);
|
$this->assertEquals(20, $items->found_posts);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function test_set_status() {
|
||||||
|
$Tainacan_Items = \Tainacan\Repositories\Items::get_instance();
|
||||||
|
|
||||||
|
$ids = array_slice($this->items_ids, 4, 11);
|
||||||
|
|
||||||
|
$bulk = new \Tainacan\Bulk_Edit([
|
||||||
|
'items_ids' => $ids,
|
||||||
|
]);
|
||||||
|
|
||||||
|
$id = $bulk->get_id();
|
||||||
|
|
||||||
|
$bulk->set_status('draft');
|
||||||
|
|
||||||
|
$items = $Tainacan_Items->fetch([
|
||||||
|
'status' => 'draft',
|
||||||
|
'posts_per_page' => -1
|
||||||
|
]);
|
||||||
|
|
||||||
|
$this->assertEquals(11, $items->found_posts);
|
||||||
|
|
||||||
|
$items = $Tainacan_Items->fetch([
|
||||||
|
'publish' => 'draft',
|
||||||
|
'posts_per_page' => -1
|
||||||
|
]);
|
||||||
|
|
||||||
|
$this->assertEquals(29, $items->found_posts);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
function test_set_regular_multi_meta() {
|
function test_set_regular_multi_meta() {
|
||||||
|
|
||||||
$Tainacan_Items = \Tainacan\Repositories\Items::get_instance();
|
$Tainacan_Items = \Tainacan\Repositories\Items::get_instance();
|
||||||
|
@ -840,6 +869,42 @@ class BulkEdit extends TAINACAN_UnitApiTestCase {
|
||||||
$this->assertEquals(14, $items->found_posts);
|
$this->assertEquals(14, $items->found_posts);
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @group api
|
||||||
|
*/
|
||||||
|
public function test_api_set_status() {
|
||||||
|
|
||||||
|
$Tainacan_Items = \Tainacan\Repositories\Items::get_instance();
|
||||||
|
|
||||||
|
$ids = array_slice($this->items_ids, 2, 14);
|
||||||
|
|
||||||
|
$bulk = new \Tainacan\Bulk_Edit([
|
||||||
|
'items_ids' => $ids,
|
||||||
|
]);
|
||||||
|
|
||||||
|
$body = json_encode([
|
||||||
|
'value' => 'private'
|
||||||
|
]);
|
||||||
|
|
||||||
|
|
||||||
|
$request = new \WP_REST_Request(
|
||||||
|
'POST', $this->api_baseroute . '/' . $bulk->get_id() . '/set_status'
|
||||||
|
);
|
||||||
|
|
||||||
|
$request->set_body( $body );
|
||||||
|
|
||||||
|
$response = $this->server->dispatch($request);
|
||||||
|
|
||||||
|
$items = $Tainacan_Items->fetch([
|
||||||
|
'status' => 'private',
|
||||||
|
'posts_per_page' => -1
|
||||||
|
]);
|
||||||
|
|
||||||
|
$this->assertEquals(14, $items->found_posts);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -262,7 +262,11 @@ class ImporterTests extends TAINACAN_UnitTestCase {
|
||||||
// Sample data
|
// Sample data
|
||||||
$data = array(
|
$data = array(
|
||||||
array('Data 11', 'Data 12', 'Data 13||TESTE', 'Data 14', 'Data 15'),
|
array('Data 11', 'Data 12', 'Data 13||TESTE', 'Data 14', 'Data 15'),
|
||||||
array('Data 21', 'Data 22', 'Data 23', 'Data 24', 'Data 25'),
|
array('Data 21', 'Data 22', 'this
|
||||||
|
is
|
||||||
|
having
|
||||||
|
multiple
|
||||||
|
lines', 'Data 24', 'Data 25'),
|
||||||
array('Data 31', 'Data 32', utf8_decode( 'Data 33||Rééço' ), 'Data 34', 'Data 35'),
|
array('Data 31', 'Data 32', utf8_decode( 'Data 33||Rééço' ), 'Data 34', 'Data 35'),
|
||||||
array('Data 41', 'Data 42', 'Data 43||limbbo', 'Data 44', 'Data 45'),
|
array('Data 41', 'Data 42', 'Data 43||limbbo', 'Data 44', 'Data 45'),
|
||||||
array('Data 51', 'Data 52', 'Data 53', 'Data 54', 'Data 55')
|
array('Data 51', 'Data 52', 'Data 53', 'Data 54', 'Data 55')
|
||||||
|
|
Loading…
Reference in New Issue