Merge tag '0.8' into develop

tag 0.8
This commit is contained in:
leogermani 2019-03-28 15:23:16 -03:00
commit 8b0f36ebf4
24 changed files with 166 additions and 80 deletions

View File

@ -198,6 +198,7 @@
<div class="control">
<button
id="button-submit-text-content-writing"
type="submit"
@click.prevent="confirmTextWriting()"
class="button is-success">
{{ $i18n.get('save') }}</button>

View File

@ -105,6 +105,14 @@ export default {
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: {
...mapActions('collection', [
'fetchCollectionNameAndURL'
@ -114,6 +122,7 @@ export default {
'getCollectionURL'
]),
openAvailableExportersModal(){
this.$modal.open({
parent: this,
component: AvailableExportersModal,
@ -124,12 +133,6 @@ export default {
}
});
}
},
mounted() {
if (!this.isRepositoryLevel) {
this.collectionId = this.$route.params.collectionId;
this.fetchCollectionNameAndURL(this.collectionId);
}
}
}
</script>
@ -180,7 +183,7 @@ export default {
h1 {
font-size: 1.125rem;
color: white;
line-height: 1.125rem;
line-height: 1.4rem;
max-width: 100%;
text-overflow: ellipsis;
white-space: nowrap;

View File

@ -7,6 +7,7 @@
<h2>{{ this.$i18n.get('exporters') }}</h2>
<hr>
</header>
<section class="tainacan-form">
<p>{{ $i18n.get('instruction_select_an_exporter_type') }}</p>
<div

View File

@ -299,6 +299,8 @@ export default {
availableExposers() {
let exposers = this.getAvailableExposers();
let tainacanApiExposerIndex = exposers.findIndex((aExposer) => aExposer.slug == 'tainacan-api');
if (tainacanApiExposerIndex < 0) {
exposers.unshift({
accept_no_mapper: true,
class_name: 'API',
@ -307,6 +309,7 @@ export default {
description: this.$i18n.get('info_tainacan_api'),
slug: 'tainacan-api'
});
}
return exposers;
}
},
@ -416,7 +419,7 @@ export default {
this.isLoading = false;
});
if (!this.collectionId != undefined) {
if (this.collectionId != undefined) {
this.fetchCollectionNameAndURL(this.collectionId);
}
}

View File

@ -75,6 +75,10 @@
font-size: 0.75rem;
margin-bottom: -0.375rem;
@media only screen and (max-width: 768px) {
padding-top: 1rem;
}
&.is-inline-flex {
flex-wrap: wrap;
justify-content: flex-start;

View File

@ -506,7 +506,7 @@
<button
class="button is-white"
:aria-label="$i18n.get('label_urls')"
:disabled="this.totalItems == undefined || this.totalItems <= 0"
:disabled="totalItems == undefined || totalItems <= 0"
@click="openExposersModal()">
<span class="gray-icon">
<i class="tainacan-icon tainacan-icon-20px tainacan-icon-url"/>
@ -700,7 +700,7 @@
<!-- Empty Placeholder (only used in Admin) -->
<section
v-if="!isOnTheme && !isLoadingItems && totalItems <= 0"
v-if="!isOnTheme && !isLoadingItems && totalItems == 0"
class="section">
<div class="content has-text-grey has-text-centered">
<p>
@ -1222,7 +1222,6 @@
}
}
}
let creationDateMetadatumDisplay = prefsFetchOnlyObject ? (prefsFetchOnlyObject[1] != null) : true;
@ -1287,11 +1286,13 @@
display: authorNameMetadatumDisplay
});
}
// 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, '');
if (this.isRepositoryLevel) {
this.sortingMetadata.push({
name: this.$i18n.get('label_title'),
metadatum: 'row_title',
@ -1301,6 +1302,16 @@
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({
name: this.$i18n.get('label_creation_date'),
@ -1346,7 +1357,7 @@
this.hasAnOpenModal = false;
},
hideCancel: true,
showNeverShowAgainOption: true,
showNeverShowAgainOption: tainacan_plugin.user_caps != undefined && tainacan_plugin.user_caps.length != undefined && tainacan_plugin.user_caps.length > 0,
messageKeyForUserPrefs: 'ItemsHiddenDueSorting'
}
});
@ -1396,7 +1407,7 @@
});
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
*/

View File

@ -492,7 +492,7 @@
<button
class="button is-white"
:aria-label="$i18n.get('label_urls')"
:disabled="this.totalItems == undefined || this.totalItems <= 0"
:disabled="totalItems == undefined || totalItems <= 0"
@click="openExposersModal()">
<span class="gray-icon">
<i class="tainacan-icon tainacan-icon-20px tainacan-icon-url"/>
@ -679,7 +679,7 @@
<!-- Empty Placeholder (only used in Admin) -->
<section
v-if="!isOnTheme && !isLoadingItems && totalItems <= 0"
v-if="!isOnTheme && !isLoadingItems && totalItems == 0"
class="section">
<div class="content has-text-grey has-text-centered">
<p>
@ -1254,6 +1254,7 @@
this.$eventBusSearch.addFetchOnly('thumbnail,creation_date,author_name,title,description', true, '');
if (this.isRepositoryLevel) {
this.sortingMetadata.push({
name: this.$i18n.get('label_title'),
metadatum: 'row_title',
@ -1263,6 +1264,16 @@
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({
name: this.$i18n.get('label_creation_date'),
@ -1300,7 +1311,7 @@
this.hasAnOpenModal = false;
},
hideCancel: true,
showNeverShowAgainOption: true,
showNeverShowAgainOption: tainacan_plugin.user_caps != undefined && tainacan_plugin.user_caps.length != undefined && tainacan_plugin.user_caps.length > 0,
messageKeyForUserPrefs: 'ItemsHiddenDueSorting'
}
});
@ -1356,7 +1367,7 @@
});
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
*/

View File

@ -78,4 +78,5 @@ button.link-style:active {
.button:not(.is-small):not(.is-medium):not(.is-large) {
height: 1.875rem !important;
font-size: 0.875rem !important;
line-height: 1.5rem;
}

View File

@ -2,6 +2,12 @@
.modal .animation-content {
width: 100%;
}
.modal .modal-close {
z-index: 99999;
@media only screen and (max-width: 768px) {
&:before, &:after { background-color: #298596; }
}
}
.tainacan-modal-title {
display: flex;
@ -37,7 +43,8 @@
background-color: white;
padding: 40px 50px;
position: relative;
max-height: 100vh;
max-height: 86%;
max-height: 86vh;
overflow-y: auto;
overflow-x: hidden;
@ -52,6 +59,11 @@
.form-submit {
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)
.dialog {

View File

@ -18,9 +18,12 @@
background-color: $blue5 !important;
color: white !important;
}
.has-text-primary, .has-text-primary:hover, .is-has-text-primary:focus {
color: $blue4 !important;
.dropdown .dropdown-menu .dropdown-content a.dropdown-item:hover {
color: black !important;
}
.has-text-primary,
.has-text-primary:hover,
.is-has-text-primary:focus,
a:not(.has-text-danger):not(.disabled),
a:hover:not(.has-text-danger):not(.disabled),
.has-text-secondary,
@ -35,6 +38,9 @@
.tainacan-page-title hr{
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) {
border: none !important;
cursor: not-allowed !important;

View File

@ -83,6 +83,7 @@
// background-blend-mode
.skeleton {
background: #fff;
color: transparent !important;
}
}

View File

@ -9,6 +9,7 @@ class REST_Controller extends \WP_REST_Controller {
* REST_Controller constructor.
*/
public function __construct() {
session_write_close();
$this->namespace = TAINACAN_REST_NAMESPACE;
add_action('rest_api_init', array($this, 'register_routes'));
}

View File

@ -171,7 +171,7 @@
this.loadingMetadata = true;
this.hasMetadata = false;
axios.get('/collection/' + value + '/metadata/')
axios.get('/collection/' + value + '/metadata/?nopaging=1')
.then((res) => {
this.loadingMetadata = false;
let metadata = res.data;

View File

@ -55,8 +55,8 @@ class Relationship extends Metadata_Type {
'description' => __( 'Select the collection to fetch items', 'tainacan' ),
],
'search' => [
'title' => __( 'Metadata for search', 'tainacan' ),
'description' => __( 'Select the metadata to help the search', 'tainacan' ),
'title' => __( 'Metadata to search', 'tainacan' ),
'description' => __( 'Select the metadata to use as search criteria in the target collection', 'tainacan' ),
],
'repeated' => [
'title' =>__( 'Allow repeated items', 'tainacan' ),
@ -92,6 +92,13 @@ class Relationship extends Metadata_Type {
'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;
}

View File

@ -274,14 +274,14 @@ class Terms extends Repository {
/**
* 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 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
*
* @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();
@ -293,23 +293,22 @@ class Terms extends Repository {
$taxonomy_slug = $taxonomy->get_db_identifier();
}
if(is_numeric($name)){
$args = [
'id' => (int) $name,
'taxonomy' => $taxonomy_slug,
'parent' => $parent,
'hide_empty' => 0,
'suppress_filter' => true
];
if(is_int($searched_term)){
$term = get_term_by( 'id', $searched_term, $taxonomy_slug );
if ( ! $term ) {
return false;
}
} else {
$args = [
'name' => $name,
'name' => $searched_term,
'taxonomy' => $taxonomy_slug,
'parent' => $parent,
'hide_empty' => 0,
'suppress_filter' => true
];
}
if (is_null($parent)) {
unset($args['parent']);
@ -321,8 +320,12 @@ class Terms extends Repository {
return false;
}
$term = $terms[0];
}
if ($return_term) {
return $terms[0];
return $term;
}
return true;

View File

@ -53,8 +53,8 @@ class Importer_Handler {
]);
$this->register_importer([
'name' => 'OAI PMH (Experimental)',
'description' => __('Import structure from a OAI PMH repository', 'tainacan'),
'name' => 'OAI-PMH (Experimental)',
'description' => __('Import items from an OAI-PMH data source', 'tainacan'),
'slug' => 'oaipmh_importer',
'class_name' => '\Tainacan\Importer\Oaipmh_Importer',
'manual_collection' => false,

View File

@ -272,6 +272,9 @@ export default {
this.$store.dispatch('search/setStatus', status);
this.updateURLQueries();
},
setTotalItems(totalItems) {
this.$store.dispatch('search/setTotalItems', totalItems);
},
setSearchQuery(searchQuery) {
this.$store.dispatch('search/setSearchQuery', searchQuery);
this.updateURLQueries();
@ -351,6 +354,7 @@ export default {
},
setCollectionId(collectionId) {
this.setTotalItems(null);
this.collectionId = collectionId;
},
setTerm(termId, taxonomy) {

View File

@ -2,9 +2,9 @@
Contributors: andrebenedito, daltonmartins, fabianobn, jacsonp, leogermani, weryques, wetah, eduardohumberto, ravipassos, jessicafpx, marinagiolo, omarceloavila
Tags: museums, libraries, archives, GLAM, collections, repository
Requires at least: 4.8
Tested up to: 5.0.2
Tested up to: 5.1.1
Requires PHP: 5.6
Stable tag: 0.7
Stable tag: 0.8
License: GPLv2 or later
License URI: http://www.gnu.org/licenses/gpl-3.0.html

View File

@ -4,7 +4,7 @@ Plugin Name: Tainacan
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.
Author: Media Lab / UFG
Version: 0.7
Version: 0.8
Text Domain: tainacan
License: GPLv2 or later
License URI: http://www.gnu.org/licenses/gpl-3.0.html

View File

@ -378,6 +378,9 @@ function tainacan_get_initials($string, $one = false) {
if (empty($string)) {
return '';
}
$string = remove_accents($string);
if (strlen($string) == 1) {
return strtoupper($string);
}

View File

@ -174,7 +174,7 @@ class Taxonomies extends TAINACAN_UnitTestCase {
// testing passing taxonomy object
$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()) );
// 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->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() {

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