Merges with develop.
This commit is contained in:
commit
e7cc2bf6b8
|
@ -7,17 +7,14 @@
|
|||
"build": "cross-env NODE_ENV=development webpack --display-error-details --mode development --progress --hide-modules"
|
||||
},
|
||||
"dependencies": {
|
||||
"@brainhubeu/react-carousel": "^1.10.1",
|
||||
"axios": "^0.18.0",
|
||||
"buefy": "^0.7.2",
|
||||
"bulma": "^0.7.2",
|
||||
"buefy": "^0.7.3",
|
||||
"bulma": "^0.7.4",
|
||||
"mdi": "^2.2.43",
|
||||
"moment": "^2.22.2",
|
||||
"node-sass": "^4.9.4",
|
||||
"qs": "^6.5.2",
|
||||
"react": "^16.5.2",
|
||||
"react-autocomplete": "^1.8.1",
|
||||
"react-dom": "^16.5.2",
|
||||
"t": "^0.5.1",
|
||||
"v-tooltip": "^2.0.0-rc.33",
|
||||
"vue": "^2.5.17",
|
||||
|
|
|
@ -34,7 +34,8 @@
|
|||
v-if="formHooks != undefined &&
|
||||
formHooks['collection'] != undefined &&
|
||||
formHooks['collection']['begin-left'] != undefined">
|
||||
<form
|
||||
<form
|
||||
class="form-hook-region"
|
||||
id="form-collection-begin-left"
|
||||
v-html="this.formHooks['collection']['begin-left'].join('')"/>
|
||||
</template>
|
||||
|
@ -172,7 +173,8 @@
|
|||
class="two-columns-dropdown"
|
||||
ref="enabledViewModesDropdown"
|
||||
:mobile-modal="true"
|
||||
:disabled="Object.keys(registeredViewModes).length < 0">
|
||||
:disabled="Object.keys(registeredViewModes).length < 0"
|
||||
aria-role="list">
|
||||
<button
|
||||
class="button is-white"
|
||||
slot="trigger"
|
||||
|
@ -187,7 +189,8 @@
|
|||
v-for="(viewMode, index) in Object.keys(registeredViewModes)"
|
||||
:key="index"
|
||||
class="control"
|
||||
custom>
|
||||
custom
|
||||
aria-role="listitem">
|
||||
<b-checkbox
|
||||
v-if="registeredViewModes[viewMode] != undefined"
|
||||
@input="updateViewModeslist(viewMode)"
|
||||
|
@ -245,6 +248,7 @@
|
|||
<form
|
||||
ref="form-collection-end-left"
|
||||
id="form-collection-end-left"
|
||||
class="form-hook-region"
|
||||
v-html="formHooks['collection']['end-left'].join('')"/>
|
||||
</template>
|
||||
|
||||
|
@ -319,6 +323,7 @@
|
|||
formHooks['collection']['begin-right'] != undefined">
|
||||
<form
|
||||
id="form-collection-begin-right"
|
||||
class="form-hook-region"
|
||||
v-html="formHooks['collection']['begin-right'].join('')"/>
|
||||
</template>
|
||||
|
||||
|
@ -430,6 +435,7 @@
|
|||
formHooks['collection']['end-right'] != undefined">
|
||||
<form
|
||||
id="form-collection-end-right"
|
||||
class="form-hook-region"
|
||||
v-html="formHooks['collection']['end-right'].join('')"/>
|
||||
</template>
|
||||
</div>
|
||||
|
@ -801,12 +807,14 @@ export default {
|
|||
frame_button: this.$i18n.get('label_select_file'),
|
||||
},
|
||||
relatedPostId: this.collectionId,
|
||||
onSave: (mediaId) => {
|
||||
this.updateThumbnail({collectionId: this.collectionId, thumbnailId: mediaId})
|
||||
.then((res) => {
|
||||
this.collection.thumbnail = res.thumbnail;
|
||||
onSave: (media) => {
|
||||
this.updateThumbnail({
|
||||
collectionId: this.collectionId, thumbnailId: media.id
|
||||
})
|
||||
.catch(error => this.$console.error(error));
|
||||
.then((res) => {
|
||||
this.collection.thumbnail = res.thumbnail;
|
||||
})
|
||||
.catch(error => this.$console.error(error));
|
||||
}
|
||||
}
|
||||
);
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
<tainacan-title
|
||||
:bread-crumb-items="[
|
||||
{ path: $routerHelper.getAvailableExportersPath(), label: $i18n.get('exporters') },
|
||||
{ path: '', label: exporterType != undefined ? exporterType : $i18n.get('title_exporter_page') }
|
||||
{ path: '', label: exporterType != undefined ? (exporterName != undefined ? exporterName : exporterType) : $i18n.get('title_exporter_page') }
|
||||
]"/>
|
||||
<b-loading
|
||||
:active.sync="isLoading"
|
||||
|
@ -119,6 +119,7 @@
|
|||
data(){
|
||||
return {
|
||||
exporterType: '',
|
||||
exporterName: '',
|
||||
collections: [],
|
||||
adminFullURL: tainacan_plugin.admin_url + 'admin.php?page=tainacan_admin#',
|
||||
isFetchingCollections: false,
|
||||
|
@ -133,6 +134,7 @@
|
|||
},
|
||||
methods: {
|
||||
...mapActions('exporter', [
|
||||
'fetchAvailableExporters',
|
||||
'createExporterSession',
|
||||
'updateExporterSession',
|
||||
'runExporterSession'
|
||||
|
@ -238,6 +240,13 @@
|
|||
this.isFetchingCollections = false;
|
||||
this.$console.error(error);
|
||||
});
|
||||
|
||||
|
||||
// Set exporter's name
|
||||
this.fetchAvailableExporters().then((exporterTypes) => {
|
||||
if (exporterTypes[this.exporterType])
|
||||
this.exporterName = exporterTypes[this.exporterType].name;
|
||||
});
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
|
|
@ -30,6 +30,7 @@
|
|||
formHooks['filter']['begin-left'] != undefined">
|
||||
<form
|
||||
id="form-filter-begin-left"
|
||||
class="form-hook-region"
|
||||
v-html="formHooks['filter']['begin-left'].join('')"/>
|
||||
</template>
|
||||
|
||||
|
@ -152,6 +153,7 @@
|
|||
formHooks['filter']['end-left'] != undefined">
|
||||
<form
|
||||
id="form-filter-end-left"
|
||||
class="form-hook-region"
|
||||
v-html="formHooks['filter']['end-left'].join('')"/>
|
||||
</template>
|
||||
</div>
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
<tainacan-title
|
||||
:bread-crumb-items="[
|
||||
{ path: $routerHelper.getAvailableImportersPath(), label: $i18n.get('importers') },
|
||||
{ path: '', label: importerType != undefined ? importerType : $i18n.get('title_importer_page') }
|
||||
{ path: '', label: importerType != undefined ? (importerName != undefined ? importerName :importerType) : $i18n.get('title_importer_page') }
|
||||
]"/>
|
||||
<form
|
||||
@click="formErrorMessage = ''"
|
||||
|
@ -186,6 +186,7 @@ export default {
|
|||
},
|
||||
importerTypes: [],
|
||||
importerType: '',
|
||||
importerName: '',
|
||||
importerFile: null,
|
||||
importerSourceInfo: null,
|
||||
collections: [],
|
||||
|
@ -196,7 +197,7 @@ export default {
|
|||
},
|
||||
methods: {
|
||||
...mapActions('importer', [
|
||||
'fetchImporterTypes',
|
||||
'fetchAvailableImporters',
|
||||
'fetchImporter',
|
||||
'sendImporter',
|
||||
'updateImporter',
|
||||
|
@ -402,6 +403,12 @@ export default {
|
|||
this.onSelectCollection(this.collectionId);
|
||||
}
|
||||
|
||||
// Set importer's name
|
||||
this.fetchAvailableImporters().then((importerTypes) => {
|
||||
if (importerTypes[this.importerType])
|
||||
this.importerName = importerTypes[this.importerType].name;
|
||||
});
|
||||
|
||||
if (this.sessionId != undefined)
|
||||
this.loadImporter();
|
||||
else
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
:to="$routerHelper.getAvailableImportersPath()">{{ $i18n.get('importers') }}</router-link> >
|
||||
<router-link
|
||||
tag="a"
|
||||
:to="$routerHelper.getImporterPath(importerType, sessionId)">{{ importerType }}</router-link> >
|
||||
:to="$routerHelper.getImporterPath(importerType, sessionId)">{{ importerType != undefined ? (importerName != undefined ? importerName :importerType) : $i18n.get('title_importer_page') }}</router-link> >
|
||||
<router-link
|
||||
tag="a"
|
||||
:to="$routerHelper.getImporterMappingPath(importerType, sessionId, collectionId)">{{ $i18n.get('label_metadata_mapping') }}</router-link>
|
||||
|
@ -196,6 +196,7 @@ export default {
|
|||
'total_items': Number
|
||||
},
|
||||
importerType: '',
|
||||
importerName: '',
|
||||
importerSourceInfo: null,
|
||||
collections: [],
|
||||
collectionMetadata: [],
|
||||
|
@ -219,7 +220,7 @@ export default {
|
|||
},
|
||||
methods: {
|
||||
...mapActions('importer', [
|
||||
'fetchImporterTypes',
|
||||
'fetchAvailableImporters',
|
||||
'fetchImporter',
|
||||
'sendImporter',
|
||||
'updateImporter',
|
||||
|
@ -416,6 +417,12 @@ export default {
|
|||
this.collectionId = this.$route.params.collectionId;
|
||||
this.mappedCollection['id'] = this.collectionId;
|
||||
|
||||
// Set importer's name
|
||||
this.fetchAvailableImporters().then((importerTypes) => {
|
||||
if (importerTypes[this.importerType])
|
||||
this.importerName = importerTypes[this.importerType].name;
|
||||
});
|
||||
|
||||
this.loadImporter();
|
||||
this.loadMetadata();
|
||||
}
|
||||
|
|
|
@ -44,6 +44,7 @@
|
|||
formHooks['item']['begin-left'] != undefined">
|
||||
<form
|
||||
id="form-item-begin-left"
|
||||
class="form-hook-region"
|
||||
v-html="formHooks['item']['begin-left'].join('')"/>
|
||||
</template>
|
||||
|
||||
|
@ -349,6 +350,7 @@
|
|||
formHooks['item']['end-left'] != undefined">
|
||||
<form
|
||||
id="form-item-end-left"
|
||||
class="form-hook-region"
|
||||
v-html="formHooks['item']['end-left'].join('')"/>
|
||||
</template>
|
||||
|
||||
|
@ -362,6 +364,7 @@
|
|||
formHooks['item']['begin-right'] != undefined">
|
||||
<form
|
||||
id="form-item-begin-right"
|
||||
class="form-hook-region"
|
||||
v-html="formHooks['item']['begin-right'].join('')"/>
|
||||
</template>
|
||||
|
||||
|
@ -438,6 +441,7 @@
|
|||
formHooks['item']['end-right'] != undefined">
|
||||
<form
|
||||
id="form-item-end-right"
|
||||
class="form-hook-region"
|
||||
v-html="formHooks['item']['end-right'].join('')"/>
|
||||
</template>
|
||||
</div>
|
||||
|
@ -1009,8 +1013,8 @@ export default {
|
|||
frame_title: this.$i18n.get('instruction_select_item_thumbnail'),
|
||||
},
|
||||
relatedPostId: this.itemId,
|
||||
onSave: (mediaId) => {
|
||||
this.updateThumbnail({itemId: this.itemId, thumbnailId: mediaId})
|
||||
onSave: (media) => {
|
||||
this.updateThumbnail({itemId: this.itemId, thumbnailId: media.id})
|
||||
.then((res) => {
|
||||
this.item.thumbnail = res.thumbnail;
|
||||
})
|
||||
|
@ -1167,9 +1171,11 @@ export default {
|
|||
}
|
||||
|
||||
// Obtains collection name
|
||||
this.fetchCollectionName(this.collectionId).then((collectionName) => {
|
||||
this.collectionName = collectionName;
|
||||
});
|
||||
if (!this.isRepositoryLevel) {
|
||||
this.fetchCollectionName(this.collectionId).then((collectionName) => {
|
||||
this.collectionName = collectionName;
|
||||
});
|
||||
}
|
||||
|
||||
// Obtains if collection allow items comments
|
||||
this.fetchCollectionAllowComments(this.collectionId).then((collectionAllowComments) => {
|
||||
|
|
|
@ -31,6 +31,7 @@
|
|||
formHooks['metadatum']['begin-left'] != undefined">
|
||||
<form
|
||||
id="form-metadatum-begin-left"
|
||||
class="form-hook-region"
|
||||
v-html="formHooks['metadatum']['begin-left'].join('')"/>
|
||||
</template>
|
||||
|
||||
|
@ -223,6 +224,7 @@
|
|||
formHooks['metadatum']['end-left'] != undefined">
|
||||
<form
|
||||
id="form-metadatum-end-left"
|
||||
class="form-hook-region"
|
||||
v-html="formHooks['metadatum']['end-left'].join('')"/>
|
||||
</template>
|
||||
</div>
|
||||
|
|
|
@ -38,6 +38,7 @@
|
|||
formHooks['taxonomy']['begin-left'] != undefined">
|
||||
<form
|
||||
id="form-taxonomy-begin-left"
|
||||
class="form-hook-region"
|
||||
v-html="formHooks['taxonomy']['begin-left'].join('')"/>
|
||||
</template>
|
||||
|
||||
|
@ -145,6 +146,7 @@
|
|||
formHooks['taxonomy']['end-left'] != undefined">
|
||||
<form
|
||||
id="form-taxonomy-end-left"
|
||||
class="form-hook-region"
|
||||
v-html="formHooks['taxonomy']['end-left'].join('')"/>
|
||||
</template>
|
||||
|
||||
|
|
|
@ -70,6 +70,7 @@
|
|||
formHooks['term']['begin-left'] != undefined">
|
||||
<form
|
||||
id="form-term-begin-left"
|
||||
class="form-hook-region"
|
||||
v-html="formHooks['term']['begin-left'].join('')"/>
|
||||
</template>
|
||||
|
||||
|
@ -139,6 +140,7 @@
|
|||
formHooks['term']['end-left'] != undefined">
|
||||
<form
|
||||
id="form-term-end-left"
|
||||
class="form-hook-region"
|
||||
v-html="formHooks['term']['end-left'].join('')"/>
|
||||
</template>
|
||||
|
||||
|
@ -154,13 +156,14 @@
|
|||
</button>
|
||||
</div>
|
||||
<div class="control">
|
||||
<button
|
||||
<a
|
||||
type="button"
|
||||
v-if="editForm.url != undefined && editForm.url!= ''"
|
||||
class="button is-secondary"
|
||||
target="_blank"
|
||||
:href="editForm.url">
|
||||
{{ $i18n.get('see') + ' ' + $i18n.get('term') }}
|
||||
</button>
|
||||
{{ $i18n.get('label_view_term') }}
|
||||
</a>
|
||||
</div>
|
||||
<div class="control">
|
||||
<button
|
||||
|
@ -279,13 +282,15 @@
|
|||
);
|
||||
},
|
||||
initializeMediaFrames() {
|
||||
this.headerImageMediaFrame = new wpMediaFrames.headerImageControl(
|
||||
'my-header-image-media-frame', {
|
||||
this.headerImageMediaFrame = new wpMediaFrames.thumbnailControl(
|
||||
'my-thumbnail-image-media-frame', {
|
||||
button_labels: {
|
||||
frame_title: this.$i18n.get('instruction_select_term_header_image'),
|
||||
frame_button: this.$i18n.get('label_select_file')
|
||||
},
|
||||
relatedPostId: this.editForm.id,
|
||||
onSave: (croppedImage) => {
|
||||
|
||||
this.editForm = Object.assign({},
|
||||
this.editForm,
|
||||
{
|
||||
|
|
|
@ -15,7 +15,8 @@
|
|||
position="is-bottom-left"
|
||||
v-if="$userCaps.hasCapability('delete_tainacan-collections')"
|
||||
:disabled="!isSelectingCollections"
|
||||
id="bulk-actions-dropdown">
|
||||
id="bulk-actions-dropdown"
|
||||
aria-role="list">
|
||||
<button
|
||||
class="button is-white"
|
||||
slot="trigger">
|
||||
|
@ -27,10 +28,13 @@
|
|||
|
||||
<b-dropdown-item
|
||||
id="item-delete-selected-items"
|
||||
@click="deleteSelectedCollections()">
|
||||
@click="deleteSelectedCollections()"
|
||||
aria-role="listitem">
|
||||
{{ $i18n.get('label_delete_selected_collections') }}
|
||||
</b-dropdown-item>
|
||||
<b-dropdown-item disabled>{{ $i18n.get('label_edit_selected_collections') + ' (Not ready)' }}
|
||||
<b-dropdown-item
|
||||
disabled
|
||||
aria-role="listitem">{{ $i18n.get('label_edit_selected_collections') + ' (Not ready)' }}
|
||||
</b-dropdown-item>
|
||||
</b-dropdown>
|
||||
</div>
|
||||
|
|
|
@ -603,10 +603,11 @@ export default {
|
|||
|
||||
|
||||
// Obtains collection name
|
||||
this.fetchCollectionName(this.collectionId).then((collectionName) => {
|
||||
this.collectionName = collectionName;
|
||||
});
|
||||
|
||||
if (!this.isRepositoryLevel) {
|
||||
this.fetchCollectionName(this.collectionId).then((collectionName) => {
|
||||
this.collectionName = collectionName;
|
||||
});
|
||||
}
|
||||
// Sets modal callback function
|
||||
this.$refs.filterTypeModal.onCancel = () => {
|
||||
this.onCancelFilterTypeSelection();
|
||||
|
|
|
@ -31,7 +31,8 @@
|
|||
position="is-bottom-left"
|
||||
v-if="items.length > 0 && items[0].current_user_can_edit"
|
||||
:disabled="selectedItemsIDs.every(id => id === false) || this.selectedItemsIDs.filter(item => item !== false).length <= 1"
|
||||
id="bulk-actions-dropdown">
|
||||
id="bulk-actions-dropdown"
|
||||
aria-role="list">
|
||||
<button
|
||||
class="button is-white"
|
||||
slot="trigger">
|
||||
|
@ -43,23 +44,27 @@
|
|||
|
||||
<b-dropdown-item
|
||||
v-if="$route.params.collectionId && $userCaps.hasCapability('edit_others_posts') && !isOnTrash"
|
||||
@click="openBulkEditionModal()">
|
||||
@click="openBulkEditionModal()"
|
||||
aria-role="listitem">
|
||||
{{ $i18n.get('label_bulk_edit_selected_items') }}
|
||||
</b-dropdown-item>
|
||||
<b-dropdown-item
|
||||
v-if="$route.params.collectionId && $userCaps.hasCapability('edit_others_posts') && !isOnTrash"
|
||||
@click="sequenceEditSelectedItems()">
|
||||
@click="sequenceEditSelectedItems()"
|
||||
aria-role="listitem">
|
||||
{{ $i18n.get('label_sequence_edit_selected_items') }}
|
||||
</b-dropdown-item>
|
||||
<b-dropdown-item
|
||||
v-if="collectionId"
|
||||
@click="deleteSelectedItems()"
|
||||
id="item-delete-selected-items">
|
||||
id="item-delete-selected-items"
|
||||
aria-role="listitem">
|
||||
{{ isOnTrash ? $i18n.get('label_delete_permanently') : $i18n.get('label_send_to_trash') }}
|
||||
</b-dropdown-item>
|
||||
<b-dropdown-item
|
||||
v-if="collectionId && isOnTrash"
|
||||
@click="untrashSelectedItems()">
|
||||
@click="untrashSelectedItems()"
|
||||
aria-role="listitem">
|
||||
{{ $i18n.get('label_untrash_selected_items') }}
|
||||
</b-dropdown-item>
|
||||
</b-dropdown>
|
||||
|
|
|
@ -220,7 +220,6 @@
|
|||
<div class="field is-grouped form-submit">
|
||||
<b-select
|
||||
id="mappers-options-dropdown"
|
||||
class="button is-secondary"
|
||||
:placeholder="$i18n.get('instruction_select_a_mapper')">
|
||||
<option
|
||||
v-for="metadatum_mapper in metadatum_mappers"
|
||||
|
@ -835,9 +834,11 @@ export default {
|
|||
});
|
||||
|
||||
// Obtains collection name
|
||||
this.fetchCollectionName(this.collectionId).then((collectionName) => {
|
||||
this.collectionName = collectionName;
|
||||
});
|
||||
if (!this.isRepositoryLevel) {
|
||||
this.fetchCollectionName(this.collectionId).then((collectionName) => {
|
||||
this.collectionName = collectionName;
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
@ -1280,10 +1281,6 @@ export default {
|
|||
|
||||
}
|
||||
}
|
||||
#mappers-options-dropdown {
|
||||
background-color: transparent;
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -16,7 +16,8 @@
|
|||
position="is-bottom-left"
|
||||
v-if="$userCaps.hasCapability('delete_tainacan-taxonomies')"
|
||||
:disabled="!isSelecting"
|
||||
id="bulk-actions-dropdown">
|
||||
id="bulk-actions-dropdown"
|
||||
aria-role="list">
|
||||
<button
|
||||
class="button is-white"
|
||||
slot="trigger">
|
||||
|
@ -28,10 +29,13 @@
|
|||
|
||||
<b-dropdown-item
|
||||
id="item-delete-selected-items"
|
||||
@click="deleteSelected()">
|
||||
@click="deleteSelected()"
|
||||
aria-role="listitem">
|
||||
{{ $i18n.get('label_delete_selected_taxonomies') }}
|
||||
</b-dropdown-item>
|
||||
<b-dropdown-item disabled>{{ $i18n.get('label_edit_selected_taxonomies') + ' (Not ready)' }}
|
||||
<b-dropdown-item
|
||||
disabled
|
||||
aria-role="listitem">{{ $i18n.get('label_edit_selected_taxonomies') + ' (Not ready)' }}
|
||||
</b-dropdown-item>
|
||||
</b-dropdown>
|
||||
</div>
|
||||
|
|
|
@ -53,13 +53,14 @@
|
|||
<b-dropdown
|
||||
ref="advancedSearchShortcut"
|
||||
class="advanced-search-header-dropdown"
|
||||
position="is-bottom-left">
|
||||
position="is-bottom-left"
|
||||
aria-role="list">
|
||||
<a
|
||||
class="advanced-search-text"
|
||||
slot="trigger">
|
||||
{{ $i18n.get('advanced_search') }}
|
||||
</a>
|
||||
<b-dropdown-item>
|
||||
<b-dropdown-item aria-role="listitem">
|
||||
<div :style="{'height': '25px'}">
|
||||
<p class="is-pulled-left advanced-search-text-di">{{ $i18n.get('advanced_search') }}</p>
|
||||
<span
|
||||
|
@ -72,7 +73,8 @@
|
|||
</b-dropdown-item>
|
||||
<b-dropdown-item
|
||||
style="padding-left: 0 !important; padding-right: 0 !important;"
|
||||
:custom="true">
|
||||
:custom="true"
|
||||
aria-role="listitem">
|
||||
<advanced-search
|
||||
:is-repository-level="true"
|
||||
:is-header="true"/>
|
||||
|
|
|
@ -449,7 +449,7 @@
|
|||
this.isSearchingLoading = true;
|
||||
let query_items = { 'current_query': this.query };
|
||||
|
||||
let query = `?order=asc&number=${this.maxNumSearchResultsShow}&searchterm=${this.optionName}&` + qs.stringify(query_items);
|
||||
let query = `?order=asc&number=${this.maxNumSearchResultsShow}&search=${this.optionName}&` + qs.stringify(query_items);
|
||||
|
||||
if (!this.isFilter)
|
||||
query += '&hideempty=0';
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
<template>
|
||||
<b-field class="filter-item-forms">
|
||||
<b-collapse
|
||||
aria-id="collection-filters-collapse"
|
||||
class="show"
|
||||
:open="open"
|
||||
animation="filter-item">
|
||||
|
|
|
@ -10,9 +10,10 @@
|
|||
$i18n.get('info_showing_items') +
|
||||
getFirstItem() +
|
||||
$i18n.get('info_to') +
|
||||
getLastItemNumber() +
|
||||
$i18n.get('info_of') + totalItems + '.'
|
||||
getLastItemNumber() +
|
||||
$i18n.get('info_of')
|
||||
}}
|
||||
<span :class="{ 'has-text-warning': collectionTotalItems > totalItems }">{{ totalItems + '.' }}</span>
|
||||
</div>
|
||||
<div class="items-per-page">
|
||||
<b-field
|
||||
|
@ -38,7 +39,8 @@
|
|||
:label="$i18n.get('label_go_to_page')">
|
||||
<b-dropdown
|
||||
position="is-top-right"
|
||||
@change="onPageChange">
|
||||
@change="onPageChange"
|
||||
aria-role="list">
|
||||
<button
|
||||
aria-labelledby="go-to-page-dropdown"
|
||||
class="button is-white"
|
||||
|
@ -53,7 +55,8 @@
|
|||
role="button"
|
||||
:key="pageNumber"
|
||||
v-for="pageNumber in totalPages"
|
||||
:value="Number(pageNumber)">
|
||||
:value="Number(pageNumber)"
|
||||
aria-role="listitem">
|
||||
{{ pageNumber }}
|
||||
</b-dropdown-item>
|
||||
</b-dropdown>
|
||||
|
@ -94,6 +97,20 @@ export default {
|
|||
},
|
||||
totalPages(){
|
||||
return Math.ceil(Number(this.totalItems)/Number(this.itemsPerPage));
|
||||
},
|
||||
collectionTotalItems() {
|
||||
let collectionTotalItemsObject = this.getCollectionTotalItems().total_items;
|
||||
if (collectionTotalItemsObject) {
|
||||
switch(this.getStatus()) {
|
||||
case 'draft':
|
||||
return collectionTotalItemsObject.draft;
|
||||
case 'trash':
|
||||
return collectionTotalItemsObject.trash;
|
||||
default:
|
||||
return collectionTotalItemsObject.publish + collectionTotalItemsObject.private;
|
||||
}
|
||||
} else
|
||||
return this.totalItems;
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
|
@ -103,11 +120,15 @@ export default {
|
|||
}
|
||||
},
|
||||
methods: {
|
||||
...mapGetters('collection', [
|
||||
'getCollectionTotalItems'
|
||||
]),
|
||||
...mapGetters('search', [
|
||||
'getTotalItems',
|
||||
'getPage',
|
||||
'getItemsPerPage',
|
||||
'getPostQuery'
|
||||
'getPostQuery',
|
||||
'getStatus'
|
||||
]),
|
||||
onChangeItemsPerPage(value) {
|
||||
if( this.itemsPerPage == value){
|
||||
|
|
|
@ -113,11 +113,11 @@ export default {
|
|||
id: this.params.relatedPostId
|
||||
}
|
||||
this.params.attachment = attachment;
|
||||
this.params.onSave(attachment.id);
|
||||
this.params.onSave(attachment);
|
||||
}
|
||||
|
||||
}),
|
||||
// CroppedImageControl, with presets for thumbnail dimensions
|
||||
// CroppedImageControl, with presets for header dimensions
|
||||
headerImageControl: wp.customize.CroppedImageControl.extend({
|
||||
|
||||
initFrame: function() {
|
||||
|
|
|
@ -9,7 +9,9 @@
|
|||
|
||||
<!-- New Collection button -->
|
||||
<div class="header-item">
|
||||
<b-dropdown id="collection-creation-options-dropdown">
|
||||
<b-dropdown
|
||||
aria-role="list"
|
||||
id="collection-creation-options-dropdown">
|
||||
<button
|
||||
class="button is-secondary"
|
||||
slot="trigger">
|
||||
|
@ -18,7 +20,7 @@
|
|||
<i class="tainacan-icon tainacan-icon-20px tainacan-icon-arrowdown" />
|
||||
</span>
|
||||
</button>
|
||||
<b-dropdown-item>
|
||||
<b-dropdown-item aria-role="listitem">
|
||||
<router-link
|
||||
id="a-create-collection"
|
||||
tag="div"
|
||||
|
@ -31,7 +33,8 @@
|
|||
<b-dropdown-item
|
||||
:key="metadatum_mapper.slug"
|
||||
v-for="metadatum_mapper in metadatum_mappers"
|
||||
v-if="metadatum_mapper.metadata != false">
|
||||
v-if="metadatum_mapper.metadata != false"
|
||||
aria-role="listitem">
|
||||
<router-link
|
||||
:id="'a-create-collection-' + metadatum_mapper.slug"
|
||||
tag="div"
|
||||
|
@ -39,7 +42,7 @@
|
|||
{{ $i18n.get(metadatum_mapper.name) }}
|
||||
</router-link>
|
||||
</b-dropdown-item>
|
||||
<b-dropdown-item>
|
||||
<b-dropdown-item aria-role="listitem">
|
||||
<div
|
||||
id="a-import-collection"
|
||||
tag="div"
|
||||
|
@ -131,7 +134,8 @@
|
|||
<div v-if="$userCaps.hasCapability('edit_tainacan-collections') && status == undefined || status == ''">
|
||||
<b-dropdown
|
||||
:disabled="isLoadingMetadatumMappers"
|
||||
id="collection-creation-options-dropdown">
|
||||
id="collection-creation-options-dropdown"
|
||||
aria-role="list">
|
||||
<button
|
||||
class="button is-secondary"
|
||||
slot="trigger">
|
||||
|
@ -140,7 +144,7 @@
|
|||
<i class="tainacan-icon tainacan-icon-20px tainacan-icon-arrowdown" />
|
||||
</span>
|
||||
</button>
|
||||
<b-dropdown-item>
|
||||
<b-dropdown-item aria-role="listitem">
|
||||
<router-link
|
||||
id="a-create-collection"
|
||||
tag="div"
|
||||
|
@ -153,7 +157,8 @@
|
|||
<b-dropdown-item
|
||||
:key="metadatum_mapper.slug"
|
||||
v-for="metadatum_mapper in metadatum_mappers"
|
||||
v-if="metadatum_mapper.metadata != false">
|
||||
v-if="metadatum_mapper.metadata != false"
|
||||
aria-role="listitem">
|
||||
<router-link
|
||||
:id="'a-create-collection-' + metadatum_mapper.slug"
|
||||
tag="div"
|
||||
|
@ -161,7 +166,7 @@
|
|||
{{ $i18n.get(metadatum_mapper.name) }}
|
||||
</router-link>
|
||||
</b-dropdown-item>
|
||||
<b-dropdown-item>
|
||||
<b-dropdown-item aria-role="listitem">
|
||||
<div
|
||||
id="a-import-collection"
|
||||
tag="div"
|
||||
|
|
|
@ -29,8 +29,9 @@
|
|||
v-if="!openAdvancedSearch && !(registeredViewModes[viewMode] != undefined && registeredViewModes[viewMode].full_screen)"
|
||||
class="is-hidden-mobile"
|
||||
id="filter-menu-compress-button"
|
||||
:style="{ top: !isOnTheme ? (isRepositoryLevel ? '172px' : '120px') : '76px' }"
|
||||
:aria-label="isFiltersMenuCompressed ? $i18n.get('label_show_filters') : $i18n.get('label_hide_filters')"
|
||||
|
||||
:style="{ top: !isOnTheme ? (isRepositoryLevel ? '172px' : '120px') : '76px' }"
|
||||
@click="isFiltersMenuCompressed = !isFiltersMenuCompressed">
|
||||
<span class="icon">
|
||||
<i
|
||||
|
@ -45,8 +46,9 @@
|
|||
v-if="!openAdvancedSearch && !(registeredViewModes[viewMode] != undefined && registeredViewModes[viewMode].full_screen)"
|
||||
class="is-hidden-tablet"
|
||||
id="filter-menu-compress-button-mobile"
|
||||
:style="{ top: !isOnTheme ? (isRepositoryLevel ? (searchControlHeight + 100) : (searchControlHeight + 70) + 'px') : (searchControlHeight - 25) + 'px' }"
|
||||
:aria-label="isFiltersMenuCompressed ? $i18n.get('label_show_filters') : $i18n.get('label_hide_filters')"
|
||||
|
||||
:style="{ top: !isOnTheme ? (isRepositoryLevel ? (searchControlHeight + 100) : (searchControlHeight + 70) + 'px') : (searchControlHeight - 25) + 'px' }"
|
||||
@click="isFilterModalActive = !isFilterModalActive">
|
||||
<span class="icon">
|
||||
<i
|
||||
|
@ -64,7 +66,7 @@
|
|||
role="region"
|
||||
aria-labelledby="filters-label-landmark"
|
||||
:style="{ top: searchControlHeight + 'px' }"
|
||||
v-if="!isFiltersMenuCompressed &&
|
||||
v-show="!isFiltersMenuCompressed &&
|
||||
!openAdvancedSearch &&
|
||||
!(registeredViewModes[viewMode] != undefined && registeredViewModes[viewMode].full_screen)"
|
||||
class="filters-menu tainacan-form is-hidden-mobile">
|
||||
|
@ -174,7 +176,8 @@
|
|||
v-if="!isOnTheme">
|
||||
<b-dropdown
|
||||
:mobile-modal="true"
|
||||
id="item-creation-options-dropdown">
|
||||
id="item-creation-options-dropdown"
|
||||
aria-role="list">
|
||||
<button
|
||||
class="button is-secondary"
|
||||
slot="trigger">
|
||||
|
@ -184,7 +187,9 @@
|
|||
</span>
|
||||
</button>
|
||||
|
||||
<b-dropdown-item v-if="!isRepositoryLevel">
|
||||
<b-dropdown-item
|
||||
v-if="!isRepositoryLevel"
|
||||
aria-role="listitem">
|
||||
<router-link
|
||||
id="a-create-item"
|
||||
tag="div"
|
||||
|
@ -192,7 +197,9 @@
|
|||
{{ $i18n.get('add_one_item') }}
|
||||
</router-link>
|
||||
</b-dropdown-item>
|
||||
<b-dropdown-item v-if="isRepositoryLevel">
|
||||
<b-dropdown-item
|
||||
v-if="isRepositoryLevel"
|
||||
aria-role="listitem">
|
||||
<div
|
||||
id="a-create-item"
|
||||
tag="div"
|
||||
|
@ -200,7 +207,9 @@
|
|||
{{ $i18n.get('add_one_item') }}
|
||||
</div>
|
||||
</b-dropdown-item>
|
||||
<b-dropdown-item v-if="!isRepositoryLevel">
|
||||
<b-dropdown-item
|
||||
v-if="!isRepositoryLevel"
|
||||
aria-role="listitem">
|
||||
<router-link
|
||||
id="a-item-add-bulk"
|
||||
tag="div"
|
||||
|
@ -210,7 +219,7 @@
|
|||
<small class="is-small">{{ $i18n.get('info_bulk_add_items') }}</small>
|
||||
</router-link>
|
||||
</b-dropdown-item>
|
||||
<b-dropdown-item>
|
||||
<b-dropdown-item aria-role="listitem">
|
||||
<div
|
||||
id="a-import-items"
|
||||
tag="div"
|
||||
|
@ -240,7 +249,8 @@
|
|||
ref="displayedMetadataDropdown"
|
||||
:mobile-modal="true"
|
||||
:disabled="totalItems <= 0 || adminViewMode == 'grid'|| adminViewMode == 'cards' || adminViewMode == 'masonry'"
|
||||
class="show">
|
||||
class="show metadata-options-dropdown"
|
||||
aria-role="list">
|
||||
<button
|
||||
:aria-label="$i18n.get('label_displayed_metadata')"
|
||||
class="button is-white"
|
||||
|
@ -255,7 +265,8 @@
|
|||
v-for="(column, index) in localDisplayedMetadata"
|
||||
:key="index"
|
||||
class="control"
|
||||
custom>
|
||||
custom
|
||||
aria-role="listitem">
|
||||
<b-checkbox
|
||||
v-model="column.display"
|
||||
:native-value="column.display">
|
||||
|
@ -277,15 +288,16 @@
|
|||
<!-- Change OrderBy Select and Order Button-->
|
||||
<div class="search-control-item">
|
||||
<b-field>
|
||||
<label class="label is-hidden-mobile">{{ $i18n.get('label_sorting') + ':' }}</label>
|
||||
<b-dropdown
|
||||
:mobile-modal="true"
|
||||
:disabled="totalItems <= 0"
|
||||
@input="onChangeOrderBy($event)">
|
||||
@input="onChangeOrderBy($event)"
|
||||
aria-role="list">
|
||||
<button
|
||||
:aria-label="$i18n.get('label_sorting')"
|
||||
class="button is-white"
|
||||
slot="trigger">
|
||||
<span>{{ $i18n.get('label_sorting') }}</span>
|
||||
<span>{{ orderByName }}</span>
|
||||
<span class="icon">
|
||||
<i class="tainacan-icon tainacan-icon-20px tainacan-icon-arrowdown" />
|
||||
</span>
|
||||
|
@ -293,14 +305,12 @@
|
|||
<b-dropdown-item
|
||||
aria-controls="items-list-results"
|
||||
role="button"
|
||||
:class="{ 'is-active': metadatum != undefined && orderBy == metadatum.slug }"
|
||||
:class="{ 'is-active': (orderBy != 'meta_value' && orderBy != 'meta_value_num' && orderBy == metadatum.slug) || ((orderBy == 'meta_value' || orderBy == 'meta_value_num') && metaKey == metadatum.id) }"
|
||||
v-for="metadatum of sortingMetadata"
|
||||
v-if="
|
||||
totalItems > 0 &&
|
||||
metadatum != undefined
|
||||
"
|
||||
v-if="metadatum != undefined"
|
||||
:value="metadatum"
|
||||
:key="metadatum.slug">
|
||||
:key="metadatum.slug"
|
||||
aria-role="listitem">
|
||||
{{ metadatum.name }}
|
||||
</b-dropdown-item>
|
||||
<!-- Once we have sorting by metadata we can use this -->
|
||||
|
@ -326,21 +336,21 @@
|
|||
<button
|
||||
aria-controls="items-list-results"
|
||||
class="button is-white is-small"
|
||||
:aria-label="$i18n.get('label_sort_ascending')"
|
||||
:aria-label="$i18n.get('label_sort_descending')"
|
||||
:disabled="totalItems <= 0 || order == 'DESC'"
|
||||
@click="onChangeOrder()">
|
||||
<span class="icon is-small gray-icon">
|
||||
<i class="tainacan-icon tainacan-icon-sortascending"/>
|
||||
<i class="tainacan-icon tainacan-icon-sortdescending"/>
|
||||
</span>
|
||||
</button>
|
||||
<button
|
||||
aria-controls="items-list-results"
|
||||
:disabled="totalItems <= 0 || order == 'ASC'"
|
||||
:aria-label="$i18n.get('label_sort_descending')"
|
||||
:aria-label="$i18n.get('label_sort_ascending')"
|
||||
class="button is-white is-small"
|
||||
@click="onChangeOrder()">
|
||||
<span class="icon is-small gray-icon">
|
||||
<i class="tainacan-icon tainacan-icon-sortdescending"/>
|
||||
<i class="tainacan-icon tainacan-icon-sortascending"/>
|
||||
</span>
|
||||
</button>
|
||||
</b-field>
|
||||
|
@ -351,20 +361,22 @@
|
|||
v-if="isOnTheme"
|
||||
class="search-control-item">
|
||||
<b-field>
|
||||
<label class="label is-hidden-mobile">{{ $i18n.get('label_visualization') + ': ' }}</label>
|
||||
<b-dropdown
|
||||
@change="onChangeViewMode($event)"
|
||||
:mobile-modal="true"
|
||||
position="is-bottom-left"
|
||||
:aria-label="$i18n.get('label_view_mode')">
|
||||
:aria-label="$i18n.get('label_view_mode')"
|
||||
aria-role="list">
|
||||
<button
|
||||
:aria-label="$i18n.get('label_view_mode')"
|
||||
:aria-label="registeredViewModes[viewMode] != undefined ? registeredViewModes[viewMode].label : $i18n.get('label_visualization')"
|
||||
class="button is-white"
|
||||
slot="trigger">
|
||||
<span
|
||||
class="gray-icon view-mode-icon"
|
||||
v-if="registeredViewModes[viewMode] != undefined"
|
||||
v-html="registeredViewModes[viewMode].icon"/>
|
||||
<span class="is-hidden-touch"> {{ $i18n.get('label_visualization') }}</span>
|
||||
<span class="is-hidden-touch"> {{ registeredViewModes[viewMode] != undefined ? registeredViewModes[viewMode].label : $i18n.get('label_visualization') }}</span>
|
||||
<span class="icon">
|
||||
<i class="tainacan-icon tainacan-icon-20px tainacan-icon-arrowdown" />
|
||||
</span>
|
||||
|
@ -376,7 +388,8 @@
|
|||
v-for="(viewModeOption, index) of enabledViewModes"
|
||||
:key="index"
|
||||
:value="viewModeOption"
|
||||
v-if="registeredViewModes[viewModeOption] != undefined && registeredViewModes[viewModeOption].full_screen == false">
|
||||
v-if="registeredViewModes[viewModeOption] != undefined && registeredViewModes[viewModeOption].full_screen == false"
|
||||
aria-role="listitem">
|
||||
<span
|
||||
class="gray-icon"
|
||||
v-html="registeredViewModes[viewModeOption].icon"/>
|
||||
|
@ -389,17 +402,19 @@
|
|||
v-if="!isOnTheme"
|
||||
class="search-control-item">
|
||||
<b-field>
|
||||
<label class="label is-hidden-mobile">{{ $i18n.get('label_visualization') + ':' }}</label>
|
||||
<b-dropdown
|
||||
@change="onChangeAdminViewMode($event)"
|
||||
:mobile-modal="true"
|
||||
position="is-bottom-left"
|
||||
:aria-label="$i18n.get('label_view_mode')">
|
||||
:aria-label="$i18n.get('label_view_mode')"
|
||||
aria-role="list">
|
||||
<button
|
||||
:aria-label="$i18n.get('label_view_mode')"
|
||||
class="button is-white"
|
||||
slot="trigger">
|
||||
<span>
|
||||
<span class="icon is-small gray-icon">
|
||||
<span class="view-mode-icon icon is-small gray-icon">
|
||||
<i
|
||||
:class="{'tainacan-icon-viewtable' : ( adminViewMode == 'table' || adminViewMode == undefined),
|
||||
'tainacan-icon-viewcards' : adminViewMode == 'cards',
|
||||
|
@ -409,7 +424,7 @@
|
|||
class="tainacan-icon"/>
|
||||
</span>
|
||||
</span>
|
||||
{{ $i18n.get('label_visualization') }}
|
||||
{{ adminViewMode != undefined ? $i18n.get('label_' + adminViewMode) : $i18n.get('label_table') }}
|
||||
<span class="icon">
|
||||
<i class="tainacan-icon tainacan-icon-20px tainacan-icon-arrowdown" />
|
||||
</span>
|
||||
|
@ -418,7 +433,8 @@
|
|||
aria-controls="items-list-results"
|
||||
role="button"
|
||||
:class="{ 'is-active': adminViewMode == 'table' }"
|
||||
:value="'table'">
|
||||
:value="'table'"
|
||||
aria-role="listitem">
|
||||
<span class="icon gray-icon">
|
||||
<i class="tainacan-icon tainacan-icon-viewtable"/>
|
||||
</span>
|
||||
|
@ -428,7 +444,8 @@
|
|||
aria-controls="items-list-results"
|
||||
role="button"
|
||||
:class="{ 'is-active': adminViewMode == 'cards' }"
|
||||
:value="'cards'">
|
||||
:value="'cards'"
|
||||
aria-role="listitem">
|
||||
<span class="icon gray-icon">
|
||||
<i class="tainacan-icon tainacan-icon-viewcards"/>
|
||||
</span>
|
||||
|
@ -438,7 +455,8 @@
|
|||
aria-controls="items-list-results"
|
||||
role="button"
|
||||
:class="{ 'is-active': adminViewMode == 'grid' }"
|
||||
:value="'grid'">
|
||||
:value="'grid'"
|
||||
aria-role="listitem">
|
||||
<span class="icon gray-icon">
|
||||
<i class="tainacan-icon tainacan-icon-viewminiature"/>
|
||||
</span>
|
||||
|
@ -448,7 +466,8 @@
|
|||
aria-controls="items-list-results"
|
||||
role="button"
|
||||
:class="{ 'is-active': adminViewMode == 'records' }"
|
||||
:value="'records'">
|
||||
:value="'records'"
|
||||
aria-role="listitem">
|
||||
<span class="icon gray-icon">
|
||||
<i class="tainacan-icon tainacan-icon-viewrecords"/>
|
||||
</span>
|
||||
|
@ -458,7 +477,8 @@
|
|||
aria-controls="items-list-results"
|
||||
role="button"
|
||||
:class="{ 'is-active': adminViewMode == 'masonry' }"
|
||||
:value="'masonry'">
|
||||
:value="'masonry'"
|
||||
aria-role="listitem">
|
||||
<span class="icon gray-icon">
|
||||
<i class="tainacan-icon tainacan-icon-viewmasonry"/>
|
||||
</span>
|
||||
|
@ -560,7 +580,7 @@
|
|||
:open-form-advanced-search="openFormAdvancedSearch"
|
||||
:is-do-search="isDoSearch"/>
|
||||
|
||||
<div class="advanced-searh-form-submit">
|
||||
<div class="advanced-search-form-submit">
|
||||
<p
|
||||
v-if="advancedSearchResults"
|
||||
class="control">
|
||||
|
@ -883,6 +903,27 @@
|
|||
},
|
||||
showLoading() {
|
||||
return this.isLoadingItems || this.isLoadingFilters || this.isLoadingMetadata;
|
||||
},
|
||||
metaKey() {
|
||||
return this.getMetaKey();
|
||||
},
|
||||
orderByName() {
|
||||
|
||||
if (this.getOrderByName() != null && this.getOrderByName() != undefined && this.getOrderByName() != '') {
|
||||
return this.getOrderByName();
|
||||
} else {
|
||||
|
||||
for (let metadatum of this.sortingMetadata) {
|
||||
|
||||
if (
|
||||
((this.orderBy != 'meta_value' && this.orderBy != 'meta_value_num' && metadatum.slug == 'creation_date' && (!metadatum.metadata_type_object || !metadatum.metadata_type_object.core)) && this.orderBy == 'date') ||
|
||||
((this.orderBy != 'meta_value' && this.orderBy != 'meta_value_num' && metadatum.slug != 'creation_date' && (metadatum.metadata_type_object != undefined && metadatum.metadata_type_object.core)) && this.orderBy == metadatum.metadata_type_object.related_mapped_prop) ||
|
||||
((this.orderBy != 'meta_value' && this.orderBy != 'meta_value_num' && metadatum.slug != 'creation_date' && (!metadatum.metadata_type_object || !metadatum.metadata_type_object.core)) && this.orderBy == metadatum.slug) ||
|
||||
((this.orderBy == 'meta_value' || this.orderBy == 'meta_value_num') && this.getMetaKey() == metadatum.id)
|
||||
)
|
||||
return metadatum.name;
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
components: {
|
||||
|
@ -930,10 +971,12 @@
|
|||
'getSearchQuery',
|
||||
'getStatus',
|
||||
'getOrderBy',
|
||||
'getOrderByName',
|
||||
'getOrder',
|
||||
'getViewMode',
|
||||
'getTotalItems',
|
||||
'getAdminViewMode',
|
||||
'getMetaKey'
|
||||
]),
|
||||
onSwipeFiltersMenu($event) {
|
||||
if (this.registeredViewModes[this.viewMode] == undefined ||
|
||||
|
@ -1493,7 +1536,7 @@
|
|||
}
|
||||
}
|
||||
|
||||
.advanced-searh-form-submit {
|
||||
.advanced-search-form-submit {
|
||||
display: flex;
|
||||
justify-content: flex-end;
|
||||
padding-right: $page-side-padding;
|
||||
|
@ -1653,6 +1696,14 @@
|
|||
flex-basis: 100%;
|
||||
}
|
||||
|
||||
.label {
|
||||
font-size: 0.875rem;
|
||||
font-weight: normal;
|
||||
margin-top: 3px;
|
||||
margin-bottom: 2px;
|
||||
cursor: default;
|
||||
}
|
||||
|
||||
.button {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
|
@ -1673,8 +1724,9 @@
|
|||
}
|
||||
|
||||
.view-mode-icon {
|
||||
margin-right: 4px !important;
|
||||
margin-right: 3px !important;
|
||||
margin-top: 1px;
|
||||
margin-left: 6px !important;
|
||||
}
|
||||
|
||||
.dropdown-menu {
|
||||
|
@ -1684,7 +1736,7 @@
|
|||
padding: 0;
|
||||
|
||||
.metadata-options-container {
|
||||
max-height: 240px;
|
||||
max-height: 288px;
|
||||
overflow: auto;
|
||||
}
|
||||
.dropdown-item {
|
||||
|
@ -1696,7 +1748,7 @@
|
|||
.dropdown-item-apply {
|
||||
width: 100%;
|
||||
border-top: 1px solid #efefef;
|
||||
padding: 8px 12px 2px 12px;
|
||||
padding: 8px 12px;
|
||||
text-align: right;
|
||||
}
|
||||
.dropdown-item-apply .button {
|
||||
|
|
|
@ -20,6 +20,7 @@
|
|||
|
||||
<!-- Sorting options ---- -->
|
||||
<b-field class="header-item">
|
||||
<label class="label">{{ $i18n.get('label_sorting') + ':' }}</label>
|
||||
<b-select
|
||||
class="sorting-select"
|
||||
:disabled="taxonomies.length <= 0"
|
||||
|
@ -167,7 +168,7 @@
|
|||
order: 'asc',
|
||||
ordeBy: 'date',
|
||||
sortingOptions: [
|
||||
{ label: this.$i18n.get('label_title'), value: 'title' },
|
||||
{ label: this.$i18n.get('label_name'), value: 'title' },
|
||||
{ label: this.$i18n.get('label_creation_date'), value: 'date' },
|
||||
]
|
||||
}
|
||||
|
@ -315,6 +316,11 @@
|
|||
.header-item .button .icon i{
|
||||
width: 100%;
|
||||
}
|
||||
.header-item .label{
|
||||
font-weight: normal;
|
||||
font-size: 0.875rem;
|
||||
margin-top: 3px;
|
||||
}
|
||||
|
||||
@media screen and (max-width: 769px) {
|
||||
height: 60px;
|
||||
|
|
|
@ -84,7 +84,9 @@
|
|||
<span
|
||||
@click="updateSearch()"
|
||||
class="icon is-right">
|
||||
<i class="tainacan-icon tainacan-icon-20px tainacan-icon-search"/>
|
||||
<span class="icon">
|
||||
<i class="tainacan-icon tainacan-icon-20px tainacan-icon-search"/>
|
||||
</span>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -96,7 +98,11 @@
|
|||
{{ $i18n.get('advanced_search') }}
|
||||
</button> -->
|
||||
|
||||
<h3 class="has-text-weight-semibold">{{ $i18n.get('filters') }}</h3>
|
||||
<h3
|
||||
id="filters-label-landmark"
|
||||
class="has-text-weight-semibold">
|
||||
{{ $i18n.get('filters') }}
|
||||
</h3>
|
||||
<button
|
||||
v-if="!isLoadingFilters &&
|
||||
((filters.length >= 0 &&
|
||||
|
@ -169,7 +175,8 @@
|
|||
v-if="!isOnTheme">
|
||||
<b-dropdown
|
||||
:mobile-modal="true"
|
||||
id="item-creation-options-dropdown">
|
||||
id="item-creation-options-dropdown"
|
||||
aria-role="list">
|
||||
<button
|
||||
class="button is-secondary"
|
||||
slot="trigger">
|
||||
|
@ -179,7 +186,7 @@
|
|||
</span>
|
||||
</button>
|
||||
|
||||
<b-dropdown-item>
|
||||
<b-dropdown-item aria-role="listitem">
|
||||
<router-link
|
||||
id="a-create-item"
|
||||
tag="div"
|
||||
|
@ -187,13 +194,17 @@
|
|||
{{ $i18n.get('add_one_item') }}
|
||||
</router-link>
|
||||
</b-dropdown-item>
|
||||
<b-dropdown-item disabled>
|
||||
<b-dropdown-item
|
||||
aria-role="listitem"
|
||||
disabled>
|
||||
{{ $i18n.get('add_items_bulk') + ' (Not ready)' }}
|
||||
</b-dropdown-item>
|
||||
<b-dropdown-item disabled>
|
||||
<b-dropdown-item
|
||||
aria-role="listitem"
|
||||
disabled>
|
||||
{{ $i18n.get('add_items_external_source') + ' (Not ready)' }}
|
||||
</b-dropdown-item>
|
||||
<b-dropdown-item>
|
||||
<b-dropdown-item aria-role="listitem">
|
||||
<div
|
||||
id="a-import-collection"
|
||||
tag="div"
|
||||
|
@ -211,17 +222,27 @@
|
|||
v-if="!isOnTheme || (registeredViewModes[viewMode] != undefined && registeredViewModes[viewMode].dynamic_metadata)"
|
||||
class="search-control-item">
|
||||
<b-dropdown
|
||||
v-tooltip="{
|
||||
delay: {
|
||||
show: 500,
|
||||
hide: 300,
|
||||
},
|
||||
content: (totalItems <= 0 || adminViewMode == 'grid'|| adminViewMode == 'cards' || adminViewMode == 'masonry') ? (adminViewMode == 'grid'|| adminViewMode == 'cards' || adminViewMode == 'masonry') ? $i18n.get('info_current_view_mode_metadata_not_allowed') : $i18n.get('info_cant_select_metadata_without_items') : '',
|
||||
autoHide: false,
|
||||
placement: 'auto-start'
|
||||
}"
|
||||
ref="displayedMetadataDropdown"
|
||||
:mobile-modal="true"
|
||||
:disabled="totalItems <= 0 || adminViewMode == 'grid'|| adminViewMode == 'cards' || adminViewMode == 'masonry'"
|
||||
class="show">
|
||||
class="show metadata-options-dropdown"
|
||||
aria-role="list">
|
||||
<button
|
||||
class="button is-white"
|
||||
:aria-label="$i18n.get('label_displayed_metadata')"
|
||||
class="button is-white"
|
||||
slot="trigger">
|
||||
<span>{{ $i18n.get('label_displayed_metadata') }}</span>
|
||||
<span class="icon">
|
||||
<i class="has-text-secondary tainacan-icon tainacan-icon-20px tainacan-icon-arrowdown"/>
|
||||
<i class="tainacan-icon tainacan-icon-20px tainacan-icon-arrowdown"/>
|
||||
</span>
|
||||
</button>
|
||||
<div class="metadata-options-container">
|
||||
|
@ -229,7 +250,8 @@
|
|||
v-for="(column, index) in localDisplayedMetadata"
|
||||
:key="index"
|
||||
class="control"
|
||||
custom>
|
||||
custom
|
||||
aria-role="listitem">
|
||||
<b-checkbox
|
||||
v-model="column.display"
|
||||
:native-value="column.display">
|
||||
|
@ -251,32 +273,29 @@
|
|||
<!-- Change OrderBy Select and Order Button-->
|
||||
<div class="search-control-item">
|
||||
<b-field>
|
||||
<label class="label is-hidden-mobile">{{ $i18n.get('label_sorting') + ':' }}</label>
|
||||
<b-dropdown
|
||||
:disabled="totalItems <= 0"
|
||||
@input="onChangeOrderBy($event)">
|
||||
:mobile-modal="true"
|
||||
@input="onChangeOrderBy($event)"
|
||||
aria-role="list">
|
||||
<button
|
||||
:aria-label="$i18n.get('label_sorting')"
|
||||
class="button is-white"
|
||||
slot="trigger">
|
||||
<span>{{ $i18n.get('label_sorting') }}</span>
|
||||
<span>{{ orderByName }}</span>
|
||||
<span class="icon">
|
||||
<i class="has-text-secondary tainacan-icon tainacan-icon-20px tainacan-icon-arrowdown"/>
|
||||
<i class="tainacan-icon tainacan-icon-20px tainacan-icon-arrowdown "/>
|
||||
</span>
|
||||
</button>
|
||||
<b-dropdown-item
|
||||
aria-controls="items-list-results"
|
||||
role="button"
|
||||
:class="{ 'is-active': metadatum != undefined && orderBy == metadatum.slug }"
|
||||
:class="{ 'is-active': (orderBy != 'meta_value' && orderBy != 'meta_value_num' && orderBy == metadatum.slug) || ((orderBy == 'meta_value' || orderBy == 'meta_value_num') && metaKey == metadatum.id) }"
|
||||
v-for="metadatum of sortingMetadata"
|
||||
v-if="
|
||||
totalItems > 0 &&
|
||||
metadatum != undefined &&
|
||||
metadatum.slug === 'creation_date' || (
|
||||
metadatum.metadata_type_object &&
|
||||
metadatum.metadata_type_object.related_mapped_prop == 'title'
|
||||
)"
|
||||
v-if="metadatum != undefined"
|
||||
:value="metadatum"
|
||||
:key="metadatum.slug">
|
||||
:key="metadatum.slug"
|
||||
aria-role="listitem">
|
||||
{{ metadatum.name }}
|
||||
</b-dropdown-item>
|
||||
<!-- Once we have sorting by metadata we can use this -->
|
||||
|
@ -327,22 +346,24 @@
|
|||
v-if="isOnTheme"
|
||||
class="search-control-item">
|
||||
<b-field>
|
||||
<label class="label is-hidden-mobile">{{ $i18n.get('label_visualization') + ': ' }}</label>
|
||||
<b-dropdown
|
||||
@change="onChangeViewMode($event)"
|
||||
:mobile-modal="true"
|
||||
position="is-bottom-left"
|
||||
:aria-label="$i18n.get('label_view_mode')">
|
||||
:aria-label="$i18n.get('label_view_mode')"
|
||||
aria-role="list">
|
||||
<button
|
||||
class="button is-white"
|
||||
:aria-label="$i18n.get('label_view_mode')"
|
||||
:aria-label="registeredViewModes[viewMode] != undefined ? registeredViewModes[viewMode].label : $i18n.get('label_visualization')"
|
||||
slot="trigger">
|
||||
<span
|
||||
class="gray-icon view-mode-icon"
|
||||
v-if="registeredViewModes[viewMode] != undefined"
|
||||
v-html="registeredViewModes[viewMode].icon"/>
|
||||
<span class="is-hidden-touch"> {{ $i18n.get('label_visualization') }}</span>
|
||||
<span class="is-hidden-touch"> {{ registeredViewModes[viewMode] != undefined ? registeredViewModes[viewMode].label : $i18n.get('label_visualization') }}</span>
|
||||
<span class="icon">
|
||||
<i class="has-text-secondary tainacan-icon tainacan-icon-20px tainacan-icon-arrowdown"/>
|
||||
<i class="tainacan-icon tainacan-icon-20px tainacan-icon-arrowdown" />
|
||||
</span>
|
||||
</button>
|
||||
<b-dropdown-item
|
||||
|
@ -352,11 +373,12 @@
|
|||
v-for="(viewModeOption, index) of enabledViewModes"
|
||||
:key="index"
|
||||
:value="viewModeOption"
|
||||
v-if="registeredViewModes[viewModeOption] != undefined && registeredViewModes[viewModeOption].full_screen == false">
|
||||
v-if="registeredViewModes[viewModeOption] != undefined && registeredViewModes[viewModeOption].full_screen == false"
|
||||
aria-role="listitem">
|
||||
<span
|
||||
class="gray-icon"
|
||||
v-html="registeredViewModes[viewModeOption].icon"/>
|
||||
{{ registeredViewModes[viewModeOption].label }}
|
||||
<span>{{ registeredViewModes[viewModeOption].label }}</span>
|
||||
</b-dropdown-item>
|
||||
</b-dropdown>
|
||||
</b-field>
|
||||
|
@ -365,17 +387,19 @@
|
|||
v-if="!isOnTheme"
|
||||
class="search-control-item">
|
||||
<b-field>
|
||||
<label class="label is-hidden-mobile">{{ $i18n.get('label_visualization') + ':' }}</label>
|
||||
<b-dropdown
|
||||
@change="onChangeAdminViewMode($event)"
|
||||
:mobile-modal="true"
|
||||
position="is-bottom-left"
|
||||
:aria-label="$i18n.get('label_view_mode')">
|
||||
:aria-label="$i18n.get('label_view_mode')"
|
||||
aria-role="list">
|
||||
<button
|
||||
class="button is-white"
|
||||
:aria-label="$i18n.get('label_view_mode')"
|
||||
slot="trigger">
|
||||
<span>
|
||||
<span class="icon is-small gray-icon">
|
||||
<span class="view-mode-icon icon is-small gray-icon">
|
||||
<i
|
||||
:class="{'tainacan-icon-viewtable' : ( adminViewMode == 'table' || adminViewMode == undefined),
|
||||
'tainacan-icon-viewcards' : adminViewMode == 'cards',
|
||||
|
@ -385,60 +409,65 @@
|
|||
class="tainacan-icon"/>
|
||||
</span>
|
||||
</span>
|
||||
{{ $i18n.get('label_visualization') }}
|
||||
{{ adminViewMode != undefined ? $i18n.get('label_' + adminViewMode) : $i18n.get('label_table') }}
|
||||
<span class="icon">
|
||||
<i class="has-text-secondary tainacan-icon tainacan-icon-20px tainacan-icon-arrowdown"/>
|
||||
<i class="tainacan-icon tainacan-icon-20px tainacan-icon-arrowdown"/>
|
||||
</span>
|
||||
</button>
|
||||
<b-dropdown-item
|
||||
aria-controls="items-list-results"
|
||||
role="button"
|
||||
:class="{ 'is-active': adminViewMode == 'table' }"
|
||||
:value="'table'">
|
||||
:value="'table'"
|
||||
aria-role="listitem">
|
||||
<span class="icon gray-icon">
|
||||
<i class="tainacan-icon tainacan-icon-viewtable"/>
|
||||
</span>
|
||||
{{ $i18n.get('label_table') }}
|
||||
<span>{{ $i18n.get('label_table') }}</span>
|
||||
</b-dropdown-item>
|
||||
<b-dropdown-item
|
||||
aria-controls="items-list-results"
|
||||
role="button"
|
||||
:class="{ 'is-active': adminViewMode == 'cards' }"
|
||||
:value="'cards'">
|
||||
:value="'cards'"
|
||||
aria-role="listitem">
|
||||
<span class="icon gray-icon">
|
||||
<i class="tainacan-icon tainacan-icon-viewcards"/>
|
||||
</span>
|
||||
{{ $i18n.get('label_cards') }}
|
||||
<span>{{ $i18n.get('label_cards') }}</span>
|
||||
</b-dropdown-item>
|
||||
<b-dropdown-item
|
||||
aria-controls="items-list-results"
|
||||
role="button"
|
||||
:class="{ 'is-active': adminViewMode == 'grid' }"
|
||||
:value="'grid'">
|
||||
:value="'grid'"
|
||||
aria-role="listitem">
|
||||
<span class="icon gray-icon">
|
||||
<i class="tainacan-icon tainacan-icon-viewminiature"/>
|
||||
</span>
|
||||
{{ $i18n.get('label_thumbnails') }}
|
||||
<span>{{ $i18n.get('label_thumbnails') }}</span>
|
||||
</b-dropdown-item>
|
||||
<b-dropdown-item
|
||||
aria-controls="items-list-results"
|
||||
role="button"
|
||||
:class="{ 'is-active': adminViewMode == 'records' }"
|
||||
:value="'records'">
|
||||
:value="'records'"
|
||||
aria-role="listitem">
|
||||
<span class="icon gray-icon">
|
||||
<i class="tainacan-icon tainacan-icon-viewrecords"/>
|
||||
</span>
|
||||
{{ $i18n.get('label_records') }}
|
||||
<span>{{ $i18n.get('label_records') }}</span>
|
||||
</b-dropdown-item>
|
||||
<b-dropdown-item
|
||||
aria-controls="items-list-results"
|
||||
role="button"
|
||||
:class="{ 'is-active': adminViewMode == 'masonry' }"
|
||||
:value="'masonry'">
|
||||
:value="'masonry'"
|
||||
aria-role="listitem">
|
||||
<span class="icon gray-icon">
|
||||
<i class="tainacan-icon tainacan-icon-viewmasonry"/>
|
||||
</span>
|
||||
{{ $i18n.get('label_masonry') }}
|
||||
<span>{{ $i18n.get('label_masonry') }}</span>
|
||||
</b-dropdown-item>
|
||||
</b-dropdown>
|
||||
</b-field>
|
||||
|
@ -544,7 +573,7 @@
|
|||
<button
|
||||
aria-controls="items-list-results"
|
||||
@click="advancedSearchResults = !advancedSearchResults"
|
||||
class="button is-small is-outlined">{{ $i18n.get('edit_search') }}</button>
|
||||
class="button is-outlined">{{ $i18n.get('edit_search') }}</button>
|
||||
</p>
|
||||
<p
|
||||
v-if="advancedSearchResults"
|
||||
|
@ -552,7 +581,7 @@
|
|||
<button
|
||||
aria-controls="items-list-results"
|
||||
@click="isDoSearch = !isDoSearch"
|
||||
class="button is-small is-secondary">{{ $i18n.get('search') }}</button>
|
||||
class="button is-success">{{ $i18n.get('search') }}</button>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -592,7 +621,7 @@
|
|||
|
||||
<h3
|
||||
id="items-list-landmark"
|
||||
class="is-hidden">
|
||||
class="sr-only">
|
||||
{{ $i18n.get('label_items_list') }}
|
||||
</h3>
|
||||
|
||||
|
@ -838,6 +867,26 @@
|
|||
},
|
||||
showLoading() {
|
||||
return this.isLoadingItems || this.isLoadingFilters || this.isLoadingMetadata;
|
||||
},
|
||||
metaKey() {
|
||||
return this.getMetaKey();
|
||||
},
|
||||
orderByName() {
|
||||
|
||||
if (this.getOrderByName() != null && this.getOrderByName() != undefined && this.getOrderByName() != '') {
|
||||
return this.getOrderByName();
|
||||
} else {
|
||||
for (let metadatum of this.sortingMetadata) {
|
||||
|
||||
if (
|
||||
((this.orderBy != 'meta_value' && this.orderBy != 'meta_value_num' && metadatum.slug == 'creation_date' && (!metadatum.metadata_type_object || !metadatum.metadata_type_object.core)) && this.orderBy == 'date') ||
|
||||
((this.orderBy != 'meta_value' && this.orderBy != 'meta_value_num' && metadatum.slug != 'creation_date' && (metadatum.metadata_type_object != undefined && metadatum.metadata_type_object.core)) && this.orderBy == metadatum.metadata_type_object.related_mapped_prop) ||
|
||||
((this.orderBy != 'meta_value' && this.orderBy != 'meta_value_num' && metadatum.slug != 'creation_date' && (!metadatum.metadata_type_object || !metadatum.metadata_type_object.core)) && this.orderBy == metadatum.slug) ||
|
||||
((this.orderBy == 'meta_value' || this.orderBy == 'meta_value_num') && this.getMetaKey() == metadatum.id)
|
||||
)
|
||||
return metadatum.name;
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
components: {
|
||||
|
@ -882,10 +931,12 @@
|
|||
'getSearchQuery',
|
||||
'getStatus',
|
||||
'getOrderBy',
|
||||
'getOrderByName',
|
||||
'getOrder',
|
||||
'getViewMode',
|
||||
'getTotalItems',
|
||||
'getAdminViewMode'
|
||||
'getAdminViewMode',
|
||||
'getMetaKey'
|
||||
]),
|
||||
onSwipeFiltersMenu($event) {
|
||||
if (this.registeredViewModes[this.viewMode] == undefined ||
|
||||
|
@ -965,7 +1016,8 @@
|
|||
|
||||
// Updates searchControlHeight before in case we need to adjust filters position on mobile
|
||||
setTimeout(() => {
|
||||
this.searchControlHeight = this.$refs['search-control'].clientHeight;
|
||||
if (this.$refs['search-control'] != undefined)
|
||||
this.searchControlHeight = this.$refs['search-control'].clientHeight;
|
||||
}, 500);
|
||||
},
|
||||
onChangeDisplayedMetadata() {
|
||||
|
@ -988,12 +1040,11 @@
|
|||
|
||||
// Updates Search
|
||||
this.$eventBusSearch.addFetchOnly(
|
||||
thumbnailMetadatum != undefined && thumbnailMetadatum.display ? 'thumbnail' : null +','+
|
||||
creationDateMetadatum != undefined && creationDateMetadatum.display ? 'creation_date' : null +','+
|
||||
authorNameMetadatum != undefined && authorNameMetadatum.display ? 'author_name': null +','+
|
||||
(this.isRepositoryLevel ? 'title' : null) +','+
|
||||
(this.isRepositoryLevel && descriptionMetadatum.display ? 'description' : null)
|
||||
, false, fetchOnlyMetadatumIds.toString());
|
||||
((thumbnailMetadatum != undefined && thumbnailMetadatum.display) ? 'thumbnail' : null) + ',' +
|
||||
((creationDateMetadatum != undefined && creationDateMetadatum.display) ? 'creation_date' : null) + ',' +
|
||||
((authorNameMetadatum != undefined && authorNameMetadatum.display) ? 'author_name': null) + ',' +
|
||||
(this.isRepositoryLevel ? 'title' : null) + ',' +
|
||||
(this.isRepositoryLevel && descriptionMetadatum.display ? 'description' : null), false, fetchOnlyMetadatumIds.toString());
|
||||
|
||||
// Closes dropdown
|
||||
this.$refs.displayedMetadataDropdown.toggle();
|
||||
|
@ -1118,10 +1169,20 @@
|
|||
multiple: metadatum.multiple,
|
||||
});
|
||||
|
||||
if (display)
|
||||
fetchOnlyMetadatumIds.push(metadatum.id);
|
||||
if (display) {
|
||||
fetchOnlyMetadatumIds.push(metadatum.id);
|
||||
}
|
||||
|
||||
if (
|
||||
metadatum.metadata_type != 'Tainacan\\Metadata_Types\\Core_Description' &&
|
||||
metadatum.metadata_type != 'Tainacan\\Metadata_Types\\Taxonomy' &&
|
||||
metadatum.metadata_type != 'Tainacan\\Metadata_Types\\Relationship'
|
||||
) {
|
||||
this.sortingMetadata.push(metadatum);
|
||||
}
|
||||
|
||||
}
|
||||
this.sortingMetadata.push(metadatum);
|
||||
|
||||
}
|
||||
|
||||
let creationDateMetadatumDisplay = prefsFetchOnlyObject ? (prefsFetchOnlyObject[1] != null) : true;
|
||||
|
@ -1186,7 +1247,7 @@
|
|||
display: authorNameMetadatumDisplay
|
||||
});
|
||||
}
|
||||
// Loads only basic attributes necessay to view modes that do not allow custom meta
|
||||
// Loads only basic attributes necessary to view modes that do not allow custom meta
|
||||
} else {
|
||||
|
||||
this.$eventBusSearch.addFetchOnly('thumbnail,creation_date,author_name,title,description', true, '');
|
||||
|
@ -1219,13 +1280,14 @@
|
|||
this.isLoadingMetadata = false;
|
||||
});
|
||||
},
|
||||
adjustSearchControlHeight: _.debounce( function() {
|
||||
this.$nextTick(() => {
|
||||
this.searchControlHeight = this.$refs['search-control'] ? this.$refs['search-control'].clientHeight : 0;
|
||||
this.isFiltersMenuCompressed = jQuery(window).width() <= 768;
|
||||
});
|
||||
}, 500)
|
||||
},
|
||||
adjustSearchControlHeight: _.debounce( function() {
|
||||
this.$nextTick(() => {
|
||||
if (this.$refs['search-control'] != undefined)
|
||||
this.searchControlHeight = this.$refs['search-control'] ? this.$refs['search-control'].clientHeight + this.$refs['search-control'].offsetTop : 0;
|
||||
this.isFiltersMenuCompressed = jQuery(window).width() <= 768;
|
||||
});
|
||||
}, 500),
|
||||
removeEventListeners() {
|
||||
// Component
|
||||
this.$off();
|
||||
|
@ -1238,6 +1300,7 @@
|
|||
this.$eventBusSearch.$off('hasFiltered');
|
||||
this.$eventBusSearch.$off('advancedSearchResults');
|
||||
this.$eventBusSearch.$off('hasToPrepareMetadataAndFilters');
|
||||
|
||||
},
|
||||
created() {
|
||||
|
||||
|
@ -1316,7 +1379,7 @@
|
|||
} else {
|
||||
let prefsAdminViewMode = !this.isRepositoryLevel ? 'admin_view_mode_' + this.collectionId : 'admin_view_mode';
|
||||
if (this.$userPrefs.get(prefsAdminViewMode) == undefined)
|
||||
this.$eventBusSearch.setInitialAdminViewMode('cards');
|
||||
this.$eventBusSearch.setInitialAdminViewMode('table');
|
||||
else {
|
||||
let existingViewMode = this.$userPrefs.get(prefsAdminViewMode);
|
||||
if (existingViewMode == 'cards' ||
|
||||
|
@ -1326,7 +1389,7 @@
|
|||
existingViewMode == 'masonry')
|
||||
this.$eventBusSearch.setInitialAdminViewMode(this.$userPrefs.get(prefsAdminViewMode));
|
||||
else
|
||||
this.$eventBusSearch.setInitialAdminViewMode('cards');
|
||||
this.$eventBusSearch.setInitialAdminViewMode('table');
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1340,6 +1403,7 @@
|
|||
// Cancels previous Request
|
||||
if (this.$eventBusSearch.searchCancel != undefined)
|
||||
this.$eventBusSearch.searchCancel.cancel('Item search Canceled.');
|
||||
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
@ -1348,6 +1412,16 @@
|
|||
|
||||
@import '../../scss/_variables.scss';
|
||||
|
||||
@keyframes open-full-screen {
|
||||
from {
|
||||
opacity: 0;
|
||||
transform: scale(0.6);
|
||||
}
|
||||
to {
|
||||
opacity: 1;
|
||||
transform: scale(1.0);
|
||||
}
|
||||
}
|
||||
|
||||
.is-fullscreen {
|
||||
position: absolute;
|
||||
|
@ -1359,7 +1433,8 @@
|
|||
height: 100vh;
|
||||
z-index: 999999999;
|
||||
background-color: black;
|
||||
transition: all 0.3s ease;
|
||||
transition: background-color 0.3s ease, width 0.3s ease, height 0.3s ease;
|
||||
animation: open-full-screen 0.4s ease;
|
||||
}
|
||||
|
||||
.collapse-all {
|
||||
|
@ -1374,9 +1449,9 @@
|
|||
h1, h2 {
|
||||
font-size: 20px;
|
||||
font-weight: 500;
|
||||
margin-bottom: 0;
|
||||
color: $gray5;
|
||||
display: inline-block;
|
||||
margin-bottom: 0;
|
||||
}
|
||||
.field.is-grouped {
|
||||
margin-left: auto;
|
||||
|
@ -1400,9 +1475,9 @@
|
|||
h1, h2 {
|
||||
font-size: 20px;
|
||||
font-weight: 500;
|
||||
margin-bottom: 0;
|
||||
color: $gray5;
|
||||
display: inline-block;
|
||||
margin-bottom: 0;
|
||||
}
|
||||
.field.is-grouped {
|
||||
margin-left: auto;
|
||||
|
@ -1569,6 +1644,14 @@
|
|||
flex-basis: 100%;
|
||||
}
|
||||
|
||||
.label {
|
||||
font-size: 0.875rem;
|
||||
font-weight: normal;
|
||||
margin-top: 3px;
|
||||
margin-bottom: 2px;
|
||||
cursor: default;
|
||||
}
|
||||
|
||||
.button {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
|
@ -1582,7 +1665,6 @@
|
|||
color: $gray4 !important;
|
||||
padding-right: 10px;
|
||||
}
|
||||
|
||||
.gray-icon .icon i::before,
|
||||
.gray-icon i::before {
|
||||
font-size: 1.3125rem !important;
|
||||
|
@ -1590,8 +1672,9 @@
|
|||
}
|
||||
|
||||
.view-mode-icon {
|
||||
margin-right: 4px !important;
|
||||
margin-right: 3px !important;
|
||||
margin-top: 1px;
|
||||
margin-left: 6px !important;
|
||||
}
|
||||
|
||||
.dropdown-menu {
|
||||
|
@ -1601,7 +1684,7 @@
|
|||
padding: 0;
|
||||
|
||||
.metadata-options-container {
|
||||
max-height: 240px;
|
||||
max-height: 288px;
|
||||
overflow: auto;
|
||||
}
|
||||
.dropdown-item {
|
||||
|
@ -1613,7 +1696,7 @@
|
|||
.dropdown-item-apply {
|
||||
width: 100%;
|
||||
border-top: 1px solid #efefef;
|
||||
padding: 8px 12px 2px 12px;
|
||||
padding: 8px 12px;
|
||||
text-align: right;
|
||||
}
|
||||
.dropdown-item-apply .button {
|
||||
|
|
|
@ -31,6 +31,7 @@
|
|||
formHooks['view-item']['begin-left'] != undefined">
|
||||
<div
|
||||
id="view-item-begin-left"
|
||||
class="form-hook-region"
|
||||
v-html="formHooks['view-item']['begin-left'].join('')"/>
|
||||
</template>
|
||||
|
||||
|
@ -197,6 +198,7 @@
|
|||
formHooks['view-item']['end-left'] != undefined">
|
||||
<div
|
||||
id="view-item-end-left"
|
||||
class="form-hook-region"
|
||||
v-html="formHooks['view-item']['end-left'].join('')"/>
|
||||
</template>
|
||||
|
||||
|
@ -210,6 +212,7 @@
|
|||
formHooks['view-item']['begin-right'] != undefined">
|
||||
<div
|
||||
id="view-item-begin-right"
|
||||
class="form-hook-region"
|
||||
v-html="formHooks['view-item']['begin-right'].join('')"/>
|
||||
</template>
|
||||
|
||||
|
@ -278,7 +281,8 @@
|
|||
v-for="(metadatum, index) of metadatumList"
|
||||
:key="index"
|
||||
class="field">
|
||||
<b-collapse
|
||||
<b-collapse
|
||||
:aria-id="'metadatum-collapse-' + metadatum.id"
|
||||
animation="filter-item"
|
||||
:open="open">
|
||||
<label
|
||||
|
@ -306,6 +310,7 @@
|
|||
formHooks['view-item']['end-right'] != undefined">
|
||||
<div
|
||||
id="view-item-end-right"
|
||||
class="form-hook-region"
|
||||
v-html="formHooks['view-item']['end-right'].join('')"/>
|
||||
</template>
|
||||
</b-tab-item>
|
||||
|
@ -467,10 +472,12 @@
|
|||
this.loadMetadata();
|
||||
});
|
||||
|
||||
// Obtains collection name
|
||||
// Obtains collection name
|
||||
if (!this.isRepositoryLevel) {
|
||||
this.fetchCollectionName(this.collectionId).then((collectionName) => {
|
||||
this.collectionName = collectionName;
|
||||
});
|
||||
}
|
||||
|
||||
// Get attachments
|
||||
this.fetchAttachments(this.itemId);
|
||||
|
|
|
@ -21,9 +21,13 @@
|
|||
padding: 0px;
|
||||
border-radius: 0px;
|
||||
min-width: 6rem;
|
||||
|
||||
.dropdown-content {
|
||||
padding: 6px 0px;
|
||||
padding: 0px;
|
||||
border-radius: 0px !important;
|
||||
max-height: 240px;
|
||||
overflow-y: auto;
|
||||
|
||||
.dropdown-item {
|
||||
display: block;
|
||||
text-decoration: none;
|
||||
|
@ -67,6 +71,13 @@
|
|||
}
|
||||
}
|
||||
|
||||
// This dropdown has a particular way of dealing with scroll
|
||||
.metadata-options-dropdown {
|
||||
.dropdown-content {
|
||||
max-height: unset !important;
|
||||
}
|
||||
}
|
||||
|
||||
.taginput-container {
|
||||
padding: 0px !important;
|
||||
background-color: white !important;
|
||||
|
|
|
@ -28,6 +28,9 @@
|
|||
.is-has-text-secondary:focus {
|
||||
color: $blue3 !important;
|
||||
}
|
||||
a.button.is-secondary {
|
||||
color: white !important;
|
||||
}
|
||||
.tainacan-page-title hr{
|
||||
background-color: $blue3 !important;
|
||||
}
|
||||
|
|
|
@ -122,4 +122,20 @@
|
|||
white-space: initial !important;
|
||||
}
|
||||
}
|
||||
|
||||
.form-hook-region {
|
||||
background-color: $gray1;
|
||||
padding: 1rem 1.875rem 2rem 1.875rem;
|
||||
|
||||
h4 {
|
||||
font-weight: 600;
|
||||
color: #298596;
|
||||
margin-bottom: 6px;
|
||||
}
|
||||
hr {
|
||||
margin-top: 8px;
|
||||
height: 1px;
|
||||
background-color: #298596;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -16,6 +16,7 @@
|
|||
.tainacan-grid-item {
|
||||
max-width: 255px;
|
||||
min-height: 300px;
|
||||
max-height: 300px;
|
||||
flex-basis: 0;
|
||||
margin: 15px;
|
||||
text-align: center;
|
||||
|
|
|
@ -541,7 +541,7 @@ return apply_filters( 'tainacan-admin-i18n', [
|
|||
'info_empty' => __( 'empty', 'tainacan' ),
|
||||
'info_url_copied' => __( 'URL link copied', 'tainacan' ),
|
||||
'info_other_item_listing_options' => __('Other items listing options: ', 'tainacan'),
|
||||
'info_send_email' => __('The exporter may take a while depending on the size of your collection. Check this option to receive an e-mail when the process is done. You can also check the process status visiting the', 'tainacan'),
|
||||
'info_send_email' => __('The exporter may take a while. Check this option to receive an e-mail when the process is done. You can also check the process status visiting the', 'tainacan'),
|
||||
'info_tainacan_api' => __('Tainacan API on JSON format.', 'tainacan'),
|
||||
|
||||
// Tainacan Metadatum Types
|
||||
|
|
|
@ -55,9 +55,9 @@ class REST_Oaipmh_Expose_Controller extends REST_Controller {
|
|||
* @throws \Exception
|
||||
*/
|
||||
public function get_verb( $request ){
|
||||
$verb = ( isset($request['verb']) ) ? $request['verb'] : false;
|
||||
|
||||
switch ($verb){
|
||||
$request['verb'] = ( isset($request['verb']) ) ? $request['verb'] : 'Identify';
|
||||
|
||||
switch ($request['verb']){
|
||||
|
||||
case 'ListSets':
|
||||
$allowed_arguments = array('verb','resumptionToken');
|
||||
|
|
|
@ -115,7 +115,10 @@
|
|||
this.isLoading = true;
|
||||
this.options = [];
|
||||
|
||||
let query_items = { 'current_query': this.query };
|
||||
let query_items = {
|
||||
'current_query': this.query,
|
||||
'search': query
|
||||
};
|
||||
|
||||
let endpoint = this.isRepositoryLevel ? '/facets/' + this.metadatum : '/collection/'+ this.collection +'/facets/' + this.metadatum;
|
||||
|
||||
|
|
|
@ -99,7 +99,7 @@ class Term_Exporter extends Exporter {
|
|||
</div>
|
||||
|
||||
<div class="field export_term_csv_taxonomies">
|
||||
<label class="label"><?php _e('Target taxonomy:', 'tainacan'); ?></label>
|
||||
<label class="label"><?php _e('Source Taxonomy:', 'tainacan'); ?></label>
|
||||
<span class="help-wrapper">
|
||||
<a class="help-button has-text-secondary">
|
||||
<span class="icon is-small">
|
||||
|
@ -108,11 +108,10 @@ class Term_Exporter extends Exporter {
|
|||
</a>
|
||||
<div class="help-tooltip">
|
||||
<div class="help-tooltip-header">
|
||||
<h5><?php _e('Existing Taxonomy', 'tainacan'); ?></h5>
|
||||
<h5><?php _e('Source Taxonomy', 'tainacan'); ?></h5>
|
||||
</div>
|
||||
<div class="help-tooltip-body">
|
||||
<p><?php _e('Inform the taxonomy you want to export the terms', 'tainacan'); ?></p>
|
||||
<p><?php _e('Select a taxonomy.', 'tainacan'); ?></p>
|
||||
<p><?php _e('Inform the taxonomy you want to export the terms from.', 'tainacan'); ?></p>
|
||||
</div>
|
||||
</div>
|
||||
</span>
|
||||
|
|
|
@ -13,8 +13,6 @@ function tainacan_blocks_initialize() {
|
|||
}
|
||||
|
||||
function tainacan_blocks_add_gutenberg_blocks_actions() {
|
||||
|
||||
//add_action('init', 'tainacan_blocks_register_tainacan_collections_carousel');
|
||||
add_action('init', 'tainacan_blocks_register_tainacan_items_grid');
|
||||
add_action('init', 'tainacan_blocks_register_tainacan_terms_list');
|
||||
|
||||
|
@ -44,10 +42,10 @@ function tainacan_blocks_register_categories($categories, $post){
|
|||
function tainacan_blocks_enqueue_on_theme(){
|
||||
global $TAINACAN_BASE_URL;
|
||||
|
||||
wp_enqueue_script(
|
||||
'collections-carousel',
|
||||
$TAINACAN_BASE_URL . '/assets/gutenberg_collections_carousel-components.js'
|
||||
);
|
||||
// wp_enqueue_script(
|
||||
// 'collections-carousel',
|
||||
// $TAINACAN_BASE_URL . '/assets/gutenberg_collections_carousel-components.js'
|
||||
// );
|
||||
}
|
||||
|
||||
function tainacan_blocks_register_tainacan_items_grid(){
|
||||
|
@ -65,7 +63,7 @@ function tainacan_blocks_register_tainacan_items_grid(){
|
|||
array('wp-edit-blocks')
|
||||
);
|
||||
|
||||
if(function_exists('register_block_type')) {
|
||||
if (function_exists('register_block_type')) {
|
||||
register_block_type( 'tainacan/items-grid', array(
|
||||
'editor_script' => 'items-grid',
|
||||
'style' => 'items-grid'
|
||||
|
@ -73,29 +71,6 @@ function tainacan_blocks_register_tainacan_items_grid(){
|
|||
}
|
||||
}
|
||||
|
||||
function tainacan_blocks_register_tainacan_collections_carousel(){
|
||||
global $TAINACAN_BASE_URL;
|
||||
|
||||
wp_register_script(
|
||||
'collections-carousel',
|
||||
$TAINACAN_BASE_URL . '/assets/gutenberg_collections_carousel-components.js',
|
||||
array('wp-blocks', 'wp-element', 'wp-components', 'wp-editor')
|
||||
);
|
||||
|
||||
wp_register_style(
|
||||
'collections-carousel',
|
||||
$TAINACAN_BASE_URL . '/assets/css/tainacan-gutenberg-blocks-style.css',
|
||||
array('wp-edit-blocks')
|
||||
);
|
||||
|
||||
if(function_exists('register_block_type')) {
|
||||
register_block_type( 'tainacan/collections-carousel', array(
|
||||
'editor_script' => 'collections-carousel',
|
||||
'style' => 'collections-carousel'
|
||||
) );
|
||||
}
|
||||
}
|
||||
|
||||
function tainacan_blocks_register_tainacan_terms_list(){
|
||||
global $TAINACAN_BASE_URL;
|
||||
|
||||
|
@ -135,7 +110,6 @@ function tainacan_blocks_add_plugin_settings() {
|
|||
|
||||
$settings = tainacan_blocks_get_plugin_js_settings();
|
||||
|
||||
//wp_localize_script( 'collections-carousel', 'tainacan_plugin', $settings );
|
||||
wp_localize_script( 'items-grid', 'tainacan_plugin', $settings );
|
||||
wp_localize_script( 'terms-list', 'tainacan_plugin', $settings );
|
||||
}
|
||||
|
|
|
@ -1,3 +1,2 @@
|
|||
//@import 'tainacan-collections/collections-carousel/collections-carousel';
|
||||
@import 'tainacan-items/items-grid/items-grid';
|
||||
@import 'tainacan-terms/terms-list/terms-list';
|
||||
@import 'tainacan-terms/terms-list/terms-list';
|
||||
|
|
|
@ -1,221 +0,0 @@
|
|||
.wp-block-tainacan-collections-carousel {
|
||||
min-height: 200px;
|
||||
|
||||
.wp-block-tainacan-collections-carousel__carousel-item {
|
||||
display: flex;
|
||||
|
||||
.wp-block-tainacan-collections-carousel__carousel-item-first {
|
||||
display: flex;
|
||||
align-items: flex-start;
|
||||
align-content: start;
|
||||
|
||||
img {
|
||||
padding: 0 !important;
|
||||
max-width: 100% !important;
|
||||
}
|
||||
}
|
||||
|
||||
.wp-block-tainacan-collections-carousel__carousel-item-others {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: flex-end;
|
||||
|
||||
img {
|
||||
padding: 0 !important;
|
||||
max-width: 100% !important;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.components-modal__frame {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.BrainhubCarousel {
|
||||
overflow: hidden;
|
||||
display: -webkit-box;
|
||||
display: -ms-flexbox;
|
||||
display: flex;
|
||||
-webkit-box-align: center;
|
||||
-ms-flex-align: center;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.BrainhubCarousel .BrainhubCarousel__trackContainer {
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.BrainhubCarousel .BrainhubCarousel__trackContainer .BrainhubCarousel__track {
|
||||
display: -webkit-box;
|
||||
display: -ms-flexbox;
|
||||
display: flex;
|
||||
overflow: hidden;
|
||||
list-style: none;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
.BrainhubCarousel .BrainhubCarousel__trackContainer .BrainhubCarousel__track .BrainhubCarousel__track--transition {
|
||||
-webkit-transition: -webkit-transform;
|
||||
transition: -webkit-transform;
|
||||
transition: transform;
|
||||
transition: transform, -webkit-transform;
|
||||
}
|
||||
|
||||
/* arrows */
|
||||
.BrainhubCarousel__arrows {
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
/* variables */
|
||||
.BrainhubCarousel__dots {
|
||||
display: -webkit-box;
|
||||
display: -ms-flexbox;
|
||||
display: flex;
|
||||
-webkit-box-pack: center;
|
||||
-ms-flex-pack: center;
|
||||
justify-content: center;
|
||||
list-style: none;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
font-size: 0;
|
||||
line-height: 0;
|
||||
}
|
||||
|
||||
.BrainhubCarousel__dots .BrainhubCarousel__dot {
|
||||
outline: 0;
|
||||
padding: 10px;
|
||||
border: none;
|
||||
opacity: 0.5;
|
||||
cursor: pointer;
|
||||
-webkit-appearance: none;
|
||||
}
|
||||
|
||||
.BrainhubCarousel__dots .BrainhubCarousel__dot .BrainhubCarousel__dot--selected {
|
||||
opacity: 1 !important;
|
||||
}
|
||||
|
||||
.BrainhubCarousel__dots .BrainhubCarousel__dot:hover {
|
||||
opacity: 1;
|
||||
}
|
||||
|
||||
.BrainhubCarousel__dots .BrainhubCarousel__dot:before {
|
||||
content: '';
|
||||
display: block;
|
||||
width: 5px;
|
||||
height: 5px;
|
||||
border-radius: 50%;
|
||||
padding: 0;
|
||||
border: none;
|
||||
background: black;
|
||||
}
|
||||
|
||||
.BrainhubCarousel__dots .BrainhubCarousel__thumbnail {
|
||||
outline: 0;
|
||||
padding: 10px;
|
||||
border: none;
|
||||
opacity: 0.5;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.BrainhubCarousel__dots .BrainhubCarousel__thumbnail .BrainhubCarousel__thumbnail--selected {
|
||||
opacity: 1 !important;
|
||||
}
|
||||
|
||||
.BrainhubCarousel__dots .BrainhubCarousel__thumbnail:hover {
|
||||
opacity: 1;
|
||||
}
|
||||
|
||||
.BrainhubCarousel__thumbnail[type=button] {
|
||||
-webkit-appearance: none;
|
||||
}
|
||||
|
||||
.BrainhubCarousel__arrows {
|
||||
position: relative;
|
||||
padding: 21px;
|
||||
border: none;
|
||||
overflow: hidden;
|
||||
outline: 0;
|
||||
font-size: 0;
|
||||
line-height: 0;
|
||||
background-color: white;
|
||||
}
|
||||
|
||||
.BrainhubCarousel__arrows span {
|
||||
display: block;
|
||||
position: absolute;
|
||||
top: 50%;
|
||||
left: 50%;
|
||||
border-style: solid;
|
||||
border-color: #298596;
|
||||
border-width: 3px 3px 0 0;
|
||||
padding: 5px;
|
||||
-webkit-transition: 0.3s;
|
||||
transition: 0.3s;
|
||||
font-size: 0;
|
||||
}
|
||||
|
||||
.BrainhubCarousel__arrows:hover {
|
||||
background-color: #298596;
|
||||
}
|
||||
|
||||
.BrainhubCarousel__arrows:hover span {
|
||||
border-color: #fff;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.BrainhubCarousel__arrowLeft span {
|
||||
-webkit-transform: translate(-50%, -50%) rotate(-135deg);
|
||||
transform: translate(-50%, -50%) rotate(-135deg);
|
||||
margin-left: 2.45px;
|
||||
}
|
||||
|
||||
.BrainhubCarousel__arrowRight span {
|
||||
-webkit-transform: translate(-50%, -50%) rotate(45deg);
|
||||
transform: translate(-50%, -50%) rotate(45deg);
|
||||
margin-left: -2.45px;
|
||||
}
|
||||
|
||||
.BrainhubCarousel__track {
|
||||
width: 100% !important;
|
||||
max-width: 100% !important;
|
||||
max-height: 100% !important;
|
||||
}
|
||||
|
||||
.BrainhubCarouselItem {
|
||||
display: -webkit-box;
|
||||
display: -ms-flexbox;
|
||||
display: flex;
|
||||
-webkit-box-pack: center;
|
||||
-ms-flex-pack: center;
|
||||
justify-content: center;
|
||||
-webkit-box-align: center;
|
||||
-ms-flex-align: center;
|
||||
align-items: center;
|
||||
position: relative;
|
||||
|
||||
width: 100% !important;
|
||||
max-width: 100% !important;
|
||||
max-height: 100% !important;
|
||||
}
|
||||
|
||||
.BrainhubCarouselItem.BrainhubCarouselItem--clickable {
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.BrainhubCarouselItem .debug-number {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
display: -webkit-box;
|
||||
display: -ms-flexbox;
|
||||
display: flex;
|
||||
-webkit-box-pack: center;
|
||||
-ms-flex-pack: center;
|
||||
justify-content: center;
|
||||
font-size: 2em;
|
||||
text-shadow: 0px 0px 9px white;
|
||||
}
|
|
@ -1,400 +0,0 @@
|
|||
const { registerBlockType } = wp.blocks;
|
||||
|
||||
const { Modal, Button, IconButton } = wp.components;
|
||||
|
||||
const { RichText } = wp.editor;
|
||||
|
||||
const { __ } = wp.i18n;
|
||||
|
||||
import tainacan from '../../api-client/axios.js';
|
||||
|
||||
import Carousel from '@brainhubeu/react-carousel';
|
||||
|
||||
global.window.userSettings = { uid: 1 };
|
||||
|
||||
registerBlockType('tainacan/collections-carousel', {
|
||||
title: __('Tainacan Collections Carousel', 'tainacan'),
|
||||
icon: 'images-alt',
|
||||
category: 'tainacan-blocks',
|
||||
attributes: {
|
||||
isOpen: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
},
|
||||
collectionsMatched: {
|
||||
type: Array,
|
||||
default: []
|
||||
},
|
||||
selectedCollections: {
|
||||
type: Array,
|
||||
default: []
|
||||
},
|
||||
items: {
|
||||
type: 'array',
|
||||
source: 'query',
|
||||
selector: 'a',
|
||||
query: {
|
||||
style: {
|
||||
source: 'attribute',
|
||||
attribute: 'style'
|
||||
},
|
||||
collection_id: {
|
||||
source: 'attribute',
|
||||
attribute: 'class'
|
||||
},
|
||||
url: {
|
||||
source: 'attribute',
|
||||
attribute: 'href'
|
||||
},
|
||||
img: {
|
||||
source: 'query',
|
||||
selector: 'img',
|
||||
query: {
|
||||
src: {
|
||||
source: 'attribute',
|
||||
attribute: 'src'
|
||||
},
|
||||
alt: {
|
||||
source: 'attribute',
|
||||
attribute: 'alt'
|
||||
},
|
||||
}
|
||||
}
|
||||
},
|
||||
default: [],
|
||||
},
|
||||
contentTemp: {
|
||||
type: Array,
|
||||
default: [],
|
||||
},
|
||||
content: {
|
||||
type: 'array',
|
||||
source: 'children',
|
||||
selector: 'div'
|
||||
},
|
||||
},
|
||||
supports: {
|
||||
align: ['full', 'left', 'right', 'wide'],
|
||||
html: false
|
||||
},
|
||||
keywords: [__('tainacan', 'tainacan'), __('carousel', 'tainacan'), __('collections', 'tainacan')],
|
||||
edit({ attributes, setAttributes, className }) {
|
||||
console.log('edit', attributes);
|
||||
|
||||
let { contentTemp, collectionsMatched, selectedCollections, items, isOpen, content } = attributes;
|
||||
let isInEdit = true;
|
||||
|
||||
const arrowRight = (
|
||||
<span style={{cursor: 'pointer'}}>
|
||||
<svg style={{width: '48px', height: '48px'}} viewBox="0 0 24 24">
|
||||
<path fill="#298596" d="M10,17L15,12L10,7V17Z"/>
|
||||
</svg>
|
||||
</span>
|
||||
);
|
||||
|
||||
const arrowLeft = (
|
||||
<span style={{cursor: 'pointer'}}>
|
||||
<svg style={{width: '48px', height: '48px'}} viewBox="0 0 24 24">
|
||||
<path fill="#298596" d="M14,7L9,12L14,17V7Z" />
|
||||
</svg>
|
||||
</span>
|
||||
);
|
||||
|
||||
function prepareItem(item, style, collectionName) {
|
||||
return (
|
||||
<a
|
||||
href={item.url}
|
||||
className={`${item.collection_id.split('{}')[0]}{}${collectionName}`}
|
||||
style={style}>
|
||||
<img
|
||||
src={
|
||||
(item.thumbnail && item.thumbnail.thumbnail) ?
|
||||
item.thumbnail.thumbnail[0] :
|
||||
( (item.img && item.img[0].src) ?
|
||||
item.img[0].src : `${tainacan_plugin.base_url}/admin/images/placeholder_square.png`)
|
||||
}
|
||||
alt={ item.title ? item.title : item.alt } />
|
||||
</a>
|
||||
);
|
||||
}
|
||||
|
||||
function getTop3ItemsOf(collection) {
|
||||
let collectionID = collection.id;
|
||||
|
||||
return tainacan.get(`/collection/${collectionID}/items?perpage=3&paged=1&orderby=date`)
|
||||
.then(response => {
|
||||
return response.data;
|
||||
})
|
||||
.catch(error => {
|
||||
console.error(error);
|
||||
});
|
||||
}
|
||||
|
||||
function updateContent(contentTemp){
|
||||
setAttributes({
|
||||
content: contentTemp.length ?
|
||||
(<div>
|
||||
<Carousel
|
||||
offset={20}
|
||||
arrowLeft={arrowLeft}
|
||||
arrowRight={arrowRight}
|
||||
addArrowClickHandler
|
||||
slidesPerScroll={1}
|
||||
slidesPerPage={contentTemp.length >= 3 ? 3 : contentTemp.length}
|
||||
arrows
|
||||
slides={contentTemp}
|
||||
breakpoints={{
|
||||
1000: { // these props will be applied when screen width is less than 1000px
|
||||
slidesPerPage: 2,
|
||||
clickToChange: false,
|
||||
centered: false,
|
||||
arrows: true,
|
||||
infinite: false,
|
||||
},
|
||||
500: {
|
||||
slidesPerPage: 1,
|
||||
slidesPerScroll: 1,
|
||||
clickToChange: false,
|
||||
centered: false,
|
||||
infinite: false,
|
||||
},
|
||||
}}
|
||||
/>
|
||||
</div>) : []
|
||||
});
|
||||
}
|
||||
|
||||
function removeCollection(collectionID) {
|
||||
let index = contentTemp.findIndex((coll) => {
|
||||
return coll.key == collectionID;
|
||||
});
|
||||
|
||||
if(index >= 0){
|
||||
contentTemp.splice(index, 1);
|
||||
selectedCollections.splice(index, 1);
|
||||
|
||||
setAttributes({contentTemp: contentTemp});
|
||||
updateContent(contentTemp);
|
||||
}
|
||||
}
|
||||
|
||||
function prepareContent(newContent, items, collection){
|
||||
newContent.push(
|
||||
<div key={collection.id}>
|
||||
<div style={{
|
||||
display: 'flex',
|
||||
flexDirection: 'column'}}>
|
||||
|
||||
{ isInEdit ? (
|
||||
<IconButton
|
||||
isSmall
|
||||
isPrimary
|
||||
style={{position: 'absolute'}}
|
||||
label={ __('Remove', 'tainacan') }
|
||||
onClick={() => {
|
||||
console.log('clicked', collection.id);
|
||||
removeCollection(collection.id);
|
||||
}}
|
||||
icon="trash"/>
|
||||
) : null }
|
||||
|
||||
<div className={`${className}__carousel-item`}>
|
||||
<div style={{width: '87px', marginRight: '3px'}} className={`${className}__carousel-item-first`}>
|
||||
{items[0] ? prepareItem(items[0], {display: 'flex', height: '87px'}, collection.name) : null}
|
||||
</div>
|
||||
|
||||
<div className={`${className}__carousel-item-others`}>
|
||||
{items[1] ? prepareItem(items[1], {width: '42px', height: '42px', marginBottom: '3px'}, collection.name) : null}
|
||||
{items[2] ? prepareItem(items[2], {width: '42px', height: '42px'}, collection.name) : null}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<small style={{
|
||||
maxWidth: '130px',
|
||||
marginLeft: '10px'}}>
|
||||
<p style={{
|
||||
fontSize: '10px',
|
||||
whiteSpace: 'nowrap',
|
||||
overflow: 'hidden',
|
||||
textOverflow: 'ellipsis',
|
||||
fontWeight: '600'
|
||||
}}>{collection.name}</p>
|
||||
</small>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
|
||||
console.info(newContent);
|
||||
|
||||
setAttributes({ contentTemp: newContent });
|
||||
}
|
||||
|
||||
if(content && content.length && content[0].type && !contentTemp.length){
|
||||
let groupedItems = items.reduce((r, a) => {
|
||||
r[a.collection_id] = r[a.collection_id] || [];
|
||||
r[a.collection_id].push(a);
|
||||
return r;
|
||||
}, Object.create(null));
|
||||
|
||||
console.log('Grouped', groupedItems);
|
||||
|
||||
for(let group in groupedItems){
|
||||
let itemsTemp = groupedItems[group];
|
||||
|
||||
prepareContent(contentTemp, itemsTemp, {
|
||||
name: itemsTemp[0].collection_id.split('{}')[1],
|
||||
id: itemsTemp[0].collection_id.split('{}')[0]
|
||||
});
|
||||
|
||||
selectedCollections.push(itemsTemp[0].collection_id.split('{}')[0]);
|
||||
}
|
||||
}
|
||||
|
||||
const autocompleters = [{
|
||||
name: __('Collections', 'tainacan'),
|
||||
triggerPrefix: '/',
|
||||
options(keyword) {
|
||||
if (!keyword) {
|
||||
return [];
|
||||
}
|
||||
|
||||
return tainacan.get(`/collections?search=${keyword}`)
|
||||
.then(response => {
|
||||
return response.data;
|
||||
})
|
||||
.catch(error => {
|
||||
console.error(error);
|
||||
});
|
||||
},
|
||||
getOptionLabel(option) {
|
||||
return (<span>{option.name}</span>);
|
||||
},
|
||||
getOptionKeywords(option) {
|
||||
let found = selectedCollections.find((id) => {
|
||||
return id == option.id;
|
||||
});
|
||||
|
||||
if(found == undefined) {
|
||||
collectionsMatched.push(option.name);
|
||||
|
||||
return collectionsMatched;
|
||||
}
|
||||
},
|
||||
getOptionCompletion(option) {
|
||||
|
||||
let found = selectedCollections.find((id) => {
|
||||
return id == option.id;
|
||||
});
|
||||
|
||||
if(found == undefined) {
|
||||
selectedCollections.push(option.id);
|
||||
|
||||
getTop3ItemsOf(option).then((res) => {
|
||||
res.map((item) => {
|
||||
items.push(prepareItem(item))
|
||||
});
|
||||
|
||||
prepareContent(contentTemp, res, option);
|
||||
|
||||
setAttributes({items: items});
|
||||
});
|
||||
|
||||
setAttributes({selectedCollections: selectedCollections});
|
||||
|
||||
return (<abbr title={option.name}>{` | ${option.name} `}</abbr>);
|
||||
}
|
||||
},
|
||||
isDebounced: true,
|
||||
debounceSpeak: true,
|
||||
}];
|
||||
|
||||
return (
|
||||
<div className={ className }>
|
||||
<div style={{
|
||||
marginBottom: '20px',
|
||||
display: 'flex',
|
||||
justifyContent: 'center',
|
||||
alignContent: 'center'
|
||||
}}>
|
||||
<Button
|
||||
style={{
|
||||
justifyContent: 'center',
|
||||
width: '100%'
|
||||
}}
|
||||
isDefault
|
||||
onClick={ () => setAttributes( { isOpen: true } ) }>{ __('Add collection', 'tainacan') }</Button>
|
||||
</div>
|
||||
|
||||
{ isOpen ?
|
||||
<Modal
|
||||
shouldCloseOnClickOutside={ false }
|
||||
shouldCloneOnEsc={false}
|
||||
focusOnMount={false}
|
||||
title={ __('Add collection', 'tainacan') }
|
||||
onRequestClose={ () => {
|
||||
setAttributes( { isOpen: false } );
|
||||
updateContent(contentTemp);
|
||||
}}>
|
||||
|
||||
<div>
|
||||
<RichText
|
||||
onChange={() => true}
|
||||
tagName="p"
|
||||
autocompleters={autocompleters}
|
||||
/>
|
||||
<p>{ __('Type '+ autocompleters[0].triggerPrefix +' for triggering the autocomplete.', 'tainacan') }</p>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<Button isDefault onClick={ () => {
|
||||
setAttributes( { isOpen: false } );
|
||||
updateContent(contentTemp);
|
||||
} }>
|
||||
{ __('Close', 'tainacan') }
|
||||
</Button>
|
||||
</div>
|
||||
</Modal>
|
||||
: null
|
||||
}
|
||||
|
||||
<div>
|
||||
{ contentTemp.length ?
|
||||
<Carousel
|
||||
offset={20}
|
||||
arrowLeft={arrowLeft}
|
||||
arrowRight={arrowRight}
|
||||
addArrowClickHandler
|
||||
slidesPerScroll={1}
|
||||
slidesPerPage={contentTemp.length >= 3 ? 3 : contentTemp.length}
|
||||
arrows
|
||||
slides={contentTemp}
|
||||
breakpoints={{
|
||||
1000: { // these props will be applied when screen width is less than 1000px
|
||||
slidesPerPage: 2,
|
||||
clickToChange: false,
|
||||
centered: false,
|
||||
arrows: true,
|
||||
infinite: false,
|
||||
},
|
||||
500: {
|
||||
slidesPerPage: 1,
|
||||
slidesPerScroll: 1,
|
||||
clickToChange: false,
|
||||
centered: false,
|
||||
infinite: false,
|
||||
},
|
||||
}}
|
||||
/> : null
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
},
|
||||
save({ attributes }) {
|
||||
console.log('save', attributes);
|
||||
|
||||
const { content } = attributes;
|
||||
|
||||
return <div>{content}</div>
|
||||
},
|
||||
});
|
|
@ -52,6 +52,15 @@ class Importer_Handler {
|
|||
'manual_mapping' => false,
|
||||
]);
|
||||
|
||||
$this->register_importer([
|
||||
'name' => 'OAI PMH',
|
||||
'description' => __('Import structure from a OAI PMH repository', 'tainacan'),
|
||||
'slug' => 'oaipmh_importer',
|
||||
'class_name' => '\Tainacan\Importer\Oaipmh_Importer',
|
||||
'manual_collection' => false,
|
||||
'manual_mapping' => false,
|
||||
]);
|
||||
|
||||
do_action('tainacan_register_importers');
|
||||
|
||||
add_action( 'tainacan-enqueue-admin-scripts', array($this, 'enqueue_scripts') );
|
||||
|
|
|
@ -0,0 +1,458 @@
|
|||
<?php
|
||||
namespace Tainacan\Importer;
|
||||
use Tainacan;
|
||||
use Tainacan\Entities;
|
||||
|
||||
class Oaipmh_Importer extends Importer {
|
||||
|
||||
protected $steps = [
|
||||
[
|
||||
'name' => 'Create Collections',
|
||||
'progress_label' => 'Create Collections',
|
||||
'callback' => 'create_collections'
|
||||
],
|
||||
[
|
||||
'name' => 'Import Items',
|
||||
'progress_label' => 'Import Items',
|
||||
'callback' => 'process_collections',
|
||||
'total' => 2
|
||||
],
|
||||
];
|
||||
|
||||
protected $tainacan_api_address, $wordpress_api_address, $actual_collection;
|
||||
|
||||
/**
|
||||
* tainacan old importer construct
|
||||
*/
|
||||
public function __construct($attributes = array()) {
|
||||
parent::__construct($attributes);
|
||||
|
||||
$this->col_repo = \Tainacan\Repositories\Collections::get_instance();
|
||||
$this->items_repo = \Tainacan\Repositories\Items::get_instance();
|
||||
$this->metadata_repo = \Tainacan\Repositories\Metadata::get_instance();
|
||||
$this->item_metadata_repo = \Tainacan\Repositories\Item_Metadata::get_instance();
|
||||
|
||||
$this->remove_import_method('file');
|
||||
$this->add_import_method('url');
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Method implemented by the child importer class to proccess each item
|
||||
* @return int
|
||||
*/
|
||||
public function process_item( $index, $collection_id ){
|
||||
$this->add_log('Proccess item index' . $index . ' in set ' . $collection_id['source_id'] );
|
||||
$records = [ 'records' => [] , 'collection_definition' => $collection_id ];
|
||||
$record_processed = [];
|
||||
|
||||
if( $index === 0 ){
|
||||
$info = $this->requester( $this->get_url() . "?verb=ListRecords&metadataPrefix=oai_dc&set=" . $collection_id['source_id'] );
|
||||
} else {
|
||||
$token = $this->get_transient('resumptionToken');
|
||||
$info = $this->requester( $this->get_url() . "?verb=ListRecords&resumptionToken=" . $token);
|
||||
}
|
||||
|
||||
if( !isset($info['body']) ){
|
||||
$this->add_log('no answer');
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
try {
|
||||
$xml = new \SimpleXMLElement($info['body']);
|
||||
|
||||
if ( isset($xml->ListRecords) && isset($xml->ListRecords->resumptionToken) ){
|
||||
|
||||
$resumptionToken = $xml->ListRecords->resumptionToken;
|
||||
if ($resumptionToken) {
|
||||
$this->add_transient('resumptionToken',(string) $resumptionToken);
|
||||
}
|
||||
}
|
||||
|
||||
} catch (Exception $e) {
|
||||
$this->add_log('error on read xml and get ');
|
||||
return false;
|
||||
}
|
||||
|
||||
if( $xml->ListRecords ){
|
||||
$j = 0;
|
||||
|
||||
while ( isset($xml->ListRecords->record[$j]) ) {
|
||||
$record = $record = $xml->ListRecords->record[$j];
|
||||
$dc = $record->metadata->children("http://www.openarchives.org/OAI/2.0/oai_dc/");
|
||||
|
||||
if ($record->metadata->Count() > 0 ) {
|
||||
$metadata = $dc->children('http://purl.org/dc/elements/1.1/');
|
||||
$tam_metadata = count($metadata);
|
||||
for ($i = 0; $i < $tam_metadata; $i++) {
|
||||
|
||||
$value = (string) $metadata[$i];
|
||||
$identifier = $this->get_identifier($metadata[$i]);
|
||||
$record_processed['dc:' . $identifier ][] = $value;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
if( $record_processed ){
|
||||
$records['records'][] = $record_processed;
|
||||
$record_processed = [];
|
||||
}
|
||||
|
||||
$j++;
|
||||
}
|
||||
}
|
||||
|
||||
if( $records['records'] ){
|
||||
return $records;
|
||||
} else {
|
||||
$this->add_log('proccessing an item empty');
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* create all collections and its metadata
|
||||
*
|
||||
*/
|
||||
public function create_collections(){
|
||||
|
||||
$this->add_log('Creating collections');
|
||||
$collection_xml = $this->fetch_collections();
|
||||
|
||||
if( isset($collection_xml->ListSets) ){
|
||||
foreach ($collection_xml->ListSets->set as $set) {
|
||||
|
||||
$setSpec = (string) $set->setSpec;
|
||||
$setName = (string) $set->setName;
|
||||
|
||||
$collection = $this->create_collection( $setSpec, $setName );
|
||||
|
||||
$metadata_map = $this->create_collection_metadata($collection);
|
||||
$total = intval($this->get_total_items_from_source($setSpec));
|
||||
$this->add_log('total in collection: ' . $total);
|
||||
$this->add_log('collection id ' . (string) $collection->get_id());
|
||||
|
||||
$this->add_collection([
|
||||
'id' => $collection->get_id(),
|
||||
'mapping' => $metadata_map,
|
||||
'total_items' =>ceil( $total / 100 ),
|
||||
'source_id' => $setSpec,
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* insert processed item from source to Tainacan
|
||||
*
|
||||
* @param array $processed_item Associative array with metadatum source's as index with
|
||||
* its value or values
|
||||
* @param integet $collection_index The index in the $this->collections array of the collection the item is beeing inserted into
|
||||
*
|
||||
* @return Tainacan\Entities\Item Item inserted
|
||||
*/
|
||||
public function insert( $processed_item, $collection_index ) {
|
||||
$this->items_repo->disable_logs();
|
||||
$records = $processed_item['records'];
|
||||
$collection_id = $processed_item['collection_definition'];
|
||||
$collection = new Entities\Collection($collection_id['id']);
|
||||
$map = $collection_id['mapping'];
|
||||
|
||||
foreach ( $records as $record ) {
|
||||
$item = new Entities\Item();
|
||||
$item->set_status('publish');
|
||||
$item->set_collection( $collection );
|
||||
$item->set_title( ( isset($record['dc:title']) ) ? $record['dc:title'][0] : 'title' );
|
||||
$item->set_description( '' );
|
||||
|
||||
$this->add_log( ( isset($record['dc:title']) ) ? $record['dc:title'][0] : 'title' );
|
||||
if( $record && $item->validate() ){
|
||||
$insertedItem = $this->items_repo->insert( $item );
|
||||
|
||||
foreach ( $record as $index => $value ){
|
||||
|
||||
$this->add_log( $index . ' ' . serialize($map) );
|
||||
$this->add_log( $insertedItem->get_id() );
|
||||
if( in_array( $index, $map ) && $insertedItem->get_id()){
|
||||
$metadatum_id = array_search($index, $map );
|
||||
$newMetadatum = new Entities\Metadatum($metadatum_id);
|
||||
|
||||
$item_metadata = new Entities\Item_Metadata_Entity( $insertedItem, $newMetadatum );
|
||||
|
||||
$unique = !$item_metadata->is_multiple();
|
||||
$value_final = ( is_array($value) && $unique ) ? $value[0] : $value;
|
||||
$item_metadata->set_value($value_final);
|
||||
|
||||
if( $item_metadata->validate() ){
|
||||
$inserted = $this->item_metadata_repo->insert( $item_metadata );
|
||||
$this->add_log('Item Metadata inserted for item ' .$item->get_title() . ' and metadata ' . $newMetadatum->get_name() );
|
||||
} else {
|
||||
$this->add_log( 'Error inserting metadatum' . $newMetadatum->get_name() );
|
||||
$this->add_log( 'Values' . $value );
|
||||
$this->add_log( $item_metadata->get_errors() );
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
} else {
|
||||
$this->add_log( (is_array($item->get_errors())) ? serialize($item->get_errors()) : $item->get_errors() );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return isset($insertedItem) ? $insertedItem : false;
|
||||
}
|
||||
|
||||
//protected functions
|
||||
|
||||
/**
|
||||
* @signature - get_identifyier($metadata)
|
||||
* @param \SimpleXMLElement $metadata
|
||||
* @return string O identifier
|
||||
*/
|
||||
protected function get_identifier($metadata) {
|
||||
$attributes = $metadata->attributes(); // atributos
|
||||
if ($attributes) {
|
||||
foreach ($attributes as $a => $b) {
|
||||
return $metadata->getName().'_'.(string) $b;
|
||||
}
|
||||
} else {
|
||||
return $metadata->getName();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Method implemented by the child importer class to return the number of items to be imported
|
||||
* @return int
|
||||
*/
|
||||
public function get_total_items_from_source( $setSpec ) {
|
||||
$info = $this->requester( $this->get_url() . "?verb=ListRecords&metadataPrefix=oai_dc&set=" . $setSpec);
|
||||
|
||||
if( !isset($info['body']) ){
|
||||
$this->add_log('ERROR');
|
||||
$this->add_error_log('Error in fetch remote total items');
|
||||
$this->abort();
|
||||
return false;
|
||||
}
|
||||
|
||||
try {
|
||||
$xml = new \SimpleXMLElement($info['body']);
|
||||
|
||||
if( isset($xml->ListRecords) && !isset($xml->ListRecords->resumptionToken) ){
|
||||
$cont = 0;
|
||||
foreach ($xml->ListRecords->record as $record) $cont++;
|
||||
|
||||
return $cont;
|
||||
} elseif ( isset($xml->ListRecords) && isset($xml->ListRecords->resumptionToken) ){
|
||||
|
||||
$resumptionToken_attributes = $xml->ListRecords->resumptionToken->attributes();
|
||||
foreach ($resumptionToken_attributes as $tag => $attribute) {
|
||||
if ($tag == 'completeListSize') {
|
||||
return (string) $attribute;
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (Exception $e) {
|
||||
$this->add_log('ERROR');
|
||||
return 0;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* create the collection in tainacan
|
||||
*
|
||||
* @return Entities\Collection
|
||||
*/
|
||||
protected function create_collection( $setSpec, $setName ){
|
||||
$new_collection = new Entities\Collection();
|
||||
$new_collection->set_name($setName);
|
||||
$new_collection->set_status('publish');
|
||||
$new_collection->validate();
|
||||
|
||||
|
||||
if($new_collection->validate()){
|
||||
$new_collection =$this->col_repo->insert($new_collection);
|
||||
|
||||
$this->add_log('Collection created: ' . $new_collection->get_name());
|
||||
|
||||
if( $new_collection )
|
||||
$this->add_transient('collection_' . $setSpec. '_name', $new_collection->get_id());
|
||||
|
||||
return $new_collection;
|
||||
} else{
|
||||
$this->add_error_log('Error creating collection ' . $setName );
|
||||
$this->add_error_log($new_collection->get_errors());
|
||||
$this->abort();
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $collection_object
|
||||
* @throws \ErrorException
|
||||
*/
|
||||
protected function create_collection_metadata( $collection_object ){
|
||||
$Tainacan_Mappers = \Tainacan\Mappers_Handler::get_instance();
|
||||
$mapper_obj = $Tainacan_Mappers->check_class_name('dublin-core', true, $Tainacan_Mappers::MAPPER_CLASS_PREFIX);
|
||||
$mapper = new $mapper_obj;
|
||||
$array_metadata = [];
|
||||
|
||||
$mapper_metadata = $mapper->metadata;
|
||||
if(is_array($mapper_metadata) ) {
|
||||
$id = $collection_object->get_id();
|
||||
|
||||
$Tainacan_Metadata = \Tainacan\Repositories\Metadata::get_instance();
|
||||
foreach ($mapper_metadata as $slug => $mapper_metadatum) {
|
||||
if( array_key_exists('core_metadatum', $mapper_metadatum) ) {
|
||||
$method = 'get_core_' . $mapper_metadatum['core_metadatum'] . '_metadatum';
|
||||
if (method_exists($collection_object, $method)) {
|
||||
$core_meta = $collection_object->$method();
|
||||
if ( ! $core_meta ) {
|
||||
$Tainacan_Metadata->register_core_metadata( $collection_object, true );
|
||||
$core_meta = $collection_object->$method();
|
||||
}
|
||||
$_meta_mapping = $core_meta->get_exposer_mapping();
|
||||
$_meta_mapping[$mapper->slug] = $slug;
|
||||
$core_meta->set_exposer_mapping($_meta_mapping);
|
||||
if ($core_meta->validate()) {
|
||||
$new_metadata = $Tainacan_Metadata->insert($core_meta);
|
||||
$array_metadata[$new_metadata->get_id()] = $slug;
|
||||
}
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
$metadatum = new \Tainacan\Entities\Metadatum();
|
||||
if(
|
||||
array_key_exists('metadata_type', $mapper_metadatum) &&
|
||||
$mapper_metadatum['metadata_type'] != false &&
|
||||
class_exists($mapper_metadatum['metadata_type'])
|
||||
) {
|
||||
$metadatum->set_metadata_type($mapper_metadatum['metadata_type']);
|
||||
} else {
|
||||
$metadatum->set_metadata_type('Tainacan\Metadata_Types\Text');
|
||||
}
|
||||
$metadatum->set_name($mapper_metadatum['label']);
|
||||
$metadatum->set_semantic_uri($mapper->get_url($slug));
|
||||
$metadatum->set_exposer_mapping([
|
||||
$mapper->slug => $slug
|
||||
]);
|
||||
$metadatum->set_status('publish');
|
||||
$metadatum->set_collection_id($id);
|
||||
$metadatum->set_slug($slug);
|
||||
|
||||
if($metadatum->validate()){
|
||||
|
||||
$new_metadata = $Tainacan_Metadata->insert($metadatum);
|
||||
$array_metadata[$new_metadata->get_id()] = $slug;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $array_metadata;
|
||||
}
|
||||
|
||||
/**
|
||||
* return all taxonomies from tainacan old
|
||||
* @return array
|
||||
*/
|
||||
protected function fetch_collections(){
|
||||
|
||||
$collections_link = $this->get_url() . "?verb=ListSets";
|
||||
$collections = $this->requester($collections_link);
|
||||
$collections_array = $this->decode_request($collections, $collections_link);
|
||||
|
||||
return ($collections_array) ? $collections_array : [];
|
||||
}
|
||||
|
||||
/**
|
||||
* decode request from wp_remote
|
||||
* @return array/bool
|
||||
*/
|
||||
protected function decode_request($result, $url){
|
||||
if (is_wp_error($result)) {
|
||||
|
||||
$this->add_error_log($result->get_error_message());
|
||||
$this->add_error_log('Error in fetch remote' . $url);
|
||||
$this->abort();
|
||||
return false;
|
||||
|
||||
} else if (isset($result['body'])){
|
||||
|
||||
try {
|
||||
$xml = new \SimpleXMLElement($result['body']);
|
||||
return $xml;
|
||||
} catch (Exception $e) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
$this->add_error_log('Error in fetch remote');
|
||||
$this->abort();
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* executes the request
|
||||
*/
|
||||
protected function requester( $link ){
|
||||
$has_response = false;
|
||||
$requests = 0;
|
||||
|
||||
$args = array(
|
||||
'timeout' => 60,
|
||||
'redirection' => 30,
|
||||
'sslverify' => false
|
||||
);
|
||||
|
||||
$this->add_log('fetching init ' . $link );
|
||||
$result = wp_remote_get($link, $args);
|
||||
|
||||
while( !$has_response ){
|
||||
|
||||
if (is_wp_error($result)) {
|
||||
|
||||
$this->add_log($result->get_error_message());
|
||||
$this->add_log('Error in fetch remote' . $link);
|
||||
$this->add_log('request number ' . $requests);
|
||||
|
||||
} else if (isset($result['body'])){
|
||||
$this->add_log('fetch OK ');
|
||||
return $result;
|
||||
}
|
||||
|
||||
if( $requests > 10 ){
|
||||
break;
|
||||
}
|
||||
|
||||
if( $requests > 3 ){
|
||||
$this->add_log('taking a moment to breathe, waiting for ' . ( $requests * 10 ) . ' seconds ' );
|
||||
sleep( $requests * 10 );
|
||||
}
|
||||
|
||||
$args = array(
|
||||
'timeout' => 60,
|
||||
'redirection' => 30,
|
||||
'sslverify' => false
|
||||
);
|
||||
|
||||
$result = wp_remote_get($link, $args);
|
||||
|
||||
$requests++;
|
||||
$this->add_log('going to ' . $requests );
|
||||
}
|
||||
|
||||
|
||||
|
||||
$this->add_error_log('Error in fetch remote, expired the 10 requests limit ' . $url);
|
||||
$this->abort();
|
||||
return false;
|
||||
}
|
||||
}
|
|
@ -773,9 +773,6 @@ class Old_Tainacan extends Importer{
|
|||
|
||||
/*Properties of metadatum*/
|
||||
if(isset($meta->metadata)){
|
||||
if($meta->metadata->required == 1){
|
||||
$newMetadatum->set_required(true);
|
||||
}
|
||||
|
||||
if(!empty($meta->metadata->default_value)){
|
||||
$newMetadatum->set_default_value($meta->metadata->default_value);
|
||||
|
|
|
@ -47,7 +47,7 @@ export default {
|
|||
},
|
||||
watch: {
|
||||
'$route' (to, from) {
|
||||
|
||||
|
||||
// Should set Collection ID from URL only when in admin.
|
||||
if (this.$route.name == 'CollectionItemsPage' || this.$route.name == 'ItemsPage')
|
||||
this.collectionId = !this.$route.params.collectionId ? this.$route.params.collectionId : parseInt(this.$route.params.collectionId);
|
||||
|
@ -84,7 +84,7 @@ export default {
|
|||
this.$userPrefs.set(orderKey, 'DESC');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Order By (required extra work to deal with custom metadata ordering)
|
||||
if (this.$route.query.orderby == undefined || to.params.collectionId != from.params.collectionId) {
|
||||
let orderByKey = (this.collectionId != undefined ? 'order_by_' + this.collectionId : 'order_by');
|
||||
|
@ -92,23 +92,22 @@ export default {
|
|||
|
||||
if (orderBy) {
|
||||
if (orderBy.slug == 'creation_date') {
|
||||
this.$route.query.orderby = 'date';
|
||||
this.$route.query.orderby = 'date';
|
||||
} else if (orderBy.slug == 'author_name') {
|
||||
this.$route.query.orderby = 'author_name';
|
||||
this.$route.query.orderby = 'author_name';
|
||||
} else if (orderBy.metadata_type_object.primitive_type == 'float' || orderBy.metadata_type_object.primitive_type == 'int') {
|
||||
this.$route.query.orderby = 'meta_value_num';
|
||||
this.$route.query.meta_key = orderBy.id;
|
||||
this.$route.query.orderby = 'meta_value_num';
|
||||
this.$route.query.metakey = orderBy.id;
|
||||
} else if (orderBy.metadata_type_object.primitive_type == 'date') {
|
||||
this.$route.query.orderby = 'meta_value';
|
||||
this.$route.query.meta_key = orderBy.id;
|
||||
this.$route.query.meta_type = 'DATETIME';
|
||||
this.$route.query.orderby = 'meta_value';
|
||||
this.$route.query.metakey = orderBy.id;
|
||||
this.$route.query.metatype = 'DATETIME';
|
||||
} else if (orderBy.metadata_type_object.core) {
|
||||
this.$route.query.orderby = orderBy.metadata_type_object.related_mapped_prop;
|
||||
this.$route.query.orderby = orderBy.metadata_type_object.related_mapped_prop;
|
||||
} else {
|
||||
this.$route.query.orderby = 'meta_value';
|
||||
this.$route.query.meta_key = orderBy.id;
|
||||
this.$route.query.orderby = 'meta_value';
|
||||
this.$route.query.metakey = orderBy.id;
|
||||
}
|
||||
this.$route.query.orderby = orderBy.slug;
|
||||
|
||||
} else {
|
||||
this.$route.query.orderby = 'date';
|
||||
|
|
|
@ -81,22 +81,32 @@ export const setOrderBy = ({ state, commit }, orderBy ) => {
|
|||
// Primitive Types: string, date, item, term, compound, float
|
||||
if (orderBy.slug == 'creation_date') {
|
||||
commit('setPostQueryAttribute', { attr: 'orderby', value: 'date' } );
|
||||
commit('removePostQueryAttribute', 'metakey');
|
||||
commit('removePostQueryAttribute', 'metatype');
|
||||
} else if (orderBy.slug == 'author_name') {
|
||||
commit('setPostQueryAttribute', { attr: 'orderby', value: 'author_name' } );
|
||||
commit('removePostQueryAttribute', 'metakey');
|
||||
commit('removePostQueryAttribute', 'metatype');
|
||||
} else if (orderBy.metadata_type_object.primitive_type == 'float' || orderBy.metadata_type_object.primitive_type == 'int') {
|
||||
commit('setPostQueryAttribute', { attr: 'metakey', value: orderBy.id } );
|
||||
commit('setPostQueryAttribute', { attr: 'orderby', value: 'meta_value_num' } );
|
||||
commit('setPostQueryAttribute', { attr: 'metakey', value: orderBy.id } );
|
||||
commit('removePostQueryAttribute', 'metatype');
|
||||
} else if (orderBy.metadata_type_object.primitive_type == 'date') {
|
||||
commit('setPostQueryAttribute', { attr: 'orderby', value: 'meta_value' } );
|
||||
commit('setPostQueryAttribute', { attr: 'metakey', value: orderBy.id } );
|
||||
commit('setPostQueryAttribute', { attr: 'metatype', value: 'DATETIME' } );
|
||||
commit('setPostQueryAttribute', { attr: 'orderby', value: 'meta_value' } );
|
||||
} else if (orderBy.metadata_type_object.core) {
|
||||
commit('setPostQueryAttribute', { attr: 'orderby', value: orderBy.metadata_type_object.related_mapped_prop } );
|
||||
commit('removePostQueryAttribute', 'metakey');
|
||||
commit('removePostQueryAttribute', 'metatype');
|
||||
} else {
|
||||
commit('setPostQueryAttribute', { attr: 'metakey', value: orderBy.id } );
|
||||
commit('setPostQueryAttribute', { attr: 'orderby', value: 'meta_value' } );
|
||||
commit('setPostQueryAttribute', { attr: 'metakey', value: orderBy.id } );
|
||||
commit('removePostQueryAttribute', 'metatype');
|
||||
}
|
||||
|
||||
commit('setOrderByName', orderBy.name);
|
||||
|
||||
};
|
||||
|
||||
export const setOrder = ({ commit }, order ) => {
|
||||
|
|
|
@ -64,6 +64,14 @@ export const getFetchOnly = state => {
|
|||
return state.postquery.fetch_only;
|
||||
};
|
||||
|
||||
export const getOrderByName = state => {
|
||||
return state.orderByName;
|
||||
};
|
||||
|
||||
export const getMetaKey = state => {
|
||||
return state.postquery.metakey;
|
||||
};
|
||||
|
||||
export const getFetchOnlyMeta = state => {
|
||||
return ( ! state.postquery.fetch_only_meta ) ? '' : state.postquery.fetch_only_meta;
|
||||
};
|
||||
|
|
|
@ -21,7 +21,8 @@ const state = {
|
|||
filter_tags: [],
|
||||
totalItems: 0,
|
||||
totalPages: 0,
|
||||
itemsPerPage: 12 // Not the same as postquery.perpage as API may have limited it's value
|
||||
itemsPerPage: 12, // Not the same as postquery.perpage as API may have limited it's value
|
||||
orderByName: ''
|
||||
};
|
||||
|
||||
export default {
|
||||
|
|
|
@ -143,6 +143,10 @@ export const setAdminViewMode = ( state, adminViewMode ) => {
|
|||
state.postquery.admin_view_mode = adminViewMode;
|
||||
};
|
||||
|
||||
export const setOrderByName = ( state, orderByName ) => {
|
||||
state.orderByName = orderByName;
|
||||
};
|
||||
|
||||
export const addFilterTag = ( state, filterTag ) => {
|
||||
state.filter_tags = ( ! state.filter_tags) ? [] : state.filter_tags;
|
||||
|
||||
|
|
|
@ -130,7 +130,11 @@ class OAIPMH_Get_Record extends OAIPMH_Expose {
|
|||
try{
|
||||
if ($maps) {
|
||||
foreach ($maps as $key => $val) {
|
||||
$this->xml_creater->addChild($this->working_node, $key, html_entity_decode($val->get_value()));
|
||||
|
||||
if( $val && is_object($val) )
|
||||
$this->xml_creater->addChild($this->working_node, $key, html_entity_decode($val->get_value()));
|
||||
else
|
||||
$this->xml_creater->addChild($this->working_node, $key, '');
|
||||
}
|
||||
}
|
||||
}catch(Exception $e){
|
||||
|
|
|
@ -179,7 +179,11 @@ class OAIPMH_List_Records extends OAIPMH_Expose {
|
|||
try{
|
||||
if ($maps) {
|
||||
foreach ($maps as $key => $val) {
|
||||
$this->xml_creater->addChild($this->working_node, $key, html_entity_decode($val->get_value()));
|
||||
|
||||
if( $val && is_object($val) )
|
||||
$this->xml_creater->addChild($this->working_node, $key, html_entity_decode($val->get_value()));
|
||||
else
|
||||
$this->xml_creater->addChild($this->working_node, $key, '');
|
||||
}
|
||||
}
|
||||
}catch(Exception $e){
|
||||
|
|
|
@ -82,7 +82,9 @@
|
|||
v-if="metadatum.value_as_html != undefined && metadatum.value_as_html != ''"
|
||||
:key="index"
|
||||
class="field">
|
||||
<b-collapse :open="!collapseAll">
|
||||
<b-collapse
|
||||
aria-id="metadata-collapse-for-slideshow"
|
||||
:open="!collapseAll">
|
||||
<label
|
||||
class="label has-text-white"
|
||||
slot="trigger"
|
||||
|
|
Loading…
Reference in New Issue