Merge from develop.

This commit is contained in:
Mateus Machado Luna 2019-03-07 15:05:19 -03:00
commit 01a738f69e
33 changed files with 1111 additions and 736 deletions

View File

@ -7,16 +7,16 @@
"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-dom": "^16.5.2",
"react": "^16.8.3",
"react-autocomplete": "^1.8.1",
"react-dom": "^16.8.3",
"t": "^0.5.1",
"v-tooltip": "^2.0.0-rc.33",
"vue": "^2.5.17",
@ -36,7 +36,7 @@
"cross-env": "^5.2.0",
"css-loader": "^1.0.0",
"element-theme-chalk": "^2.4.8",
"eslint": "^5.7.0",
"eslint": "^5.14.1",
"eslint-loader": "^2.1.1",
"eslint-plugin-vue": "^4.7.1",
"file-loader": "^2.0.0",

View File

@ -173,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"
@ -188,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)"
@ -694,10 +696,10 @@ export default {
// Generates options for parent collection
this.isFetchingCollections = true;
this.fetchCollectionsForParent()
.then((collections) => {
this.collections = collections;
this.isFetchingCollections = false;
})
.then((collections) => {
this.collections = collections;
this.isFetchingCollections = false;
})
.catch((error) => {
this.$console.error(error);
this.isFetchingCollections = false;

View File

@ -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>

View File

@ -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

View File

@ -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',
@ -231,9 +232,6 @@ export default {
'runImporter',
'fetchMappingImporter'
]),
...mapActions('collection', [
'fetchCollectionsForParent'
]),
...mapActions('bgprocess', [
'fetchProcess'
]),
@ -416,6 +414,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();
}

View File

@ -84,7 +84,7 @@
<div
class="document-item"
v-for="(item, index) of uploadedItems"
:key="index">
:key="item.id">
<img
v-if="item.document!= undefined && item.document != '' && item.document_type != 'empty'"
class="document-thumb"

View File

@ -39,8 +39,8 @@
<transition-group name="item-appear">
<div
class="document-item"
v-for="(item, index) of items"
:key="index">
v-for="(item) of items"
:key="item.id">
<img
v-if="item.document!= undefined && item.document != '' && item.document_type != 'empty'"
class="document-thumb"

View File

@ -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>

View File

@ -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>

View File

@ -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>

View File

@ -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"/>

View File

@ -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">

View File

@ -41,7 +41,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"
@ -56,7 +57,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>

View File

@ -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"

View File

@ -176,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">
@ -186,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"
@ -194,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"
@ -202,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"
@ -212,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"
@ -242,7 +249,8 @@
ref="displayedMetadataDropdown"
:mobile-modal="true"
:disabled="totalItems <= 0 || adminViewMode == 'grid'|| adminViewMode == 'cards' || adminViewMode == 'masonry'"
class="show metadata-options-dropdown">
class="show metadata-options-dropdown"
aria-role="list">
<button
:aria-label="$i18n.get('label_displayed_metadata')"
class="button is-white"
@ -257,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">
@ -282,7 +291,8 @@
<label class="label is-hidden-mobile">{{ $i18n.get('label_sorting') + ':' }}</label>
<b-dropdown
:mobile-modal="true"
@input="onChangeOrderBy($event)">
@input="onChangeOrderBy($event)"
aria-role="list">
<button
:aria-label="$i18n.get('label_sorting')"
class="button is-white"
@ -299,7 +309,8 @@
v-for="metadatum of sortingMetadata"
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 -->
@ -355,7 +366,8 @@
@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="registeredViewModes[viewMode] != undefined ? registeredViewModes[viewMode].label : $i18n.get('label_visualization')"
class="button is-white"
@ -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"/>
@ -394,7 +407,8 @@
@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"
@ -419,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>
@ -429,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>
@ -439,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>
@ -449,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>
@ -459,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>

View File

@ -175,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">
@ -185,7 +186,7 @@
</span>
</button>
<b-dropdown-item>
<b-dropdown-item aria-role="listitem">
<router-link
id="a-create-item"
tag="div"
@ -193,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"
@ -229,7 +234,8 @@
ref="displayedMetadataDropdown"
:mobile-modal="true"
:disabled="totalItems <= 0 || adminViewMode == 'grid'|| adminViewMode == 'cards' || adminViewMode == 'masonry'"
class="show metadata-options-dropdown">
class="show metadata-options-dropdown"
aria-role="list">
<button
:aria-label="$i18n.get('label_displayed_metadata')"
class="button is-white"
@ -244,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">
@ -269,7 +276,8 @@
<label class="label is-hidden-mobile">{{ $i18n.get('label_sorting') + ':' }}</label>
<b-dropdown
:mobile-modal="true"
@input="onChangeOrderBy($event)">
@input="onChangeOrderBy($event)"
aria-role="list">
<button
:aria-label="$i18n.get('label_sorting')"
class="button is-white"
@ -286,7 +294,8 @@
v-for="metadatum of sortingMetadata"
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 -->
@ -342,7 +351,8 @@
@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="registeredViewModes[viewMode] != undefined ? registeredViewModes[viewMode].label : $i18n.get('label_visualization')"
@ -363,7 +373,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"/>
@ -381,7 +392,8 @@
@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')"
@ -406,7 +418,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>
@ -416,7 +429,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>
@ -426,7 +440,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>
@ -436,7 +451,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>
@ -446,7 +462,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>

View File

@ -281,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

View File

@ -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

View File

@ -1,3 +1,171 @@
.wp-block-tainacan-terms-list {
margin: 1rem 0px; }
.wp-block-tainacan-terms-list .components-spinner {
position: absolute;
right: 0; }
.wp-block-tainacan-terms-list .block-control {
display: flex;
flex-direction: row; }
.wp-block-tainacan-terms-list .block-control .block-control-item {
width: 100%; }
.wp-block-tainacan-terms-list .block-control .block-control-item.disabled {
cursor: none; }
.wp-block-tainacan-terms-list .block-control .block-control-item.disabled label.autocomplete-label {
color: #cbcbcb; }
.wp-block-tainacan-terms-list .block-control .block-control-item.disabled input {
background-color: #f2f2f2; }
.wp-block-tainacan-terms-list label.autocomplete-label {
display: block;
font-weight: 600;
font-size: 14px; }
.wp-block-tainacan-terms-list .react-autocomplete {
margin: 0 12px 12px 0;
position: relative;
display: inline-block; }
.wp-block-tainacan-terms-list .react-autocomplete input {
margin: 4px 12px 0px 0px;
border: 1px solid #dbdbdb;
padding: 4px 10px;
width: 100%; }
.wp-block-tainacan-terms-list .react-autocomplete input:focus, .wp-block-tainacan-terms-list .react-autocomplete input:active {
border: 1px solid #555758; }
.wp-block-tainacan-terms-list .react-autocomplete .menu {
position: absolute;
background-color: white;
width: 100%;
padding: 0;
border: 1px solid #cbcbcb;
z-index: 999;
height: auto;
transition: height ease 0.2s, display ease 0.2s, visibility ease 0.2s; }
.wp-block-tainacan-terms-list .react-autocomplete .menu .item {
padding: 4px 12px;
font-size: 14px; }
.wp-block-tainacan-terms-list .react-autocomplete .menu .item.item-highlighted {
background-color: #e6f6f8; }
.wp-block-tainacan-terms-list ul.terms-list.terms-layout-grid,
.wp-block-tainacan-terms-list ul.terms-list-edit.terms-layout-grid {
padding: 0;
display: -ms-grid;
display: grid;
grid-template-columns: repeat(auto-fill, 220px);
grid-gap: 0px;
justify-content: space-evenly;
list-style-type: none; }
.wp-block-tainacan-terms-list ul.terms-list.terms-layout-grid li.term-list-item,
.wp-block-tainacan-terms-list ul.terms-list-edit.terms-layout-grid li.term-list-item {
position: relative;
display: block;
margin: 12px 12px 24px 12px;
margin-bottom: 12px;
width: 185px; }
.wp-block-tainacan-terms-list ul.terms-list.terms-layout-grid li.term-list-item a,
.wp-block-tainacan-terms-list ul.terms-list-edit.terms-layout-grid li.term-list-item a {
color: #454647;
font-weight: bold; }
.wp-block-tainacan-terms-list ul.terms-list.terms-layout-grid li.term-list-item img,
.wp-block-tainacan-terms-list ul.terms-list-edit.terms-layout-grid li.term-list-item img {
height: auto;
width: 185px;
min-width: 185px;
padding: 0px;
margin-bottom: 10px; }
.wp-block-tainacan-terms-list ul.terms-list.terms-layout-grid li.term-list-item:hover a,
.wp-block-tainacan-terms-list ul.terms-list-edit.terms-layout-grid li.term-list-item:hover a {
color: #454647;
text-decoration: none; }
.wp-block-tainacan-terms-list ul.terms-list-edit li.term-list-item {
display: flex;
align-items: flex-start; }
.wp-block-tainacan-terms-list ul.terms-list-edit li.term-list-item button {
position: absolute !important;
background-color: rgba(255, 255, 255, 0.75);
color: #454647;
padding: 2px;
margin-left: 5px;
min-width: 14px;
visibility: hidden;
position: relative;
opacity: 0;
right: -12px;
justify-content: center; }
.wp-block-tainacan-terms-list ul.terms-list-edit li.term-list-item:hover button {
visibility: visible;
opacity: 1;
right: 0px;
transition: opacity linear 0.15s, right linear 0.15s; }
@media only screen and (max-width: 498px) {
.wp-block-tainacan-terms-list ul.terms-list.terms-layout-grid,
.wp-block-tainacan-terms-list ul.terms-list-edit.terms-layout-grid {
grid-template-columns: repeat(auto-fill, 100%); }
.wp-block-tainacan-terms-list ul.terms-list.terms-layout-grid li.term-list-item,
.wp-block-tainacan-terms-list ul.terms-list-edit.terms-layout-grid li.term-list-item {
width: 100%; }
.wp-block-tainacan-terms-list ul.terms-list.terms-layout-grid li.term-list-item img,
.wp-block-tainacan-terms-list ul.terms-list-edit.terms-layout-grid li.term-list-item img {
width: 100%; } }
.wp-block-tainacan-terms-list ul.terms-list.terms-layout-list,
.wp-block-tainacan-terms-list ul.terms-list-edit.terms-layout-list {
padding: 0;
display: block;
list-style-type: none; }
.wp-block-tainacan-terms-list ul.terms-list.terms-layout-list li.term-list-item,
.wp-block-tainacan-terms-list ul.terms-list-edit.terms-layout-list li.term-list-item {
position: relative;
display: inline-block;
margin: 12px 12px 24px 12px;
margin-bottom: 12px;
min-height: 54px;
min-width: 22%;
width: 22%; }
.wp-block-tainacan-terms-list ul.terms-list.terms-layout-list li.term-list-item a,
.wp-block-tainacan-terms-list ul.terms-list-edit.terms-layout-list li.term-list-item a {
color: #454647;
display: flex;
align-items: center;
height: 54px; }
.wp-block-tainacan-terms-list ul.terms-list.terms-layout-list li.term-list-item img,
.wp-block-tainacan-terms-list ul.terms-list-edit.terms-layout-list li.term-list-item img {
height: auto;
width: 54px;
min-width: 54px;
padding: 0px;
margin-right: 20px; }
.wp-block-tainacan-terms-list ul.terms-list.terms-layout-list li.term-list-item:hover a,
.wp-block-tainacan-terms-list ul.terms-list-edit.terms-layout-list li.term-list-item:hover a {
color: #454647;
text-decoration: none; }
.wp-block-tainacan-terms-list ul.terms-list-edit li.term-list-item button {
position: absolute !important;
background-color: rgba(255, 255, 255, 0.75);
color: #454647;
padding: 2px;
margin-left: 5px;
min-width: 14px;
visibility: hidden;
position: relative;
opacity: 0;
right: -12px;
justify-content: center; }
.wp-block-tainacan-terms-list ul.terms-list-edit li.term-list-item:hover button {
visibility: visible;
opacity: 1;
right: 0px;
transition: opacity linear 0.15s, right linear 0.15s; }
@media only screen and (max-width: 1600px) {
.wp-block-tainacan-terms-list ul.terms-list.terms-layout-list li.term-list-item,
.wp-block-tainacan-terms-list ul.terms-list-edit.terms-layout-list li.term-list-item {
min-width: 30%;
width: 30%; } }
@media only screen and (max-width: 1024px) {
.wp-block-tainacan-terms-list ul.terms-list.terms-layout-list li.term-list-item,
.wp-block-tainacan-terms-list ul.terms-list-edit.terms-layout-list li.term-list-item {
min-width: 45%;
width: 45%; } }
@media only screen and (max-width: 768px) {
.wp-block-tainacan-terms-list ul.terms-list.terms-layout-list li.term-list-item,
.wp-block-tainacan-terms-list ul.terms-list-edit.terms-layout-list li.term-list-item {
min-width: 100%;
width: 100%; } }
/*# sourceMappingURL=tainacan-gutenberg-blocks-style.css.map */

View File

@ -1,7 +1,7 @@
{
"version": 3,
"mappings": "",
"sources": [],
"mappings": "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",
"sources": ["../../gutenberg-blocks/tainacan-terms/terms-list/terms-list.scss"],
"names": [],
"file": "tainacan-gutenberg-blocks-style.css"
}

View File

@ -421,7 +421,11 @@ class Collections extends Repository {
$Tainacan_Metadata->register_core_metadata( $collection );
if ( $this->old_collection instanceof Entities\Collection && $this->old_collection->get_parent() != $collection->get_parent() ) {
if ( $this->old_collection instanceof Entities\Collection &&
$this->old_collection->get_parent() != $collection->get_parent() &&
$this->old_core_title instanceof Entities\Metadatum &&
$this->old_core_description instanceof Entities\Metadatum
) {
$Tainacan_Metadata->maybe_update_core_metadata_meta_keys( $collection, $this->old_collection, $this->old_core_title, $this->old_core_description );
}
}

View File

@ -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>

View File

@ -13,16 +13,17 @@ 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');
add_action('init', 'tainacan_blocks_add_plugin_settings');
//add_action('wp_enqueue_scripts', 'tainacan_blocks_enqueue_on_theme');
add_filter('block_categories', 'tainacan_blocks_register_tainacan_block_categories', 10, 2);
add_filter('block_categories', 'tainacan_blocks_register_categories', 10, 2);
}
function tainacan_blocks_register_tainacan_block_categories($categories, $post){
function tainacan_blocks_register_categories($categories, $post){
if ( $post->post_type !== 'post' ) {
return $categories;
}
@ -41,10 +42,10 @@ function tainacan_blocks_register_tainacan_block_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(){
@ -62,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'
@ -70,25 +71,25 @@ function tainacan_blocks_register_tainacan_items_grid(){
}
}
function tainacan_blocks_register_tainacan_collections_carousel(){
function tainacan_blocks_register_tainacan_terms_list(){
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')
'terms-list',
$TAINACAN_BASE_URL . '/assets/gutenberg_terms_list-components.js',
array('wp-blocks', 'wp-element', 'wp-components', 'wp-editor', 'underscore')
);
wp_register_style(
'collections-carousel',
'terms-list',
$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'
register_block_type( 'tainacan/terms-list', array(
'editor_script' => 'terms-list',
'style' => 'terms-list'
) );
}
}
@ -109,6 +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 );
}

View File

@ -1,2 +1,2 @@
//@import 'tainacan-collections/collections-carousel/collections-carousel';
@import 'tainacan-items/items-grid/items-grid';
@import 'tainacan-items/items-grid/items-grid';
@import 'tainacan-terms/terms-list/terms-list';

View File

@ -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;
}

View File

@ -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.items;
})
.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>
},
});

View File

@ -0,0 +1,465 @@
const { registerBlockType } = wp.blocks;
const { __ } = wp.i18n;
const { IconButton, Spinner, ToggleControl, Placeholder, Toolbar } = wp.components;
const { InspectorControls, BlockControls } = wp.editor;
import Autocomplete from 'react-autocomplete';
import tainacan from '../../api-client/axios.js';
import qs from 'qs';
registerBlockType('tainacan/terms-list', {
title: __('Tainacan Terms List', 'tainacan'),
icon:
<svg width="24" height="24" viewBox="0 -2 12 16">
<path
d="M 4.4,2.5 H 0 V 0 h 4.4 l 1.2,1.3 z m -1.9,5 v 3.1 H 5 v 1.2 H 1.3 v -8 H 2.5 V 6.3 H 5 V 7.6 H 2.5 Z m 8.2,0.7 H 6.3 V 5.7 h 4.4 l 1.2,1.2 z M 11.9,11.3 10.7,10 H 6.3 v 2.5 h 4.4 z"/>
</svg>,
category: 'tainacan-blocks',
keywords: [ __( 'Tainacan', 'tainacan' ), __( 'terms', 'tainacan' ), __( 'taxonomy', 'tainacan' ) ],
attributes: {
selectedTermsObject: {
type: 'array',
source: 'query',
selector: 'a',
query: {
id: {
type: 'string',
source: 'attribute',
attribute: 'id'
},
url: {
type: 'string',
source: 'attribute',
attribute: 'href'
},
name: {
type: 'string',
source: 'text'
},
header_image: {
source: 'query',
selector: 'img',
query: {
src: {
source: 'attribute',
attribute: 'src'
},
alt: {
source: 'attribute',
attribute: 'alt'
},
}
},
},
default: []
},
content: {
type: 'array',
source: 'children',
selector: 'div'
},
termsPerPage: {
type: Number,
default: 12
},
query: {
type: Object,
default: {}
},
taxonomyId: {
type: String,
default: ''
},
taxonomyName: {
type: String,
default: ''
},
isLoadingTaxonomies: {
type: Boolean,
default: false
},
isLoadingTerms: {
type: Boolean,
default: false
},
taxonomies: {
type: Array,
default: []
},
terms: {
type: Array,
default: []
},
selectedTermsHTML: {
type: Array,
default: []
},
currentTermName: {
type: String,
default: ''
},
showImage: {
type: Boolean,
default: true
},
layout: {
type: String,
default: 'grid'
},
},
supports: {
align: ['full', 'left', 'right', 'wide'],
html: false,
},
edit({ attributes, setAttributes, className, isSelected }){
let {
selectedTermsObject,
selectedTermsHTML,
terms,
content,
currentTermName,
taxonomyId,
taxonomyName,
isLoadingTerms,
isLoadingTaxonomies,
taxonomies,
showImage,
layout
} = attributes;
function prepareTerm(term) {
return (
<li
key={ term.id }
className="term-list-item">
<IconButton
onClick={ () => removeTermOfId(term.id) }
icon="no-alt"
label={__('Remove', 'tainacan')}/>
<a
id={ isNaN(term.id) ? term.id : 'term-id-' + term.id }
href={ term.url }
target="_blank">
{ term.header_image && showImage ?
<img
src={ term.header_image && term.header_image[0] && term.header_image[0].src ? term.header_image[0].src : `${tainacan_plugin.base_url}/admin/images/placeholder_square.png`}
alt={ term.header_image && term.header_image[0] ? term.header_image[0].alt : term.name }/>
: null
}
{ term.name ? term.name : '' }
</a>
</li>
);
}
function setContent(){
selectedTermsHTML = [];
for (let i = 0; i < selectedTermsObject.length; i++)
selectedTermsHTML.push(prepareTerm(selectedTermsObject[i]));
setAttributes({
content: (
<ul className={'terms-list terms-layout-' + layout}>{ selectedTermsHTML }</ul>
),
selectedTermsHTML: selectedTermsHTML
});
}
function fetchTaxonomies(name) {
isLoadingTaxonomies = true;
taxonomies = [];
terms = []
setAttributes({
isLoadingTaxonomies: isLoadingTaxonomies,
taxonomies: taxonomies,
terms: terms
});
let endpoint = '/taxonomies/?perpage=12';
if (name != undefined && name != '')
endpoint += '&search=' + name;
tainacan.get(endpoint)
.then(response => {
taxonomies = response.data.map((taxonomy) => ({ name: taxonomy.name, value: taxonomy.id + "" }));
isLoadingTaxonomies = false;
setAttributes({
isLoadingTaxonomies: isLoadingTaxonomies,
taxonomies: taxonomies
});
return taxonomies;
})
.catch(error => {
console.log('Error trying to fetch taxonomies: ' + error);
});
}
function fetchTerms(name) {
let endpoint = '/taxonomy/'+ taxonomyId + '/terms/?number=12';
if (name != undefined && name != '')
endpoint += '&searchterm=' + name;
tainacan.get(endpoint)
.then(response => {
terms = response.data.map((term) => ({
name: term.name,
value: term.id + "", // same as string version of id, because autocomplete expects value
id: term.id,
url: term.url,
header_image: [{
src: term.header_image,
alt: term.name
}]
}));
isLoadingTerms = false;
setAttributes({
isLoadingTerms: isLoadingTerms,
terms: terms
});
return terms;
})
.catch(error => {
console.log('Error trying to fetch terms: ' + error);
});
}
function fetchTaxonomy() {
tainacan.get('/taxonomies/' + taxonomyId)
.then((response) => {
taxonomyName = response.data.name;
setAttributes({ taxonomyName: taxonomyName });
}).catch(error => {
console.log('Error trying to fetch taxonomy: ' + error);
});
}
function selectTerm(term) {
let existingTermIndex = selectedTermsObject.findIndex((existingTerm) => existingTerm.id == 'term-id-' + term.id);
if (existingTermIndex < 0) {
let termId = isNaN(term.id) ? term.id : 'term-id-' + term.id;
selectedTermsObject.push({
id: termId,
name: term.name,
url: term.url,
header_image: term.header_image
});
}
setContent();
}
function removeTermOfId(termId) {
let existingTermIndex = selectedTermsObject.findIndex((existingTerm) => ((existingTerm.id == 'term-id-' + termId) || (existingTerm.id == termId)));
if (existingTermIndex >= 0)
selectedTermsObject.splice(existingTermIndex, 1);
setContent();
}
function updateLayout(newLayout) {
layout = newLayout;
setAttributes({ layout: newLayout });
setContent();
}
// Executed every time Edit function runs
if (taxonomyId != null && taxonomyId != '')
fetchTaxonomy();
// Executed only on the first load of page
if(content && content.length && content[0].type)
setContent();
const layoutControls = [
{
icon: 'grid-view',
title: __( 'Grid View' ),
onClick: () => updateLayout('grid'),
isActive: layout === 'grid',
},
{
icon: 'list-view',
title: __( 'List View' ),
onClick: () => updateLayout('list'),
isActive: layout === 'list',
}
];
return (
<div className={className}>
<div>
<BlockControls>
<Toolbar controls={ layoutControls } />
</BlockControls>
</div>
<div>
<InspectorControls>
<div style={{ marginTop: '24px' }}>
<ToggleControl
label={__('Image', 'tainacan')}
help={ showImage ? __('Toggle to show term\'s image', 'tainacan') : __('Do not show term\'s image', 'tainacan')}
checked={ showImage }
onChange={ ( isChecked ) => {
showImage = isChecked;
setAttributes({ showImage: showImage });
setContent();
}
}
/>
</div>
</InspectorControls>
</div>
{ isSelected ?
(<div>
{ isLoadingTaxonomies || isLoadingTerms ? <Spinner /> : null }
<div className="block-control">
<div className="block-control-item">
<label
className="autocomplete-label"
htmlFor="taxonomy-autocomplete">
{__('Select a taxonomy', 'tainacan')}
</label>
<Autocomplete
inputProps={{ id: 'taxonomy-autocomplete' }}
wrapperProps={{ className: 'react-autocomplete' }}
value={ taxonomyName }
items={ taxonomies }
onSelect={(value, item) => {
taxonomyId = value;
taxonomyName = item.name;
setAttributes({ taxonomyId: taxonomyId, taxonomyName: taxonomyName, taxonomies: [ item ] });
}
}
getItemValue={(taxonomy) => taxonomy.value }
onChange={(event, value) => {
taxonomyId = null;
taxonomyName = value;
setAttributes({ taxonomyId: taxonomyId, taxonomyName: taxonomyName });
_.debounce(fetchTaxonomies(value), 300);
}
}
renderMenu={ children => (
children.length > 0 ? (
<div className="menu">
{ children }
</div>
) : <span></span>
)}
renderItem={(item, isHighlighted) => (
<div
className={`item ${isHighlighted ? 'item-highlighted' : ''}`}
key={item.value}>
{item.name}
</div>
)}/>
</div>
<div className={'block-control-item' + (taxonomyId == null || taxonomyId == undefined ? ' disabled' : '')}>
<label
className="autocomplete-label"
htmlFor="taxonomy-autocomplete">
{__('Select a term to add', 'tainacan')}
</label>
<Autocomplete
autoHighlight={true}
inputProps={{
id: 'term-autocomplete',
disabled: taxonomyId == null || taxonomyId == undefined
}}
wrapperProps={{ className: 'react-autocomplete' }}
value={ currentTermName }
items={ terms }
onSelect={(value, item) => {
currentTermName = '';
setAttributes({ currentTermName: currentTermName });
selectTerm(item);
}
}
shouldItemRender={(item) => {
let existingTermIndex = selectedTermsObject.findIndex((existingTerm) => ((existingTerm.id == 'term-id-' + item.id) || (existingTerm.id == item.id)));
return existingTermIndex < 0;
}}
getItemValue={(term) => term.value }
onChange={(event, value) => {
currentTermName = value;
isLoadingTerms = true;
terms = [];
setAttributes({
isLoadingTerms: isLoadingTerms,
terms: terms,
currentTermName: currentTermName
});
_.debounce(fetchTerms(value), 300);
}
}
renderMenu={ children => (
children.length > 0 ? (
<div
className="menu">
{ children }
</div>
) : <span></span>
)}
renderItem={(item, isHighlighted) => (
<div
className={`item ${isHighlighted ? 'item-highlighted' : ''}`}
key={ item.id }>
{ item.name }
</div>
)}/>
</div>
</div>
<hr/>
</div>
) : null
}
{ !selectedTermsHTML.length ? (
<Placeholder
icon={(
<img
width={148}
src={ `${tainacan_plugin.base_url}/admin/images/tainacan_logo_header.svg` }
alt="Tainacan Logo"/>
)}
/>) : null
}
<ul className={'terms-list-edit terms-layout-' + layout}>{ selectedTermsHTML }</ul>
</div>
);
},
save({ attributes, className }){
const { content } = attributes;
return <div className={className}>{ content }</div>
}
});

View File

@ -0,0 +1,236 @@
.wp-block-tainacan-terms-list {
margin: 1rem 0px;
// Spinner
.components-spinner {
position: absolute;
right: 0;
}
// Control region ----------------------------------------------------
.block-control {
display: flex;
flex-direction: row;
.block-control-item {
width: 100%;
}
.block-control-item.disabled {
cursor: none;
label.autocomplete-label {
color: #cbcbcb;
}
input {
background-color: #f2f2f2;
}
}
}
// Autocomplete ----------------------------------------------------
label.autocomplete-label {
display: block;
font-weight: 600;
font-size: 14px;
}
.react-autocomplete {
margin: 0 12px 12px 0;
position: relative;
display: inline-block;
input {
margin: 4px 12px 0px 0px;
border: 1px solid #dbdbdb;
padding: 4px 10px;
width: 100%;
&:focus, &:active {
border: 1px solid #555758;
}
}
.menu {
position: absolute;
background-color: white;
width: 100%;
padding: 0;
border: 1px solid #cbcbcb;
z-index: 999;
height: auto;
transition: height ease 0.2s, display ease 0.2s, visibility ease 0.2s;
.item {
padding: 4px 12px;
font-size: 14px;
}
.item.item-highlighted {
background-color: #e6f6f8;
}
}
}
// Grid View Mode ----------------------------------------------------
ul.terms-list.terms-layout-grid,
ul.terms-list-edit.terms-layout-grid {
padding: 0;
display: -ms-grid;
display: grid;
grid-template-columns: repeat(auto-fill, 220px);
grid-gap: 0px;
justify-content: space-evenly;
list-style-type: none;
li.term-list-item {
position: relative;
display: block;
margin: 12px 12px 24px 12px;
margin-bottom: 12px;
width: 185px;
a {
color: #454647;
font-weight: bold;
}
img {
height: auto;
width: 185px;
min-width: 185px;
padding: 0px;
margin-bottom: 10px;
}
&:hover a {
color: #454647;
text-decoration: none;
}
}
}
ul.terms-list-edit li.term-list-item {
display: flex;
align-items: flex-start;
button {
position: absolute !important;
background-color: rgba(255, 255, 255, 0.75);
color: #454647;
padding: 2px;
margin-left: 5px;
min-width: 14px;
visibility: hidden;
position: relative;
opacity: 0;
right: -12px;
justify-content: center;
}
&:hover button {
visibility: visible;
opacity: 1;
right: 0px;
transition: opacity linear 0.15s, right linear 0.15s;
}
}
@media only screen and (max-width: 498px) {
ul.terms-list.terms-layout-grid,
ul.terms-list-edit.terms-layout-grid {
grid-template-columns: repeat(auto-fill, 100%);
li.term-list-item {
width: 100%;
img { width: 100%; }
}
}
}
// List View Mode ----------------------------------------------------
ul.terms-list.terms-layout-list,
ul.terms-list-edit.terms-layout-list {
padding: 0;
display: block;
list-style-type: none;
li.term-list-item {
position: relative;
display: inline-block;
margin: 12px 12px 24px 12px;
margin-bottom: 12px;
min-height: 54px;
min-width: 22%;
width: 22%;
a {
color: #454647;
// overflow: hidden;
// text-overflow: ellipsis;
// white-space: nowrap;
display: flex;
align-items: center;
height: 54px;
}
img {
height: auto;
width: 54px;
min-width: 54px;
padding: 0px;
margin-right: 20px;
}
&:hover a {
color: #454647;
text-decoration: none;
}
}
}
ul.terms-list-edit li.term-list-item {
button {
position: absolute !important;
background-color: rgba(255, 255, 255, 0.75);
color: #454647;
padding: 2px;
margin-left: 5px;
min-width: 14px;
visibility: hidden;
position: relative;
opacity: 0;
right: -12px;
justify-content: center;
}
&:hover button {
visibility: visible;
opacity: 1;
right: 0px;
transition: opacity linear 0.15s, right linear 0.15s;
}
}
@media only screen and (max-width: 1600px) {
ul.terms-list.terms-layout-list li.term-list-item,
ul.terms-list-edit.terms-layout-list li.term-list-item {
min-width: 30%;
width: 30%;
}
}
@media only screen and (max-width: 1024px) {
ul.terms-list.terms-layout-list li.term-list-item,
ul.terms-list-edit.terms-layout-list li.term-list-item {
min-width: 45%;
width: 45%;
}
}
@media only screen and (max-width: 768px) {
ul.terms-list.terms-layout-list li.term-list-item,
ul.terms-list-edit.terms-layout-list li.term-list-item {
min-width: 100%;
width: 100%;
}
}
}

View File

@ -76,9 +76,9 @@ class Oaipmh_Importer extends Importer {
}
if( $xml->ListRecords ){
$size = count($xml->ListRecords->record); // verifico o tamanho dos list record para o for
$j = 0;
for ($j = 0; $j < $size; $j++) {
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/");
@ -98,6 +98,8 @@ class Oaipmh_Importer extends Importer {
$records['records'][] = $record_processed;
$record_processed = [];
}
$j++;
}
}

View File

@ -452,7 +452,7 @@ export const fetchUsers = ({ commit }, { search, exceptions }) => {
// Fetch Collections for choosing Parent Collection
export const fetchCollectionsForParent = ({ commit }) => {
return new Promise((resolve, reject) => {
axios.tainacan.get('/collections/?fetch_only=name,id')
axios.tainacan.get('/collections/?nopaging=1fetch_only=name,id')
.then(res => {
let collections = res.data;
resolve( collections );

View File

@ -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"

View File

@ -346,4 +346,40 @@ class Collections extends TAINACAN_UnitTestCase {
$this->assertEquals([1 => 4, 2 => 5, 0 => 3], $diff['moderators_ids']['diff_with_index']);
}
function test_create_child_collection() {
$x = $this->tainacan_entity_factory->create_entity(
'collection',
array(
'name' => 'test',
'description' => 'adasdasdsa',
'default_order' => 'DESC',
),
true
);
$col = $this->tainacan_entity_factory->create_entity(
'collection',
array(
'name' => 'test',
'description' => 'adasdasdsa',
'default_order' => 'DESC',
'status' => 'auto-draft'
),
true
);
$Collections = \Tainacan\Repositories\Collections::get_instance();
$col->set_parent($x->get_id());
$col->set_status('publish');
$col->validate();
$col = $Collections->insert($col);
$this->assertEquals($x->get_id(), $col->get_parent());
}
}

View File

@ -9,6 +9,7 @@ module.exports = {
user_admin: './src/admin/js/main.js',
//gutenberg_collections_carousel: './src/gutenberg-blocks/tainacan-collections/collections-carousel/index.js',
gutenberg_items_grid: './src/gutenberg-blocks/tainacan-items/items-grid/index.js',
gutenberg_terms_list: './src/gutenberg-blocks/tainacan-terms/terms-list/index.js',
},
output: {
path: path.resolve(__dirname, './src/assets/'),