commit
8b0f36ebf4
|
@ -198,6 +198,7 @@
|
||||||
<div class="control">
|
<div class="control">
|
||||||
<button
|
<button
|
||||||
id="button-submit-text-content-writing"
|
id="button-submit-text-content-writing"
|
||||||
|
type="submit"
|
||||||
@click.prevent="confirmTextWriting()"
|
@click.prevent="confirmTextWriting()"
|
||||||
class="button is-success">
|
class="button is-success">
|
||||||
{{ $i18n.get('save') }}</button>
|
{{ $i18n.get('save') }}</button>
|
||||||
|
|
|
@ -105,6 +105,14 @@ export default {
|
||||||
return this.getCollectionURL();
|
return this.getCollectionURL();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
watch: {
|
||||||
|
'$route' (to, from) {
|
||||||
|
if (!this.isRepositoryLevel && from.path != undefined && to.path != from.path) {
|
||||||
|
this.collectionId = this.$route.params.collectionId;
|
||||||
|
this.fetchCollectionNameAndURL(this.collectionId);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
methods: {
|
methods: {
|
||||||
...mapActions('collection', [
|
...mapActions('collection', [
|
||||||
'fetchCollectionNameAndURL'
|
'fetchCollectionNameAndURL'
|
||||||
|
@ -114,6 +122,7 @@ export default {
|
||||||
'getCollectionURL'
|
'getCollectionURL'
|
||||||
]),
|
]),
|
||||||
openAvailableExportersModal(){
|
openAvailableExportersModal(){
|
||||||
|
|
||||||
this.$modal.open({
|
this.$modal.open({
|
||||||
parent: this,
|
parent: this,
|
||||||
component: AvailableExportersModal,
|
component: AvailableExportersModal,
|
||||||
|
@ -124,12 +133,6 @@ export default {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
},
|
|
||||||
mounted() {
|
|
||||||
if (!this.isRepositoryLevel) {
|
|
||||||
this.collectionId = this.$route.params.collectionId;
|
|
||||||
this.fetchCollectionNameAndURL(this.collectionId);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
@ -180,7 +183,7 @@ export default {
|
||||||
h1 {
|
h1 {
|
||||||
font-size: 1.125rem;
|
font-size: 1.125rem;
|
||||||
color: white;
|
color: white;
|
||||||
line-height: 1.125rem;
|
line-height: 1.4rem;
|
||||||
max-width: 100%;
|
max-width: 100%;
|
||||||
text-overflow: ellipsis;
|
text-overflow: ellipsis;
|
||||||
white-space: nowrap;
|
white-space: nowrap;
|
||||||
|
|
|
@ -7,6 +7,7 @@
|
||||||
<h2>{{ this.$i18n.get('exporters') }}</h2>
|
<h2>{{ this.$i18n.get('exporters') }}</h2>
|
||||||
<hr>
|
<hr>
|
||||||
</header>
|
</header>
|
||||||
|
|
||||||
<section class="tainacan-form">
|
<section class="tainacan-form">
|
||||||
<p>{{ $i18n.get('instruction_select_an_exporter_type') }}</p>
|
<p>{{ $i18n.get('instruction_select_an_exporter_type') }}</p>
|
||||||
<div
|
<div
|
||||||
|
|
|
@ -299,14 +299,17 @@ export default {
|
||||||
availableExposers() {
|
availableExposers() {
|
||||||
let exposers = this.getAvailableExposers();
|
let exposers = this.getAvailableExposers();
|
||||||
|
|
||||||
exposers.unshift({
|
let tainacanApiExposerIndex = exposers.findIndex((aExposer) => aExposer.slug == 'tainacan-api');
|
||||||
accept_no_mapper: true,
|
if (tainacanApiExposerIndex < 0) {
|
||||||
class_name: 'API',
|
exposers.unshift({
|
||||||
mappers: [],
|
accept_no_mapper: true,
|
||||||
name: this.$i18n.get('label_tainacan_api'),
|
class_name: 'API',
|
||||||
description: this.$i18n.get('info_tainacan_api'),
|
mappers: [],
|
||||||
slug: 'tainacan-api'
|
name: this.$i18n.get('label_tainacan_api'),
|
||||||
});
|
description: this.$i18n.get('info_tainacan_api'),
|
||||||
|
slug: 'tainacan-api'
|
||||||
|
});
|
||||||
|
}
|
||||||
return exposers;
|
return exposers;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -416,7 +419,7 @@ export default {
|
||||||
this.isLoading = false;
|
this.isLoading = false;
|
||||||
});
|
});
|
||||||
|
|
||||||
if (!this.collectionId != undefined) {
|
if (this.collectionId != undefined) {
|
||||||
this.fetchCollectionNameAndURL(this.collectionId);
|
this.fetchCollectionNameAndURL(this.collectionId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -75,6 +75,10 @@
|
||||||
font-size: 0.75rem;
|
font-size: 0.75rem;
|
||||||
margin-bottom: -0.375rem;
|
margin-bottom: -0.375rem;
|
||||||
|
|
||||||
|
@media only screen and (max-width: 768px) {
|
||||||
|
padding-top: 1rem;
|
||||||
|
}
|
||||||
|
|
||||||
&.is-inline-flex {
|
&.is-inline-flex {
|
||||||
flex-wrap: wrap;
|
flex-wrap: wrap;
|
||||||
justify-content: flex-start;
|
justify-content: flex-start;
|
||||||
|
|
|
@ -506,7 +506,7 @@
|
||||||
<button
|
<button
|
||||||
class="button is-white"
|
class="button is-white"
|
||||||
:aria-label="$i18n.get('label_urls')"
|
:aria-label="$i18n.get('label_urls')"
|
||||||
:disabled="this.totalItems == undefined || this.totalItems <= 0"
|
:disabled="totalItems == undefined || totalItems <= 0"
|
||||||
@click="openExposersModal()">
|
@click="openExposersModal()">
|
||||||
<span class="gray-icon">
|
<span class="gray-icon">
|
||||||
<i class="tainacan-icon tainacan-icon-20px tainacan-icon-url"/>
|
<i class="tainacan-icon tainacan-icon-20px tainacan-icon-url"/>
|
||||||
|
@ -700,7 +700,7 @@
|
||||||
|
|
||||||
<!-- Empty Placeholder (only used in Admin) -->
|
<!-- Empty Placeholder (only used in Admin) -->
|
||||||
<section
|
<section
|
||||||
v-if="!isOnTheme && !isLoadingItems && totalItems <= 0"
|
v-if="!isOnTheme && !isLoadingItems && totalItems == 0"
|
||||||
class="section">
|
class="section">
|
||||||
<div class="content has-text-grey has-text-centered">
|
<div class="content has-text-grey has-text-centered">
|
||||||
<p>
|
<p>
|
||||||
|
@ -1222,7 +1222,6 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
let creationDateMetadatumDisplay = prefsFetchOnlyObject ? (prefsFetchOnlyObject[1] != null) : true;
|
let creationDateMetadatumDisplay = prefsFetchOnlyObject ? (prefsFetchOnlyObject[1] != null) : true;
|
||||||
|
@ -1287,20 +1286,32 @@
|
||||||
display: authorNameMetadatumDisplay
|
display: authorNameMetadatumDisplay
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
// Loads only basic attributes necessary to view modes that do not allow custom meta
|
// Loads only basic attributes necessary to view modes that do not allow custom meta
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
this.$eventBusSearch.addFetchOnly('thumbnail,creation_date,author_name,title,description', true, '');
|
this.$eventBusSearch.addFetchOnly('thumbnail,creation_date,author_name,title,description', true, '');
|
||||||
|
|
||||||
this.sortingMetadata.push({
|
if (this.isRepositoryLevel) {
|
||||||
name: this.$i18n.get('label_title'),
|
this.sortingMetadata.push({
|
||||||
metadatum: 'row_title',
|
name: this.$i18n.get('label_title'),
|
||||||
metadata_type_object: {core: true, related_mapped_prop: 'title'},
|
metadatum: 'row_title',
|
||||||
metadata_type: undefined,
|
metadata_type_object: {core: true, related_mapped_prop: 'title'},
|
||||||
slug: 'title',
|
metadata_type: undefined,
|
||||||
id: undefined,
|
slug: 'title',
|
||||||
display: true
|
id: undefined,
|
||||||
});
|
display: true
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
for (let metadatum of this.metadata) {
|
||||||
|
if (metadatum.display !== 'never' &&
|
||||||
|
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({
|
this.sortingMetadata.push({
|
||||||
name: this.$i18n.get('label_creation_date'),
|
name: this.$i18n.get('label_creation_date'),
|
||||||
|
@ -1346,7 +1357,7 @@
|
||||||
this.hasAnOpenModal = false;
|
this.hasAnOpenModal = false;
|
||||||
},
|
},
|
||||||
hideCancel: true,
|
hideCancel: true,
|
||||||
showNeverShowAgainOption: true,
|
showNeverShowAgainOption: tainacan_plugin.user_caps != undefined && tainacan_plugin.user_caps.length != undefined && tainacan_plugin.user_caps.length > 0,
|
||||||
messageKeyForUserPrefs: 'ItemsHiddenDueSorting'
|
messageKeyForUserPrefs: 'ItemsHiddenDueSorting'
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -1396,7 +1407,7 @@
|
||||||
});
|
});
|
||||||
|
|
||||||
this.$eventBusSearch.$on('hasToPrepareMetadataAndFilters', (to) => {
|
this.$eventBusSearch.$on('hasToPrepareMetadataAndFilters', (to) => {
|
||||||
/* This condition is to prevent a incorrect fetch by filter or metadata when we coming from items
|
/* This condition is to prevent an incorrect fetch by filter or metadata when we coming from items
|
||||||
* at collection level to items page at repository level
|
* at collection level to items page at repository level
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@ -1416,7 +1427,7 @@
|
||||||
|
|
||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
|
|
||||||
this.prepareFilters();
|
this.prepareFilters();
|
||||||
this.prepareMetadata();
|
this.prepareMetadata();
|
||||||
this.localDisplayedMetadata = JSON.parse(JSON.stringify(this.displayedMetadata));
|
this.localDisplayedMetadata = JSON.parse(JSON.stringify(this.displayedMetadata));
|
||||||
|
|
|
@ -492,7 +492,7 @@
|
||||||
<button
|
<button
|
||||||
class="button is-white"
|
class="button is-white"
|
||||||
:aria-label="$i18n.get('label_urls')"
|
:aria-label="$i18n.get('label_urls')"
|
||||||
:disabled="this.totalItems == undefined || this.totalItems <= 0"
|
:disabled="totalItems == undefined || totalItems <= 0"
|
||||||
@click="openExposersModal()">
|
@click="openExposersModal()">
|
||||||
<span class="gray-icon">
|
<span class="gray-icon">
|
||||||
<i class="tainacan-icon tainacan-icon-20px tainacan-icon-url"/>
|
<i class="tainacan-icon tainacan-icon-20px tainacan-icon-url"/>
|
||||||
|
@ -679,7 +679,7 @@
|
||||||
|
|
||||||
<!-- Empty Placeholder (only used in Admin) -->
|
<!-- Empty Placeholder (only used in Admin) -->
|
||||||
<section
|
<section
|
||||||
v-if="!isOnTheme && !isLoadingItems && totalItems <= 0"
|
v-if="!isOnTheme && !isLoadingItems && totalItems == 0"
|
||||||
class="section">
|
class="section">
|
||||||
<div class="content has-text-grey has-text-centered">
|
<div class="content has-text-grey has-text-centered">
|
||||||
<p>
|
<p>
|
||||||
|
@ -1253,16 +1253,27 @@
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
this.$eventBusSearch.addFetchOnly('thumbnail,creation_date,author_name,title,description', true, '');
|
this.$eventBusSearch.addFetchOnly('thumbnail,creation_date,author_name,title,description', true, '');
|
||||||
|
|
||||||
this.sortingMetadata.push({
|
if (this.isRepositoryLevel) {
|
||||||
name: this.$i18n.get('label_title'),
|
this.sortingMetadata.push({
|
||||||
metadatum: 'row_title',
|
name: this.$i18n.get('label_title'),
|
||||||
metadata_type_object: {core: true, related_mapped_prop: 'title'},
|
metadatum: 'row_title',
|
||||||
metadata_type: undefined,
|
metadata_type_object: {core: true, related_mapped_prop: 'title'},
|
||||||
slug: 'title',
|
metadata_type: undefined,
|
||||||
id: undefined,
|
slug: 'title',
|
||||||
display: true
|
id: undefined,
|
||||||
});
|
display: true
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
for (let metadatum of this.metadata) {
|
||||||
|
if (metadatum.display !== 'never' &&
|
||||||
|
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({
|
this.sortingMetadata.push({
|
||||||
name: this.$i18n.get('label_creation_date'),
|
name: this.$i18n.get('label_creation_date'),
|
||||||
|
@ -1300,7 +1311,7 @@
|
||||||
this.hasAnOpenModal = false;
|
this.hasAnOpenModal = false;
|
||||||
},
|
},
|
||||||
hideCancel: true,
|
hideCancel: true,
|
||||||
showNeverShowAgainOption: true,
|
showNeverShowAgainOption: tainacan_plugin.user_caps != undefined && tainacan_plugin.user_caps.length != undefined && tainacan_plugin.user_caps.length > 0,
|
||||||
messageKeyForUserPrefs: 'ItemsHiddenDueSorting'
|
messageKeyForUserPrefs: 'ItemsHiddenDueSorting'
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -1356,7 +1367,7 @@
|
||||||
});
|
});
|
||||||
|
|
||||||
this.$eventBusSearch.$on('hasToPrepareMetadataAndFilters', (to) => {
|
this.$eventBusSearch.$on('hasToPrepareMetadataAndFilters', (to) => {
|
||||||
/* This condition is to prevent a incorrect fetch by filter or metadata when we come from items
|
/* This condition is to prevent an incorrect fetch by filter or metadata when we come from items
|
||||||
* at collection level to items page at repository level
|
* at collection level to items page at repository level
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
|
@ -78,4 +78,5 @@ button.link-style:active {
|
||||||
.button:not(.is-small):not(.is-medium):not(.is-large) {
|
.button:not(.is-small):not(.is-medium):not(.is-large) {
|
||||||
height: 1.875rem !important;
|
height: 1.875rem !important;
|
||||||
font-size: 0.875rem !important;
|
font-size: 0.875rem !important;
|
||||||
|
line-height: 1.5rem;
|
||||||
}
|
}
|
|
@ -2,6 +2,12 @@
|
||||||
.modal .animation-content {
|
.modal .animation-content {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
}
|
}
|
||||||
|
.modal .modal-close {
|
||||||
|
z-index: 99999;
|
||||||
|
@media only screen and (max-width: 768px) {
|
||||||
|
&:before, &:after { background-color: #298596; }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
.tainacan-modal-title {
|
.tainacan-modal-title {
|
||||||
display: flex;
|
display: flex;
|
||||||
|
@ -37,7 +43,8 @@
|
||||||
background-color: white;
|
background-color: white;
|
||||||
padding: 40px 50px;
|
padding: 40px 50px;
|
||||||
position: relative;
|
position: relative;
|
||||||
max-height: 100vh;
|
max-height: 86%;
|
||||||
|
max-height: 86vh;
|
||||||
overflow-y: auto;
|
overflow-y: auto;
|
||||||
overflow-x: hidden;
|
overflow-x: hidden;
|
||||||
|
|
||||||
|
@ -52,6 +59,11 @@
|
||||||
.form-submit {
|
.form-submit {
|
||||||
padding: 40px 0em 0.4em 0em !important;
|
padding: 40px 0em 0.4em 0em !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@media only screen and (max-width: 768px) {
|
||||||
|
max-height: 100%;
|
||||||
|
max-height: 100vh;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
// Bulma modals customized for Tainacan (custom-dialog.vue)
|
// Bulma modals customized for Tainacan (custom-dialog.vue)
|
||||||
.dialog {
|
.dialog {
|
||||||
|
|
|
@ -18,9 +18,12 @@
|
||||||
background-color: $blue5 !important;
|
background-color: $blue5 !important;
|
||||||
color: white !important;
|
color: white !important;
|
||||||
}
|
}
|
||||||
.has-text-primary, .has-text-primary:hover, .is-has-text-primary:focus {
|
.dropdown .dropdown-menu .dropdown-content a.dropdown-item:hover {
|
||||||
color: $blue4 !important;
|
color: black !important;
|
||||||
}
|
}
|
||||||
|
.has-text-primary,
|
||||||
|
.has-text-primary:hover,
|
||||||
|
.is-has-text-primary:focus,
|
||||||
a:not(.has-text-danger):not(.disabled),
|
a:not(.has-text-danger):not(.disabled),
|
||||||
a:hover:not(.has-text-danger):not(.disabled),
|
a:hover:not(.has-text-danger):not(.disabled),
|
||||||
.has-text-secondary,
|
.has-text-secondary,
|
||||||
|
@ -35,6 +38,9 @@
|
||||||
.tainacan-page-title hr{
|
.tainacan-page-title hr{
|
||||||
background-color: $blue3 !important;
|
background-color: $blue3 !important;
|
||||||
}
|
}
|
||||||
|
button.link-style, button.link-style:focus button.link-style:active {
|
||||||
|
color: $blue4;
|
||||||
|
}
|
||||||
.button[disabled]:not(.is-white), .button:hover[disabled]:not(.is-white) {
|
.button[disabled]:not(.is-white), .button:hover[disabled]:not(.is-white) {
|
||||||
border: none !important;
|
border: none !important;
|
||||||
cursor: not-allowed !important;
|
cursor: not-allowed !important;
|
||||||
|
|
|
@ -83,6 +83,7 @@
|
||||||
// background-blend-mode
|
// background-blend-mode
|
||||||
.skeleton {
|
.skeleton {
|
||||||
background: #fff;
|
background: #fff;
|
||||||
|
color: transparent !important;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -9,6 +9,7 @@ class REST_Controller extends \WP_REST_Controller {
|
||||||
* REST_Controller constructor.
|
* REST_Controller constructor.
|
||||||
*/
|
*/
|
||||||
public function __construct() {
|
public function __construct() {
|
||||||
|
session_write_close();
|
||||||
$this->namespace = TAINACAN_REST_NAMESPACE;
|
$this->namespace = TAINACAN_REST_NAMESPACE;
|
||||||
add_action('rest_api_init', array($this, 'register_routes'));
|
add_action('rest_api_init', array($this, 'register_routes'));
|
||||||
}
|
}
|
||||||
|
|
|
@ -171,7 +171,7 @@
|
||||||
this.loadingMetadata = true;
|
this.loadingMetadata = true;
|
||||||
this.hasMetadata = false;
|
this.hasMetadata = false;
|
||||||
|
|
||||||
axios.get('/collection/' + value + '/metadata/')
|
axios.get('/collection/' + value + '/metadata/?nopaging=1')
|
||||||
.then((res) => {
|
.then((res) => {
|
||||||
this.loadingMetadata = false;
|
this.loadingMetadata = false;
|
||||||
let metadata = res.data;
|
let metadata = res.data;
|
||||||
|
|
|
@ -55,8 +55,8 @@ class Relationship extends Metadata_Type {
|
||||||
'description' => __( 'Select the collection to fetch items', 'tainacan' ),
|
'description' => __( 'Select the collection to fetch items', 'tainacan' ),
|
||||||
],
|
],
|
||||||
'search' => [
|
'search' => [
|
||||||
'title' => __( 'Metadata for search', 'tainacan' ),
|
'title' => __( 'Metadata to search', 'tainacan' ),
|
||||||
'description' => __( 'Select the metadata to help the search', 'tainacan' ),
|
'description' => __( 'Select the metadata to use as search criteria in the target collection', 'tainacan' ),
|
||||||
],
|
],
|
||||||
'repeated' => [
|
'repeated' => [
|
||||||
'title' =>__( 'Allow repeated items', 'tainacan' ),
|
'title' =>__( 'Allow repeated items', 'tainacan' ),
|
||||||
|
@ -92,6 +92,13 @@ class Relationship extends Metadata_Type {
|
||||||
'collection_id' => __('The related collection is required','tainacan')
|
'collection_id' => __('The related collection is required','tainacan')
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ( !is_array($this->get_option('search')) ) {
|
||||||
|
return [
|
||||||
|
'search' => __('Search option must be an array','tainacan')
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -274,14 +274,14 @@ class Terms extends Repository {
|
||||||
/**
|
/**
|
||||||
* Check if a term already exists
|
* Check if a term already exists
|
||||||
*
|
*
|
||||||
* @param string $term_name The term name
|
* @param string $searched_term The term name (string) or term_id (integer). If term id is passed, parent is not considered.
|
||||||
* @param mixed $taxonomy The taxonomy ID, slug or Entity.
|
* @param mixed $taxonomy The taxonomy ID, slug or Entity.
|
||||||
* @param int $parent The ID of the parent term to look for children or null to look for terms in any hierarchical position. Default is null
|
* @param int $parent The ID of the parent term to look for children or null to look for terms in any hierarchical position. Default is null
|
||||||
* @param bool $return_term wether to return the term object if it exists. default is to false
|
* @param bool $return_term wether to return the term object if it exists. default is to false
|
||||||
*
|
*
|
||||||
* @return bool|WP_Term return boolean indicating if term exists. If $return_term is true and term exists, return WP_Term object
|
* @return bool|WP_Term return boolean indicating if term exists. If $return_term is true and term exists, return WP_Term object
|
||||||
*/
|
*/
|
||||||
public function term_exists($name, $taxonomy, $parent = null, $return_term = false) {
|
public function term_exists($searched_term, $taxonomy, $parent = null, $return_term = false) {
|
||||||
|
|
||||||
$Tainacan_Taxonomies = \Tainacan\Repositories\Taxonomies::get_instance();
|
$Tainacan_Taxonomies = \Tainacan\Repositories\Taxonomies::get_instance();
|
||||||
|
|
||||||
|
@ -293,36 +293,39 @@ class Terms extends Repository {
|
||||||
$taxonomy_slug = $taxonomy->get_db_identifier();
|
$taxonomy_slug = $taxonomy->get_db_identifier();
|
||||||
}
|
}
|
||||||
|
|
||||||
if(is_numeric($name)){
|
if(is_int($searched_term)){
|
||||||
$args = [
|
|
||||||
'id' => (int) $name,
|
$term = get_term_by( 'id', $searched_term, $taxonomy_slug );
|
||||||
'taxonomy' => $taxonomy_slug,
|
|
||||||
'parent' => $parent,
|
if ( ! $term ) {
|
||||||
'hide_empty' => 0,
|
return false;
|
||||||
'suppress_filter' => true
|
}
|
||||||
];
|
|
||||||
} else {
|
} else {
|
||||||
$args = [
|
$args = [
|
||||||
'name' => $name,
|
'name' => $searched_term,
|
||||||
'taxonomy' => $taxonomy_slug,
|
'taxonomy' => $taxonomy_slug,
|
||||||
'parent' => $parent,
|
'parent' => $parent,
|
||||||
'hide_empty' => 0,
|
'hide_empty' => 0,
|
||||||
'suppress_filter' => true
|
'suppress_filter' => true
|
||||||
];
|
];
|
||||||
}
|
|
||||||
|
if (is_null($parent)) {
|
||||||
if (is_null($parent)) {
|
unset($args['parent']);
|
||||||
unset($args['parent']);
|
}
|
||||||
}
|
|
||||||
|
$terms = get_terms($args);
|
||||||
$terms = get_terms($args);
|
|
||||||
|
if (empty($terms)) {
|
||||||
if (empty($terms)) {
|
return false;
|
||||||
return false;
|
}
|
||||||
|
|
||||||
|
$term = $terms[0];
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($return_term) {
|
if ($return_term) {
|
||||||
return $terms[0];
|
return $term;
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -172,7 +172,7 @@ registerBlockType('tainacan/items-list', {
|
||||||
html: false,
|
html: false,
|
||||||
},
|
},
|
||||||
edit({ attributes, setAttributes, className, isSelected }){
|
edit({ attributes, setAttributes, className, isSelected }){
|
||||||
let {
|
let {
|
||||||
selectedItemsObject,
|
selectedItemsObject,
|
||||||
selectedItemsHTML,
|
selectedItemsHTML,
|
||||||
temporarySelectedItems,
|
temporarySelectedItems,
|
||||||
|
|
|
@ -53,8 +53,8 @@ class Importer_Handler {
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$this->register_importer([
|
$this->register_importer([
|
||||||
'name' => 'OAI PMH (Experimental)',
|
'name' => 'OAI-PMH (Experimental)',
|
||||||
'description' => __('Import structure from a OAI PMH repository', 'tainacan'),
|
'description' => __('Import items from an OAI-PMH data source', 'tainacan'),
|
||||||
'slug' => 'oaipmh_importer',
|
'slug' => 'oaipmh_importer',
|
||||||
'class_name' => '\Tainacan\Importer\Oaipmh_Importer',
|
'class_name' => '\Tainacan\Importer\Oaipmh_Importer',
|
||||||
'manual_collection' => false,
|
'manual_collection' => false,
|
||||||
|
|
|
@ -272,6 +272,9 @@ export default {
|
||||||
this.$store.dispatch('search/setStatus', status);
|
this.$store.dispatch('search/setStatus', status);
|
||||||
this.updateURLQueries();
|
this.updateURLQueries();
|
||||||
},
|
},
|
||||||
|
setTotalItems(totalItems) {
|
||||||
|
this.$store.dispatch('search/setTotalItems', totalItems);
|
||||||
|
},
|
||||||
setSearchQuery(searchQuery) {
|
setSearchQuery(searchQuery) {
|
||||||
this.$store.dispatch('search/setSearchQuery', searchQuery);
|
this.$store.dispatch('search/setSearchQuery', searchQuery);
|
||||||
this.updateURLQueries();
|
this.updateURLQueries();
|
||||||
|
@ -351,6 +354,7 @@ export default {
|
||||||
|
|
||||||
},
|
},
|
||||||
setCollectionId(collectionId) {
|
setCollectionId(collectionId) {
|
||||||
|
this.setTotalItems(null);
|
||||||
this.collectionId = collectionId;
|
this.collectionId = collectionId;
|
||||||
},
|
},
|
||||||
setTerm(termId, taxonomy) {
|
setTerm(termId, taxonomy) {
|
||||||
|
|
|
@ -2,9 +2,9 @@
|
||||||
Contributors: andrebenedito, daltonmartins, fabianobn, jacsonp, leogermani, weryques, wetah, eduardohumberto, ravipassos, jessicafpx, marinagiolo, omarceloavila
|
Contributors: andrebenedito, daltonmartins, fabianobn, jacsonp, leogermani, weryques, wetah, eduardohumberto, ravipassos, jessicafpx, marinagiolo, omarceloavila
|
||||||
Tags: museums, libraries, archives, GLAM, collections, repository
|
Tags: museums, libraries, archives, GLAM, collections, repository
|
||||||
Requires at least: 4.8
|
Requires at least: 4.8
|
||||||
Tested up to: 5.0.2
|
Tested up to: 5.1.1
|
||||||
Requires PHP: 5.6
|
Requires PHP: 5.6
|
||||||
Stable tag: 0.7
|
Stable tag: 0.8
|
||||||
License: GPLv2 or later
|
License: GPLv2 or later
|
||||||
License URI: http://www.gnu.org/licenses/gpl-3.0.html
|
License URI: http://www.gnu.org/licenses/gpl-3.0.html
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,7 @@ Plugin Name: Tainacan
|
||||||
Plugin URI: https://tainacan.org/
|
Plugin URI: https://tainacan.org/
|
||||||
Description: powerfull and flexible repository platform for WordPress. Manage and publish you digital collections as easily as publishing a post to your blog, while having all the tools of a professional respository platform.
|
Description: powerfull and flexible repository platform for WordPress. Manage and publish you digital collections as easily as publishing a post to your blog, while having all the tools of a professional respository platform.
|
||||||
Author: Media Lab / UFG
|
Author: Media Lab / UFG
|
||||||
Version: 0.7
|
Version: 0.8
|
||||||
Text Domain: tainacan
|
Text Domain: tainacan
|
||||||
License: GPLv2 or later
|
License: GPLv2 or later
|
||||||
License URI: http://www.gnu.org/licenses/gpl-3.0.html
|
License URI: http://www.gnu.org/licenses/gpl-3.0.html
|
||||||
|
|
|
@ -378,6 +378,9 @@ function tainacan_get_initials($string, $one = false) {
|
||||||
if (empty($string)) {
|
if (empty($string)) {
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$string = remove_accents($string);
|
||||||
|
|
||||||
if (strlen($string) == 1) {
|
if (strlen($string) == 1) {
|
||||||
return strtoupper($string);
|
return strtoupper($string);
|
||||||
}
|
}
|
||||||
|
|
|
@ -174,7 +174,7 @@ class Taxonomies extends TAINACAN_UnitTestCase {
|
||||||
// testing passing taxonomy object
|
// testing passing taxonomy object
|
||||||
$this->assertTrue( $Tainacan_Terms->term_exists('Rock', $taxonomy) );
|
$this->assertTrue( $Tainacan_Terms->term_exists('Rock', $taxonomy) );
|
||||||
|
|
||||||
// testing passing ID
|
// testing passing taxonomy ID
|
||||||
$this->assertTrue( $Tainacan_Terms->term_exists('Rock', $taxonomy->get_id()) );
|
$this->assertTrue( $Tainacan_Terms->term_exists('Rock', $taxonomy->get_id()) );
|
||||||
|
|
||||||
// testing via Taxonomy object
|
// testing via Taxonomy object
|
||||||
|
@ -189,6 +189,20 @@ class Taxonomies extends TAINACAN_UnitTestCase {
|
||||||
$this->assertFalse( $Tainacan_Terms->term_exists('Child', $taxonomy->get_db_identifier(), 0) ); // parent 0
|
$this->assertFalse( $Tainacan_Terms->term_exists('Child', $taxonomy->get_db_identifier(), 0) ); // parent 0
|
||||||
$this->assertTrue( $Tainacan_Terms->term_exists('Child', $taxonomy->get_db_identifier(), $parent->get_id()) ); // parent
|
$this->assertTrue( $Tainacan_Terms->term_exists('Child', $taxonomy->get_db_identifier(), $parent->get_id()) ); // parent
|
||||||
|
|
||||||
|
// test with ID
|
||||||
|
$this->assertTrue( $Tainacan_Terms->term_exists($term->get_id(), $taxonomy->get_id()) );
|
||||||
|
|
||||||
|
// test get term
|
||||||
|
$test_term = $Tainacan_Terms->term_exists($term->get_id(), $taxonomy->get_id(), null, true);
|
||||||
|
$this->assertEquals($term->get_id(), $test_term->term_id);
|
||||||
|
|
||||||
|
$test_term = $Tainacan_Terms->term_exists('Rock', $taxonomy->get_id(), null, true);
|
||||||
|
$this->assertEquals($term->get_id(), $test_term->term_id);
|
||||||
|
|
||||||
|
$test_term = $Tainacan_Terms->term_exists('Parent', $taxonomy->get_id(), null, true);
|
||||||
|
$this->assertEquals($parent->get_id(), $test_term->term_id);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function test_term_validation() {
|
function test_term_validation() {
|
||||||
|
|
Binary file not shown.
Before Width: | Height: | Size: 29 KiB After Width: | Height: | Size: 90 KiB |
Binary file not shown.
Before Width: | Height: | Size: 13 KiB After Width: | Height: | Size: 35 KiB |
Loading…
Reference in New Issue