Merge branch 'develop' into oai-pmh-exposer

This commit is contained in:
Eduardo Humberto 2019-02-04 19:50:42 -02:00
commit e6dada7f0f
40 changed files with 399 additions and 116 deletions

View File

@ -88,9 +88,6 @@
class="tainacan-modal-content">
<div class="tainacan-modal-title">
<h2>{{ $i18n.get('instruction_select_metadatum_type') }}</h2>
<a
class="back-link"
@click="onMetadatumEditionCanceled(); isNewMetadatumModalActive = false">{{ $i18n.get('exit') }}</a>
<hr>
</div>
<section class="tainacan-form">
@ -103,6 +100,16 @@
<h4>{{ metadatumType.name }}</h4>
</div>
</div>
<div class="field is-grouped form-submit">
<div class="control">
<button
id="button-cancel-importer-edition"
class="button is-outlined"
type="button"
@click="onMetadatumEditionCanceled(); isNewMetadatumModalActive = false">
{{ $i18n.get('cancel') }}</button>
</div>
</div>
</section>
</div>
<div
@ -110,6 +117,11 @@
class="tainacan-modal-content">
<div class="tainacan-modal-title">
<h2>{{ $i18n.get('instruction_configure_new_metadatum') }}</h2>
<a
class="back-link"
@click="isEditingMetadatum = false">
{{ $i18n.get('back') }}
</a>
<hr>
</div>
<metadatum-edition-form

View File

@ -392,25 +392,25 @@
border-top: 1px solid $gray2;
border-bottom: 1px solid $gray2;
margin-top: 1.0em;
}
form#metadatumEditForm .options-columns {
-moz-column-count: 2;
-moz-column-gap: 0;
-moz-column-rule: none;
-webkit-column-count: 2;
-webkit-column-gap: 0;
-webkit-column-rule: none;
column-count: 2;
column-gap: 4rem;
column-rule: none;
padding-bottom: 1.5rem;
.options-columns {
-moz-column-count: 2;
-moz-column-gap: 0;
-moz-column-rule: none;
-webkit-column-count: 2;
-webkit-column-gap: 0;
-webkit-column-rule: none;
column-count: 2;
column-gap: 4rem;
column-rule: none;
padding-bottom: 1.5rem;
&>.field, &>section {
-webkit-column-break-inside: avoid;
page-break-inside: avoid;
break-inside: avoid;
}
&>.field, &>section {
-webkit-column-break-inside: avoid;
page-break-inside: avoid;
break-inside: avoid;
}
}
</style>

View File

@ -978,8 +978,6 @@ export default {
if (!metadata || itemMetadata == undefined) {
return '';
} else if (metadata.date_i18n) {
return metadata.date_i18n;
} else {
if (component != undefined && component == 'tainacan-textarea')
return metadata.value_as_string;

View File

@ -23,6 +23,16 @@
<p>{{ exporterType.description }}</p>
</div>
</div>
<footer class="field is-grouped form-submit">
<div class="control">
<button
id="button-cancel-exporter-selection"
class="button is-outlined"
type="button"
@click="$parent.close();">
{{ $i18n.get('cancel') }}</button>
</div>
</footer>
<b-loading
:active.sync="isLoading"

View File

@ -22,22 +22,24 @@
<h4>{{ importerType.name }}</h4>
<p>{{ importerType.description }}</p>
</div>
</div>
<b-loading
<b-loading
:is-full-page="false"
:active.sync="isLoading"
:can-cancel="false"/>
<!-- <footer class="field is-grouped form-submit">
</div>
<footer class="field is-grouped form-submit">
<div class="control">
<button
class="button is-outlined"
type="button"
@click="$parent.close()">Close</button>
</div>
<div class="control">
<!-- <div class="control">
<button class="button is-success">Confirm</button>
</div>
</footer> -->
</div> -->
</footer>
</section>
</div>
</form>
@ -86,6 +88,7 @@ export default {
@import "../../scss/_variables.scss";
.importer-types-container {
position: relative;
.importer-type {
border-bottom: 1px solid $gray2;

View File

@ -20,11 +20,21 @@
<h4>{{ collection.name }}</h4>
<p>{{ collection.length > 200 ? (collection.description.substring(0,197) + '...') : collection.description }}</p>
</div>
</div>
<b-loading
<b-loading
:is-full-page="false"
:active.sync="isLoading"
:can-cancel="false"/>
</div>
<footer class="field is-grouped form-submit">
<div class="control">
<button
class="button is-outlined"
type="button"
@click="$parent.close()">Close</button>
</div>
</footer>
</section>
</div>
</form>
@ -73,6 +83,7 @@ export default {
@import "../../scss/_variables.scss";
.collection-types-container {
position: relative;
.collection-type {
border-bottom: 1px solid $gray2;

View File

@ -36,14 +36,21 @@
<div class="tainacan-modal-content">
<div class="tainacan-modal-title">
<h2 v-if="file.title != undefined">{{ file.title.rendered }}</h2>
<a
@click="isPreviewModalActive = false"
class="back-link">{{ $i18n.get('exit') }}</a>
<hr>
</div>
<div
class="is-flex rendered-content"
v-html="file.description.rendered" />
<div class="field is-grouped form-submit">
<div class="control">
<button
id="button-cancel-importer-edition"
class="button is-outlined"
type="button"
@click="isPreviewModalActive = false">
{{ $i18n.get('exit') }}</button>
</div>
</div>
</div>
</b-modal>
</template>
@ -69,7 +76,7 @@ export default {
getIconForMimeType(mimeType) {
let type = mimeType.split('/');
if (type[0] == 'application' && type[1] != undefined){
switch (type[1]) {
case 'pdf':

View File

@ -115,8 +115,10 @@ UserPrefsPlugin.install = function (Vue, options = {}) {
'admin_view_mode': 'cards',
'fetch_only': 'thumbnail,creation_date,author_name',
'fetch_only_meta': '',
'taxonomies_order': 'asc',
'taxonomies_order_by': 'date'
'taxonomies_order': 'desc',
'taxonomies_order_by': 'date',
'collections_order': 'desc',
'collections_order_by': 'date'
},
init() {
if (tainacan_plugin.user_prefs == undefined || tainacan_plugin.user_prefs == '') {

View File

@ -1,11 +1,13 @@
<template>
<div class="repository-level-page page-container">
<b-loading :active.sync="isLoadingMetadatumMappers"/>
<b-loading :active.sync="isLoading"/>
<tainacan-title
:bread-crumb-items="[{ path: '', label: this.$i18n.get('collections') }]"/>
<div
class="sub-header"
v-if="$userCaps.hasCapability('edit_tainacan-collections')">
<!-- New Collection button -->
<div class="header-item">
<b-dropdown id="collection-creation-options-dropdown">
<button
@ -49,6 +51,39 @@
</b-dropdown-item>
</b-dropdown>
</div>
<!-- Sorting options ---- -->
<b-field class="header-item">
<b-select
class="sorting-select"
:disabled="collections.length <= 0"
@input="onChangeOrderBy($event)"
:value="orderBy"
:label="$i18n.get('label_sorting')">
<option
v-for="(option, index) in sortingOptions"
:value="option.value"
:key="index">
{{ option.label }}
</option>
</b-select>
<button
:disabled="collections.length <= 0 || isLoading || order == 'asc'"
class="button is-white is-small"
@click="onChangeOrder('asc')">
<span class="icon gray-icon is-small">
<i class="tainacan-icon tainacan-icon-sortascending tainacan-icon-20px"/>
</span>
</button>
<button
:disabled="collections.length <= 0 || isLoading || order == 'desc'"
class="button is-white is-small"
@click="onChangeOrder('desc')">
<span class="icon gray-icon is-small">
<i class="tainacan-icon tainacan-icon-sortdescending tainacan-icon-20px"/>
</span>
</button>
</b-field>
</div>
<div class="above-subheader">
@ -94,7 +129,9 @@
<p v-if="status == 'trash'">{{ $i18n.get('info_no_collection_trash') }}</p>
<div v-if="$userCaps.hasCapability('edit_tainacan-collections') && status == undefined || status == ''">
<b-dropdown id="collection-creation-options-dropdown">
<b-dropdown
:disabled="isLoadingMetadatumMappers"
id="collection-creation-options-dropdown">
<button
class="button is-secondary"
slot="trigger">
@ -198,7 +235,13 @@ export default {
page: 1,
collectionsPerPage: 12,
isLoadingMetadatumMappers: true,
status: ''
status: '',
order: 'desc',
ordeBy: 'date',
sortingOptions: [
{ label: this.$i18n.get('label_title'), value: 'title' },
{ label: this.$i18n.get('label_creation_date'), value: 'date' },
]
}
},
components: {
@ -236,6 +279,33 @@ export default {
this.status = status;
this.loadCollections();
},
onChangeOrder(newOrder) {
if (newOrder != this.order) {
this.$userPrefs.set('collections_order', newOrder)
.then((newOrder) => {
this.order = newOrder;
})
.catch(() => {
this.$console.log("Error settings user prefs for collections order")
});
}
this.order = newOrder;
this.loadCollections()
},
onChangeOrderBy(newOrderBy) {
if (newOrderBy != this.orderBy) {
this.$userPrefs.set('collections_order_by', newOrderBy)
.then((newOrderBy) => {
this.orderBy = newOrderBy;
})
.catch(() => {
this.$console.log("Error settings user prefs for collections orderby")
});
}
this.orderBy = newOrderBy;
this.loadCollections();
},
onChangeCollectionsPerPage(value) {
if (value != this.collectionsPerPage) {
@ -258,10 +328,13 @@ export default {
this.cleanCollections();
this.isLoading = true;
this.fetchCollections({
'page': this.page,
'collectionsPerPage': this.collectionsPerPage,
'status': this.status,
'contextEdit': true })
page: this.page,
collectionsPerPage: this.collectionsPerPage,
status: this.status,
contextEdit: true,
order: this.order,
orderby: this.orderBy
})
.then((res) => {
this.isLoading = false;
this.totalCollections = res.total;
@ -297,12 +370,26 @@ export default {
mounted(){
if (this.collectionsPerPage != this.$userPrefs.get('collections_per_page'))
this.collectionsPerPage = this.$userPrefs.get('collections_per_page');
if (!this.collectionsPerPage) {
this.collectionsPerPage = 12;
this.$userPrefs.set('collections_per_page', 12);
}
if (this.order != this.$userPrefs.get('collections_order'))
this.order = this.$userPrefs.get('collections_order');
if (!this.order) {
this.order = 'asc';
this.$userPrefs.set('collections_order', 'asc');
}
if (this.orderBy != this.$userPrefs.get('collections_order_by'))
this.orderBy = this.$userPrefs.get('collections_order_by');
if (!this.orderBy) {
this.orderBy = 'date';
this.$userPrefs.set('collections_order_by', 'date');
}
this.loadCollections();
}
}
@ -318,10 +405,17 @@ export default {
padding-left: 0;
padding-right: 0;
border-bottom: 1px solid #ddd;
display: inline-flex;
justify-content: space-between;
align-items: center;
width: 100%;
.header-item {
display: inline-block;
padding-right: 8em;
.header-item:not(:last-child) {
padding-right: 0.5em;
}
.header-item .button .icon i{
width: 100%;
}
@media screen and (max-width: 769px) {
@ -330,7 +424,7 @@ export default {
padding-top: 0.9em;
.header-item {
padding-right: 0.5em;
padding-right: 0.2em;
}
}
}

View File

@ -626,7 +626,7 @@
<h3
id="items-list-landmark"
class="is-hidden">
class="sr-only">
{{ $i18n.get('label_items_list') }}
</h3>
@ -1044,13 +1044,13 @@
let authorNameMetadatum = this.localDisplayedMetadata.find(metadatum => metadatum.slug == 'author_name');
let descriptionMetadatum = this.localDisplayedMetadata.find(metadatum => metadatum.metadata_type_object != undefined ? metadatum.metadata_type_object.related_mapped_prop == 'description' : false);
// Updates Search
this.$eventBusSearch.addFetchOnly(
thumbnailMetadatum != undefined && thumbnailMetadatum.display ? 'thumbnail' : null +','+
creationDateMetadatum != undefined && creationDateMetadatum.display ? 'creation_date' : null +','+
authorNameMetadatum != undefined && authorNameMetadatum.display ? 'author_name': null +','+
(this.isRepositoryLevel ? 'title' : null) +','+
((thumbnailMetadatum != undefined && thumbnailMetadatum.display) ? 'thumbnail' : null) + ',' +
((creationDateMetadatum != undefined && creationDateMetadatum.display) ? 'creation_date' : null) + ',' +
((authorNameMetadatum != undefined && authorNameMetadatum.display) ? 'author_name': null) + ',' +
(this.isRepositoryLevel ? 'title' : null) + ',' +
(this.isRepositoryLevel && descriptionMetadatum.display ? 'description' : null), false, fetchOnlyMetadatumIds.toString());
// Closes dropdown

View File

@ -7,7 +7,7 @@
class="sub-header"
v-if="$userCaps.hasCapability('edit_tainacan-taxonomies')">
<!-- New Taxonomiy Button ---- -->
<!-- New Taxonomy Button ---- -->
<div class="header-item">
<router-link
id="button-create-taxonomy"

View File

@ -292,14 +292,7 @@
</span>
{{ metadatum.metadatum.name }}
</label>
<div
v-if="metadatum.date_i18n"
class="content">
<p v-html="metadatum.date_i18n != '' ? metadatum.date_i18n : `<span class='has-text-gray is-italic'>` + $i18n.get('label_value_not_informed') + `</span>`"/>
</div>
<div
v-else
class="content">
<div class="content">
<p v-html="metadatum.value_as_html != '' ? metadatum.value_as_html : `<span class='has-text-gray is-italic'>` + $i18n.get('label_value_not_informed') + `</span>`"/>
</div>
</b-collapse>

View File

@ -30,6 +30,8 @@
padding: 0.375rem 1rem;
font-size: 0.8125rem;
color: $tainacan-input-color !important;
white-space: initial;
label { margin-bottom: 0; }
&.control { font-size: 0.8125rem !important; }
.b-checkbox { width: 100% };

View File

@ -13,6 +13,7 @@
h1, h2 {
font-size: 1.25rem;
font-weight: normal;
font-weight: 500;
color: $gray5;
display: inline-block;
width: 90%;
@ -38,7 +39,8 @@
position: relative;
max-height: 100vh;
overflow-y: auto;
overflow-x: hidden;
figure {
margin: 0;
text-align: center;

View File

@ -154,6 +154,18 @@ $family-sans-serif: 'Roboto', sans-serif;
// Bulma's modal (needs to be greather than tainacan-admin-app)
$modal-z: 9999999;
// A copy of bootstrap's screen reader only class to be used for accessibility.
.sr-only {
position: absolute;
width: 1px;
height: 1px;
padding: 0;
margin: -1px;
overflow: hidden;
clip: rect(0,0,0,0);
border: 0;
}
// Animations for Slide Menu
@keyframes slide-menu-in {
from {

View File

@ -397,7 +397,7 @@ return apply_filters( 'tainacan-admin-i18n', [
'instruction_select_an_importer_type' => __( 'Select an importer from the options below:', 'tainacan' ),
'instruction_drop_file_or_click_to_upload' => __( 'Drop your source file or click here to upload.', 'tainacan' ),
'instruction_select_metadatum_type' => __( 'Select a metadatum type', 'tainacan' ),
'instruction_configure_new_metadatum' => __( 'Configure new metadatum.', 'tainacan' ),
'instruction_configure_new_metadatum' => __( 'Configure new metadatum', 'tainacan' ),
'instruction_insert_mapper_metadatum_info' => __( 'Insert the new mapper\'s metadatum info', 'tainacan' ),
'instruction_select_max_options_to_show' => __( 'Select max options to show', 'tainacan' ),
'instruction_select_collection_fetch_items' => __( 'Select a collection to fetch items', 'tainacan' ),

View File

@ -2,8 +2,8 @@
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd" >
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1">
<metadata>
Created by FontForge 20170910 at Thu Dec 20 15:06:27 2018
By Jimmy Wärting
Created by FontForge 20161003 at Wed Nov 14 11:54:32 2018
By www-data
</metadata>
<defs>
<font id="TainacanIcons" horiz-adv-x="1000" >
@ -225,14 +225,6 @@ d="M243 371l256 -255l256 255l78 -78l-334 -334l-334 334z" />
<glyph glyph-name="pausefill" unicode="pausefill"
d="M908 353q12 -48 12 -100q0 -87 -33 -163.5t-90 -133.5t-133.5 -90t-163.5 -33t-163.5 33t-133.5 90t-90 133.5t-33 163.5q0 52 12 98v3q17 69 55.5 127t92.5 101t121 66.5t141 23.5q73 0 139 -24t119.5 -66t91.5 -99.5t55 -125.5q0 -1 0.5 -2t0.5 -2zM627 419l-84 1
l-2 -336l84 -1zM459 420l-84 1l-2 -336l84 -1z" />
<glyph glyph-name="attachments" unicode="attachments"
d="M83 229q0 48 18 89.5t49 72.5t73 49t89 18h438q35 0 65 -13t53 -35.5t36 -52.5t13 -65t-13 -65.5t-36 -53t-53 -35.5t-65 -13h-354q-44 0 -74 30t-30 74t30 74t74 30h313v-83h-317q-9 0 -13 -6.5t-4 -14.5t4 -14.5t13 -6.5h358q35 0 59.5 24.5t24.5 59.5q0 34 -24.5 58.5
t-59.5 24.5h-438q-30 0 -56.5 -11.5t-46.5 -31.5t-31.5 -46.5t-11.5 -56.5t11.5 -56.5t31.5 -46.5t46.5 -31.5t56.5 -11.5h397v-83h-397q-47 0 -89 18t-73 49t-49 72.5t-18 89.5z" />
<glyph glyph-name="openurl" unicode="openurl"
d="M792 250h83v-292q0 -35 -24 -59t-59 -24h-584q-35 0 -59 24t-24 59v584q0 34 24 58.5t59 24.5h292v-83h-292v-584h584v292zM875 625v-292h-83v150l-410 -410l-59 59l410 410h-150v83h292z" />
<glyph glyph-name="waiting" unicode="waiting"
d="M500 667q86 0 162 -33t132.5 -89.5t89.5 -132.5t33 -162t-33 -162t-89.5 -132.5t-132.5 -89.5t-162 -33q-87 0 -163 33t-132.5 89.5t-89 132.5t-32.5 162t32.5 162t89 132.5t132.5 89.5t163 33zM500 -84q69 0 130 26.5t106 71.5t71.5 106t26.5 130t-26.5 130t-71.5 106
t-106 71.5t-130 26.5t-130 -26.5t-106 -71.5t-71.5 -106t-26.5 -130t26.5 -130t71.5 -106t106 -71.5t130 -26.5zM521 240l188 -112l-32 -51l-219 131v250h63v-218z" />
<glyph glyph-name=".notdef" horiz-adv-x="500"
/>
<glyph glyph-name="uni0000" horiz-adv-x="0"

Before

Width:  |  Height:  |  Size: 28 KiB

After

Width:  |  Height:  |  Size: 27 KiB

View File

@ -90,6 +90,9 @@
.tainacan-icon-audio:before {
content: "audio";
}
.tainacan-icon-video:before {
content: "video";
}
.tainacan-icon-close:before {
content: "close";
}

View File

@ -67,11 +67,16 @@ class Taxonomy extends Entity {
'new_item_name' => __( 'New Genre term', 'tainacan' ),
'menu_name' => $this->get_name(),
);
$enabled_post_types = $this->get_enabled_post_types();
$enabled_post_types = sizeof($enabled_post_types) ? $enabled_post_types : null;
$show_ui = is_array($enabled_post_types) ? true : false;
$args = array(
'hierarchical' => true,
'labels' => $labels,
'show_ui' => true,
'show_ui' => $show_ui,
'show_in_rest' => $show_ui,
'show_admin_column' => false,
'rewrite' => [
'slug' => $this->get_slug()
@ -82,8 +87,7 @@ class Taxonomy extends Entity {
unregister_taxonomy($this->get_db_identifier());
}
$enabled_post_types = $this->get_enabled_post_types();
$enabled_post_types = sizeof($enabled_post_types) ? $enabled_post_types : null;
register_taxonomy(
$this->get_db_identifier(),

View File

@ -75,14 +75,14 @@ class Date extends Metadata_Type {
$separator = $item_metadata->get_multivalue_separator();
foreach ( $value as $el ) {
$return .= $prefix;
$return .= date(get_option('date_format'), strtotime($el));
$return .= mysql2date(get_option('date_format'), ($el));
$return .= $suffix;
$count ++;
if ($count < $total)
$return .= $separator;
}
} else {
$return = date(get_option('date_format'), strtotime($value));
$return = mysql2date(get_option('date_format'), ($value));
}
return $return;

View File

@ -56,7 +56,6 @@
v-model="input_type"
@input="emitValues()"
v-else>
<option
v-for="(option, index) in multiple_types"
:value="index"
@ -96,11 +95,11 @@
errors: [ String, Object, Array ]
},
created(){
this.fetchTaxonomies().then(() => {
if ( this.value ) {
this.taxonomy_id = this.value.taxonomy_id;
}
});
this.fetchTaxonomies();
if ( this.value ) {
this.taxonomy_id = this.value.taxonomy_id;
}
if( this.value ) {
this.allow_new_terms = ( this.value.allow_new_terms ) ? this.value.allow_new_terms : 'no';
@ -112,6 +111,13 @@
this.isReady = true;
},
watch: {
input_type(val, oldValue) {
if (val != oldValue) {
this.emitValues();
}
}
},
computed: {
listInputType(){
if( this.metadatum && this.metadatum.multiple === 'no' ){
@ -158,6 +164,7 @@
this.taxonomyMessage = message;
},
fetchTaxonomies(){
return axios.get('/taxonomies?nopaging=1&order=asc&orderby=title')
.then(res => {
let taxonomies = res.data;

View File

@ -69,7 +69,7 @@ class Collections extends Repository {
'description' => __( 'The collection modification date', 'tainacan' )
],
'order' => [
'map' => 'menu_order',
'map' => 'order',
'title' => __( 'Order', 'tainacan' ),
'type' => 'string',
'description' => __( 'Collection order. This metadata is used if collections are manually ordered.', 'tainacan' ),

View File

@ -359,6 +359,18 @@ class Taxonomies extends Repository {
return $prefix . $id;
}
public function get_id_by_db_identifier( $db_identifier ) {
$prefix = \Tainacan\Entities\Taxonomy::$db_identifier_prefix;
//$sufix = \Tainacan\Entities\Taxonomy::$db_identifier_sufix;
$id = str_replace( $prefix, '', $db_identifier );
//$id = str_replace( $sufix, '', $id );
if ( is_numeric( $id ) ) {
return (int) $id;
}
return false;
}
/**
* Check if a term already exists
*

View File

@ -292,14 +292,24 @@ class Terms extends Repository {
} elseif ( $taxonomy instanceof Entities\Taxonomy ) {
$taxonomy_slug = $taxonomy->get_db_identifier();
}
$args = [
'name' => $name,
'taxonomy' => $taxonomy_slug,
'parent' => $parent,
'hide_empty' => 0,
'suppress_filter' => true
];
if(is_numeric($name)){
$args = [
'id' => (int) $name,
'taxonomy' => $taxonomy_slug,
'parent' => $parent,
'hide_empty' => 0,
'suppress_filter' => true
];
} else {
$args = [
'name' => $name,
'taxonomy' => $taxonomy_slug,
'parent' => $parent,
'hide_empty' => 0,
'suppress_filter' => true
];
}
if (is_null($parent)) {
unset($args['parent']);

View File

@ -613,6 +613,7 @@ class Old_Tainacan extends Importer{
$args = array(
'timeout' => 60,
'redirection' => 30,
'sslverify' => false
);
$this->add_log('fetching init ' . $link );
@ -643,6 +644,7 @@ class Old_Tainacan extends Importer{
$args = array(
'timeout' => 60,
'redirection' => 30,
'sslverify' => false
);
$result = wp_remote_get($link, $args);

View File

@ -189,6 +189,7 @@ export default {
}
},
addFetchOnly( metadatum, ignorePrefs, metadatumIDs ){
this.$store.dispatch('search/add_fetch_only', metadatum );
this.$store.dispatch('search/add_fetch_only_meta', metadatumIDs);
this.updateURLQueries();

View File

@ -131,7 +131,7 @@ export const deleteItem = ({ commit }, { itemId, isPermanently }) => {
});
};
export const fetchCollections = ({commit} , { page, collectionsPerPage, status, contextEdit }) => {
export const fetchCollections = ({commit} , { page, collectionsPerPage, status, contextEdit, order, orderby }) => {
return new Promise((resolve, reject) => {
let endpoint = '/collections?paged='+page+'&perpage='+collectionsPerPage;
@ -141,7 +141,10 @@ export const fetchCollections = ({commit} , { page, collectionsPerPage, status,
if (status != '' && status != undefined)
endpoint = endpoint + '&status=' + status;
if (order != undefined && order != '' && orderby != undefined && orderby != '')
endpoint = endpoint + '&order=' + order + '&orderby=' + orderby;
axios.tainacan.get(endpoint)
.then(res => {
let collections = res.data;

View File

@ -1,5 +1,5 @@
=== Tainacan ===
Contributors: andrebenedito, daltonmartins, fabianobn, jacsonp, leogermani, weryques, wetah, eduardohumberto
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

View File

@ -56,7 +56,9 @@ class Theme_Helper {
add_action( 'pre_get_posts', array($this, 'archive_repository_pre_get_posts'));
// TODO: fix the WP Title
// add_filter( 'wp_title', array($this, 'archive_repository_wp_title'), 10, 3);
add_action( 'wp_head', array($this, 'add_social_meta'), 5 );
$this->register_view_mode('table', [
'label' => __('Table', 'tainacan'),
'dynamic_metadata' => true,
@ -208,9 +210,22 @@ class Theme_Helper {
$term = get_queried_object();
if ($term instanceof \WP_Term && $this->is_term_a_tainacan_term($term)) {
// TODO: Why post_type = any does not work?
// ANSWER because post types are registered with exclude_from_search. Should we change it?
$wp_query->set( 'post_type', \Tainacan\Repositories\Repository::get_collections_db_identifiers() );
$tax_id = \Tainacan\Repositories\Taxonomies::get_instance()->get_id_by_db_identifier($term->taxonomy);
$tax = \Tainacan\Repositories\Taxonomies::get_instance()->fetch($tax_id);
if ( $tax ) {
$post_types = $tax->get_enabled_post_types();
// TODO: Why post_type = any does not work?
// ANSWER because post types are registered with exclude_from_search. Should we change it?
// TODO adding all post types to the list is something we need to discuss
$post_types = array_merge($post_types, \Tainacan\Repositories\Repository::get_collections_db_identifiers());
$wp_query->set( 'post_type', $post_types);
}
}
}
@ -285,6 +300,18 @@ class Theme_Helper {
$term = get_queried_object();
if ( isset($term->taxonomy) && $this->is_taxonomy_a_tainacan_tax($term->taxonomy)) {
$tax_id = \Tainacan\Repositories\Taxonomies::get_instance()->get_id_by_db_identifier($term->taxonomy);
$tax = \Tainacan\Repositories\Taxonomies::get_instance()->fetch($tax_id);
if ( $tax ) {
$post_types = $tax->get_enabled_post_types();
if (sizeof($post_types)) {
// if taxonomy is enabled for other post types, we disable
// custom template ans use default list
// TODO: This needs discussion
return $templates;
}
}
$last_template = array_pop($templates);
@ -474,5 +501,91 @@ class Theme_Helper {
return isset($this->registered_view_modes[$slug]) ? $this->registered_view_modes[$slug] : false;
}
/**
* Adds meta tags to the header to improve social sharing
*/
public function add_social_meta() {
if ( is_single() || is_tax() || is_archive() ) {
$logo = get_template_directory_uri() . '/assets/images/social-logo.png';
$excerpt = get_bloginfo( 'description' );
$url_src = (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] === 'on' ? "https" : "http") . "://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]";
global $wp;
if ( is_post_type_archive() ) {
$collection_id = tainacan_get_collection_id();
if ($collection_id) {
$title = tainacan_get_the_collection_name();
$img_info = ( has_post_thumbnail( tainacan_get_collection_id() ) ) ? wp_get_attachment_image_src( get_post_thumbnail_id( tainacan_get_collection_id() ), 'full' ) : $logo;
$url_src = home_url( $wp->request );
$excerpt = tainacan_get_the_collection_description();
}
} elseif ( is_singular() ) {
global $post;
if ( !is_object($post) ) { return; }
$title = get_the_title();
$img_info = ( has_post_thumbnail( $post->ID ) ) ? wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), 'full' ) : $logo;
$url_src = get_permalink();
$content = wp_trim_words( $post->post_content, 28, '[...]' );
if ( $content ) {
$excerpt = strip_tags( $content );
$excerpt = str_replace( '', "'", $excerpt );
}
} elseif ( is_tax() ) {
$term = get_queried_object();
$tainacan_term = tainacan_get_term();
$title = $term->name;
$excerpt = $term->description;
$url_src = get_term_link($term->term_id, $term->taxonomy);
if ($tainacan_term) {
$_term = new \Tainacan\Entities\Term( $tainacan_term );
$img_id = $_term->get_header_image_id();
if ($img_id) {
$img_info = wp_get_attachment_image_src( $img_id, 'full' );
}
}
} else {
if ( is_day() ) :
$title = sprintf( __( 'Daily Archives: %s', 'tainacan-interface' ), get_the_date() );
elseif ( is_month() ) :
$title = sprintf( __( 'Monthly Archives: %s', 'tainacan-interface' ), get_the_date( _x( 'F Y', 'monthly archives date format', 'tainacan-interface' ) ) );
elseif ( is_year() ) :
$title = sprintf( __( 'Yearly Archives: %s', 'tainacan-interface' ), get_the_date( _x( 'Y', 'yearly archives date format', 'tainacan-interface' ) ) );
elseif ( is_author() ) :
$title = get_the_author();
else :
$title = get_the_archive_title();
endif;
}
$image = array(
'url' => ( ! empty( $img_info[0] ) && $img_info[1] >= 200 && $img_info[2] >= 200 ) ? $img_info[0] : $logo,
'width' => ( ! empty( $img_info[1] ) && $img_info[1] >= 200 && $img_info[2] >= 200 ) ? $img_info[1] : 200,
'height' => ( ! empty( $img_info[2] ) && $img_info[1] >= 200 && $img_info[2] >= 200 ) ? $img_info[2] : 200,
);
?>
<meta property="og:type" content="article"/>
<meta property="og:title" content="<?php echo $title; ?>"/>
<meta property="og:site_name" content="<?php echo get_bloginfo(); ?>"/>
<meta property="og:description" content="<?php echo $excerpt; ?>"/>
<meta property="og:url" content="<?php echo $url_src; ?>"/>
<meta property="og:image" content="<?php echo $image['url']; ?>"/>
<meta property="og:image:width" content="<?php echo $image['width']; ?>"/>
<meta property="og:image:height" content="<?php echo $image['height']; ?>"/>
<?php } else { return; } // End if().
}
}

View File

@ -203,7 +203,7 @@ function tainacan_the_faceted_search() {
$props .= 'default-view-mode="' . $default_view_mode . '" ';
$props .= 'enabled-view-modes="' . implode(',', $enabled_view_modes) . '" ';
echo "<div id='tainacan-items-page' $props ></div>";
echo "<main id='tainacan-items-page' $props ></main>";
}

View File

@ -134,8 +134,6 @@ export default {
if (!metadata) {
return '';
} else if (metadata.date_i18n) {
return metadata.date_i18n;
} else {
return metadata.value_as_html;
}

View File

@ -105,8 +105,6 @@ export default {
if (!metadata) {
return '';
} else if (metadata.date_i18n) {
return metadata.date_i18n;
} else {
return metadata.value_as_html;
}

View File

@ -149,8 +149,6 @@ export default {
if (!metadata) {
return '';
} else if (metadata.date_i18n) {
return metadata.date_i18n;
} else {
return metadata.value_as_html;
}

View File

@ -585,8 +585,6 @@ export default {
if (!metadata) {
return '';
} else if (metadata.date_i18n) {
return metadata.date_i18n;
} else {
return metadata.value_as_html;
}

View File

@ -194,8 +194,6 @@ export default {
if (!metadata) {
return '';
} else if (metadata.date_i18n) {
return metadata.date_i18n;
} else {
if (component != undefined && component == 'tainacan-textarea')
return metadata.value_as_string;