commit
d315fb59b0
|
@ -663,7 +663,9 @@ a.pswp__share--download:hover {
|
|||
.tainacan-media-component__swiper-main li.swiper-slide:not(.swiper-slide-active) {
|
||||
opacity: 0.75; }
|
||||
.tainacan-media-component__swiper-main li.swiper-slide .swiper-slide-metadata {
|
||||
text-align: center; }
|
||||
text-align: center;
|
||||
font-size: 0.875em;
|
||||
margin-bottom: 1em; }
|
||||
.tainacan-media-component__swiper-main li.swiper-slide .swiper-slide-metadata.hide-name .swiper-slide-metadata__name {
|
||||
display: none;
|
||||
visibility: hidden; }
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -996,9 +996,11 @@ function tainacan_get_the_mime_type_icon($mime_type, $image_size = 'medium') {
|
|||
$icon_file = 'placeholder_pdf';
|
||||
break;
|
||||
case 'attachment':
|
||||
$icon_file = 'placeholder_attachment';
|
||||
break;
|
||||
case 'empty':
|
||||
default:
|
||||
$icon_file = 'placeholder_attachment';
|
||||
$icon_file = 'placeholder_square';
|
||||
}
|
||||
|
||||
return $images_path . $icon_file . $image_size . '.png';
|
||||
|
|
|
@ -1174,10 +1174,8 @@ export default {
|
|||
|
||||
} else {
|
||||
parent.postMessage({
|
||||
type: 'itemCreationMessage',
|
||||
itemId: this.item.id,
|
||||
itemTitle: this.item.title,
|
||||
itemThumbnail: this.item.thumbnail
|
||||
type: 'itemEditionMessage',
|
||||
item: this.item
|
||||
},
|
||||
tainacan_plugin.admin_url);
|
||||
}
|
||||
|
@ -1206,10 +1204,8 @@ export default {
|
|||
this.$router.go(-1);
|
||||
else
|
||||
parent.postMessage({
|
||||
type: 'itemCreationMessage',
|
||||
itemId: null,
|
||||
itemTitle: null,
|
||||
itemThumbnail: null
|
||||
type: 'itemEditionMessage',
|
||||
item: null
|
||||
},
|
||||
tainacan_plugin.admin_url);
|
||||
|
||||
|
|
|
@ -261,7 +261,7 @@
|
|||
</div>
|
||||
<div class="control">
|
||||
<b-button
|
||||
:loading="isLoading"
|
||||
:loading="isUpdating"
|
||||
class="button is-success"
|
||||
native-type="submit">
|
||||
{{ $i18n.get('save') }}
|
||||
|
@ -327,10 +327,10 @@
|
|||
...mapActions('metadata', [
|
||||
'updateMetadatum'
|
||||
]),
|
||||
saveEdition(metadatum) {
|
||||
if ((metadatum.metadata_type_object && metadatum.metadata_type_object.form_component) || metadatum.edit_form == '') {
|
||||
saveEdition(metadatum) {
|
||||
if ((metadatum.metadata_type_object && metadatum.metadata_type_object.form_component) || metadatum.edit_form == '') {
|
||||
let repository = this.editForm.repository_level;
|
||||
if (repository && repository === 'yes') {
|
||||
if (repository && repository === 'yes') {
|
||||
this.isRepositoryLevel = true;
|
||||
}
|
||||
|
||||
|
|
|
@ -208,7 +208,7 @@
|
|||
const message = event.message ? 'message' : 'data';
|
||||
const data = event[message];
|
||||
|
||||
if (data.type == 'itemCreationMessage') {
|
||||
if (data.type == 'itemEditionMessage') {
|
||||
this.editItemModal = false;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -231,7 +231,20 @@ class Compound extends Metadata_Type {
|
|||
private function get_meta_html(Item_Metadata_Entity $meta) {
|
||||
$html = '';
|
||||
if ($meta instanceof Item_Metadata_Entity && !empty($meta->get_value_as_html())) {
|
||||
$html = '<div class="tainacan-metadatum"><label class="label">' . $meta->get_metadatum()->get_name() . '</label> <p>' . $meta->get_value_as_html() . "</p></div>";
|
||||
ob_start();
|
||||
?>
|
||||
<div class="tainacan-metadatum">
|
||||
<h4 class="label">
|
||||
<?php echo $meta->get_metadatum()->get_name(); ?>
|
||||
</h4>
|
||||
<p>
|
||||
<?php echo $meta->get_value_as_html(); ?>
|
||||
</p>
|
||||
</div>
|
||||
<?php
|
||||
$html = ob_get_contents();
|
||||
ob_end_clean();
|
||||
|
||||
}
|
||||
|
||||
return $html;
|
||||
|
|
|
@ -32,6 +32,8 @@
|
|||
<div
|
||||
v-if="loadingMetadata"
|
||||
class="loading-spinner"/>
|
||||
</transition>
|
||||
<transition name="filter-item">
|
||||
<b-field
|
||||
v-if="hasMetadata"
|
||||
:addons="false">
|
||||
|
@ -55,6 +57,37 @@
|
|||
</b-select>
|
||||
</b-field>
|
||||
</transition>
|
||||
<transition name="filter-item">
|
||||
<b-field
|
||||
v-if="hasMetadata"
|
||||
:addons="false">
|
||||
<label class="label">
|
||||
{{ $i18n.getHelperTitle('tainacan-relationship', 'display_related_item_metadata') }}
|
||||
<help-button
|
||||
:title="$i18n.getHelperTitle('tainacan-relationship', 'display_related_item_metadata')"
|
||||
:message="$i18n.getHelperMessage('tainacan-relationship', 'display_related_item_metadata')"/>
|
||||
</label>
|
||||
<div :class="'displayed-metadata-options' + (metadata.length > 5 ? ' has-more-than-5-metadata' : '')">
|
||||
<b-checkbox
|
||||
native-value="thumbnail"
|
||||
name="metadata_type_relationship[display_related_item_metadata]"
|
||||
@input="emitValues()"
|
||||
v-model="displayRelatedItemMetadata">
|
||||
{{ $i18n.get('label_thumbnail') }}
|
||||
</b-checkbox>
|
||||
<b-checkbox
|
||||
v-for="(metadatumOption, index) in metadata"
|
||||
:key="index"
|
||||
:native-value="metadatumOption.id"
|
||||
name="metadata_type_relationship[display_related_item_metadata]"
|
||||
@input="emitValues()"
|
||||
v-model="displayRelatedItemMetadata"
|
||||
:disabled="metadatumOption.id == modelSearch">
|
||||
{{ metadatumOption.name }}
|
||||
</b-checkbox>
|
||||
</div>
|
||||
</b-field>
|
||||
</transition>
|
||||
|
||||
<b-field
|
||||
:addons="false"
|
||||
|
@ -97,7 +130,8 @@
|
|||
modelDisplayInRelatedItems: 'no',
|
||||
modelSearch:'',
|
||||
collectionType: '',
|
||||
collectionMessage: ''
|
||||
collectionMessage: '',
|
||||
displayRelatedItemMetadata: []
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
|
@ -124,28 +158,30 @@
|
|||
}
|
||||
},
|
||||
modelSearch( value ){
|
||||
this.modelSearch = value;
|
||||
if ( !this.displayRelatedItemMetadata.includes(value) )
|
||||
this.displayRelatedItemMetadata.push(value);
|
||||
this.emitValues();
|
||||
}
|
||||
},
|
||||
created(){
|
||||
this.fetchCollections().then(() => {
|
||||
if( this.collection_id && this.collection_id !== '' ){
|
||||
this.collection = this.collection_id;
|
||||
} else if ( this.value ) {
|
||||
this.collection = this.value.collection_id;
|
||||
}
|
||||
});
|
||||
this.fetchCollections().then(() => {
|
||||
if( this.collection_id && this.collection_id !== '' ){
|
||||
this.collection = this.collection_id;
|
||||
} else if ( this.value ) {
|
||||
this.collection = this.value.collection_id;
|
||||
}
|
||||
});
|
||||
|
||||
this.modelDisplayInRelatedItems = this.value && this.value.display_in_related_items ? this.value.display_in_related_items : 'no';
|
||||
this.displayRelatedItemMetadata = this.value && this.value.display_related_item_metadata && Array.isArray(this.value.display_related_item_metadata) ? this.value.display_related_item_metadata : [];
|
||||
this.modelDisplayInRelatedItems = this.value && this.value.display_in_related_items ? this.value.display_in_related_items : 'no';
|
||||
},
|
||||
methods:{
|
||||
methods: {
|
||||
setErrorsAttributes( type, message ){
|
||||
this.collectionType = type;
|
||||
this.collectionType = message;
|
||||
},
|
||||
fetchCollections(){
|
||||
return axios.get('/collections?nopaging=1')
|
||||
async fetchCollections(){
|
||||
return await axios.get('/collections?nopaging=1')
|
||||
.then(res => {
|
||||
const collections = res.data;
|
||||
|
||||
|
@ -169,14 +205,13 @@
|
|||
this.metadata = [];
|
||||
|
||||
for (let metadatum of metadata) {
|
||||
|
||||
if (metadatum.metadata_type_object.component !== 'tainacan-relationship' && metadatum.metadata_type_object.component !== 'tainacan-compound') {
|
||||
this.metadata.push( metadatum );
|
||||
this.hasMetadata = true;
|
||||
this.checkMetadata()
|
||||
this.checkMetadata();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (this.metadata.length <= 0) {
|
||||
this.$buefy.toast.open({
|
||||
duration: 4000,
|
||||
|
@ -225,7 +260,8 @@
|
|||
this.$emit('input',{
|
||||
collection_id: this.collection,
|
||||
search: this.modelSearch,
|
||||
display_in_related_items: this.modelDisplayInRelatedItems
|
||||
display_in_related_items: this.modelDisplayInRelatedItems,
|
||||
display_related_item_metadata: this.displayRelatedItemMetadata
|
||||
});
|
||||
}
|
||||
}
|
||||
|
@ -239,4 +275,11 @@
|
|||
.switch.is-small {
|
||||
margin-top: -0.5em;
|
||||
}
|
||||
.displayed-metadata-options.has-more-than-5-metadata {
|
||||
max-height: 125px;
|
||||
overflow-y: auto;
|
||||
border: 1px solid var(--tainacan-gray2);
|
||||
overflow-x: hidden;
|
||||
padding: 6px 12px;
|
||||
}
|
||||
</style>
|
||||
|
|
|
@ -1,60 +1,118 @@
|
|||
<template>
|
||||
<div :class="{ 'is-flex is-flex-wrap-wrap': itemMetadatum.metadatum.multiple != 'yes' || maxtags != undefined }">
|
||||
<b-taginput
|
||||
expanded
|
||||
:disabled="disabled"
|
||||
:id="'tainacan-item-metadatum_id-' + itemMetadatum.metadatum.id + (itemMetadatum.parent_meta_id ? ('_parent_meta_id-' + itemMetadatum.parent_meta_id) : '')"
|
||||
<b-tabs
|
||||
size="is-small"
|
||||
icon="magnify"
|
||||
:value="selected"
|
||||
@input="onInput"
|
||||
@blur="onBlur"
|
||||
:data="options"
|
||||
:maxtags="maxtags != undefined ? maxtags : (itemMetadatum.metadatum.multiple == 'yes' || allowNew === true ? null : 1)"
|
||||
autocomplete
|
||||
:remove-on-keys="[]"
|
||||
:dropdown-position="isLastMetadatum ? 'top' :'auto'"
|
||||
attached
|
||||
:placeholder="$i18n.get('instruction_type_existing_item')"
|
||||
:loading="isLoading"
|
||||
:aria-close-label="$i18n.get('remove_value')"
|
||||
:class="{'has-selected': selected != undefined && selected != []}"
|
||||
field="label"
|
||||
@typing="search"
|
||||
check-infinite-scroll
|
||||
@infinite-scroll="searchMore"
|
||||
:has-counter="false">
|
||||
<template slot-scope="props">
|
||||
<div class="media">
|
||||
animated
|
||||
v-model="activeTab">
|
||||
<b-tab-item :label="$i18n.get('label_insert_items')">
|
||||
<b-taginput
|
||||
expanded
|
||||
:disabled="disabled"
|
||||
:id="relationshipInputId"
|
||||
size="is-small"
|
||||
icon="magnify"
|
||||
:value="selected"
|
||||
@input="onInput"
|
||||
@blur="onBlur"
|
||||
@add="onAdd"
|
||||
@remove="onRemove"
|
||||
:data="options"
|
||||
:maxtags="maxtags != undefined ? maxtags : (itemMetadatum.metadatum.multiple == 'yes' || allowNew === true ? null : 1)"
|
||||
autocomplete
|
||||
:remove-on-keys="[]"
|
||||
:dropdown-position="isLastMetadatum ? 'top' :'auto'"
|
||||
attached
|
||||
:placeholder="$i18n.get('instruction_type_existing_item')"
|
||||
:loading="isLoading"
|
||||
:aria-close-label="$i18n.get('remove_value')"
|
||||
:class="{'has-selected': selected != undefined && selected != []}"
|
||||
field="label"
|
||||
@typing="search"
|
||||
check-infinite-scroll
|
||||
@infinite-scroll="searchMore"
|
||||
:has-counter="false">
|
||||
<template slot-scope="props">
|
||||
<div
|
||||
v-if="!isDisplayingRelatedItemMetadata"
|
||||
class="media">
|
||||
<div
|
||||
v-if="props.option.img"
|
||||
class="media-left">
|
||||
<img
|
||||
width="28"
|
||||
:src="props.option.img">
|
||||
</div>
|
||||
<div class="media-content">
|
||||
{{ props.option.label }}
|
||||
</div>
|
||||
</div>
|
||||
<div
|
||||
v-else
|
||||
class="tainacan-relationship-group">
|
||||
<div v-html="props.option.valuesAsHtml" />
|
||||
</div>
|
||||
</template>
|
||||
<template
|
||||
v-if="!isLoading"
|
||||
slot="empty">
|
||||
{{ $i18n.get('info_no_item_found') }}
|
||||
</template>
|
||||
<template
|
||||
v-if="currentUserCanEditItems && !($route && $route.query.iframemode)"
|
||||
slot="footer">
|
||||
<a @click="editItemModalOpen = true">
|
||||
{{ $i18n.get('label_crate_new_item') + ' "' + searchQuery + '"' }}
|
||||
</a>
|
||||
</template>
|
||||
</b-taginput>
|
||||
</b-tab-item>
|
||||
<b-tab-item
|
||||
v-if="itemMetadatum"
|
||||
style="min-height: 56px;"
|
||||
:label="( itemMetadatum.value.length == 1 || itemMetadatum.metadatum.multiple != 'yes' ) ? $i18n.get('label_selected_item') : ( $i18n.get('label_selected_items') + ' (' + itemMetadatum.value.length + ')' )">
|
||||
<div class="tainacan-relationship-results-container">
|
||||
<div
|
||||
v-if="props.option.img"
|
||||
class="media-left">
|
||||
<img
|
||||
width="28"
|
||||
:src="props.option.img">
|
||||
v-if="itemMetadatum.value && itemMetadatum.value.length"
|
||||
class="tainacan-relationship-group">
|
||||
<div
|
||||
v-for="(itemValue, index) of selected"
|
||||
:key="index"
|
||||
style="position: relative;">
|
||||
<div v-html="itemValue.valuesAsHtml" />
|
||||
<a
|
||||
v-if="currentUserCanEditItems && $route && !$route.query.iframemode"
|
||||
@click="editSelected(itemValue.value)"
|
||||
class="relationship-value-button--edit">
|
||||
<span class="icon">
|
||||
<i class="tainacan-icon tainacan-icon-edit" />
|
||||
</span>
|
||||
</a>
|
||||
<a
|
||||
@click="removeFromSelected(itemValue.value)"
|
||||
class="relationship-value-button--remove">
|
||||
<span class="icon">
|
||||
<i class="tainacan-icon tainacan-icon-close" />
|
||||
</span>
|
||||
</a>
|
||||
<span
|
||||
v-if="index < selected.length - 1"
|
||||
class="multivalue-separator"> | </span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="media-content">
|
||||
{{ props.option.label }}
|
||||
<div v-else>
|
||||
<p
|
||||
class="has-text-gray"
|
||||
style="font-size: 0.875em;">
|
||||
{{ $i18n.get('info_no_item_found') }}
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
<template
|
||||
v-if="!isLoading"
|
||||
slot="empty">
|
||||
{{ $i18n.get('info_no_item_found') }}
|
||||
</template>
|
||||
<template
|
||||
v-if="currentUserCanEditItems && !($route && $route.query.iframemode)"
|
||||
slot="footer">
|
||||
<a @click="createNewItemModal = true">
|
||||
{{ $i18n.get('label_crate_new_item') + ' "' + searchQuery + '"' }}
|
||||
</a>
|
||||
</template>
|
||||
</b-taginput>
|
||||
</b-tab-item>
|
||||
</b-tabs>
|
||||
<a
|
||||
v-if="currentUserCanEditItems && itemMetadatum.item && itemMetadatum.item.id"
|
||||
:disabled="!$route || $route.query.iframemode"
|
||||
@click="createNewItemModal = !createNewItemModal"
|
||||
@click="editItemModalOpen = !editItemModalOpen"
|
||||
class="add-link">
|
||||
<span class="icon is-small">
|
||||
<i class="tainacan-icon has-text-secondary tainacan-icon-add"/>
|
||||
|
@ -63,15 +121,14 @@
|
|||
</a>
|
||||
<b-modal
|
||||
:width="1200"
|
||||
:active.sync="createNewItemModal"
|
||||
custom-class="tainacan-modal">
|
||||
:active.sync="editItemModalOpen"
|
||||
:custom-class="'tainacan-modal' + (collection && collection.id ? ' tainacan-modal-item-edition--collection-' + collection.id : '')">
|
||||
<iframe
|
||||
:id="newItemFrame"
|
||||
:id="relationshipInputId + '_item-edition-modal'"
|
||||
width="100%"
|
||||
style="height: 85vh"
|
||||
:src="adminFullURL + $routerHelper.getNewItemPath(collectionId) + '?iframemode=true&newmetadatumid=' + itemMetadatum.metadatum.metadata_type_options.search + '&newitemtitle=' + searchQuery" />
|
||||
:src="itemModalSrc" />
|
||||
</b-modal>
|
||||
|
||||
</div>
|
||||
</template>
|
||||
|
||||
|
@ -80,7 +137,7 @@
|
|||
import { mapGetters } from 'vuex';
|
||||
import qs from 'qs';
|
||||
|
||||
export default {
|
||||
export default {
|
||||
props: {
|
||||
itemMetadatum: Object,
|
||||
maxtags: undefined,
|
||||
|
@ -95,41 +152,71 @@
|
|||
isLoading: false,
|
||||
collectionId: '',
|
||||
searchQuery: '',
|
||||
editingItemId: '',
|
||||
totalItems: 0,
|
||||
page: 1,
|
||||
createNewItemModal: false,
|
||||
activeTab: 0,
|
||||
editItemModalOpen: false,
|
||||
adminFullURL: tainacan_plugin.admin_url + 'admin.php?page=tainacan_admin#',
|
||||
currentUserCanEditItems: false
|
||||
currentUserCanEditItems: false,
|
||||
selectedValuesAsHtml: []
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
collection() {
|
||||
return this.getCollection();
|
||||
},
|
||||
itemModalSrc() {
|
||||
if (this.editingItemId)
|
||||
return this.adminFullURL + this.$routerHelper.getItemEditPath(this.collectionId, this.editingItemId) + '?iframemode=true';
|
||||
else
|
||||
return this.adminFullURL + this.$routerHelper.getNewItemPath(this.collectionId) + '?iframemode=true&newmetadatumid=' + this.itemMetadatum.metadatum.metadata_type_options.search + '&newitemtitle=' + this.searchQuery;
|
||||
},
|
||||
relationshipInputId() {
|
||||
if (this.itemMetadatum && this.itemMetadatum.metadatum)
|
||||
return 'tainacan-item-metadatum_id-' + this.itemMetadatum.metadatum.id + (this.itemMetadatum.parent_meta_id ? ('_parent_meta_id-' + this.itemMetadatum.parent_meta_id) : '');
|
||||
else
|
||||
return '';
|
||||
},
|
||||
isDisplayingRelatedItemMetadata() {
|
||||
return this.itemMetadatum &&
|
||||
this.itemMetadatum.metadatum &&
|
||||
this.itemMetadatum.metadatum.metadata_type_options &&
|
||||
this.itemMetadatum.metadatum.metadata_type_options.display_related_item_metadata &&
|
||||
this.itemMetadatum.metadatum.metadata_type_options.display_related_item_metadata.length &&
|
||||
this.itemMetadatum.metadatum.metadata_type_options.display_related_item_metadata.length > 1;
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
createNewItemModal() {
|
||||
if (this.createNewItemModal)
|
||||
window.addEventListener('message', this.createNewItemFromModal, false);
|
||||
editItemModalOpen() {
|
||||
if (this.editItemModalOpen)
|
||||
window.addEventListener('message', this.updateItemFromModal, false);
|
||||
else
|
||||
window.removeEventListener('message', this.createNewItemFromModal);
|
||||
window.removeEventListener('message', this.updateItemFromModal);
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.collectionId = ( this.itemMetadatum && this.itemMetadatum.metadatum.metadata_type_options && this.itemMetadatum.metadatum.metadata_type_options.collection_id ) ? this.itemMetadatum.metadatum.metadata_type_options.collection_id : '';
|
||||
|
||||
|
||||
if (this.itemMetadatum.value && (Array.isArray( this.itemMetadatum.value ) ? this.itemMetadatum.value.length > 0 : true )) {
|
||||
let query = qs.stringify({ postin: ( Array.isArray( this.itemMetadatum.value ) ) ? this.itemMetadatum.value : [ this.itemMetadatum.value ] });
|
||||
query += this.itemMetadatum.metadatum.metadata_type_options.search ? '&fetch_only_meta=' + this.itemMetadatum.metadatum.metadata_type_options.search : '';
|
||||
axios.get('/collection/' + this.collectionId + '/items?' + query + '&nopaging=1&fetch_only=title,document_mimetype,thumbnail&order=asc')
|
||||
let query = [];
|
||||
|
||||
query['postin'] = Array.isArray( this.itemMetadatum.value ) ? this.itemMetadatum.value : [ this.itemMetadatum.value ];
|
||||
query['nopaging'] = 1;
|
||||
query['order'] = 'asc';
|
||||
query['fetch_only'] = 'title,document_mimetype,thumbnail';
|
||||
query['fetch_only_meta'] = this.isDisplayingRelatedItemMetadata ? (this.itemMetadatum.metadatum.metadata_type_options.display_related_item_metadata.filter(metadatumId => metadatumId !== 'thumbnail') + '') : (this.itemMetadatum.metadatum.metadata_type_options.search ? this.itemMetadatum.metadatum.metadata_type_options.search : '');
|
||||
axios.get('/collection/' + this.collectionId + '/items?' + qs.stringify(query) )
|
||||
.then( res => {
|
||||
if (res.data.items) {
|
||||
for (let item of res.data.items)
|
||||
for (let item of res.data.items) {
|
||||
this.selected.push({
|
||||
label: this.getItemLabel(item),
|
||||
value: item.id,
|
||||
valuesAsHtml: this.getItemMetadataValuesAsHtml(item),
|
||||
img: this.$thumbHelper.getSrc(item['thumbnail'], 'tainacan-small', item.document_mimetype)
|
||||
});
|
||||
}
|
||||
}
|
||||
})
|
||||
.catch(error => {
|
||||
|
@ -191,12 +278,14 @@
|
|||
.then( res => {
|
||||
|
||||
if (res.data.items) {
|
||||
for (let item of res.data.items)
|
||||
for (let item of res.data.items) {
|
||||
this.options.push({
|
||||
label: this.getItemLabel(item),
|
||||
value: item.id,
|
||||
valuesAsHtml: this.getItemMetadataValuesAsHtml(item),
|
||||
img: this.$thumbHelper.getSrc(item['thumbnail'], 'tainacan-small', item.document_mimetype)
|
||||
})
|
||||
});
|
||||
}
|
||||
}
|
||||
if (res.headers['x-wp-total'])
|
||||
this.totalItems = res.headers['x-wp-total'];
|
||||
|
@ -272,8 +361,8 @@
|
|||
} else {
|
||||
query['search'] = search;
|
||||
}
|
||||
query['fetch_only'] = 'title,thumbnail';
|
||||
query['fetch_only_meta'] = this.itemMetadatum.metadatum.metadata_type_options.search;
|
||||
query['fetch_only'] = 'title,thumbnail,document_mimetype';
|
||||
query['fetch_only_meta'] = this.isDisplayingRelatedItemMetadata ? (this.itemMetadatum.metadatum.metadata_type_options.display_related_item_metadata.filter(metadatumId => metadatumId !== 'thumbnail') + '') : (this.itemMetadatum.metadatum.metadata_type_options.search ? this.itemMetadatum.metadatum.metadata_type_options.search : '');
|
||||
query['perpage'] = 12;
|
||||
query['paged'] = this.page;
|
||||
query['order'] = 'asc';
|
||||
|
@ -283,33 +372,200 @@
|
|||
|
||||
return qs.stringify(query);
|
||||
},
|
||||
createNewItemFromModal(event) {
|
||||
updateItemFromModal(event) {
|
||||
const message = event.message ? 'message' : 'data';
|
||||
const data = event[message];
|
||||
|
||||
if (data.type == 'itemCreationMessage') {
|
||||
this.createNewItemModal = false;
|
||||
if (data.type == 'itemEditionMessage') {
|
||||
this.editItemModalOpen = false;
|
||||
|
||||
if (data.itemId) {
|
||||
this.searchQuery = '';
|
||||
this.selected.push({
|
||||
label: data.itemTitle,
|
||||
value: data.itemId,
|
||||
img: data.itemThumbnail ? data.itemThumbnail : ''
|
||||
});
|
||||
this.onInput(this.selected);
|
||||
// An item is being edited from the modal
|
||||
if (this.editingItemId) {
|
||||
if (data.item && data.item.id) {
|
||||
const existingItemIndex = this.selected.findIndex(anItemValue => anItemValue.value == data.item.id);
|
||||
|
||||
if (existingItemIndex >= 0) {
|
||||
this.selected.splice(existingItemIndex, 1, {
|
||||
label: this.getItemLabel(data.item),
|
||||
value: data.item.id,
|
||||
valuesAsHtml: this.getItemMetadataValuesAsHtml(data.item),
|
||||
img: data.item.thumbnail ? data.item.thumbnail : ''
|
||||
});
|
||||
}
|
||||
this.onInput(this.selected);
|
||||
}
|
||||
this.editingItemId = '';
|
||||
|
||||
// An item is being created from the modal
|
||||
} else {
|
||||
|
||||
if (data.item && data.item.id) {
|
||||
this.searchQuery = '';
|
||||
|
||||
this.selected.push({
|
||||
label: this.getItemLabel(data.item),
|
||||
value: data.item.id,
|
||||
valuesAsHtml: this.getItemMetadataValuesAsHtml(data.item),
|
||||
img: data.item.thumbnail ? data.item.thumbnail : ''
|
||||
});
|
||||
|
||||
this.onInput(this.selected);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
getItemMetadataValuesAsHtml(item) {
|
||||
|
||||
let valuesAsHtml = '';
|
||||
valuesAsHtml += `<div class="tainacan-relationship-metadatum" data-item-id="${ item.id }">
|
||||
<div class="tainacan-relationship-metadatum-header">`;
|
||||
if (this.isDisplayingRelatedItemMetadata && this.itemMetadatum.metadatum.metadata_type_options.display_related_item_metadata.indexOf('thumbnail') >= 0)
|
||||
valuesAsHtml += `<img src="${ this.$thumbHelper.getSrc(item['thumbnail'], 'tainacan-small', item.document_mimetype) }" class="attachment-tainacan-small size-tainacan-small" alt="${ item.thumbnail_alt }" loading="lazy" width="40" height="40">`;
|
||||
|
||||
valuesAsHtml += `<h4 class="label">
|
||||
${ this.getItemLabel(item) }
|
||||
</h4>`;
|
||||
valuesAsHtml += `</div>`;
|
||||
|
||||
Object.values(item.metadata).forEach(metadatumValue => {
|
||||
if (
|
||||
metadatumValue.id != this.itemMetadatum.metadatum.metadata_type_options.search &&
|
||||
this.itemMetadatum.metadatum.metadata_type_options.display_related_item_metadata.indexOf(metadatumValue.id) >= 0 &&
|
||||
metadatumValue.value_as_html
|
||||
) {
|
||||
valuesAsHtml += `<div class="tainacan-metadatum">
|
||||
<h5 class="label">
|
||||
${ metadatumValue.name }
|
||||
</h5>
|
||||
<p>
|
||||
${ metadatumValue.value_as_html }
|
||||
</p>
|
||||
</div>`;
|
||||
}
|
||||
});
|
||||
valuesAsHtml += `</div>`;
|
||||
|
||||
return valuesAsHtml;
|
||||
},
|
||||
editSelected(itemId) {
|
||||
this.editingItemId = itemId;
|
||||
this.editItemModalOpen = true;
|
||||
},
|
||||
removeFromSelected(itemId) {
|
||||
const indexOfRemovedItem = this.selected.findIndex(itemValue => itemValue.value == itemId);
|
||||
|
||||
if (indexOfRemovedItem >= 0) {
|
||||
this.selected.splice(indexOfRemovedItem, 1);
|
||||
this.onInput(this.selected);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
<style lang="scss" scoped>
|
||||
div.is-flex {
|
||||
justify-content: flex-start;
|
||||
}
|
||||
.add-link {
|
||||
font-size: 0.75em;
|
||||
}
|
||||
.b-tabs {
|
||||
margin-bottom: 0;
|
||||
width: 100%;
|
||||
}
|
||||
/deep/ .b-tabs .tab-content {
|
||||
padding: 0.5em 0px !important;
|
||||
}
|
||||
/deep/ .tabs {
|
||||
margin-bottom: 0 !important;
|
||||
|
||||
ul {
|
||||
padding: 0;
|
||||
}
|
||||
}
|
||||
/deep/ .tainacan-relationship-results-container {
|
||||
border: 1px solid var(--tainacan-gray1);
|
||||
background-color: var(--tainacan-white);
|
||||
margin-top: calc(-1 * (0.5em + 1px));
|
||||
margin-bottom: calc(-1 * (0.5em + 1px));
|
||||
display: flex;
|
||||
overflow: auto;
|
||||
padding: 12px;
|
||||
max-height: 40vh;
|
||||
transition: height 0.5s ease, min-height 0.5s ease;
|
||||
|
||||
.tainacan-relationship-group {
|
||||
padding-bottom: 12px;
|
||||
.tainacan-relationship-metadatum {
|
||||
.tainacan-metadatum .label {
|
||||
font-size: 0.75em;
|
||||
}
|
||||
a {
|
||||
pointer-events: auto;
|
||||
}
|
||||
.tainacan-relationship-metadatum-header {
|
||||
padding-right: 64px;
|
||||
.label{
|
||||
font-size: 0.875em;
|
||||
}
|
||||
}
|
||||
}
|
||||
&>div>.multivalue-separator {
|
||||
display: block;
|
||||
max-height: 1px;
|
||||
width: calc(100% - 40px);
|
||||
background: var(--tainacan-gray2);
|
||||
content: none;
|
||||
color: transparent;
|
||||
margin: 0.5em 0 0.5em 40px;
|
||||
}
|
||||
}
|
||||
}
|
||||
/deep/ .tainacan-relationship-group {
|
||||
width: 100%;
|
||||
.tainacan-relationship-metadatum {
|
||||
.label {
|
||||
font-size: 1em;
|
||||
}
|
||||
a {
|
||||
pointer-events: none;
|
||||
}
|
||||
p {
|
||||
font-size: 0.875em;
|
||||
margin-bottom: 0;
|
||||
margin-top: 0;
|
||||
}
|
||||
}
|
||||
.tainacan-relationship-metadatum-header {
|
||||
.label {
|
||||
font-size: 1.125em;
|
||||
font-weight: normal;
|
||||
}
|
||||
img {
|
||||
max-width: 28px;
|
||||
max-height: 28px;
|
||||
margin-right: 10px;
|
||||
}
|
||||
}
|
||||
.relationship-value-button--edit,
|
||||
.relationship-value-button--remove {
|
||||
position: absolute;
|
||||
top: 0px;
|
||||
}
|
||||
}
|
||||
/deep/ .relationship-value-button--edit,
|
||||
/deep/ .relationship-value-button--remove {
|
||||
right: 4px;
|
||||
background-color: var(--tainacan-white);
|
||||
border-radius: 100%;
|
||||
padding: 2px;
|
||||
|
||||
&:hover {
|
||||
background-color: var(--tainacan-gray0);
|
||||
}
|
||||
}
|
||||
/deep/ .relationship-value-button--edit {
|
||||
right: 34px;
|
||||
}
|
||||
</style>
|
||||
|
|
|
@ -59,6 +59,10 @@ class Relationship extends Metadata_Type {
|
|||
'title' => __( 'Related Metadatum', 'tainacan' ),
|
||||
'description' => __( 'Select the metadata to use as search criteria in the target collection and as a label when representing the relationship', 'tainacan' ),
|
||||
],
|
||||
'display_related_item_metadata' => [
|
||||
'title' => __( 'Displayed related item metadata', 'tainacan' ),
|
||||
'description' => __( 'Select the metadata that will be displayed from the related item.', 'tainacan' ),
|
||||
],
|
||||
'display_in_related_items' => [
|
||||
'title' => __( 'Display in "Items related to this"', 'tainacan' ),
|
||||
'description' => __( 'Include items linked by this metadata on a list of related items.', 'tainacan' ),
|
||||
|
@ -119,8 +123,24 @@ class Relationship extends Metadata_Type {
|
|||
$readable_option_value = $option_value;
|
||||
break;
|
||||
|
||||
case 'display_related_item_metadata':
|
||||
if ( is_array($option_value) ) {
|
||||
$metadata_list = [];
|
||||
foreach($option_value as $metadata_id) {
|
||||
if ($metadata_id == 'thumbnail') {
|
||||
$metadata_list[] = __('Thumbnail', 'tainacan');
|
||||
} else {
|
||||
$metadata = \tainacan_metadata()->fetch( (int) $metadata_id );
|
||||
if ( $metadata ) $metadata_list[] = $metadata;
|
||||
}
|
||||
|
||||
}
|
||||
$readable_option_value = implode(", ", $metadata_list);
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
$readable_option_value = $option_value;
|
||||
$readable_option_value = is_string($option_value) ? $option_value : json_encode($option_value);
|
||||
}
|
||||
$options_as_html .= '<div class="value">' . $readable_option_value . '</div></div>';
|
||||
}
|
||||
|
@ -163,13 +183,13 @@ class Relationship extends Metadata_Type {
|
|||
* @param Item_Metadata_Entity $item_metadata
|
||||
* @return string The HTML representation of the value, containing one or multiple items names, linked to the item page
|
||||
*/
|
||||
public function get_value_as_html(\Tainacan\Entities\Item_Metadata_Entity $item_metadata) {
|
||||
public function get_value_as_html(\Tainacan\Entities\Item_Metadata_Entity $item_metadata) {
|
||||
$value = $item_metadata->get_value();
|
||||
$search_meta_id = $this->get_option('search');
|
||||
$display_metas = $this->get_option('display_related_item_metadata');
|
||||
|
||||
$return = '';
|
||||
if ( $item_metadata->is_multiple() ) {
|
||||
$count = 1;
|
||||
$total = sizeof($value);
|
||||
$prefix = $item_metadata->get_multivalue_prefix();
|
||||
$suffix = $item_metadata->get_multivalue_suffix();
|
||||
$separator = $item_metadata->get_multivalue_separator();
|
||||
|
@ -178,19 +198,11 @@ class Relationship extends Metadata_Type {
|
|||
try {
|
||||
$Tainacan_Items = \Tainacan\Repositories\Items::get_instance();
|
||||
$item = $Tainacan_Items->fetch( (int) $item_id);
|
||||
|
||||
$count++;
|
||||
|
||||
if ( $item instanceof \Tainacan\Entities\Item ) {
|
||||
$return .= $prefix;
|
||||
$return .= $this->get_item_html($item);
|
||||
$return .= $suffix;
|
||||
|
||||
if ( $count <= $total ) {
|
||||
$return .= $separator;
|
||||
}
|
||||
if ( $this->can_display_item($item) ) {
|
||||
$return .= empty($return)
|
||||
? ($prefix . $this->get_item_html($item, $search_meta_id, $display_metas) . $suffix)
|
||||
: ($separator . $prefix . $this->get_item_html($item, $search_meta_id, $display_metas) . $suffix);
|
||||
}
|
||||
|
||||
} catch (\Exception $e) {
|
||||
// item not found
|
||||
}
|
||||
|
@ -198,55 +210,126 @@ class Relationship extends Metadata_Type {
|
|||
} else {
|
||||
try {
|
||||
$item = new \Tainacan\Entities\Item($value);
|
||||
if ( $item instanceof \Tainacan\Entities\Item ) {
|
||||
$return .= $this->get_item_html($item);
|
||||
if ( $this->can_display_item($item) ) {
|
||||
$return .= $this->get_item_html($item, $search_meta_id, $display_metas);
|
||||
}
|
||||
} catch (\Exception $e) {
|
||||
// item not found
|
||||
}
|
||||
}
|
||||
if(!empty($display_metas) && is_array($display_metas) && count($display_metas) > 1) {
|
||||
return "<div class='tainacan-relationship-group'>{$return}</div>";
|
||||
}
|
||||
return $return;
|
||||
}
|
||||
|
||||
private function can_display_item($item) {
|
||||
return (
|
||||
$item instanceof \Tainacan\Entities\Item && (
|
||||
is_user_logged_in() ||
|
||||
(
|
||||
\is_post_status_viewable( $item->get_status() ) &&
|
||||
\is_post_status_viewable( $item->get_collection()->get_status() )
|
||||
)
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
private function get_item_html($item, $search_meta_id, $display_metas) {
|
||||
$return = '';
|
||||
$id = $item->get_id();
|
||||
|
||||
if(!empty($display_metas) && is_array($display_metas) && count($display_metas) > 1) {
|
||||
$has_thumbnail = array_search('thumbnail', $display_metas);
|
||||
$thumbnail_id = false;
|
||||
if($has_thumbnail !== false) {
|
||||
unset($display_metas[$has_thumbnail]);
|
||||
$thumbnail_id = $item->get__thumbnail_id();
|
||||
}
|
||||
$args = ['post__in' => $display_metas];
|
||||
$metadatum = $item->get_metadata($args);
|
||||
|
||||
$metadata_value = [];
|
||||
foreach ( $metadatum as $item_meta_id => $item_meta ) {
|
||||
if ( $item_meta instanceof \Tainacan\Entities\Item_Metadata_Entity && $item_meta->get_value_as_html() != '' ) {
|
||||
$meta_id = $item_meta->get_metadatum()->get_id();
|
||||
$as_header = $search_meta_id == $meta_id ? $this->get_item_link($item, $search_meta_id) : false;
|
||||
$html = $this->get_meta_html($item_meta, $item, $as_header, $thumbnail_id);
|
||||
if($as_header === false) {
|
||||
$metadata_value[] = $html;
|
||||
} else {
|
||||
array_unshift($metadata_value, $html);
|
||||
}
|
||||
}
|
||||
$return = implode("\n", $metadata_value);
|
||||
}
|
||||
$return = "<div class='tainacan-relationship-metadatum' data-item-id='$id'>{$return}</div>";
|
||||
} else if ( $id && $search_meta_id ) {
|
||||
$as_link = $this->get_item_link($item, $search_meta_id);
|
||||
$return = "$as_link";
|
||||
}
|
||||
|
||||
return $return;
|
||||
}
|
||||
|
||||
private function get_item_html($item) {
|
||||
private function get_item_link($item, $search_meta_id) {
|
||||
$return = '';
|
||||
$id = $item->get_id();
|
||||
|
||||
$search_meta_id = $this->get_option('search');
|
||||
|
||||
if ( $id && $search_meta_id ) {
|
||||
$link = get_permalink( (int) $id );
|
||||
|
||||
$search_meta_id = $this->get_option('search');
|
||||
|
||||
$metadatum = \Tainacan\Repositories\Metadata::get_instance()->fetch((int) $search_meta_id);
|
||||
|
||||
$label = '';
|
||||
|
||||
if ($metadatum instanceof \Tainacan\Entities\Metadatum) {
|
||||
$item_meta = new \Tainacan\Entities\Item_Metadata_Entity($item, $metadatum);
|
||||
$label = $item_meta->get_value_as_string();
|
||||
}
|
||||
|
||||
if ( empty($label) ) {
|
||||
$label = $item->get_title();
|
||||
}
|
||||
|
||||
if (is_string($link)) {
|
||||
if ( is_user_logged_in() ||
|
||||
\is_post_status_viewable( $item->get_status() ) &&
|
||||
\is_post_status_viewable($item->get_collection()->get_status()) ) {
|
||||
$return = "<a data-linkto='item' data-id='$id' href='$link'>";
|
||||
$return.= $label;
|
||||
$return .= "</a>";
|
||||
} else {
|
||||
$return.= $label;
|
||||
}
|
||||
$link = get_permalink( (int) $id );
|
||||
$metadatum = \Tainacan\Repositories\Metadata::get_instance()->fetch((int) $search_meta_id);
|
||||
$value = '';
|
||||
if ($metadatum instanceof \Tainacan\Entities\Metadatum) {
|
||||
$item_meta = new \Tainacan\Entities\Item_Metadata_Entity($item, $metadatum);
|
||||
$value = $item_meta->get_value_as_string();
|
||||
}
|
||||
if ( empty($value) ) {
|
||||
$value = $item->get_title();
|
||||
}
|
||||
if (is_string($link)) {
|
||||
$return = "<a data-linkto='item' data-id='$id' href='$link'>$value</a>";
|
||||
}
|
||||
return $return;
|
||||
}
|
||||
|
||||
private function get_item_thumbnail($thumbnail_id, $item) {
|
||||
if($thumbnail_id !== false && !empty($thumbnail_id)){
|
||||
return \wp_get_attachment_image($thumbnail_id, 'tainacan-small');
|
||||
}
|
||||
$media_type = $item->get_document_mimetype();
|
||||
$placeholder_image = '<img src="' . \tainacan_get_the_mime_type_icon($media_type, 'tainacan-small') . '" />';
|
||||
return $placeholder_image;
|
||||
}
|
||||
|
||||
private function get_meta_html(\Tainacan\Entities\Item_Metadata_Entity $meta, \Tainacan\Entities\Item $item, $value_link = false, $thumbnail_id = false) {
|
||||
$html = '';
|
||||
if ($meta instanceof \Tainacan\Entities\Item_Metadata_Entity && !empty($meta->get_value_as_html())) {
|
||||
ob_start();
|
||||
if ($value_link) {
|
||||
?>
|
||||
<div class="tainacan-relationship-metadatum-header">
|
||||
<?php echo $this->get_item_thumbnail($thumbnail_id, $item); ?>
|
||||
<h4 class="label">
|
||||
<?php echo $value_link; ?>
|
||||
</h4>
|
||||
</div>
|
||||
<?php
|
||||
} else {
|
||||
?>
|
||||
<div class="tainacan-metadatum">
|
||||
<h5 class="label">
|
||||
<?php echo $meta->get_metadatum()->get_name(); ?>
|
||||
</h5>
|
||||
<p>
|
||||
<?php echo ($value_link === false ? $meta->get_value_as_html() : $value_link); ?>
|
||||
</p>
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
$html = ob_get_contents();
|
||||
ob_end_clean();
|
||||
}
|
||||
|
||||
return $return;
|
||||
return $html;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -1,9 +1,6 @@
|
|||
<template>
|
||||
<b-field
|
||||
:class="{
|
||||
'has-collapses-hidden': hideCollapses,
|
||||
'hightlighted-metadatum': isHighlightedMetadatum
|
||||
}"
|
||||
:class="metadatumFormClasses"
|
||||
:ref="isHighlightedMetadatum ? 'hightlighted-metadatum': 'null'"
|
||||
:addons="false"
|
||||
:message="errorMessage"
|
||||
|
@ -147,6 +144,13 @@
|
|||
isTextInputComponent() {
|
||||
const array = ['tainacan-relationship','tainacan-taxonomy', 'tainacan-compound', 'tainacan-user'];
|
||||
return !(array.indexOf(this.metadatumComponent) >= 0 );
|
||||
},
|
||||
metadatumFormClasses() {
|
||||
return '' +
|
||||
(this.hideCollapses ? ' has-collapses-hidden' : '') +
|
||||
(this.isHighlightedMetadatum ? ' hightlighted-metadatum' : '') +
|
||||
(this.metadatumComponent ? ' tainacan-metadatum-component--' + this.metadatumComponent : '') +
|
||||
(this.itemMetadatum && this.itemMetadatum.metadatum && this.itemMetadatum.metadatum.id ? ' tainacan-metadatum-id--' + this.itemMetadatum.metadatum.id : '');
|
||||
}
|
||||
},
|
||||
created() {
|
||||
|
|
|
@ -174,7 +174,7 @@
|
|||
|
||||
<style scoped>
|
||||
.add-new-term {
|
||||
margin: 6px 0;
|
||||
margin: 3px 0;
|
||||
font-size: 0.75em;
|
||||
}
|
||||
</style>
|
||||
|
|
|
@ -524,7 +524,7 @@ export default {
|
|||
|
||||
h4 {
|
||||
color: var(--tainacan-heading-color);
|
||||
font-size: 1em;
|
||||
font-size: 1em !important;
|
||||
font-weight: 500;
|
||||
padding: 0em 0.5em;
|
||||
margin: 0;
|
||||
|
|
|
@ -5,9 +5,7 @@
|
|||
animated
|
||||
@input="fetchSelectedLabels()"
|
||||
v-model="activeTab">
|
||||
<b-tab-item
|
||||
style="margin: 0 -0.75rem;"
|
||||
:label="isTaxonomy ? $i18n.get('label_all_terms') : $i18n.get('label_all_metadatum_values')">
|
||||
<b-tab-item :label="isTaxonomy ? $i18n.get('label_all_terms') : $i18n.get('label_all_metadatum_values')">
|
||||
|
||||
<!-- Search input -->
|
||||
<b-field class="is-clearfix tainacan-checkbox-search-section">
|
||||
|
@ -805,9 +803,9 @@
|
|||
display: none;
|
||||
visibility: hidden;
|
||||
}
|
||||
.tab-content {
|
||||
/deep/ .tab-content {
|
||||
transition: height 0.2s ease;
|
||||
padding: 0.5em 20px !important;
|
||||
padding: 0.5em 0px !important;
|
||||
}
|
||||
|
||||
// In theme, the bootstrap removes the style of <a> without href
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
<div class="tainacan-form">
|
||||
<div class="columns">
|
||||
|
||||
<div class="column is-7">
|
||||
<div class="column is-7">
|
||||
|
||||
<!-- Hook for extra Form options -->
|
||||
<template
|
||||
|
@ -173,11 +173,18 @@
|
|||
<div
|
||||
:class="{
|
||||
'metadata-type-textarea': itemMetadatum.metadatum.metadata_type_object.component == 'tainacan-textarea',
|
||||
'metadata-type-compound': itemMetadatum.metadatum.metadata_type_object.component == 'tainacan-compound'
|
||||
'metadata-type-compound': itemMetadatum.metadatum.metadata_type_object.component == 'tainacan-compound',
|
||||
'metadata-type-relationship': itemMetadatum.metadatum.metadata_type_object.component == 'tainacan-relationship'
|
||||
}"
|
||||
class="content">
|
||||
<component
|
||||
:is="itemMetadatum.metadatum.metadata_type_object.component == 'tainacan-compound' ? 'div' : 'p'"
|
||||
:is="
|
||||
itemMetadatum.metadatum.metadata_type_object.component == 'tainacan-compound' ||
|
||||
(itemMetadatum.metadatum.metadata_type_object.component == 'tainacan-relationship' &&
|
||||
itemMetadatum.metadatum.metadata_type_object.options &&
|
||||
itemMetadatum.metadatum.metadata_type_object.options.display_related_item_metadata &&
|
||||
itemMetadatum.metadatum.metadata_type_object.options.display_related_item_metadata.length > 1
|
||||
) ? 'div' : 'p'"
|
||||
v-html="itemMetadatum.value_as_html != '' ? itemMetadatum.value_as_html : `<p><span class='has-text-gray is-italic'>` + $i18n.get('label_value_not_provided') + `</span></p>`"/>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -348,8 +355,8 @@
|
|||
<!-- Hook for extra Form options -->
|
||||
<template
|
||||
v-if="formHooks != undefined &&
|
||||
formHooks['view-item'] != undefined &&
|
||||
formHooks['view-item']['end-left'] != undefined">
|
||||
formHooks['view-item'] != undefined &&
|
||||
formHooks['view-item']['end-left'] != undefined">
|
||||
<div
|
||||
id="view-item-end-left"
|
||||
class="form-hook-region"
|
||||
|
@ -658,6 +665,10 @@
|
|||
margin-right: 18px;
|
||||
}
|
||||
}
|
||||
p:empty {
|
||||
display: none;
|
||||
visibility: hidden;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -36,7 +36,7 @@ button.link-style:active {
|
|||
background: var(--tainacan-secondary) !important;
|
||||
color: var(--tainacan-white) !important;
|
||||
}
|
||||
&.is-primary, &:hover, &.is-primary:focus {
|
||||
&.is-primary, &.is-primary:hover, &.is-primary:focus {
|
||||
background: var(--tainacan-primary) !important;
|
||||
color: var(--tainacan-white) !important;
|
||||
}
|
||||
|
@ -47,6 +47,11 @@ button.link-style:active {
|
|||
&.is-white, &.is-white:hover, &.is-white:focus, &.is-outlined:hover, &.is-outlined:focus {
|
||||
background-color: transparent !important;
|
||||
}
|
||||
&.is-loading, &.is-loading:hover, &.is-loading:focus,
|
||||
&.is-loading.is-success, &.is-loading.is-success:hover, &.is-loading.is-success:focus,
|
||||
&.is-loading.is-secondary, &.is-loading.is-secondary:hover, &.is-loading.is-secondary:focus {
|
||||
color: transparent !important;
|
||||
}
|
||||
&:active {
|
||||
-webkit-transform: none !important;
|
||||
transform: none !important;
|
||||
|
@ -96,6 +101,7 @@ button.link-style:active {
|
|||
kbd {
|
||||
padding: 0.25rem 0.5rem 0.25rem 0.35rem;
|
||||
background: radial-gradient(var(--tainacan-white, #ffffff), var(--tainacan-gray1, #f2f2f2) );
|
||||
color: inherit;
|
||||
display: inline-block;
|
||||
position: relative;
|
||||
top: -0.15rem;
|
||||
|
|
|
@ -149,6 +149,11 @@
|
|||
background-color: transparent !important;
|
||||
color: var(--tainacan-black) !important;
|
||||
}
|
||||
.button.is-loading, .button.is-loading:hover, .button.is-loading:focus,
|
||||
.button.is-loading.is-success, .button.is-loading.is-success:hover, .button.is-loading.is-success:focus,
|
||||
.button.is-loading.is-secondary, .button.is-loading.is-secondary:hover, .button.is-loading.is-secondary:focus {
|
||||
color: transparent !important;
|
||||
}
|
||||
|
||||
a,
|
||||
a:hover,
|
||||
|
|
|
@ -20,6 +20,7 @@
|
|||
|
||||
h3 {
|
||||
font-size: 1em;
|
||||
padding-top: 0;
|
||||
color: var(--tainacan-heading-color);
|
||||
margin-bottom: 1em;
|
||||
}
|
||||
|
|
|
@ -29,7 +29,7 @@
|
|||
align-items: flex-end;
|
||||
|
||||
h1, h2 {
|
||||
font-size: 1.25em;
|
||||
font-size: 1.25em !important;
|
||||
font-weight: normal;
|
||||
font-weight: 500;
|
||||
color: var(--tainacan-heading-color);
|
||||
|
@ -39,12 +39,12 @@
|
|||
margin-bottom: 0px;
|
||||
margin: 0 auto 0 0;
|
||||
}
|
||||
a.back-link{
|
||||
a.back-link {
|
||||
font-weight: 500;
|
||||
float: right;
|
||||
margin-top: 5px;
|
||||
}
|
||||
hr{
|
||||
hr {
|
||||
margin: 3px 0 4px 0;
|
||||
height: 1px;
|
||||
background-color: var(--tainacan-secondary);
|
||||
|
|
|
@ -229,7 +229,7 @@
|
|||
.tainacan-compound-metadatum .label {
|
||||
text-align: left;
|
||||
margin-bottom: 0.25em;
|
||||
font-size: 1em;
|
||||
font-size: 1em !important;
|
||||
color: var(--tainacan-info-color);
|
||||
}
|
||||
.tainacan-compound-metadatum p {
|
||||
|
@ -246,6 +246,49 @@
|
|||
color: transparent;
|
||||
margin: 1em auto 1em -0.875em;
|
||||
}
|
||||
|
||||
}
|
||||
.tainacan-relationship-group {
|
||||
text-align: left;
|
||||
.tainacan-relationship-metadatum {
|
||||
text-align: left;
|
||||
.tainacan-relationship-metadatum-header {
|
||||
text-align: left;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
img {
|
||||
margin-right: 12px;
|
||||
max-width: 28px;
|
||||
max-height: 28px;
|
||||
}
|
||||
.label {
|
||||
font-weight: normal;
|
||||
font-size: 1em !important;
|
||||
margin-top: 0;
|
||||
margin-left: 0;
|
||||
margin-bottom: 0;
|
||||
margin-right: 0;
|
||||
}
|
||||
}
|
||||
.tainacan-metadatum {
|
||||
text-align: left;
|
||||
margin-left: 40px;
|
||||
.label {
|
||||
color: var(--tainacan-gray4);
|
||||
font-size: 1em !important;
|
||||
line-height: 1em;
|
||||
margin-top: 8px;
|
||||
margin-bottom: 2px;
|
||||
}
|
||||
}
|
||||
}
|
||||
&>.multivalue-separator {
|
||||
display: block;
|
||||
max-height: 1px;
|
||||
width: calc(100% - 40px);
|
||||
background: var(--tainacan-gray2);
|
||||
content: none;
|
||||
color: transparent;
|
||||
margin: 0.5em 0 0.5em 40px;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -196,6 +196,7 @@ a:hover {
|
|||
}
|
||||
}
|
||||
|
||||
// Inside one of the view modes
|
||||
.metadata-value {
|
||||
.tainacan-compound-group {
|
||||
margin-left: 2px;
|
||||
|
@ -220,9 +221,29 @@ a:hover {
|
|||
color: transparent;
|
||||
margin: 1em auto 1em -0.875em;
|
||||
}
|
||||
|
||||
}
|
||||
.tainacan-relationship-group {
|
||||
.tainacan-relationship-metadatum {
|
||||
.tainacan-relationship-metadatum-header {
|
||||
.label {
|
||||
font-size: 1em;
|
||||
}
|
||||
img {
|
||||
max-width: 22px;
|
||||
max-height: 22px;
|
||||
}
|
||||
}
|
||||
.tainacan-metadatum {
|
||||
margin-left: 40px;
|
||||
font-size: 1.125em;
|
||||
&>*{
|
||||
font-size: 0.875em;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// Inside the admin item page
|
||||
.metadata-type-textarea,
|
||||
.metadata-type-compound {
|
||||
.multivalue-separator {
|
||||
|
@ -251,6 +272,44 @@ a:hover {
|
|||
}
|
||||
}
|
||||
}
|
||||
.tainacan-relationship-group {
|
||||
.tainacan-relationship-metadatum {
|
||||
.tainacan-relationship-metadatum-header {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
img {
|
||||
margin-right: 12px;
|
||||
max-width: 28px;
|
||||
max-height: 28px;
|
||||
}
|
||||
.label {
|
||||
font-weight: normal;
|
||||
margin-top: 0;
|
||||
margin-left: 0;
|
||||
margin-bottom: 0;
|
||||
margin-right: 0;
|
||||
}
|
||||
}
|
||||
.tainacan-metadatum {
|
||||
margin-left: 40px;
|
||||
.label {
|
||||
font-size: 0.8125em;
|
||||
line-height: 1em;
|
||||
margin-top: 8px;
|
||||
margin-bottom: 2px;
|
||||
}
|
||||
}
|
||||
}
|
||||
&>.multivalue-separator {
|
||||
display: block;
|
||||
max-height: 1px;
|
||||
width: calc(100% - 40px);
|
||||
background: var(--tainacan-gray2);
|
||||
content: none;
|
||||
color: transparent;
|
||||
margin: 0.5em 0 0.5em 40px;
|
||||
}
|
||||
}
|
||||
.taginput-container .input:hover {
|
||||
border: none !important;
|
||||
}
|
||||
|
|
|
@ -25,6 +25,7 @@ import TainacanFormItem from '../../../admin/components/metadata-types/tainacan-
|
|||
import HelpButton from '../../../admin/components/other/help-button.vue';
|
||||
import store from '../../../admin/js/store/store';
|
||||
import { I18NPlugin, UserPrefsPlugin, RouterHelperPlugin, ConsolePlugin, StatusHelperPlugin, CommentsStatusHelperPlugin } from '../../../admin/js/admin-utilities';
|
||||
import { ThumbnailHelperPlugin } from '../../../admin/js/utilities';
|
||||
|
||||
export default (element) => {
|
||||
function renderItemSubmissionForm() {
|
||||
|
@ -56,6 +57,7 @@ export default (element) => {
|
|||
Vue.use(ConsolePlugin, {visual: false});
|
||||
Vue.use(VueTheMask);
|
||||
Vue.use(CommentsStatusHelperPlugin);
|
||||
Vue.use(ThumbnailHelperPlugin);
|
||||
|
||||
/* Registers Extra Vue Components passed to the window.tainacan_extra_components */
|
||||
if (typeof window.tainacan_extra_components != "undefined") {
|
||||
|
|
|
@ -79,7 +79,9 @@ $pswp__include-minimal-style: true !default;
|
|||
|
||||
.swiper-slide-metadata {
|
||||
text-align: center;
|
||||
|
||||
font-size: 0.875em;
|
||||
margin-bottom: 1em;
|
||||
|
||||
&.hide-name .swiper-slide-metadata__name {
|
||||
display: none;
|
||||
visibility: hidden;
|
||||
|
|
|
@ -225,6 +225,7 @@ return apply_filters( 'tainacan-admin-i18n', [
|
|||
'label_taxonomy_allow_new_terms' => __( 'Allow new terms', 'tainacan' ),
|
||||
'label_selectbox_init' => __( 'Select', 'tainacan' ),
|
||||
'label_insert_options' => __( 'Insert options', 'tainacan'),
|
||||
'label_insert_items' => __( 'Insert items', 'tainacan'),
|
||||
'label_available_terms' => __( 'Available terms', 'tainacan' ),
|
||||
'label_some_available_terms' => __( 'Some available terms', 'tainacan' ),
|
||||
'label_attachments' => __( 'Attachments', 'tainacan' ),
|
||||
|
@ -410,6 +411,8 @@ return apply_filters( 'tainacan-admin-i18n', [
|
|||
'label_all_terms' => __( 'All terms', 'tainacan' ),
|
||||
'label_selected_terms' => __( 'Selected terms', 'tainacan' ),
|
||||
'label_selected_term' => __( 'Selected term', 'tainacan' ),
|
||||
'label_selected_items' => __( 'Selected items', 'tainacan' ),
|
||||
'label_selected_item' => __( 'Selected item', 'tainacan' ),
|
||||
'label_all_metadatum_values' => __( 'All metadatum values', 'tainacan' ),
|
||||
'label_selected_metadatum_values' => __( 'Selected metadatum values', 'tainacan' ),
|
||||
/* translators: 'n.' here comes from 'number' */
|
||||
|
|
|
@ -1251,7 +1251,7 @@
|
|||
margin-bottom: 40px;
|
||||
|
||||
h1, h2 {
|
||||
font-size: 1.25em;
|
||||
font-size: 1.25em !important;
|
||||
font-weight: 500;
|
||||
color: var(--tainacan-heading-color);
|
||||
display: inline-block;
|
||||
|
|
|
@ -90,7 +90,7 @@
|
|||
}
|
||||
|
||||
h3 {
|
||||
font-size: 100%;
|
||||
font-size: 100% !important;
|
||||
margin-top: 0px;
|
||||
}
|
||||
|
||||
|
@ -117,7 +117,7 @@
|
|||
|
||||
.label {
|
||||
cursor: pointer;
|
||||
font-size: 0.875em;
|
||||
font-size: 0.875em !important;
|
||||
font-weight: 500;
|
||||
margin-bottom: 0.75em !important;
|
||||
display: inline-flex;
|
||||
|
|
|
@ -185,6 +185,39 @@ export default {
|
|||
}
|
||||
}
|
||||
|
||||
.tainacan-table {
|
||||
.tainacan-relationship-group {
|
||||
.tainacan-relationship-metadatum {
|
||||
display: inline-block;
|
||||
.tainacan-relationship-metadatum-header {
|
||||
img {
|
||||
display: none;
|
||||
}
|
||||
.label {
|
||||
font-weight: normal;
|
||||
font-size: 1em !important;
|
||||
margin-top: 0;
|
||||
margin-left: 0;
|
||||
margin-bottom: 0;
|
||||
margin-right: 0;
|
||||
padding: 0;
|
||||
}
|
||||
}
|
||||
.tainacan-metadatum {
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
&>.multivalue-separator {
|
||||
display: inline-block;
|
||||
max-height: 100%;
|
||||
width: 1px;
|
||||
background: var(--tainacan-gray2);
|
||||
content: none;
|
||||
color: transparent;
|
||||
margin: 0 6px;
|
||||
}
|
||||
}
|
||||
}
|
||||
.column-large-width {
|
||||
.tainacan-compound-group {
|
||||
display: inline-block;
|
||||
|
@ -199,7 +232,8 @@ export default {
|
|||
display: inline-block;
|
||||
}
|
||||
.label {
|
||||
font-size: 1em;
|
||||
font-size: 1em !important;
|
||||
padding: 0;
|
||||
color: var(--tainacan-info-color);
|
||||
&:not(:first-child)::before {
|
||||
content: ', ';
|
||||
|
@ -225,7 +259,6 @@ export default {
|
|||
}
|
||||
}
|
||||
.metadata-value {
|
||||
|
||||
.tainacan-compound-group {
|
||||
margin-left: 2px;
|
||||
padding-left: 0.875em;
|
||||
|
@ -233,7 +266,7 @@ export default {
|
|||
|
||||
.tainacan-compound-metadatum .label {
|
||||
margin-bottom: 0.25em;
|
||||
font-size: 1em;
|
||||
font-size: 1em !important;
|
||||
color: var(--tainacan-info-color);
|
||||
}
|
||||
.tainacan-compound-metadatum p {
|
||||
|
@ -249,7 +282,46 @@ export default {
|
|||
color: transparent;
|
||||
margin: 1em auto 1em -0.875em;
|
||||
}
|
||||
|
||||
}
|
||||
.tainacan-relationship-group {
|
||||
.tainacan-relationship-metadatum {
|
||||
.tainacan-relationship-metadatum-header {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
img {
|
||||
margin-right: 12px;
|
||||
max-width: 22px;
|
||||
max-height: 22px;
|
||||
}
|
||||
.label {
|
||||
font-weight: normal;
|
||||
font-size: 1em !important;
|
||||
margin-top: 0;
|
||||
margin-left: 0;
|
||||
margin-bottom: 0;
|
||||
margin-right: 0;
|
||||
}
|
||||
}
|
||||
.tainacan-metadatum {
|
||||
margin-left: 40px;
|
||||
.label {
|
||||
color: var(--tainacan-gray4);
|
||||
font-size: 1em !important;
|
||||
line-height: 1em;
|
||||
margin-top: 8px;
|
||||
margin-bottom: 2px;
|
||||
}
|
||||
}
|
||||
}
|
||||
&>.multivalue-separator {
|
||||
display: block;
|
||||
max-height: 1px;
|
||||
width: calc(100% - 40px);
|
||||
background: var(--tainacan-gray2);
|
||||
content: none;
|
||||
color: transparent;
|
||||
margin: 0.5em 0 0.5em 40px;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue