Update requests with query string in Vue JS api client and Items Grid Gutenberg Block to the new shorter URLs format. (#93)
This commit is contained in:
parent
e739385118
commit
e63fc6b8eb
|
@ -103,6 +103,7 @@
|
|||
margin: 94px auto 0 auto;
|
||||
position: relative;
|
||||
overflow-y: hidden;
|
||||
overflow-x: hidden;
|
||||
height: calc(100% - 94px);
|
||||
|
||||
@media screen and (max-width: 769px) {
|
||||
|
|
|
@ -4,15 +4,7 @@
|
|||
:is-full-page="false"
|
||||
:active.sync="isLoading"
|
||||
:can-cancel="false"/>
|
||||
<button
|
||||
id="metadata-column-compress-button"
|
||||
@click="isMetadataColumnCompressed = !isMetadataColumnCompressed">
|
||||
<span class="icon">
|
||||
<i
|
||||
:class="{ 'tainacan-icon-arrowleft' : isMetadataColumnCompressed, 'tainacan-icon-arrowright' : !isMetadataColumnCompressed }"
|
||||
class="tainacan-icon tainacan-icon-20px"/>
|
||||
</span>
|
||||
</button>
|
||||
|
||||
<div class="tainacan-page-title">
|
||||
<h1 v-if="isCreatingNewItem">
|
||||
<span
|
||||
|
@ -43,9 +35,7 @@
|
|||
class="tainacan-form"
|
||||
label-width="120px">
|
||||
<div class="columns">
|
||||
<div
|
||||
:class="{ 'is-12': isMetadataColumnCompressed, 'is-5-5': !isMetadataColumnCompressed }"
|
||||
class="column">
|
||||
<div class="column is-5">
|
||||
|
||||
<!-- Hook for extra Form options -->
|
||||
<template
|
||||
|
@ -360,9 +350,7 @@
|
|||
</template>
|
||||
|
||||
</div>
|
||||
<div
|
||||
class="column is-4-5"
|
||||
v-show="!isMetadataColumnCompressed">
|
||||
<div class="column is-7">
|
||||
|
||||
<!-- Hook for extra Form options -->
|
||||
<template
|
||||
|
@ -658,7 +646,6 @@ export default {
|
|||
isOnSequenceEdit: false,
|
||||
sequenceRightDirection: false,
|
||||
isLoading: false,
|
||||
isMetadataColumnCompressed: false,
|
||||
metadatumCollapses: [],
|
||||
collapseAll: true,
|
||||
visibility: 'publish',
|
||||
|
@ -810,7 +797,7 @@ export default {
|
|||
|
||||
this.isLoading = false;
|
||||
|
||||
if (!this.isOnSequenceEdit) {
|
||||
if (!this.isOnSequenceEdit) {
|
||||
if (this.form.status != 'trash')
|
||||
this.$router.push(this.$routerHelper.getItemPath(this.form.collectionId, this.itemId));
|
||||
else
|
||||
|
@ -958,11 +945,8 @@ export default {
|
|||
});
|
||||
},
|
||||
deleteAttachment(attachment) {
|
||||
console.log(attachment)
|
||||
this.removeAttachmentFromItem(attachment.id)
|
||||
.then(() => {
|
||||
console.log(this.attachmentsList)
|
||||
})
|
||||
.then(() => { })
|
||||
.catch((error) => {
|
||||
this.$console.error(error);
|
||||
});
|
||||
|
@ -1217,28 +1201,6 @@ export default {
|
|||
|
||||
@import '../../scss/_variables.scss';
|
||||
|
||||
#metadata-column-compress-button {
|
||||
position: absolute;
|
||||
z-index: 99;
|
||||
right: 0;
|
||||
top: 148px;
|
||||
max-width: 36px;
|
||||
height: 36px;
|
||||
width: 36px;
|
||||
border: none;
|
||||
background-color: $gray2;
|
||||
color: $secondary;
|
||||
padding: 0px;
|
||||
border-top-left-radius: 2px;
|
||||
border-bottom-left-radius: 2px;
|
||||
cursor: pointer;
|
||||
|
||||
.icon {
|
||||
margin-top: 2px;
|
||||
margin-right: 8px;
|
||||
}
|
||||
}
|
||||
|
||||
.page-container {
|
||||
padding: 25px 0px;
|
||||
|
||||
|
@ -1290,32 +1252,24 @@ export default {
|
|||
}
|
||||
}
|
||||
|
||||
.column.is-12 {
|
||||
.column.is-5 {
|
||||
padding-left: $page-side-padding;
|
||||
padding-right: $page-side-padding;
|
||||
}
|
||||
|
||||
.column.is-5-5 {
|
||||
max-width: 55%;
|
||||
padding-left: $page-side-padding;
|
||||
padding-right: $page-side-padding;
|
||||
transition: width 0.6s;
|
||||
|
||||
@media screen and (max-width: 769px) {
|
||||
max-width: 100%;
|
||||
}
|
||||
}
|
||||
.column.is-4-5 {
|
||||
max-width: 45%;
|
||||
padding-left: $page-side-padding;
|
||||
.column.is-7 {
|
||||
padding-left: 0;
|
||||
padding-right: $page-side-padding;
|
||||
transition: all 0.6s;
|
||||
|
||||
.field {
|
||||
padding: 10px 0px 10px 60px;
|
||||
}
|
||||
|
||||
@media screen and (max-width: 769px) {
|
||||
padding-left: $page-side-padding;
|
||||
max-width: 100%;
|
||||
}
|
||||
|
||||
|
@ -1406,14 +1360,12 @@ export default {
|
|||
|
||||
.file-item-control {
|
||||
position: absolute;
|
||||
background-color: $gray2;
|
||||
background-color: $gray1;
|
||||
width: 112px;
|
||||
margin: 15px;
|
||||
bottom: 0px;
|
||||
padding: 2px 8px 4px 8px;
|
||||
text-align: right;
|
||||
border-bottom-right-radius: 5px;
|
||||
border-bottom-left-radius: 5px;
|
||||
display: none;
|
||||
visibility: hidden;
|
||||
opacity: 0;
|
||||
|
@ -1447,7 +1399,7 @@ export default {
|
|||
min-width: 30px !important;
|
||||
padding: 0 !important;
|
||||
z-index: 99;
|
||||
margin-left: 10px !important;
|
||||
margin-left: 12px !important;
|
||||
|
||||
.icon {
|
||||
display: inherit;
|
||||
|
|
|
@ -55,7 +55,7 @@
|
|||
type="checkbox">
|
||||
<span class="check" />
|
||||
<span class="control-label">
|
||||
<span class="checkbox-label-text">{{ `${ limitChars(option.label) }` }}</span>
|
||||
<span class="checkbox-label-text">{{ `${ (option.label? limitChars(option.label) : '') }` }}</span>
|
||||
<span
|
||||
v-if="isFilter && option.total_items != undefined"
|
||||
class="has-text-gray"> {{ "(" + option.total_items + ")" }}</span>
|
||||
|
@ -217,7 +217,7 @@
|
|||
type="checkbox">
|
||||
<span class="check" />
|
||||
<span class="control-label">
|
||||
<span class="checkbox-label-text">{{ `${ option.name ? limitChars(option.name) : limitChars(option.label) }` }}</span>
|
||||
<span class="checkbox-label-text">{{ `${ option.name ? limitChars(option.name) : (option.label ? limitChars(option.label) : '') }` }}</span>
|
||||
<span
|
||||
v-if="isFilter && option.total_items != undefined"
|
||||
class="has-text-gray">
|
||||
|
@ -229,7 +229,7 @@
|
|||
v-else
|
||||
v-model="selected"
|
||||
:native-value="option.id ? (isNaN(Number(option.id)) ? option.id : Number(option.value)) : (isNaN(Number(option.value)) ? option.value : Number(option.value))">
|
||||
{{ `${ option.name ? limitChars(option.name) : limitChars(option.label) }` }}
|
||||
{{ `${ option.name ? limitChars(option.name) : (option.label ? limitChars(option.label) : '') }` }}
|
||||
<span
|
||||
v-if="isFilter && option.total_items != undefined"
|
||||
class="has-text-gray">
|
||||
|
@ -369,10 +369,9 @@
|
|||
}
|
||||
},
|
||||
limitChars(label){
|
||||
if(label.length > this.maxTextToShow){
|
||||
if (label.length > this.maxTextToShow){
|
||||
return label.slice(0, this.maxTextToShow)+'...';
|
||||
}
|
||||
|
||||
return label;
|
||||
},
|
||||
beforePage(){
|
||||
|
|
|
@ -7,7 +7,6 @@
|
|||
:style="{ 'max-width': size != undefined ? size + 'px' : '112px' }"
|
||||
v-if="showName && file.title != undefined">{{ file.title.rendered }}</figcaption>
|
||||
<div
|
||||
:class="{ 'rounded': showName }"
|
||||
:style="{ 'width': size != undefined ? size + 'px' : '112px', 'height': size != undefined ? size + 'px' : '112px' }"
|
||||
class="image-wrapper">
|
||||
<div
|
||||
|
@ -100,17 +99,15 @@ export default {
|
|||
.image, .file-placeholder {
|
||||
transform: scale(1.05);
|
||||
}
|
||||
figcaption {
|
||||
background-color: $gray1;
|
||||
}
|
||||
}
|
||||
.image-wrapper {
|
||||
overflow: hidden;
|
||||
position: relative;
|
||||
display: inline-block;
|
||||
|
||||
&.rounded {
|
||||
border-bottom-left-radius: 5px;
|
||||
border-bottom-right-radius: 5px;
|
||||
}
|
||||
|
||||
.image {
|
||||
height: 100%;
|
||||
width: 100%;
|
||||
|
@ -138,9 +135,7 @@ export default {
|
|||
}
|
||||
|
||||
figcaption {
|
||||
background-color: $gray1;
|
||||
border-top-left-radius: 5px;
|
||||
border-top-right-radius: 5px;
|
||||
background-color: white;
|
||||
padding: 8px 15px;
|
||||
font-size: 9px;
|
||||
width: 100%;
|
||||
|
|
|
@ -4,20 +4,12 @@
|
|||
<b-loading
|
||||
:active.sync="isLoading"
|
||||
:can-cancel="false"/>
|
||||
<button
|
||||
id="metadata-column-compress-button"
|
||||
@click="isMetadataColumnCompressed = !isMetadataColumnCompressed">
|
||||
<span class="icon">
|
||||
<i
|
||||
:class="{ 'tainacan-icon-arrowleft' : isMetadataColumnCompressed, 'tainacan-icon-arrowright' : !isMetadataColumnCompressed }"
|
||||
class="tainacan-icon tainacan-icon-20px"/>
|
||||
</span>
|
||||
</button>
|
||||
|
||||
<div class="tainacan-page-title">
|
||||
<h1>
|
||||
<span
|
||||
v-if="(item != null && item != undefined && item.status != undefined && !isLoading)"
|
||||
class="status-tag">{{ $i18n.get(item.status) }}</span>
|
||||
<span
|
||||
v-if="(item != null && item != undefined && item.status != undefined && !isLoading)"
|
||||
class="status-tag">{{ $i18n.get(item.status) }}</span>
|
||||
{{ $i18n.get('title_item_page') + ' ' }}
|
||||
<span style="font-weight: 600;">{{ (item != null && item != undefined) ? item.title : '' }}</span>
|
||||
</h1>
|
||||
|
@ -30,15 +22,13 @@
|
|||
</div>
|
||||
<div class="tainacan-form">
|
||||
<div class="columns">
|
||||
<div
|
||||
:class="{ 'is-12': isMetadataColumnCompressed, 'is-5-5': !isMetadataColumnCompressed }"
|
||||
class="column">
|
||||
<div class="column is-5">
|
||||
|
||||
<!-- Hook for extra Form options -->
|
||||
<template
|
||||
v-if="formHooks != undefined &&
|
||||
formHooks['view-item'] != undefined &&
|
||||
formHooks['view-item']['begin-left'] != undefined">
|
||||
formHooks['view-item'] != undefined &&
|
||||
formHooks['view-item']['begin-left'] != undefined">
|
||||
<div
|
||||
id="view-item-begin-left"
|
||||
v-html="formHooks['view-item']['begin-left'].join('')"/>
|
||||
|
@ -53,8 +43,8 @@
|
|||
<div class="section-box">
|
||||
<div
|
||||
v-if="item.document !== undefined && item.document !== null &&
|
||||
item.document_type !== undefined && item.document_type !== null &&
|
||||
item.document !== '' && item.document_type !== 'empty'">
|
||||
item.document_type !== undefined && item.document_type !== null &&
|
||||
item.document !== '' && item.document_type !== 'empty'">
|
||||
|
||||
<div v-if="item.document_type === 'attachment'">
|
||||
<!-- <div v-html="item.document_as_html"/> -->
|
||||
|
@ -85,10 +75,10 @@
|
|||
:show-name="false"
|
||||
:size="178"
|
||||
:file="{
|
||||
media_type: 'image',
|
||||
guid: { rendered: item.thumbnail['tainacan-medium'] ? item.thumbnail['tainacan-medium'][0] : item.thumbnail.medium[0] },
|
||||
title: { rendered: $i18n.get('label_thumbnail')},
|
||||
description: { rendered: `<img alt='Thumbnail' src='` + item.thumbnail.full[0] + `'/>` }}"/>
|
||||
media_type: 'image',
|
||||
guid: { rendered: item.thumbnail['tainacan-medium'] ? item.thumbnail['tainacan-medium'][0] : item.thumbnail.medium[0] },
|
||||
title: { rendered: $i18n.get('label_thumbnail')},
|
||||
description: { rendered: `<img alt='Thumbnail' src='` + item.thumbnail.full[0] + `'/>` }}"/>
|
||||
<figure
|
||||
v-if="item.thumbnail == undefined || ((item.thumbnail.medium == undefined || item.thumbnail.medium == false) && (item.thumbnail['tainacan-medium'] == undefined || item.thumbnail['tainacan-medium'] == false))"
|
||||
class="image">
|
||||
|
@ -131,7 +121,7 @@
|
|||
disabled/>
|
||||
</b-field>
|
||||
<!-- Exposers --------------------------------------------- -->
|
||||
<div>
|
||||
<!-- <div>
|
||||
<b-loading :active.sync="isLoadingMetadatumMappers"/>
|
||||
<div v-if="!isLoadingMetadatumMappers">
|
||||
<b-collapse :open="false">
|
||||
|
@ -142,10 +132,10 @@
|
|||
<label>
|
||||
{{ $i18n.get('label_exposer_urls') }}
|
||||
<span class="icon">
|
||||
<i
|
||||
:class="{ 'tainacan-icon-arrowdown' : session_props.open, 'tainacan-icon-arrowright' : !session_props.open }"
|
||||
class="has-text-secondary tainacan-icon tainacan-icon-20px"/>
|
||||
</span>
|
||||
<i
|
||||
:class="{ 'tainacan-icon-arrowdown' : session_props.open, 'tainacan-icon-arrowright' : !session_props.open }"
|
||||
class="has-text-secondary tainacan-icon tainacan-icon-20px"/>
|
||||
</span>
|
||||
</label>
|
||||
</div>
|
||||
<br>
|
||||
|
@ -155,10 +145,10 @@
|
|||
{{ urls_open ? $i18n.get('label_collapse_all') :
|
||||
$i18n.get('label_expand_all') }}
|
||||
<span class="icon">
|
||||
<i
|
||||
:class="{ 'tainacan-icon-arrowdown' : urls_open, 'tainacan-icon-arrowright' : !urls_open }"
|
||||
class="has-text-secondary tainacan-icon tainacan-icon-20px"/>
|
||||
</span>
|
||||
<i
|
||||
:class="{ 'tainacan-icon-arrowdown' : urls_open, 'tainacan-icon-arrowright' : !urls_open }"
|
||||
class="has-text-secondary tainacan-icon tainacan-icon-20px"/>
|
||||
</span>
|
||||
</a>
|
||||
<div>
|
||||
<div
|
||||
|
@ -170,11 +160,11 @@
|
|||
class="label"
|
||||
slot="trigger"
|
||||
slot-scope="props">
|
||||
<span class="icon">
|
||||
<i
|
||||
:class="{ 'tainacan-icon-arrowdown' : props.open, 'tainacan-icon-arrowright' : !props.open }"
|
||||
class="has-text-secondary tainacan-icon tainacan-icon-20px"/>
|
||||
</span>
|
||||
<span class="icon">
|
||||
<i
|
||||
:class="{ 'tainacan-icon-arrowdown' : props.open, 'tainacan-icon-arrowright' : !props.open }"
|
||||
class="has-text-secondary tainacan-icon tainacan-icon-20px"/>
|
||||
</span>
|
||||
{{ index }}
|
||||
</label>
|
||||
<div
|
||||
|
@ -193,130 +183,119 @@
|
|||
</div>
|
||||
</b-collapse>
|
||||
</div>
|
||||
</div>
|
||||
</div> -->
|
||||
|
||||
<!-- 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"
|
||||
v-html="formHooks['view-item']['end-left'].join('')"/>
|
||||
</template>
|
||||
|
||||
</div>
|
||||
<!--<b-tabs v-model="activeTab">-->
|
||||
<!--<b-tab-item-->
|
||||
<!--style="margin: 0 -1rem 0 -1rem !important;"-->
|
||||
<!--:label="$i18n.get('title_item_page')">-->
|
||||
<div class="column is-7">
|
||||
|
||||
<!-- Hook for extra Form options -->
|
||||
<template
|
||||
v-if="formHooks != undefined &&
|
||||
formHooks['view-item'] != undefined &&
|
||||
formHooks['view-item']['begin-right'] != undefined">
|
||||
<div
|
||||
v-show="!isMetadataColumnCompressed"
|
||||
class="column is-4-5">
|
||||
id="view-item-begin-right"
|
||||
v-html="formHooks['view-item']['begin-right'].join('')"/>
|
||||
</template>
|
||||
|
||||
<!-- Hook for extra Form options -->
|
||||
<template
|
||||
v-if="formHooks != undefined &&
|
||||
formHooks['view-item'] != undefined &&
|
||||
formHooks['view-item']['begin-right'] != undefined">
|
||||
<div
|
||||
id="view-item-begin-right"
|
||||
v-html="formHooks['view-item']['begin-right'].join('')"/>
|
||||
</template>
|
||||
|
||||
<!-- Visibility (status public or private) -------------------------------- -->
|
||||
<div class="section-label">
|
||||
<label>{{ $i18n.get('label_visibility') }}</label>
|
||||
</div>
|
||||
<div class="section-status">
|
||||
<div class="field has-addons">
|
||||
<span v-if="item.status != 'private'">
|
||||
<span class="icon">
|
||||
<i class="tainacan-icon tainacan-icon-public"/>
|
||||
</span> {{ $i18n.get('publish_visibility') }}
|
||||
</span>
|
||||
<span v-if="item.status == 'private'">
|
||||
<span class="icon">
|
||||
<i class="tainacan-icon tainacan-icon-private"/>
|
||||
</span> {{ $i18n.get('private_visibility') }}
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Collection -------------------------------- -->
|
||||
<div class="section-label">
|
||||
<label>{{ $i18n.get('collection') }}</label>
|
||||
</div>
|
||||
<div class="section-status">
|
||||
<div class="field has-addons">
|
||||
<span>
|
||||
{{ collectionName }}
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<!-- Metadata -------------------------------- -->
|
||||
<div class="section-label">
|
||||
<label>{{ $i18n.get('metadata') }}</label>
|
||||
</div>
|
||||
<br>
|
||||
<a
|
||||
class="collapse-all"
|
||||
@click="open = !open">
|
||||
{{ open ? $i18n.get('label_collapse_all') : $i18n.get('label_expand_all') }}
|
||||
<span class="icon">
|
||||
<i
|
||||
:class="{ 'tainacan-icon-arrowdown' : open, 'tainacan-icon-arrowright' : !open }"
|
||||
class="has-text-secondary tainacan-icon tainacan-icon-20px"/>
|
||||
</span>
|
||||
</a>
|
||||
<div>
|
||||
<div
|
||||
v-for="(metadatum, index) of metadatumList"
|
||||
:key="index"
|
||||
class="field">
|
||||
<b-collapse :open="open">
|
||||
<label
|
||||
class="label"
|
||||
slot="trigger"
|
||||
slot-scope="props">
|
||||
<span class="icon">
|
||||
<i
|
||||
:class="{ 'tainacan-icon-arrowdown' : props.open, 'tainacan-icon-arrowright' : !props.open }"
|
||||
class="has-text-secondary tainacan-icon tainacan-icon-20px"/>
|
||||
</span>
|
||||
{{ metadatum.metadatum.name }}
|
||||
</label>
|
||||
<div
|
||||
v-if="metadatum.date_i18n"
|
||||
class="content">
|
||||
<p v-html="metadatum.date_i18n != '' ? metadatum.date_i18n : `<span class='has-text-gray is-italic'>` + $i18n.get('label_value_not_informed') + `</span>`"/>
|
||||
</div>
|
||||
<div
|
||||
v-else
|
||||
class="content">
|
||||
<p v-html="metadatum.value_as_html != '' ? metadatum.value_as_html : `<span class='has-text-gray is-italic'>` + $i18n.get('label_value_not_informed') + `</span>`"/>
|
||||
</div>
|
||||
</b-collapse>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Hook for extra Form options -->
|
||||
<template
|
||||
v-if="formHooks != undefined &&
|
||||
formHooks['view-item'] != undefined &&
|
||||
formHooks['view-item']['end-right'] != undefined">
|
||||
<div
|
||||
id="view-item-end-right"
|
||||
v-html="formHooks['view-item']['end-right'].join('')"/>
|
||||
</template>
|
||||
<!-- Visibility (status public or private) -------------------------------- -->
|
||||
<div class="section-label">
|
||||
<label>{{ $i18n.get('label_visibility') }}</label>
|
||||
</div>
|
||||
<div class="section-status">
|
||||
<div class="field has-addons">
|
||||
<span v-if="item.status != 'private'">
|
||||
<span class="icon">
|
||||
<i class="tainacan-icon tainacan-icon-public"/>
|
||||
</span> {{ $i18n.get('publish_visibility') }}
|
||||
</span>
|
||||
<span v-if="item.status == 'private'">
|
||||
<span class="icon">
|
||||
<i class="tainacan-icon tainacan-icon-private"/>
|
||||
</span> {{ $i18n.get('private_visibility') }}
|
||||
</span>
|
||||
</div>
|
||||
<!--</b-tab-item>-->
|
||||
<!--<b-tab-item :label="$i18n.get('activities')">-->
|
||||
<!--<activites-page/>-->
|
||||
<!--</b-tab-item>-->
|
||||
<!--</b-tabs>-->
|
||||
</div>
|
||||
|
||||
<!-- Collection -------------------------------- -->
|
||||
<div class="section-label">
|
||||
<label>{{ $i18n.get('collection') }}</label>
|
||||
</div>
|
||||
<div class="section-status">
|
||||
<div class="field has-addons">
|
||||
<span>
|
||||
{{ collectionName }}
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<!-- Metadata -------------------------------- -->
|
||||
<div class="section-label">
|
||||
<label>{{ $i18n.get('metadata') }}</label>
|
||||
</div>
|
||||
<br>
|
||||
<a
|
||||
class="collapse-all"
|
||||
@click="open = !open">
|
||||
{{ open ? $i18n.get('label_collapse_all') : $i18n.get('label_expand_all') }}
|
||||
<span class="icon">
|
||||
<i
|
||||
:class="{ 'tainacan-icon-arrowdown' : open, 'tainacan-icon-arrowright' : !open }"
|
||||
class="has-text-secondary tainacan-icon tainacan-icon-20px"/>
|
||||
</span>
|
||||
</a>
|
||||
<div>
|
||||
<div
|
||||
v-for="(metadatum, index) of metadatumList"
|
||||
:key="index"
|
||||
class="field">
|
||||
<b-collapse :open="open">
|
||||
<label
|
||||
class="label"
|
||||
slot="trigger"
|
||||
slot-scope="props">
|
||||
<span class="icon">
|
||||
<i
|
||||
:class="{ 'tainacan-icon-arrowdown' : props.open, 'tainacan-icon-arrowright' : !props.open }"
|
||||
class="has-text-secondary tainacan-icon tainacan-icon-20px"/>
|
||||
</span>
|
||||
{{ metadatum.metadatum.name }}
|
||||
</label>
|
||||
<div
|
||||
v-if="metadatum.date_i18n"
|
||||
class="content">
|
||||
<p v-html="metadatum.date_i18n != '' ? metadatum.date_i18n : `<span class='has-text-gray is-italic'>` + $i18n.get('label_value_not_informed') + `</span>`"/>
|
||||
</div>
|
||||
<div
|
||||
v-else
|
||||
class="content">
|
||||
<p v-html="metadatum.value_as_html != '' ? metadatum.value_as_html : `<span class='has-text-gray is-italic'>` + $i18n.get('label_value_not_informed') + `</span>`"/>
|
||||
</div>
|
||||
</b-collapse>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Hook for extra Form options -->
|
||||
<template
|
||||
v-if="formHooks != undefined &&
|
||||
formHooks['view-item'] != undefined &&
|
||||
formHooks['view-item']['end-right'] != undefined">
|
||||
<div
|
||||
id="view-item-end-right"
|
||||
v-html="formHooks['view-item']['end-right'].join('')"/>
|
||||
</template>
|
||||
</div>
|
||||
</div>
|
||||
<div class="footer">
|
||||
<div class="form-submission-footer">
|
||||
|
@ -341,19 +320,18 @@
|
|||
import {mapActions, mapGetters} from 'vuex';
|
||||
import FileItem from '../../components/other/file-item.vue';
|
||||
import DocumentItem from '../../components/other/document-item.vue';
|
||||
import {formHooks} from '../../js/mixins';
|
||||
import { formHooks } from '../../js/mixins';
|
||||
import ActivitiesPage from '../lists/activities-page.vue';
|
||||
|
||||
export default {
|
||||
name: 'ItemPage',
|
||||
mixins: [formHooks],
|
||||
mixins: [ formHooks ],
|
||||
data() {
|
||||
return {
|
||||
collectionId: Number,
|
||||
itemId: Number,
|
||||
isLoading: false,
|
||||
isLoadingMetadatumMappers: false,
|
||||
isMetadataColumnCompressed: false,
|
||||
open: true,
|
||||
collectionName: '',
|
||||
thumbPlaceholderPath: tainacan_plugin.base_url + '/admin/images/placeholder_square.png',
|
||||
|
@ -382,7 +360,7 @@
|
|||
'getMetadata',
|
||||
'getAttachments'
|
||||
]),
|
||||
...mapGetters('metadata', [
|
||||
...mapGetters('metadata',[
|
||||
'getMetadatumMappers'
|
||||
]),
|
||||
...mapActions('metadata', [
|
||||
|
@ -397,21 +375,21 @@
|
|||
extractExposerLabel(urlString, typeSlug) {
|
||||
let url = new URL(urlString);
|
||||
let mapperParam = url.searchParams.get(tainacan_plugin.exposer_mapper_param);
|
||||
if (mapperParam != 'undefined' && mapperParam != null) {
|
||||
if(mapperParam != 'undefined' && mapperParam != null) {
|
||||
let mapper = this.metadatum_mappers.find(obj => {
|
||||
return obj.slug === mapperParam;
|
||||
});
|
||||
if (mapper != 'undefined' && mapper != null) {
|
||||
return this.$i18n.get('label_exposer') + ": " + typeSlug + ', ' + this.$i18n.get('label_mapper') + ": " + mapper.name;
|
||||
if(mapper != 'undefined' && mapper != null) {
|
||||
return this.$i18n.get('label_exposer')+": "+typeSlug+', '+this.$i18n.get('label_mapper')+": "+mapper.name;
|
||||
} else {
|
||||
if (mapperParam == 'value') {
|
||||
return this.$i18n.get('label_exposer') + ": " + typeSlug + ', ' + this.$i18n.get('label_exposer_mapper_values');
|
||||
if(mapperParam == 'value') {
|
||||
return this.$i18n.get('label_exposer')+": "+typeSlug+', '+this.$i18n.get('label_exposer_mapper_values');
|
||||
}
|
||||
}
|
||||
}
|
||||
return this.$i18n.get('label_exposer') + ": " + typeSlug;
|
||||
return this.$i18n.get('label_exposer')+": "+typeSlug;
|
||||
},
|
||||
|
||||
|
||||
},
|
||||
computed: {
|
||||
item() {
|
||||
|
@ -442,18 +420,18 @@
|
|||
|
||||
this.isLoadingMetadatumMappers = true;
|
||||
this.fetchMetadatumMappers()
|
||||
.then(() => {
|
||||
this.isLoadingMetadatumMappers = false;
|
||||
})
|
||||
.catch(() => {
|
||||
this.isLoadingMetadatumMappers = false;
|
||||
});
|
||||
|
||||
.then(() => {
|
||||
this.isLoadingMetadatumMappers = false;
|
||||
})
|
||||
.catch(() => {
|
||||
this.isLoadingMetadatumMappers = false;
|
||||
});
|
||||
|
||||
// Obtains Item
|
||||
this.fetchItem(this.itemId).then((item) => {
|
||||
this.$root.$emit('onCollectionBreadCrumbUpdate', [
|
||||
{path: this.$routerHelper.getCollectionPath(this.collectionId), label: this.$i18n.get('items')},
|
||||
{path: '', label: item.title}
|
||||
{ path: this.$routerHelper.getCollectionPath(this.collectionId), label: this.$i18n.get('items') },
|
||||
{ path: '', label: item.title}
|
||||
]);
|
||||
this.loadMetadata();
|
||||
});
|
||||
|
@ -465,12 +443,12 @@
|
|||
|
||||
// Get attachments
|
||||
this.fetchAttachments(this.itemId);
|
||||
|
||||
|
||||
// Obtains collection Comment Status
|
||||
this.fetchCollectionAllowComments(this.collectionId).then((collectionAllowComments) => {
|
||||
this.collectionAllowComments = collectionAllowComments;
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
|
@ -478,32 +456,10 @@
|
|||
|
||||
@import '../../scss/_variables.scss';
|
||||
|
||||
#metadata-column-compress-button {
|
||||
position: absolute;
|
||||
z-index: 99;
|
||||
right: 0;
|
||||
top: 148px;
|
||||
max-width: 36px;
|
||||
height: 36px;
|
||||
width: 36px;
|
||||
border: none;
|
||||
background-color: $gray2;
|
||||
color: $secondary;
|
||||
padding: 0;
|
||||
border-top-left-radius: 2px;
|
||||
border-bottom-left-radius: 2px;
|
||||
cursor: pointer;
|
||||
|
||||
.icon {
|
||||
margin-top: 2px;
|
||||
margin-right: 8px;
|
||||
}
|
||||
}
|
||||
|
||||
.page-container {
|
||||
padding: 25px 0;
|
||||
|
||||
& > .tainacan-form {
|
||||
&>.tainacan-form {
|
||||
margin-bottom: 110px;
|
||||
}
|
||||
|
||||
|
@ -538,50 +494,46 @@
|
|||
position: relative;
|
||||
top: -2px;
|
||||
}
|
||||
a.back-link {
|
||||
a.back-link{
|
||||
font-weight: 500;
|
||||
float: right;
|
||||
margin-top: 5px;
|
||||
}
|
||||
hr {
|
||||
margin: 3px 0px 4px 0px;
|
||||
hr{
|
||||
margin: 3px 0px 4px 0px;
|
||||
height: 1px;
|
||||
background-color: $secondary;
|
||||
width: 100%;
|
||||
}
|
||||
}
|
||||
|
||||
.tainacan-form > .columns {
|
||||
.tainacan-form>.columns {
|
||||
margin-bottom: 70px;
|
||||
}
|
||||
|
||||
.column.is-5-5 {
|
||||
width: 45.833333333%;
|
||||
.column.is-5 {
|
||||
padding-left: $page-side-padding;
|
||||
padding-right: $page-side-padding;
|
||||
transition: width 0.6s;
|
||||
|
||||
@media screen and (max-width: 769px) {
|
||||
width: 100%;
|
||||
}
|
||||
}
|
||||
.column.is-4-5 {
|
||||
width: 37.5%;
|
||||
padding-left: $page-side-padding;
|
||||
.column.is-7 {
|
||||
padding-left: 0;
|
||||
padding-right: $page-side-padding;
|
||||
transition: all 0.6s;
|
||||
|
||||
.field {
|
||||
padding: 10px 0 10px 30px;
|
||||
|
||||
}
|
||||
|
||||
@media screen and (max-width: 769px) {
|
||||
padding-left: $page-side-padding;
|
||||
width: 100%;
|
||||
}
|
||||
}
|
||||
.collapse .collapse-content {
|
||||
margin-left: 30px;
|
||||
margin-left: 30px;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -623,7 +575,7 @@
|
|||
}
|
||||
|
||||
.section-box {
|
||||
|
||||
|
||||
background-color: white;
|
||||
padding: 26px;
|
||||
margin-top: 16px;
|
||||
|
@ -653,21 +605,19 @@
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
.section-status {
|
||||
padding-bottom: 16px;
|
||||
font-size: 0.75rem;
|
||||
.section-status{
|
||||
padding-bottom: 16px;
|
||||
font-size: 0.75rem;
|
||||
|
||||
.field {
|
||||
border-bottom: none;
|
||||
|
||||
.icon {
|
||||
font-size: 18px !important;
|
||||
.icon {
|
||||
font-size: 18px !important;
|
||||
color: $gray3;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.section-attachments {
|
||||
border: 1px solid $gray2;
|
||||
height: 250px;
|
||||
|
@ -675,9 +625,7 @@
|
|||
resize: vertical;
|
||||
overflow: auto;
|
||||
|
||||
p {
|
||||
margin: 4px 15px
|
||||
}
|
||||
p { margin: 4px 15px }
|
||||
}
|
||||
|
||||
.uploaded-files {
|
||||
|
@ -687,7 +635,7 @@
|
|||
margin-right: -15px;
|
||||
}
|
||||
|
||||
.thumbnail-field {
|
||||
.thumbnail-field {
|
||||
|
||||
.content {
|
||||
padding: 10px;
|
||||
|
@ -717,10 +665,10 @@
|
|||
bottom: 0;
|
||||
z-index: 999999;
|
||||
background-color: $gray1;
|
||||
width: 100%;
|
||||
width: 100%;
|
||||
height: 65px;
|
||||
|
||||
.form-submission-footer {
|
||||
.form-submission-footer {
|
||||
width: 100%;
|
||||
display: flex;
|
||||
justify-content: flex-end;
|
||||
|
|
|
@ -9,17 +9,26 @@ class CSV extends Exporter {
|
|||
public function __construct($attributes = array()) {
|
||||
parent::__construct($attributes);
|
||||
$this->set_accepted_mapping_methods('any'); // set all method to mapping
|
||||
//$this->set_accepted_mapping_methods('list', [ "dublin-core" => "Tainacan\\Exposers\\Mappers\\Dublin_Core" ]); // set specific list of methods to mapping
|
||||
//todo create list only slug
|
||||
$this->accept_no_mapping = true;
|
||||
//$this->set_accepted_mapping_methods('list', [ "dublin-core" ]); // set specific list of methods to mapping
|
||||
$this->set_default_options([
|
||||
'delimiter' => ',',
|
||||
'multivalued_delimiter' => '||',
|
||||
'enclosure' => '"'
|
||||
]);
|
||||
}
|
||||
|
||||
public function filter_multivalue_separator($separator) {
|
||||
return $this->get_option('multivalued_delimiter');
|
||||
}
|
||||
|
||||
public function process_item( $processed_item ) {
|
||||
|
||||
|
||||
$mapper = $this->get_current_mapper();
|
||||
error_log(json_encode($mapper));
|
||||
$line = [];
|
||||
|
||||
add_filter('tainacan-item-metadata-get-multivalue-separator', [$this, 'filter_multivalue_separator']);
|
||||
|
||||
foreach ($processed_item as $meta_key => $meta) {
|
||||
|
||||
if (!$meta) {
|
||||
|
@ -31,12 +40,13 @@ class CSV extends Exporter {
|
|||
|
||||
}
|
||||
|
||||
$line_string = $this->str_putcsv($line, ',', '"');
|
||||
remove_filter('tainacan-item-metadata-get-multivalue-separator', [$this, 'filter_multivalue_separator']);
|
||||
|
||||
$line_string = $this->str_putcsv($line, $this->get_option('delimiter'), $this->get_option('enclosure'));
|
||||
|
||||
|
||||
$this->append_to_file('exporter', $line_string."\n");
|
||||
|
||||
|
||||
}
|
||||
|
||||
public function output_header() {
|
||||
|
@ -63,7 +73,7 @@ class CSV extends Exporter {
|
|||
}
|
||||
}
|
||||
|
||||
$line_string = $this->str_putcsv($line, ',', '"');
|
||||
$line_string = $this->str_putcsv($line, $this->get_option('delimiter'), $this->get_option('enclosure'));
|
||||
|
||||
$this->append_to_file('exporter', $line_string."\n");
|
||||
|
||||
|
@ -107,7 +117,7 @@ class CSV extends Exporter {
|
|||
</div>
|
||||
</span>
|
||||
<div class="control is-clearfix">
|
||||
<input class="input" type="text" name="delimiter" value="<?php echo $this->get_option('delimiter'); ?>">
|
||||
<input class="input" type="text" name="delimiter" maxlength="1" value="<?php echo $this->get_option('delimiter'); ?>">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
@ -151,36 +161,11 @@ class CSV extends Exporter {
|
|||
</div>
|
||||
</span>
|
||||
<div class="control is-clearfix">
|
||||
<input class="input" type="text" name="enclosure" value="<?php echo $this->get_option('enclosure'); ?>">
|
||||
<input class="input" type="text" name="enclosure" value="<?php echo esc_attr($this->get_option('enclosure')); ?>">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="field">
|
||||
<label class="label"><?php _e('File Encoding', 'tainacan'); ?></label>
|
||||
<span class="help-wrapper">
|
||||
<a class="help-button has-text-secondary">
|
||||
<span class="icon is-small">
|
||||
<i class="mdi mdi-help-circle-outline" ></i>
|
||||
</span>
|
||||
</a>
|
||||
<div class="help-tooltip">
|
||||
<div class="help-tooltip-header">
|
||||
<h5><?php _e('File Encoding', 'tainacan'); ?></h5>
|
||||
</div>
|
||||
<div class="help-tooltip-body">
|
||||
<p><?php _e('The encoding of the CSV file.', 'tainacan'); ?></p>
|
||||
</div>
|
||||
</div>
|
||||
</span>
|
||||
<div class="control is-clearfix">
|
||||
<div class="select">
|
||||
<select name="encode">
|
||||
<option value="utf8" <?php selected($this->get_option('encode'), 'utf8'); ?> >UTF-8</option>
|
||||
<option value="iso88591" <?php selected($this->get_option('encode'), 'iso88591'); ?> >ISO-88591</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<?php
|
||||
|
||||
|
|
|
@ -72,12 +72,7 @@ abstract class CommunImportExport {
|
|||
* Example of the structure of this propery for one collection:
|
||||
* 0 => [
|
||||
* 'id' => 12,
|
||||
* 'mapping' => [
|
||||
* 30 => 'column1'
|
||||
* 31 => 'column2'
|
||||
* ],
|
||||
* 'total_items' => 1234,
|
||||
* 'source_id' => 55
|
||||
* ],
|
||||
*
|
||||
* use add_collection() and remove_collection() to interact with thiis array.
|
||||
|
@ -103,6 +98,16 @@ abstract class CommunImportExport {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function update_collection($index, $collection_definition) {
|
||||
if (isset($this->collections[$index]))
|
||||
$this->collections[$index] = $collection_definition;
|
||||
}
|
||||
|
||||
public function update_current_collection($collection_definition) {
|
||||
$current_collection = $this->get_current_collection();
|
||||
return $this->update_collection($current_collection, $collection_definition);
|
||||
}
|
||||
|
||||
public function next_item() {
|
||||
$current_collection = $this->get_current_collection();
|
||||
|
@ -484,6 +489,7 @@ class Exporter extends CommunImportExport {
|
|||
private $send_email = null;
|
||||
protected $mapping_list = [];
|
||||
public $mapping_selected = "";
|
||||
protected $accept_no_mapping = true;
|
||||
|
||||
protected $steps = [
|
||||
[
|
||||
|
@ -502,7 +508,13 @@ class Exporter extends CommunImportExport {
|
|||
];
|
||||
|
||||
public function __construct($attributess = array()) {
|
||||
$this->array_attributes = array_merge($this->array_attributes, ['current_collection_item', 'current_collection']);
|
||||
$this->array_attributes = array_merge($this->array_attributes, [
|
||||
'mapping_selected',
|
||||
'current_collection_item',
|
||||
'current_collection',
|
||||
'output_files',
|
||||
'send_email'
|
||||
]);
|
||||
parent::__construct();
|
||||
$_SESSION['tainacan_exporter'][$this->get_id()] = $this;
|
||||
if (!empty($attributess)) {
|
||||
|
@ -526,14 +538,11 @@ class Exporter extends CommunImportExport {
|
|||
global $Tainacan_Exporter_Handler;
|
||||
$exporter_definition = $Tainacan_Exporter_Handler->get_exporter_by_object($this);
|
||||
|
||||
$return['mapping_selected'] = $this->get_mapping_selected();
|
||||
$return['output_files'] = $this->output_files;
|
||||
$return['send_email'] = $this->send_email;
|
||||
|
||||
if ($short === false) {
|
||||
$return['manual_collection'] = $exporter_definition['manual_collection'];
|
||||
$return['mapping_accept'] = $this->mapping_accept;
|
||||
$return['mapping_list'] = $this->mapping_list;
|
||||
$return['accept_no_mapping'] = $this->accept_no_mapping;
|
||||
$return['options_form'] = $this->options_form();
|
||||
}
|
||||
|
||||
|
@ -541,60 +550,20 @@ class Exporter extends CommunImportExport {
|
|||
}
|
||||
|
||||
public function add_collection(array $collection) {
|
||||
if (!isset($collection['total_items'])) {
|
||||
$collection['total_items'] = 10;
|
||||
}
|
||||
parent::add_collection($collection);
|
||||
|
||||
$this->update_collections_mapping();
|
||||
// if (!isset($collection['total_items'])) {
|
||||
// $collection['total_items'] = 10;
|
||||
// }
|
||||
parent::add_collection($collection);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the current mapper object, if one was chosen by the user, false Otherwise
|
||||
*/
|
||||
public function get_current_mapper() {
|
||||
return \Tainacan\Mappers_Handler::get_instance()->get_mapper($this->get_mapping_selected());
|
||||
}
|
||||
|
||||
private function update_collections_mapping() {
|
||||
$mapper_handler = Tainacan\Mappers_Handler::get_instance();
|
||||
$collection_repo = Tainacan\Repositories\Collections::get_instance();
|
||||
|
||||
foreach ($this->get_collections() as $index => $col) {
|
||||
|
||||
$collection_id = $col['id'];
|
||||
|
||||
$collection = $collection_repo->fetch((int)$collection_id);
|
||||
|
||||
if ( ! $collection instanceof \Tainacan\Entities\Collection ) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$metas = $collection->get_metadata();
|
||||
|
||||
$mapping = [];
|
||||
$current_mapping = isset($col['mapping']) ? $col['mapping'] : [];
|
||||
|
||||
if ( $mapper = $mapper_handler->get_mapper($this->get_mapping_selected()) ) {
|
||||
|
||||
foreach ($metas as $meta) {
|
||||
|
||||
$metadatum_mapping = $meta->get_exposer_mapping();
|
||||
//var_dump($metadatum_mapping);
|
||||
|
||||
if(array_key_exists($mapper->slug, $metadatum_mapping)) {
|
||||
$mapping[$meta->get_name()] = $metadatum_mapping[$mapper->slug];
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
$col['mapping'] = $mapping;
|
||||
if ($col['mapping'] !== $current_mapping) {
|
||||
$this->add_collection($col);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Method implemented by child importer/exporter to return the HTML of the Options Form to be rendered in the Importer page
|
||||
*/
|
||||
|
@ -665,6 +634,13 @@ class Exporter extends CommunImportExport {
|
|||
|
||||
$this->add_log('Proccessing item index ' . $index . ' in collection ' . $collection_definition['id'] );
|
||||
$items = $tainacan_items->fetch($filters, $collection_id, 'WP_Query');
|
||||
|
||||
if ( !isset($collection_definition['total_items']) ) {
|
||||
$collection_definition['total_items'] = $items->found_posts;
|
||||
$this->update_current_collection($collection_definition);
|
||||
}
|
||||
|
||||
|
||||
$data = [];
|
||||
while ($items->have_posts()) {
|
||||
$items->the_post();
|
||||
|
@ -681,6 +657,12 @@ class Exporter extends CommunImportExport {
|
|||
return $data;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets an Item as input and return an array of ItemMetadataObjects
|
||||
* If a mapper is selected, the array keys will be the slugs of the metadata
|
||||
* declared by the mapper, in the same order.
|
||||
* Note that if one of the metadata is not mapped, this array item will be null
|
||||
*/
|
||||
private function map_item_metadata(\Tainacan\Entities\Item $item) {
|
||||
|
||||
$mapper = $this->get_current_mapper();
|
||||
|
@ -765,7 +747,6 @@ class Exporter extends CommunImportExport {
|
|||
|
||||
public function set_mapping_selected($mapping_selected) {
|
||||
$this->mapping_selected = $mapping_selected;
|
||||
$this->update_collections_mapping();
|
||||
}
|
||||
|
||||
public function get_mapping_selected() {
|
||||
|
@ -775,11 +756,20 @@ class Exporter extends CommunImportExport {
|
|||
public function set_send_email($email) {
|
||||
$this->send_email = $email;
|
||||
}
|
||||
public function get_send_email() {
|
||||
return $this->send_email;
|
||||
}
|
||||
|
||||
public function finished() {
|
||||
if($this->send_email != null) {
|
||||
$msg = 'export completed successfully';
|
||||
wp_mail($this->send_email, __('Finished export.', 'tainacan'), __($msg, 'tainacan'));
|
||||
if($this->get_send_email() == 1) {
|
||||
$author = $this->get_transient('author');
|
||||
$user = get_userdata( (int) $author );
|
||||
if ($user instanceof \WP_User) {
|
||||
$msg = __('export completed successfully', 'tainacan');
|
||||
$this->add_log('Sending email to ' . $user->user_email);
|
||||
wp_mail($user->user_email, __('Finished export.', 'tainacan'), $msg);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -794,6 +784,9 @@ class Exporter extends CommunImportExport {
|
|||
private function set_output_files($output_files) {
|
||||
$this->output_files = $output_files;
|
||||
}
|
||||
private function get_output_files() {
|
||||
return $this->output_files;
|
||||
}
|
||||
/**
|
||||
* runs one iteration
|
||||
*/
|
||||
|
|
|
@ -222,7 +222,7 @@ class CSV extends Importer {
|
|||
</div>
|
||||
</span>
|
||||
<div class="control is-clearfix">
|
||||
<input class="input" type="text" name="delimiter" value="<?php echo $this->get_option('delimiter'); ?>">
|
||||
<input class="input" type="text" name="delimiter" value="<?php echo esc_attr($this->get_option('delimiter')); ?>">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
|
Loading…
Reference in New Issue