Merge remote-tracking branch 'origin/develop' into field-mapping-interface
This commit is contained in:
commit
b5d832fb5d
|
@ -9,6 +9,7 @@ module.exports = {
|
|||
},
|
||||
rules: {
|
||||
// override/add rules settings here, such as:
|
||||
'no-extra-boolean-cast': 'off',
|
||||
'vue/no-unused-vars': 'error',
|
||||
'no-console': 'warn',
|
||||
'no-unused-vars': 'warn',
|
||||
|
|
|
@ -145,7 +145,7 @@ A REST API for Tainacan Plugin. This API uses the Wordpress REST API.
|
|||
}
|
||||
```
|
||||
|
||||
2. Route `wp-json/tainacan/v2/collection/(?P<collection_id>[\d]+)/metadata/(?P<field_id>[\d]+)`
|
||||
2. Route `wp-json/tainacan/v2/collection/(?P<collection_id>[\d]+)/metadata/(?P<metadatum_id>[\d]+)`
|
||||
|
||||
1. Endpoints:
|
||||
|
||||
|
@ -174,7 +174,7 @@ A REST API for Tainacan Plugin. This API uses the Wordpress REST API.
|
|||
|
||||
In body of requisition pass a JSON with the attributes of metadatum.
|
||||
|
||||
4. Route `wp-json/tainacan/v2/metadata/(?P(<field_id>[\d]+))`
|
||||
4. Route `wp-json/tainacan/v2/metadata/(?P(<metadatum_id>[\d]+))`
|
||||
|
||||
1. Endpoints:
|
||||
|
||||
|
@ -271,7 +271,7 @@ A REST API for Tainacan Plugin. This API uses the Wordpress REST API.
|
|||
------
|
||||
#### Filters
|
||||
|
||||
1. Route `wp-json/tainacan/v2/collection/(?P<collection_id>[\d]+)/metadatum/(?P<field_id>[\d]+)/filters`
|
||||
1. Route `wp-json/tainacan/v2/collection/(?P<collection_id>[\d]+)/metadatum/(?P<metadatum_id>[\d]+)/filters`
|
||||
|
||||
1. Endpoints:
|
||||
|
||||
|
|
|
@ -223,9 +223,9 @@ class Admin {
|
|||
|
||||
function register_user_meta() {
|
||||
$args = array(
|
||||
//'sanitize_callback' => 'sanitize_my_meta_key',
|
||||
//'sanitize_callback' => array(&$this, 'santize_user_tainacan_prefs'),
|
||||
//'auth_callback' => 'authorize_my_meta_key',
|
||||
'type' => 'array',
|
||||
'type' => 'string',
|
||||
'description' => 'Tainacan admin user preferences',
|
||||
'single' => true,
|
||||
'show_in_rest' => true,
|
||||
|
|
|
@ -3,8 +3,8 @@
|
|||
<div class="columns is-multiline tnc-advanced-search-container">
|
||||
|
||||
<div
|
||||
v-for="searchMetadatum in totalSearchMetadata"
|
||||
:key="searchMetadatum"
|
||||
v-for="searchCriteria in searchCriterias"
|
||||
:key="searchCriteria"
|
||||
class="field column is-12 tainacan-form">
|
||||
|
||||
<b-field
|
||||
|
@ -12,7 +12,7 @@
|
|||
grouped>
|
||||
<b-field class="column">
|
||||
<b-select
|
||||
@input="addToAdvancedSearchQuery($event, 'field_id', searchMetadatum)">
|
||||
@input="addToAdvancedSearchQuery($event, 'key', searchCriteria)">
|
||||
<option
|
||||
v-for="metadata in metadataList"
|
||||
v-if="metadata.enabled"
|
||||
|
@ -24,12 +24,12 @@
|
|||
|
||||
<b-field class="column is-two-thirds">
|
||||
<b-input
|
||||
@input="addValueToAdvancedSearchQuery($event, 'value', searchMetadatum)"/>
|
||||
@input="addValueToAdvancedSearchQuery($event, 'value', searchCriteria)"/>
|
||||
</b-field>
|
||||
|
||||
<b-field class="column">
|
||||
<b-select
|
||||
@input="addToAdvancedSearchQuery($event, 'compare', searchMetadatum)">
|
||||
@input="addToAdvancedSearchQuery($event, 'compare', searchCriteria)">
|
||||
<option
|
||||
v-for="(opt, key) in compare"
|
||||
:value="key"
|
||||
|
@ -50,12 +50,33 @@
|
|||
size="is-small"
|
||||
type="is-secondary"/>
|
||||
<a
|
||||
@click="addSearchMetadata"
|
||||
@click="addSearchCriteria"
|
||||
class="is-secondary is-small">
|
||||
{{ $i18n.get('add_more_one_search_metadatum') }}</a>
|
||||
{{ $i18n.get('add_more_one_search_criteria') }}</a>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div class="field column is-12">
|
||||
<b-field
|
||||
grouped
|
||||
group-multiline>
|
||||
<div
|
||||
v-for="searchCriteria in searchCriterias"
|
||||
:key="searchCriteria"
|
||||
class="control taginput-container">
|
||||
<b-tag
|
||||
v-if="advancedSearchQuery[searchCriteria] && advancedSearchQuery[searchCriteria].value"
|
||||
type="is-white"
|
||||
@close="removeThis(searchCriteria)"
|
||||
attached
|
||||
closable>
|
||||
{{ Array.isArray(advancedSearchQuery[searchCriteria].value) ?
|
||||
advancedSearchQuery[searchCriteria].value.toString() :
|
||||
advancedSearchQuery[searchCriteria].value }}
|
||||
</b-tag>
|
||||
</div>
|
||||
</b-field>
|
||||
</div>
|
||||
<div class="column">
|
||||
<div class="field is-grouped is-pulled-right">
|
||||
<p class="control">
|
||||
|
@ -71,7 +92,6 @@
|
|||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- <pre>{{ advancedSearchQuery }}</pre> -->
|
||||
</div>
|
||||
</template>
|
||||
|
||||
|
@ -90,24 +110,38 @@
|
|||
'IN': this.$i18n.get('contains'),
|
||||
'NOT IN': this.$i18n.get('not_contains')
|
||||
},
|
||||
totalSearchMetadata: 1,
|
||||
searchCriterias: [1],
|
||||
advancedSearchQuery: {
|
||||
advancedSearch: true,
|
||||
metaquery: {
|
||||
relation: 'AND',
|
||||
}
|
||||
},
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
addSearchMetadata(){
|
||||
this.totalSearchMetadata++;
|
||||
removeThis(searchCriteria){
|
||||
let criteriaIndex = this.searchCriterias.findIndex((element) => {
|
||||
return element == searchCriteria;
|
||||
});
|
||||
|
||||
this.searchCriterias.splice(criteriaIndex, 1);
|
||||
delete this.advancedSearchQuery[criteriaIndex];
|
||||
},
|
||||
addSearchCriteria(){
|
||||
let aleatoryKey = Math.floor(Math.random() * 1000) + 2;
|
||||
|
||||
let found = this.searchCriterias.find((element) => {
|
||||
return element == aleatoryKey;
|
||||
});
|
||||
|
||||
if(found == undefined){
|
||||
this.searchCriterias.push(aleatoryKey);
|
||||
} else {
|
||||
this.addSearchCriteria();
|
||||
}
|
||||
},
|
||||
clearSearch(){
|
||||
this.totalSearchMetadata = 1;
|
||||
this.searchCriterias = [1];
|
||||
this.advancedSearchQuery = {
|
||||
advancedSearch: true,
|
||||
relation: 'AND',
|
||||
};
|
||||
},
|
||||
addValueToAdvancedSearchQuery: _.debounce(function(value, type, relation) {
|
||||
|
@ -116,21 +150,40 @@
|
|||
vm.addToAdvancedSearchQuery(value, type, relation);
|
||||
}, 900),
|
||||
searchAdvanced(){
|
||||
if(this.advancedSearchQuery.length > 2){
|
||||
this.advancedSearchQuery.relation = 'AND';
|
||||
}
|
||||
|
||||
this.$eventBusSearch.$emit('searchAdvanced', this.advancedSearchQuery);
|
||||
},
|
||||
addToAdvancedSearchQuery(value, type, relation){
|
||||
if(this.advancedSearchQuery.metaquery.hasOwnProperty(relation)){
|
||||
if(this.advancedSearchQuery.hasOwnProperty(relation)){
|
||||
//if(this.advancedSearchQuery[relation].compare === 'IN'){
|
||||
//this.advancedSearchQuery[relation][type] = value.split(' ');
|
||||
//} else {
|
||||
this.advancedSearchQuery.metaquery[relation][type] = value;
|
||||
if(type == 'compare' && (this.advancedSearchQuery[relation]['compare'] == 'IN' ||
|
||||
this.advancedSearchQuery[relation]['compare'] == 'NOT IN')){
|
||||
|
||||
this.advancedSearchQuery[relation].value.push(value);
|
||||
} else {
|
||||
this.advancedSearchQuery[relation][type] = value;
|
||||
}
|
||||
//}
|
||||
} else {
|
||||
this.advancedSearchQuery.metaquery = Object.assign({}, this.advancedSearchQuery.metaquery, {
|
||||
[`${relation}`]: {
|
||||
[`${type}`]: value,
|
||||
}
|
||||
});
|
||||
if(type == 'compare' && (value == 'IN' || value == 'NOT IN')){
|
||||
|
||||
this.advancedSearchQuery = Object.assign({}, this.advancedSearchQuery, {
|
||||
[`${relation}`]: {
|
||||
[`${type}`]: [value],
|
||||
}
|
||||
});
|
||||
} else {
|
||||
this.advancedSearchQuery = Object.assign({}, this.advancedSearchQuery, {
|
||||
[`${relation}`]: {
|
||||
[`${type}`]: value,
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
console.log(this.advancedSearchQuery);
|
||||
|
|
|
@ -19,7 +19,6 @@
|
|||
:title="$i18n.getHelperTitle('categories', 'name')"
|
||||
:message="$i18n.getHelperMessage('categories', 'name')"/>
|
||||
<b-input
|
||||
:class="{'has-content': form.name != undefined && form.name != ''}"
|
||||
id="tainacan-text-name"
|
||||
v-model="form.name"
|
||||
@focus="clearErrors('name')"
|
||||
|
@ -36,7 +35,6 @@
|
|||
:title="$i18n.getHelperTitle('categories', 'description')"
|
||||
:message="$i18n.getHelperMessage('categories', 'description')"/>
|
||||
<b-input
|
||||
:class="{'has-content': form.description != undefined && form.description != ''}"
|
||||
id="tainacan-text-description"
|
||||
type="textarea"
|
||||
v-model="form.description"
|
||||
|
@ -77,7 +75,6 @@
|
|||
:message="$i18n.getHelperMessage('categories', 'slug')"/>
|
||||
<b-icon :class="{'is-loading': isUpdatingSlug}"/>
|
||||
<b-input
|
||||
:class="{'has-content': form.slug != undefined && form.slug != ''}"
|
||||
@input="updateSlug()"
|
||||
id="tainacan-text-slug"
|
||||
v-model="form.slug"
|
||||
|
|
|
@ -8,13 +8,42 @@
|
|||
class="tainacan-form"
|
||||
label-width="120px">
|
||||
|
||||
<div class="columns is-variable is-8">
|
||||
<div class="column is-narrow">
|
||||
<!-- Header Page -------------------------------- -->
|
||||
<b-field :addons="false">
|
||||
<label class="section-label">{{ $i18n.get('label_header_image') }}</label>
|
||||
<div class="header-field">
|
||||
<a
|
||||
class="button is-rounred is-secondary"
|
||||
id="button-edit-header-image"
|
||||
:aria-label="$i18n.get('label_button_edit_header_image')"
|
||||
@click="headerImageMediaFrame.openFrame($event)">
|
||||
<b-icon icon="pencil" />
|
||||
</a>
|
||||
<figure class="image">
|
||||
<span
|
||||
v-if="collection.header_image == undefined || collection.header_image == false"
|
||||
class="image-placeholder">{{ $i18n.get('label_empty_header_image') }}</span>
|
||||
<img
|
||||
:alt="$i18n.get('label_thumbnail')"
|
||||
:src="(collection.header_image == undefined || collection.header_image == false) ? headerPlaceholderPath : collection.header_image">
|
||||
</figure>
|
||||
<div class="header-buttons-row">
|
||||
<a
|
||||
id="button-delete"
|
||||
:aria-label="$i18n.get('label_button_delete_thumb')"
|
||||
@click="deleteHeaderImage()">
|
||||
<b-icon icon="delete" />
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</b-field>
|
||||
|
||||
<div class="columns">
|
||||
<div class="column">
|
||||
|
||||
<!-- Thumbnail -------------------------------- -->
|
||||
<b-field
|
||||
:addons="false"
|
||||
:label="$i18n.get('label_thumbnail')">
|
||||
<b-field :addons="false">
|
||||
<label class="section-label">{{ $i18n.get('label_thumbnail') }}</label>
|
||||
<div class="thumbnail-field">
|
||||
<a
|
||||
class="button is-rounred is-secondary"
|
||||
|
@ -23,7 +52,7 @@
|
|||
@click.prevent="thumbnailMediaFrame.openFrame($event)">
|
||||
<b-icon icon="pencil" />
|
||||
</a>
|
||||
<figure class="image is-128x128">
|
||||
<figure class="image">
|
||||
<span
|
||||
v-if="collection.thumbnail.thumb == undefined || collection.thumbnail.thumb == false"
|
||||
class="image-placeholder">{{ $i18n.get('label_empty_thumbnail') }}</span>
|
||||
|
@ -43,94 +72,6 @@
|
|||
</div>
|
||||
</b-field>
|
||||
|
||||
<!-- Header Page -------------------------------- -->
|
||||
<b-field
|
||||
:addons="false"
|
||||
:label="$i18n.get('label_header_image')">
|
||||
<div class="thumbnail-field">
|
||||
<a
|
||||
class="button is-rounred is-secondary"
|
||||
id="button-edit-header-image"
|
||||
:aria-label="$i18n.get('label_button_edit_header_image')"
|
||||
@click="headerImageMediaFrame.openFrame($event)">
|
||||
<b-icon icon="pencil" />
|
||||
</a>
|
||||
<figure class="image is-128x128">
|
||||
<span
|
||||
v-if="collection.header_image == undefined || collection.header_image == false"
|
||||
class="image-placeholder">{{ $i18n.get('label_empty_header_image') }}</span>
|
||||
<img
|
||||
:alt="$i18n.get('label_thumbnail')"
|
||||
:src="(collection.header_image == undefined || collection.header_image == false) ? headerPlaceholderPath : collection.header_image">
|
||||
</figure>
|
||||
<div class="thumbnail-buttons-row">
|
||||
<a
|
||||
id="button-delete"
|
||||
:aria-label="$i18n.get('label_button_delete_thumb')"
|
||||
@click="deleteHeaderImage()">
|
||||
<b-icon icon="delete" />
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</b-field>
|
||||
</div>
|
||||
<div class="column">
|
||||
<!-- Status -------------------------------- -->
|
||||
<b-field
|
||||
:addons="false"
|
||||
:label="$i18n.get('label_status')"
|
||||
:type="editFormErrors['status'] != undefined ? 'is-danger' : ''"
|
||||
:message="editFormErrors['status'] != undefined ? editFormErrors['status'] : ''">
|
||||
<help-button
|
||||
:title="$i18n.getHelperTitle('collections', 'status')"
|
||||
:message="$i18n.getHelperMessage('collections', 'status')"/>
|
||||
<b-select
|
||||
id="tainacan-select-status"
|
||||
v-model="form.status"
|
||||
@focus="clearErrors('status')"
|
||||
:placeholder="$i18n.get('instruction_select_a_status')">
|
||||
<option
|
||||
v-for="statusOption in statusOptions"
|
||||
:key="statusOption.value"
|
||||
:value="statusOption.value"
|
||||
:disabled="statusOption.disabled">{{ statusOption.label }}
|
||||
</option>
|
||||
</b-select>
|
||||
</b-field>
|
||||
|
||||
<!-- Name -------------------------------- -->
|
||||
<b-field
|
||||
:addons="false"
|
||||
:label="$i18n.get('label_name')"
|
||||
:type="editFormErrors['name'] != undefined ? 'is-danger' : ''"
|
||||
:message="editFormErrors['name'] != undefined ? editFormErrors['name'] : ''">
|
||||
<help-button
|
||||
:title="$i18n.getHelperTitle('collections', 'name')"
|
||||
:message="$i18n.getHelperMessage('collections', 'name')"/>
|
||||
<b-input
|
||||
:class="{'has-content': form.name != undefined && form.name != ''}"
|
||||
id="tainacan-text-name"
|
||||
v-model="form.name"
|
||||
@focus="clearErrors('name')"/>
|
||||
</b-field>
|
||||
|
||||
<!-- Description -------------------------------- -->
|
||||
<b-field
|
||||
:addons="false"
|
||||
:label="$i18n.get('label_description')"
|
||||
:type="editFormErrors['description'] != undefined ? 'is-danger' : ''"
|
||||
:message="editFormErrors['description'] != undefined ? editFormErrors['description'] : ''">
|
||||
<help-button
|
||||
:title="$i18n.getHelperTitle('collections', 'description')"
|
||||
:message="$i18n.getHelperMessage('collections', 'description')"/>
|
||||
<b-input
|
||||
:class="{'has-content': form.description != undefined && form.description != ''}"
|
||||
id="tainacan-text-description"
|
||||
type="textarea"
|
||||
v-model="form.description"
|
||||
@focus="clearErrors('description')"/>
|
||||
</b-field>
|
||||
|
||||
<!-- Enable Cover Page -------------------------------- -->
|
||||
<div class="field">
|
||||
<b-checkbox
|
||||
|
@ -192,90 +133,6 @@
|
|||
</div>
|
||||
</b-field>
|
||||
|
||||
<!-- Moderators List -------------------------------- -->
|
||||
<b-field
|
||||
:addons="false"
|
||||
:label="$i18n.get('label_moderators')"
|
||||
:type="editFormErrors['moderators'] != undefined ? 'is-danger' : ''"
|
||||
:message="editFormErrors['moderators'] != undefined ? editFormErrors['moderators'] : ''">
|
||||
<help-button
|
||||
:title="$i18n.getHelperTitle('collections', 'moderators_ids')"
|
||||
:message="$i18n.getHelperMessage('collections', 'moderators_ids')"/>
|
||||
<b-autocomplete
|
||||
id="tainacan-text-moderators-input"
|
||||
:placeholder="$i18n.get('instruction_moderators')"
|
||||
:data="users"
|
||||
@select="onAddModerator($event)"
|
||||
:loading="isFetchingModerators"
|
||||
@input="fecthModerators($event)"
|
||||
@focus="clearErrors('moderators')">
|
||||
<template slot-scope="props">
|
||||
{{ props.option.name }}
|
||||
</template>
|
||||
<template slot="empty">{{ $i18n.get('info_no_user_found') }}</template>
|
||||
</b-autocomplete>
|
||||
<ul
|
||||
class="selected-list-box"
|
||||
v-if="moderators != undefined && moderators.length > 0">
|
||||
<li
|
||||
:key="index"
|
||||
v-for="(moderator, index) of moderators">
|
||||
<b-tag
|
||||
attached
|
||||
closable
|
||||
@close="removeModerator(index)">
|
||||
{{ moderator.name }}
|
||||
</b-tag>
|
||||
</li>
|
||||
</ul>
|
||||
<div
|
||||
class="moderators-empty-list"
|
||||
v-else>
|
||||
{{ $i18n.get('info_no_moderator_on_collection') }}
|
||||
</div>
|
||||
</b-field>
|
||||
|
||||
<!-- Slug -------------------------------- -->
|
||||
<b-field
|
||||
:addons="false"
|
||||
:label="$i18n.get('label_slug')"
|
||||
:type="editFormErrors['slug'] != undefined ? 'is-danger' : ''"
|
||||
:message="editFormErrors['slug'] != undefined ? editFormErrors['slug'] : ''">
|
||||
<help-button
|
||||
:title="$i18n.getHelperTitle('collections', 'slug')"
|
||||
:message="$i18n.getHelperMessage('collections', 'slug')"/>
|
||||
<b-input
|
||||
:class="{'has-content': form.slug != undefined && form.slug != ''}"
|
||||
id="tainacan-text-slug"
|
||||
v-model="form.slug"
|
||||
@focus="clearErrors('slug')"/>
|
||||
</b-field>
|
||||
|
||||
<!-- Parent Collection -------------------------------- -->
|
||||
<b-field
|
||||
:addons="false"
|
||||
:label="$i18n.get('label_parent_collection')"
|
||||
:type="editFormErrors['parent'] != undefined ? 'is-danger' : ''"
|
||||
:message="editFormErrors['parent'] != undefined ? editFormErrors['parent'] : ''">
|
||||
<help-button
|
||||
:title="$i18n.getHelperTitle('collections', 'parent')"
|
||||
:message="$i18n.getHelperMessage('collections', 'parent')"/>
|
||||
<b-select
|
||||
id="tainacan-select-parent"
|
||||
v-model="form.parent"
|
||||
@focus="clearErrors('parent')"
|
||||
:loading="isFetchingCollections"
|
||||
:placeholder="$i18n.get('instruction_select_a_parent_collection')">
|
||||
<option value="0">{{ $i18n.get('label_no_parent_collection') }}</option>
|
||||
<option
|
||||
v-if="collection.id != anotherCollection.id"
|
||||
v-for="anotherCollection of collections"
|
||||
:key="anotherCollection.id"
|
||||
:value="anotherCollection.id">{{ anotherCollection.name }}
|
||||
</option>
|
||||
</b-select>
|
||||
</b-field>
|
||||
|
||||
<!-- Enabled View Modes ------------------------------- -->
|
||||
<div class="field">
|
||||
<label class="label">{{ $i18n.get('label_view_modes_available') }}</label>
|
||||
|
@ -335,6 +192,144 @@
|
|||
</b-field>
|
||||
|
||||
</div>
|
||||
<div class="column">
|
||||
<!-- Status -------------------------------- -->
|
||||
<b-field
|
||||
:addons="false"
|
||||
:label="$i18n.get('label_status')"
|
||||
:type="editFormErrors['status'] != undefined ? 'is-danger' : ''"
|
||||
:message="editFormErrors['status'] != undefined ? editFormErrors['status'] : ''">
|
||||
<help-button
|
||||
:title="$i18n.getHelperTitle('collections', 'status')"
|
||||
:message="$i18n.getHelperMessage('collections', 'status')"/>
|
||||
<b-select
|
||||
id="tainacan-select-status"
|
||||
v-model="form.status"
|
||||
@focus="clearErrors('status')"
|
||||
:placeholder="$i18n.get('instruction_select_a_status')">
|
||||
<option
|
||||
v-for="statusOption in statusOptions"
|
||||
:key="statusOption.value"
|
||||
:value="statusOption.value"
|
||||
:disabled="statusOption.disabled">{{ statusOption.label }}
|
||||
</option>
|
||||
</b-select>
|
||||
</b-field>
|
||||
|
||||
<!-- Name -------------------------------- -->
|
||||
<b-field
|
||||
:addons="false"
|
||||
:label="$i18n.get('label_name')"
|
||||
:type="editFormErrors['name'] != undefined ? 'is-danger' : ''"
|
||||
:message="editFormErrors['name'] != undefined ? editFormErrors['name'] : ''">
|
||||
<help-button
|
||||
:title="$i18n.getHelperTitle('collections', 'name')"
|
||||
:message="$i18n.getHelperMessage('collections', 'name')"/>
|
||||
<b-input
|
||||
id="tainacan-text-name"
|
||||
v-model="form.name"
|
||||
@focus="clearErrors('name')"/>
|
||||
</b-field>
|
||||
|
||||
<!-- Description -------------------------------- -->
|
||||
<b-field
|
||||
:addons="false"
|
||||
:label="$i18n.get('label_description')"
|
||||
:type="editFormErrors['description'] != undefined ? 'is-danger' : ''"
|
||||
:message="editFormErrors['description'] != undefined ? editFormErrors['description'] : ''">
|
||||
<help-button
|
||||
:title="$i18n.getHelperTitle('collections', 'description')"
|
||||
:message="$i18n.getHelperMessage('collections', 'description')"/>
|
||||
<b-input
|
||||
id="tainacan-text-description"
|
||||
type="textarea"
|
||||
v-model="form.description"
|
||||
@focus="clearErrors('description')"/>
|
||||
</b-field>
|
||||
|
||||
<!-- Moderators List -------------------------------- -->
|
||||
<b-field
|
||||
:addons="false"
|
||||
:label="$i18n.get('label_moderators')"
|
||||
:type="editFormErrors['moderators'] != undefined ? 'is-danger' : ''"
|
||||
:message="editFormErrors['moderators'] != undefined ? editFormErrors['moderators'] : ''">
|
||||
<help-button
|
||||
:title="$i18n.getHelperTitle('collections', 'moderators_ids')"
|
||||
:message="$i18n.getHelperMessage('collections', 'moderators_ids')"/>
|
||||
<b-autocomplete
|
||||
id="tainacan-text-moderators-input"
|
||||
:placeholder="$i18n.get('instruction_moderators')"
|
||||
:data="users"
|
||||
@select="onAddModerator($event)"
|
||||
:loading="isFetchingModerators"
|
||||
@input="fecthModerators($event)"
|
||||
@focus="clearErrors('moderators')">
|
||||
<template slot-scope="props">
|
||||
{{ props.option.name }}
|
||||
</template>
|
||||
<template slot="empty">{{ $i18n.get('info_no_user_found') }}</template>
|
||||
</b-autocomplete>
|
||||
<ul
|
||||
class="selected-list-box"
|
||||
v-if="moderators != undefined && moderators.length > 0">
|
||||
<li
|
||||
:key="index"
|
||||
v-for="(moderator, index) of moderators">
|
||||
<b-tag
|
||||
attached
|
||||
closable
|
||||
@close="removeModerator(index)">
|
||||
{{ moderator.name }}
|
||||
</b-tag>
|
||||
</li>
|
||||
</ul>
|
||||
<div
|
||||
class="moderators-empty-list"
|
||||
v-else>
|
||||
{{ $i18n.get('info_no_moderator_on_collection') }}
|
||||
</div>
|
||||
</b-field>
|
||||
|
||||
<!-- Slug -------------------------------- -->
|
||||
<b-field
|
||||
:addons="false"
|
||||
:label="$i18n.get('label_slug')"
|
||||
:type="editFormErrors['slug'] != undefined ? 'is-danger' : ''"
|
||||
:message="editFormErrors['slug'] != undefined ? editFormErrors['slug'] : ''">
|
||||
<help-button
|
||||
:title="$i18n.getHelperTitle('collections', 'slug')"
|
||||
:message="$i18n.getHelperMessage('collections', 'slug')"/>
|
||||
<b-input
|
||||
id="tainacan-text-slug"
|
||||
v-model="form.slug"
|
||||
@focus="clearErrors('slug')"/>
|
||||
</b-field>
|
||||
|
||||
<!-- Parent Collection -------------------------------- -->
|
||||
<b-field
|
||||
:addons="false"
|
||||
:label="$i18n.get('label_parent_collection')"
|
||||
:type="editFormErrors['parent'] != undefined ? 'is-danger' : ''"
|
||||
:message="editFormErrors['parent'] != undefined ? editFormErrors['parent'] : ''">
|
||||
<help-button
|
||||
:title="$i18n.getHelperTitle('collections', 'parent')"
|
||||
:message="$i18n.getHelperMessage('collections', 'parent')"/>
|
||||
<b-select
|
||||
id="tainacan-select-parent"
|
||||
v-model="form.parent"
|
||||
@focus="clearErrors('parent')"
|
||||
:loading="isFetchingCollections"
|
||||
:placeholder="$i18n.get('instruction_select_a_parent_collection')">
|
||||
<option value="0">{{ $i18n.get('label_no_parent_collection') }}</option>
|
||||
<option
|
||||
v-if="collection.id != anotherCollection.id"
|
||||
v-for="anotherCollection of collections"
|
||||
:key="anotherCollection.id"
|
||||
:value="anotherCollection.id">{{ anotherCollection.name }}
|
||||
</option>
|
||||
</b-select>
|
||||
</b-field>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Form submit -------------------------------- -->
|
||||
|
@ -734,7 +729,7 @@ export default {
|
|||
|
||||
if (this.$route.fullPath.split("/").pop() != "new") {
|
||||
document.getElementById('collection-page-container').addEventListener('scroll', ($event) => {
|
||||
this.$emit('onShrinkHeader', ($event.originalTarget.scrollTop > 53));
|
||||
this.$emit('onShrinkHeader', ($event.target.scrollTop > 53));
|
||||
});
|
||||
}
|
||||
}
|
||||
|
@ -751,9 +746,36 @@ export default {
|
|||
position: relative;
|
||||
}
|
||||
|
||||
.section-label {
|
||||
font-size: 16px !important;
|
||||
font-weight: 500 !important;
|
||||
color: $tertiary !important;
|
||||
line-height: 1.2em;
|
||||
}
|
||||
|
||||
#button-edit-thumbnail, #button-edit-header-image {
|
||||
|
||||
border-radius: 100px !important;
|
||||
height: 40px !important;
|
||||
width: 40px !important;
|
||||
bottom: -40px;
|
||||
z-index: 99;
|
||||
|
||||
.icon {
|
||||
display: inherit;
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
margin-top: 1px;
|
||||
}
|
||||
}
|
||||
.header-field {
|
||||
img {
|
||||
padding: 20px;
|
||||
}
|
||||
}
|
||||
.thumbnail-field {
|
||||
max-height: 128px;
|
||||
margin-bottom: 96px;
|
||||
max-height: 208px;
|
||||
margin-bottom: 180px;
|
||||
margin-top: -20px;
|
||||
|
||||
.content {
|
||||
|
@ -761,7 +783,11 @@ export default {
|
|||
font-size: 0.8em;
|
||||
}
|
||||
img {
|
||||
border-radius: 100px;
|
||||
position: absolute;
|
||||
height: 178px;
|
||||
width: 178px;
|
||||
padding: 20px;
|
||||
}
|
||||
.image-placeholder {
|
||||
position: absolute;
|
||||
|
@ -774,34 +800,20 @@ export default {
|
|||
text-align: center;
|
||||
color: gray;
|
||||
}
|
||||
#button-edit-thumbnail, #button-edit-header-image {
|
||||
|
||||
border-radius: 100px !important;
|
||||
height: 40px !important;
|
||||
width: 40px !important;
|
||||
bottom: -20px;
|
||||
left: -20px;
|
||||
z-index: 99;
|
||||
|
||||
.icon {
|
||||
display: inherit;
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
margin-top: 1px;
|
||||
}
|
||||
}
|
||||
.thumbnail-buttons-row {
|
||||
display: none;
|
||||
visibility: hidden;
|
||||
display: inline-block;
|
||||
position: relative;
|
||||
top: -20px;
|
||||
background-color: rgba(255, 255, 255, 0.9);
|
||||
padding: 2px 8px;
|
||||
border-radius: 0px 0px 0px 4px;
|
||||
left: 88px;
|
||||
}
|
||||
&:hover {
|
||||
.thumbnail-buttons-row {
|
||||
display: inline-block;
|
||||
position: relative;
|
||||
top: -128px;
|
||||
background-color: rgba(255, 255, 255, 0.9);
|
||||
padding: 2px 8px;
|
||||
border-radius: 0px 0px 0px 4px;
|
||||
left: 88px;
|
||||
visibility: visible;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -17,7 +17,6 @@
|
|||
:message="$i18n.getHelperMessage('filters', 'name')"/>
|
||||
</label>
|
||||
<b-input
|
||||
:class="{'has-content': editForm.name != undefined && editForm.name != ''}"
|
||||
v-model="editForm.name"
|
||||
name="name"
|
||||
@focus="clearErrors('name')"/>
|
||||
|
@ -34,7 +33,6 @@
|
|||
:message="$i18n.getHelperMessage('filters', 'description')"/>
|
||||
</label>
|
||||
<b-input
|
||||
:class="{'has-content': editForm.description != undefined && editForm.description != ''}"
|
||||
type="textarea"
|
||||
name="description"
|
||||
v-model="editForm.description"
|
||||
|
|
|
@ -168,7 +168,6 @@
|
|||
<hr>
|
||||
</div>
|
||||
<b-input
|
||||
:class="{'has-content': textContent != undefined && textContent != ''}"
|
||||
type="textarea"
|
||||
v-model="textContent"/>
|
||||
|
||||
|
@ -203,9 +202,7 @@
|
|||
<h2>{{ $i18n.get('instruction_insert_url') }}</h2>
|
||||
<hr>
|
||||
</div>
|
||||
<b-input
|
||||
:class="{'has-content': urlLink != undefined && urlLink != ''}"
|
||||
v-model="urlLink"/>
|
||||
<b-input v-model="urlLink"/>
|
||||
|
||||
<div class="field is-grouped form-submit">
|
||||
<div class="control">
|
||||
|
@ -671,7 +668,7 @@ export default {
|
|||
},
|
||||
mounted() {
|
||||
document.getElementById('collection-page-container').addEventListener('scroll', ($event) => {
|
||||
this.$emit('onShrinkHeader', ($event.originalTarget.scrollTop > 53));
|
||||
this.$emit('onShrinkHeader', ($event.target.scrollTop > 53));
|
||||
});
|
||||
},
|
||||
beforeRouteLeave ( to, from, next ) {
|
||||
|
|
|
@ -18,7 +18,6 @@
|
|||
:message="$i18n.getHelperMessage('metadata', 'name')"/>
|
||||
</label>
|
||||
<b-input
|
||||
:class="{'has-content': editForm.name != undefined && editForm.name != ''}"
|
||||
v-model="editForm.name"
|
||||
name="name"
|
||||
@focus="clearErrors('name')"/>
|
||||
|
@ -35,7 +34,6 @@
|
|||
:message="$i18n.getHelperMessage('metadata', 'description')"/>
|
||||
</label>
|
||||
<b-input
|
||||
:class="{'has-content': editForm.description != undefined && editForm.description != ''}"
|
||||
type="textarea"
|
||||
name="description"
|
||||
v-model="editForm.description"
|
||||
|
|
|
@ -61,7 +61,6 @@
|
|||
:message="$i18n.get('info_help_term_name')"/>
|
||||
</label>
|
||||
<b-input
|
||||
:class="{'has-content': editForm.name != undefined && editForm.name != ''}"
|
||||
v-model="editForm.name"
|
||||
name="name"
|
||||
@focus="clearErrors({ name: 'name', repeated: 'repeated' })"/>
|
||||
|
@ -78,7 +77,6 @@
|
|||
:message="$i18n.get('info_help_term_description')"/>
|
||||
</label>
|
||||
<b-input
|
||||
:class="{'has-content': editForm.description != undefined && editForm.description != ''}"
|
||||
type="textarea"
|
||||
name="description"
|
||||
v-model="editForm.description"
|
||||
|
|
|
@ -319,7 +319,7 @@ export default {
|
|||
|
||||
for (let filter of this.filterTypes) {
|
||||
for (let supportedType of filter['supported_types']) {
|
||||
if (choosenMetadatum.metadata_type_object.primitive_type == supportedType)
|
||||
if (choosenMetadatum.metadatum_type_object.primitive_type == supportedType)
|
||||
this.allowedFilterTypes.push(filter);
|
||||
}
|
||||
}
|
||||
|
@ -462,7 +462,7 @@ export default {
|
|||
mounted() {
|
||||
if (!this.isRepositoryLevel) {
|
||||
document.getElementById('collection-page-container').addEventListener('scroll', ($event) => {
|
||||
this.$emit('onShrinkHeader', ($event.originalTarget.scrollTop > 53));
|
||||
this.$emit('onShrinkHeader', ($event.target.scrollTop > 53));
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
@ -193,9 +193,13 @@
|
|||
class="column-default-width"
|
||||
:class="{
|
||||
'thumbnail-cell': column.metadatum == 'row_thumbnail',
|
||||
'column-small-width' : column.metadata_type_object != undefined ? (column.metadata_type_object.className == 'Tainacan\\Metadata_Types\\Date' || column.metadata_type_object.className == 'Tainacan\\Metadata_Types\\Numeric') : false,
|
||||
'column-medium-width' : column.metadata_type_object != undefined ? (column.metadata_type_object.className == 'Tainacan\\Metadata_Types\\Selectbox' || column.metadata_type_object.className == 'Tainacan\\Metadata_Types\\Category' || column.metadata_type_object.className == 'Tainacan\\Metadata_Types\\Compound') : false,
|
||||
'column-large-width' : column.metadata_type_object != undefined ? (column.metadata_type_object.className == 'Tainacan\\Metadata_Types\\Textarea') : false,
|
||||
'column-small-width' : column.metadata_type_object != undefined ? (column.metadata_type_object.primitive_type == 'date' ||
|
||||
column.metadata_type_object.primitive_type == 'float' ||
|
||||
column.metadata_type_object.primitive_type == 'int') : false,
|
||||
'column-medium-width' : column.metadata_type_object != undefined ? (column.metadata_type_object.primitive_type == 'term' ||
|
||||
column.metadata_type_object.primitive_type == 'item' ||
|
||||
column.metadata_type_object.primitive_type == 'compound') : false,
|
||||
'column-large-width' : column.metadata_type_object != undefined ? (column.metadata_type_object.primitive_type == 'long_string' || column.metadata_type_object.related_mapped_prop == 'description') : false,
|
||||
}"
|
||||
:custom-key="column.slug">
|
||||
<div class="th-wrap">{{ column.name }}</div>
|
||||
|
@ -230,10 +234,15 @@
|
|||
:class="{
|
||||
'thumbnail-cell': column.metadatum == 'row_thumbnail',
|
||||
'column-main-content' : column.metadata_type_object != undefined ? (column.metadata_type_object.related_mapped_prop == 'title') : false,
|
||||
'column-needed-width column-align-right' : column.metadata_type_object != undefined ? (column.metadata_type_object.className == 'Tainacan\\Metadata_Types\\Numeric') : false,
|
||||
'column-small-width' : column.metadata_type_object != undefined ? (column.metadata_type_object.className == 'Tainacan\\Metadata_Types\\Date' || column.metadata_type_object.className == 'Tainacan\\Metadata_Types\\Numeric') : false,
|
||||
'column-medium-width' : column.metadata_type_object != undefined ? (column.metadata_type_object.className == 'Tainacan\\Metadata_Types\\Selectbox' || column.metadata_type_object.className == 'Tainacan\\Metadata_Types\\Category' || column.metadata_type_object.className == 'Tainacan\\Metadata_Types\\Compound') : false,
|
||||
'column-large-width' : column.metadata_type_object != undefined ? (column.metadata_type_object.className == 'Tainacan\\Metadata_Types\\Textarea') : false,
|
||||
'column-needed-width column-align-right' : column.metadata_type_object != undefined ? (column.metadata_type_object.primitive_type == 'float' ||
|
||||
column.metadata_type_object.primitive_type == 'int' ) : false,
|
||||
'column-small-width' : column.metadata_type_object != undefined ? (column.metadata_type_object.primitive_type == 'date' ||
|
||||
column.metadata_type_object.primitive_type == 'int' ||
|
||||
column.metadata_type_object.primitive_type == 'float') : false,
|
||||
'column-medium-width' : column.metadata_type_object != undefined ? (column.metadata_type_object.primitive_type == 'item' ||
|
||||
column.metadata_type_object.primitive_type == 'term' ||
|
||||
column.metadata_type_object.primitive_type == 'compound') : false,
|
||||
'column-large-width' : column.metadata_type_object != undefined ? (column.metadata_type_object.primitive_type == 'long_string' || column.metadata_type_object.related_mapped_prop == 'description') : false,
|
||||
}"
|
||||
@click="goToItemPage(item)">
|
||||
|
||||
|
|
|
@ -85,8 +85,8 @@
|
|||
<a
|
||||
:style="{ visibility:
|
||||
metadatum.collection_id != collectionId ||
|
||||
metadatum.metadata_type == 'Tainacan\\Metadata_Types\\Core_Title' ||
|
||||
metadatum.metadata_type == 'Tainacan\\Metadata_Types\\Core_Description'
|
||||
metadatum.metadata_type_object.related_mapped_prop == 'title' ||
|
||||
metadatum.metadata_type_object.related_mapped_prop == 'description'
|
||||
? 'hidden' : 'visible'
|
||||
}"
|
||||
@click.prevent="removeMetadatum(metadatum)">
|
||||
|
@ -527,7 +527,7 @@ export default {
|
|||
mounted() {
|
||||
if (!this.isRepositoryLevel) {
|
||||
document.getElementById('collection-page-container').addEventListener('scroll', ($event) => {
|
||||
this.$emit('onShrinkHeader', ($event.originalTarget.scrollTop > 53));
|
||||
this.$emit('onShrinkHeader', ($event.target.scrollTop > 53));
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<template>
|
||||
<div
|
||||
class="tainacan-page-title">
|
||||
<h1>{{ pageTitle }} <span class="is-italic">{{ isRepositoryLevel ? '' : entityName }}</span></h1>
|
||||
<h1>{{ pageTitle }} <span class="is-italic has-text-weight-semibold">{{ isRepositoryLevel ? '' : entityName }}</span></h1>
|
||||
<a
|
||||
@click="$router.go(-1)"
|
||||
class="back-link is-secondary">
|
||||
|
|
|
@ -78,7 +78,7 @@
|
|||
apply_filter(){
|
||||
this.$eventBusSearch.$emit( 'input', {
|
||||
filter: 'checkbox',
|
||||
field_id: 'collection_id',
|
||||
metadatum_id: 'collection_id',
|
||||
value: this.collectionsIdsToFilter,
|
||||
compare: 'IN',
|
||||
collection_id: this.collectionsIdsToFilter,
|
||||
|
|
|
@ -29,7 +29,8 @@ import FilterCategorySelectbox from '../../classes/filter-types/category/Selectb
|
|||
import TaincanFormItem from '../../classes/metadata-types/tainacan-form-item.vue';
|
||||
import TaincanFiltersList from '../../classes/filter-types/tainacan-filter-item.vue';
|
||||
import ItemsPage from '../pages/lists/items-page.vue';
|
||||
import TableViewMode from '../../theme-helper/table-view-mode.vue';
|
||||
import ViewModeTable from '../../theme-helper/view-mode-table.vue';
|
||||
import ViewModeCards from '../../theme-helper/view-mode-cards.vue';
|
||||
|
||||
// Remaining imports
|
||||
import HelpButton from '../components/other/help-button.vue';
|
||||
|
@ -77,7 +78,9 @@ Vue.component('help-button', HelpButton);
|
|||
Vue.component('draggable', draggable);
|
||||
Vue.component('items-page', ItemsPage);
|
||||
|
||||
Vue.component('table-view-mode', TableViewMode);
|
||||
// Oficial view modes
|
||||
Vue.component('view-mode-table', ViewModeTable);
|
||||
Vue.component('view-mode-cards', ViewModeCards);
|
||||
|
||||
Vue.use(eventBusSearch, { store: store, router: routerTheme});
|
||||
|
||||
|
|
|
@ -148,7 +148,7 @@
|
|||
|
||||
if (!this.isRepositoryLevel) {
|
||||
document.getElementById('collection-page-container').addEventListener('scroll', ($event) => {
|
||||
this.$emit('onShrinkHeader', ($event.originalTarget.scrollTop > 53));
|
||||
this.$emit('onShrinkHeader', ($event.target.scrollTop > 53));
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
@ -326,8 +326,6 @@
|
|||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Admin Table -->
|
||||
|
||||
<!-- When advanced search -->
|
||||
<items-list
|
||||
v-if="!isOnTheme &&
|
||||
|
@ -343,7 +341,7 @@
|
|||
:is-on-trash="status == 'trash'"
|
||||
:view-mode="adminViewMode"/>
|
||||
|
||||
<!-- Regular -->
|
||||
<!-- Admin View Modes-->
|
||||
<items-list
|
||||
v-else-if="!isOnTheme &&
|
||||
!isLoadingItems &&
|
||||
|
@ -370,10 +368,10 @@
|
|||
registeredViewModes[viewMode] != undefined &&
|
||||
registeredViewModes[viewMode].type == 'component'"
|
||||
:collection-id="collectionId"
|
||||
:table-metadata="tableMetadata"
|
||||
:displayed-metadata="tableMetadata"
|
||||
:items="items"
|
||||
:is-loading="isLoadingItems"
|
||||
:is="'table-view-mode'"/>
|
||||
:is="registeredViewModes[viewMode].component"/>
|
||||
|
||||
<!-- Empty Placeholder (only used in Admin) -->
|
||||
<section
|
||||
|
@ -677,6 +675,10 @@
|
|||
this.hasFiltered = hasFiltered;
|
||||
});
|
||||
|
||||
this.$eventBusSearch.$on('advancedSearchResults', advancedSearchResults => {
|
||||
this.advancedSearchResults = advancedSearchResults;
|
||||
});
|
||||
|
||||
this.$eventBusSearch.$on('hasToPrepareMetadataAndFilters', (to) => {
|
||||
/* This condition is to prevent a incorrect fetch by filter or metadata when we come from items
|
||||
* at collection level to items page at repository level
|
||||
|
@ -700,7 +702,7 @@
|
|||
// Watch Scroll for shrinking header, only on Admin at collection level
|
||||
if (!this.isRepositoryLevel && !this.isOnTheme) {
|
||||
document.getElementById('items-list-area').addEventListener('scroll', ($event) => {
|
||||
this.isHeaderShrinked = ($event.originalTarget.scrollTop > 53);
|
||||
this.isHeaderShrinked = ($event.target.scrollTop > 53);
|
||||
this.$emit('onShrinkHeader', this.isHeaderShrinked);
|
||||
});
|
||||
}
|
||||
|
@ -771,18 +773,13 @@
|
|||
|
||||
.control {
|
||||
width: 100%;
|
||||
|
||||
input {
|
||||
height: 27px;
|
||||
font-size: 11px;
|
||||
color: $gray-light;
|
||||
}
|
||||
.icon {
|
||||
pointer-events: all;
|
||||
cursor: pointer;
|
||||
color: $tertiary;
|
||||
height: 27px;
|
||||
font-size: 18px !important;
|
||||
height: 2rem !important;
|
||||
}
|
||||
margin-bottom: 5px;
|
||||
}
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
:class="{ 'is-shrink': shouldShrinkHeader }"
|
||||
:id="collectionId"/>
|
||||
<router-view
|
||||
@onShrinkHeader="shouldShrinkHeader = $event"
|
||||
@onShrinkHeader="onUpdateShrinkHeader($event)"
|
||||
id="collection-page-container"
|
||||
:collection-id="collectionId"
|
||||
class="page-container page-container-small"
|
||||
|
@ -32,7 +32,11 @@ export default {
|
|||
this.collectionId = parseInt(this.$route.params.collectionId);
|
||||
this.$eventBusSearch.setCollectionId(this.collectionId);
|
||||
},
|
||||
mounted() {
|
||||
methods: {
|
||||
onUpdateShrinkHeader(event) {
|
||||
if (this.shouldShrinkHeader != event)
|
||||
this.shouldShrinkHeader = event;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -19,6 +19,8 @@
|
|||
font-size: 14px;
|
||||
display: inline-block;
|
||||
white-space: nowrap;
|
||||
text-overflow: ellipsis;
|
||||
overflow: hidden;
|
||||
}
|
||||
.required-metadatum-asterisk {
|
||||
color: $gray;
|
||||
|
@ -38,12 +40,6 @@
|
|||
|
||||
}
|
||||
.control{
|
||||
&.has-content {
|
||||
.input, .textarea {
|
||||
background-color: white;
|
||||
border: 1px solid $tainacan-input-background;
|
||||
}
|
||||
}
|
||||
&.has-icons-right {
|
||||
.icon {
|
||||
height: 2.0em;
|
||||
|
|
|
@ -65,7 +65,7 @@ $header-height: 53px;
|
|||
$subheader-height: 82px;
|
||||
$side-menu-width: 180px;
|
||||
$filter-menu-width: 200px;
|
||||
$filter-menu-width-theme: 270px;
|
||||
$filter-menu-width-theme: 20.833333333%;
|
||||
$page-height: calc(100% - 53px);
|
||||
|
||||
// Overall Pages padding:
|
||||
|
|
|
@ -53,7 +53,7 @@ return apply_filters('tainacan-admin-i18n',[
|
|||
'new_blank_collection' => __( 'New Blank Collection', 'tainacan' ),
|
||||
'split' => __( 'Split', 'tainacan' ),
|
||||
'unified' => __( 'Unified', 'tainacan' ),
|
||||
'add_more_one_search_metadatum' => __( 'Add more one search metadatum', 'tainacan' ),
|
||||
'add_more_one_search_criteria' => __( 'Add more one search criteria', 'tainacan' ),
|
||||
'clear_search' => __( 'Clear search', 'tainacan' ),
|
||||
|
||||
// Wordpress Status
|
||||
|
|
|
@ -287,7 +287,11 @@ export default {
|
|||
min-width: $filter-menu-width-theme;
|
||||
background-color: unset;
|
||||
border-right: 0;
|
||||
padding: 25px 25px 25px 4.1666667%;
|
||||
padding: 25px 12px 25px 4.1666667%;
|
||||
|
||||
.columns {
|
||||
display: flex;
|
||||
}
|
||||
}
|
||||
|
||||
.search-control {
|
||||
|
|
|
@ -9,7 +9,7 @@ defined( 'ABSPATH' ) or die( 'No script kiddies please!' );
|
|||
class Autocomplete extends Filter_Type {
|
||||
|
||||
function __construct(){
|
||||
$this->set_supported_types(['string','item']);
|
||||
$this->set_supported_types(['string','long_string','item']);
|
||||
$this->set_component('tainacan-filter-autocomplete');
|
||||
}
|
||||
|
||||
|
|
|
@ -9,7 +9,7 @@ defined( 'ABSPATH' ) or die( 'No script kiddies please!' );
|
|||
class Checkbox extends Filter_Type {
|
||||
|
||||
function __construct(){
|
||||
$this->set_supported_types(['string','item']);
|
||||
$this->set_supported_types(['string','long_string','item']);
|
||||
$this->set_component('tainacan-filter-checkbox');
|
||||
}
|
||||
|
||||
|
|
|
@ -9,7 +9,7 @@ defined( 'ABSPATH' ) or die( 'No script kiddies please!' );
|
|||
class Selectbox extends Filter_Type {
|
||||
|
||||
function __construct(){
|
||||
$this->set_supported_types(['string']);
|
||||
$this->set_supported_types(['string', 'long_string']);
|
||||
$this->set_component('tainacan-filter-selectbox');
|
||||
}
|
||||
|
||||
|
|
|
@ -9,7 +9,7 @@ defined( 'ABSPATH' ) or die( 'No script kiddies please!' );
|
|||
class Taginput extends Filter_Type {
|
||||
|
||||
function __construct(){
|
||||
$this->set_supported_types(['string','item']);
|
||||
$this->set_supported_types(['string','long_string','item']);
|
||||
$this->set_component('tainacan-filter-taginput');
|
||||
}
|
||||
|
||||
|
|
|
@ -201,6 +201,7 @@
|
|||
font-weight: normal;
|
||||
font-size: 14px;
|
||||
display: inline-flex;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.input, .textarea, .taginput-container {
|
||||
|
|
|
@ -12,7 +12,7 @@ class Textarea extends Metadata_Type {
|
|||
function __construct(){
|
||||
// call metadatum type constructor
|
||||
parent::__construct();
|
||||
$this->set_primitive_type('string');
|
||||
$this->set_primitive_type('long_string');
|
||||
$this->set_component('tainacan-textarea');
|
||||
}
|
||||
|
||||
|
|
|
@ -48,9 +48,15 @@ class Item_Metadata extends Repository {
|
|||
$unique = !$item_metadata->is_multiple();
|
||||
|
||||
$metadata_type = $item_metadata->get_metadatum()->get_metadata_type_object();
|
||||
|
||||
if ($metadata_type->get_core()) {
|
||||
$this->save_core_metadatum_value($item_metadata);
|
||||
} elseif ($metadata_type->get_primitive_type() == 'term') {
|
||||
// Core metadata are also stored as regular metadata (in the code following below)
|
||||
// This is usefull to create queries via filters, advanced search or apis
|
||||
// si you can search for title and content with meta_query as if they were regular metadata
|
||||
}
|
||||
|
||||
if ($metadata_type->get_primitive_type() == 'term') {
|
||||
$this->save_terms_metadatum_value($item_metadata);
|
||||
} elseif ($metadata_type->get_primitive_type() == 'compound') {
|
||||
// do nothing. Compound values are updated when its child metadata are updated
|
||||
|
|
|
@ -135,5 +135,4 @@ require_once(__DIR__ . '/../theme-helper/class-tainacan-theme-helper.php');
|
|||
require_once(__DIR__ . '/../theme-helper/template-tags.php');
|
||||
$Tainacan_Theme_Helper = \Tainacan\Theme_Helper::get_instance();
|
||||
|
||||
|
||||
?>
|
||||
|
|
|
@ -28,8 +28,6 @@ export default {
|
|||
this.$root.$on('searchAdvanced', advancedSearchQuery => {
|
||||
this.$store.dispatch('search/setPage', 1);
|
||||
|
||||
console.log('Emit caught', advancedSearchQuery);
|
||||
|
||||
this.searchAdvanced(advancedSearchQuery);
|
||||
|
||||
this.updateURLQueries();
|
||||
|
@ -50,8 +48,8 @@ export default {
|
|||
if (this.$route.query.orderby == undefined)
|
||||
this.$route.query.orderby = 'date';
|
||||
|
||||
if(this.$route.query.advancedSearch){
|
||||
delete this.$route.query.advancedSearch;
|
||||
if(this.$route.query.metaquery && this.$route.query.metaquery.advancedSearch){
|
||||
console.log(this.$route);
|
||||
this.$store.dispatch('search/set_advanced_query', this.$route.query);
|
||||
} else {
|
||||
this.$store.dispatch('search/set_postquery', this.$route.query);
|
||||
|
@ -131,15 +129,10 @@ export default {
|
|||
this.$store.dispatch('search/setViewMode', viewMode);
|
||||
this.updateURLQueries();
|
||||
},
|
||||
updateURLQueries(isAdvancedSearch = false) {
|
||||
this.$router.push({ query: {}});
|
||||
|
||||
if(isAdvancedSearch) {
|
||||
this.$router.push({query: this.$store.getters['search/getAdvancedSearchQuery']});
|
||||
console.log(this.$route);
|
||||
} else {
|
||||
this.$router.push({query: this.$store.getters['search/getPostQuery']});
|
||||
}
|
||||
updateURLQueries(isAdvancedSearch) {
|
||||
this.$router.push({query: {}});
|
||||
this.$route.meta['advancedSearch'] = isAdvancedSearch;
|
||||
this.$router.push({query: this.$store.getters['search/getPostQuery']});
|
||||
},
|
||||
updateStoreFromURL() {
|
||||
this.$store.dispatch('search/set_postquery', this.$route.query);
|
||||
|
@ -159,6 +152,10 @@ export default {
|
|||
.then((res) => {
|
||||
this.$emit( 'isLoadingItems', false);
|
||||
this.$emit( 'hasFiltered', res.hasFiltered);
|
||||
|
||||
if(res.advancedSearchResults){
|
||||
this.$emit('advancedSearchResults', res.advancedSearchResults);
|
||||
}
|
||||
})
|
||||
.catch(() => {
|
||||
this.$emit( 'isLoadingItems', false);
|
||||
|
|
|
@ -8,12 +8,28 @@ export const fetchItems = ({ rootGetters, dispatch, commit }, { collectionId, is
|
|||
|
||||
// Adds queries for filtering
|
||||
let postQueries = rootGetters['search/getPostQuery'];
|
||||
|
||||
let query = '';
|
||||
// Sets a flag to inform components that an empty sate is or not due to filtering
|
||||
let hasFiltered = false;
|
||||
if (postQueries.metaquery != undefined && postQueries.metaquery.length > 0)
|
||||
let advancedSearchResults = false;
|
||||
|
||||
if (postQueries.metaquery != undefined && postQueries.metaquery.metaquery){
|
||||
hasFiltered = true;
|
||||
|
||||
if(postQueries.metaquery.metaquery.advancedSearch){
|
||||
|
||||
advancedSearchResults = postQueries.metaquery.metaquery.advancedSearch;
|
||||
|
||||
delete postQueries.metaquery.metaquery.advancedSearch;
|
||||
|
||||
query = qs.stringify({metaquery: postQueries.metaquery.metaquery});
|
||||
|
||||
console.log({q: query});
|
||||
} else {
|
||||
query = postQueries;
|
||||
}
|
||||
}
|
||||
|
||||
// Garanttees at least empty fetch_only are passed in case none is found
|
||||
if (qs.stringify(postQueries.fetch_only) == '')
|
||||
dispatch('search/add_fetchonly', {} , { root: true });
|
||||
|
@ -24,24 +40,26 @@ export const fetchItems = ({ rootGetters, dispatch, commit }, { collectionId, is
|
|||
// Differentiates between repository level and collection level queries
|
||||
let endpoint = '/collection/'+collectionId+'/items?'
|
||||
|
||||
if (collectionId == undefined)
|
||||
if (collectionId == undefined){
|
||||
endpoint = '/items?'
|
||||
}
|
||||
|
||||
if (!isOnTheme)
|
||||
if (!isOnTheme){
|
||||
endpoint = endpoint + 'context=edit&'
|
||||
}
|
||||
|
||||
axios.tainacan.get(endpoint + qs.stringify(postQueries))
|
||||
axios.tainacan.get(endpoint+query)
|
||||
.then(res => {
|
||||
|
||||
let items = res.data;
|
||||
let viewModeObject = tainacan_plugin.registered_view_modes[postQueries.view_mode];
|
||||
|
||||
if (isOnTheme && viewModeObject != undefined && viewModeObject.type == 'template') {
|
||||
commit('setItemsListTemplate', items );
|
||||
resolve({'itemsListTemplate': items, 'total': res.headers['x-wp-total'], hasFiltered: hasFiltered});
|
||||
commit('setItemsListTemplate', items);
|
||||
resolve({'itemsListTemplate': items, 'total': res.headers['x-wp-total'], hasFiltered: hasFiltered, advancedSearchResults: advancedSearchResults});
|
||||
} else {
|
||||
commit('setItems', items );
|
||||
resolve({'items': items, 'total': res.headers['x-wp-total'], hasFiltered: hasFiltered});
|
||||
commit('setItems', items);
|
||||
resolve({'items': items, 'total': res.headers['x-wp-total'], hasFiltered: hasFiltered, advancedSearchResults: advancedSearchResults });
|
||||
}
|
||||
dispatch('search/setTotalItems', res.headers['x-wp-total'], { root: true } );
|
||||
})
|
||||
|
|
|
@ -4,6 +4,7 @@ import * as mutations from './mutations';
|
|||
|
||||
const state = {
|
||||
items: [],
|
||||
isFromAdvancedSearch: false,
|
||||
itemsListTemplate: '',
|
||||
collections: [],
|
||||
collection: null,
|
||||
|
|
|
@ -21,7 +21,6 @@ const state = {
|
|||
},
|
||||
view_mode: 'table'
|
||||
},
|
||||
advancedSearchQuery: {},
|
||||
totalItems: 0
|
||||
};
|
||||
|
||||
|
|
|
@ -9,7 +9,7 @@ export const setPostQuery = ( state, postquery ) => {
|
|||
};
|
||||
|
||||
export const setAdvancedSearchQuery = (state, advancedSearchQuery) => {
|
||||
state.advancedSearchQuery = advancedSearchQuery;
|
||||
state.postquery.metaquery = advancedSearchQuery;
|
||||
};
|
||||
|
||||
export const addMetaQuery = ( state, filter ) => {
|
||||
|
|
|
@ -55,7 +55,13 @@ class Theme_Helper {
|
|||
'icon' => '<span class="icon"><i class="mdi mdi-table mdi-24px"></i></span>',
|
||||
'type' => 'component',
|
||||
]);
|
||||
|
||||
$this->register_view_mode('cards', [
|
||||
'label' => __('Cards view', 'tainacan'),
|
||||
'dynamic_metadata' => true,
|
||||
'description' => 'A cards view, flexible for metadata',
|
||||
'icon' => '<span class="icon"><i class="mdi mdi-view-list mdi-24px"></i></span>',
|
||||
'type' => 'component'
|
||||
]);
|
||||
}
|
||||
|
||||
public function enqueue_scripts($force = false) {
|
||||
|
@ -298,7 +304,7 @@ class Theme_Helper {
|
|||
* Default: theme-path/tainacan/view-mode-{$slug}.php
|
||||
* @type string $component Component tag name. The web component js must be included and must accept two props:
|
||||
* * items - the list of items to be rendered
|
||||
* * displayed_metadata - list of metadata to be displayed
|
||||
* * displayed-metadata - list of metadata to be displayed
|
||||
* Default view-mode-{$slug}
|
||||
* @type string $thumbnail Full URL to an thumbnail that represents the view mode. Displayed in admin.
|
||||
* @type string $icon HTML that outputs an icon that represents the view mode. Displayed in front end.
|
||||
|
|
|
@ -0,0 +1,96 @@
|
|||
<template>
|
||||
<div class="table-container">
|
||||
<div class="table-wrapper">
|
||||
<!-- CARDS VIEW MODE -->
|
||||
<div class="tainacan-cards-container">
|
||||
<div
|
||||
:key="index"
|
||||
v-for="(item, index) of items"
|
||||
class="tainacan-card">
|
||||
|
||||
<!-- Title -->
|
||||
<p
|
||||
v-for="(column, index) in displayedMetadata"
|
||||
:key="index"
|
||||
v-if="column.display && column.metadata_type_object != undefined && (column.metadata_type_object.related_mapped_prop == 'title')"
|
||||
class="metadata-title"
|
||||
@click="goToItemPage(item)"
|
||||
v-html="item.metadata != undefined ? renderMetadata(item.metadata, column) : ''" />
|
||||
|
||||
<!-- Remaining metadata -->
|
||||
<div
|
||||
class="media"
|
||||
@click="goToItemPage(item)">
|
||||
<a
|
||||
v-if="item.thumbnail != undefined"
|
||||
@click="goToItemPage(item)">
|
||||
<img :src="item['thumbnail'].medium_large ? item['thumbnail'].medium_large : thumbPlaceholderPath">
|
||||
</a>
|
||||
|
||||
<div class="list-metadata media-body">
|
||||
<span
|
||||
v-for="(column, index) in displayedMetadata"
|
||||
:key="index"
|
||||
v-if="column.display && column.slug != 'thumbnail' && column.metadata_type_object != undefined && (column.metadata_type_object.related_mapped_prop != 'title')">
|
||||
<h3 class="metadata-label">{{ column.name }}</h3>
|
||||
<p
|
||||
v-html="item.metadata != undefined ? renderMetadata(item.metadata, column) : ''"
|
||||
class="metadata-value"/>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
|
||||
export default {
|
||||
name: 'ViewModeCards',
|
||||
props: {
|
||||
collectionId: Number,
|
||||
displayedMetadata: Array,
|
||||
items: Array,
|
||||
isLoading: false
|
||||
},
|
||||
methods: {
|
||||
goToItemPage(item) {
|
||||
window.location.href = item.url;
|
||||
},
|
||||
renderMetadata(itemMetadata, column) {
|
||||
|
||||
let metadata = itemMetadata[column.slug] != undefined ? itemMetadata[column.slug] : false;
|
||||
|
||||
if (!metadata) {
|
||||
return '';
|
||||
} else if (metadata.date_i18n) {
|
||||
return metadata.date_i18n;
|
||||
} else {
|
||||
return metadata.value_as_html;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
$primary-lighter: #e6f6f8;
|
||||
$primary-lighter-hover: #d1e6e6;
|
||||
$tainacan-input-color: #1d1d1d;
|
||||
$tainacan-input-background: #e5e5e5;
|
||||
$tainacan-placeholder-color: #898d8f;
|
||||
$gray-hover: #dcdcdc;
|
||||
$gray-light: #898d8f;
|
||||
|
||||
@import "../../src/admin/scss/_view-mode-cards.scss";
|
||||
|
||||
.tainacan-cards-container .tainacan-card .metadata-title {
|
||||
padding: 0.75rem;
|
||||
margin-bottom: 0px;
|
||||
}
|
||||
</style>
|
||||
|
||||
|
|
@ -6,15 +6,19 @@
|
|||
<tr>
|
||||
<!-- Displayed Metadata -->
|
||||
<th
|
||||
v-for="(column, index) in tableMetadata"
|
||||
v-for="(column, index) in displayedMetadata"
|
||||
:key="index"
|
||||
v-if="column.display"
|
||||
class="column-default-width"
|
||||
:class="{
|
||||
'thumbnail-cell': column.metadatum == 'row_thumbnail',
|
||||
'column-small-width' : column.metadata_type_object != undefined ? (column.metadata_type_object.className == 'Tainacan\\Metadata_Types\\Date' || column.metadata_type_object.className == 'Tainacan\\Metadata_Types\\Numeric') : false,
|
||||
'column-medium-width' : column.metadata_type_object != undefined ? (column.metadata_type_object.className == 'Tainacan\\Metadata_Types\\Selectbox' || column.metadata_type_object.className == 'Tainacan\\Metadata_Types\\Category' || column.metadata_type_object.className == 'Tainacan\\Metadata_Types\\Compound') : false,
|
||||
'column-large-width' : column.metadata_type_object != undefined ? (column.metadata_type_object.className == 'Tainacan\\Metadata_Types\\Textarea') : false,
|
||||
'column-small-width' : column.metadata_type_object != undefined ? (column.metadata_type_object.primitive_type == 'date' ||
|
||||
column.metadata_type_object.primitive_type == 'float' ||
|
||||
column.metadata_type_object.primitive_type == 'int') : false,
|
||||
'column-medium-width' : column.metadata_type_object != undefined ? (column.metadata_type_object.primitive_type == 'term' ||
|
||||
column.metadata_type_object.primitive_type == 'item' ||
|
||||
column.metadata_type_object.primitive_type == 'compound') : false,
|
||||
'column-large-width' : column.metadata_type_object != undefined ? (column.metadata_type_object.primitive_type == 'long_string' || column.metadata_type_object.related_mapped_prop == 'description') : false,
|
||||
}"
|
||||
:custom-key="column.slug">
|
||||
<div class="th-wrap">{{ column.name }}</div>
|
||||
|
@ -29,7 +33,7 @@
|
|||
<!-- Item Displayed Metadata -->
|
||||
<td
|
||||
:key="index"
|
||||
v-for="(column, index) in tableMetadata"
|
||||
v-for="(column, index) in displayedMetadata"
|
||||
v-if="column.display"
|
||||
:label="column.name"
|
||||
:aria-label="(column.metadatum != 'row_thumbnail' && column.metadatum != 'row_creation' && column.metadatum != 'row_author')
|
||||
|
@ -38,10 +42,15 @@
|
|||
:class="{
|
||||
'thumbnail-cell': column.metadatum == 'row_thumbnail',
|
||||
'column-main-content' : column.metadata_type_object != undefined ? (column.metadata_type_object.related_mapped_prop == 'title') : false,
|
||||
'column-needed-width column-align-right' : column.metadata_type_object != undefined ? (column.metadata_type_object.className == 'Tainacan\\Metadata_Types\\Numeric') : false,
|
||||
'column-small-width' : column.metadata_type_object != undefined ? (column.metadata_type_object.className == 'Tainacan\\Metadata_Types\\Date' || column.metadata_type_object.className == 'Tainacan\\Metadata_Types\\Numeric') : false,
|
||||
'column-medium-width' : column.metadata_type_object != undefined ? (column.metadata_type_object.className == 'Tainacan\\Metadata_Types\\Selectbox' || column.metadata_type_object.className == 'Tainacan\\Metadata_Types\\Category' || column.metadata_type_object.className == 'Tainacan\\Metadata_Types\\Compound') : false,
|
||||
'column-large-width' : column.metadata_type_object != undefined ? (column.metadata_type_object.className == 'Tainacan\\Metadata_Types\\Textarea') : false,
|
||||
'column-needed-width column-align-right' : column.metadata_type_object != undefined ? (column.metadata_type_object.primitive_type == 'float' ||
|
||||
column.metadata_type_object.primitive_type == 'int' ) : false,
|
||||
'column-small-width' : column.metadata_type_object != undefined ? (column.metadata_type_object.primitive_type == 'date' ||
|
||||
column.metadata_type_object.primitive_type == 'int' ||
|
||||
column.metadata_type_object.primitive_type == 'float') : false,
|
||||
'column-medium-width' : column.metadata_type_object != undefined ? (column.metadata_type_object.primitive_type == 'item' ||
|
||||
column.metadata_type_object.primitive_type == 'term' ||
|
||||
column.metadata_type_object.primitive_type == 'compound') : false,
|
||||
'column-large-width' : column.metadata_type_object != undefined ? (column.metadata_type_object.primitive_type == 'long_string' || column.metadata_type_object.related_mapped_prop == 'description') : false,
|
||||
}"
|
||||
@click="goToItemPage(item)">
|
||||
|
||||
|
@ -91,10 +100,10 @@
|
|||
<script>
|
||||
|
||||
export default {
|
||||
name: 'TableViewMode',
|
||||
name: 'ViewModeTable',
|
||||
props: {
|
||||
collectionId: Number,
|
||||
tableMetadata: Array,
|
||||
displayedMetadata: Array,
|
||||
items: Array,
|
||||
isLoading: false
|
||||
},
|
|
@ -24,32 +24,15 @@ class CoreMetadatumTypes extends TAINACAN_UnitTestCase {
|
|||
$collection = $this->tainacan_entity_factory->create_entity(
|
||||
'collection',
|
||||
array(
|
||||
'name' => 'test',
|
||||
'name' => 'test',
|
||||
'status' => 'publish'
|
||||
),
|
||||
true
|
||||
);
|
||||
|
||||
$metadatum = $this->tainacan_entity_factory->create_entity(
|
||||
'metadatum',
|
||||
array(
|
||||
'name' => 'metadado',
|
||||
'description' => 'title',
|
||||
'collection' => $collection,
|
||||
'metadata_type' => 'Tainacan\Metadata_Types\Core_Title'
|
||||
),
|
||||
true
|
||||
);
|
||||
$metadatum = $collection->get_core_title_metadatum();
|
||||
|
||||
$metadatumDescription = $this->tainacan_entity_factory->create_entity(
|
||||
'metadatum',
|
||||
array(
|
||||
'name' => 'metadado_desc',
|
||||
'description' => 'description',
|
||||
'collection' => $collection,
|
||||
'metadata_type' => 'Tainacan\Metadata_Types\Core_Description'
|
||||
),
|
||||
true
|
||||
);
|
||||
$metadatumDescription = $collection->get_core_description_metadatum();
|
||||
|
||||
|
||||
$i = $this->tainacan_entity_factory->create_entity(
|
||||
|
@ -57,7 +40,8 @@ class CoreMetadatumTypes extends TAINACAN_UnitTestCase {
|
|||
array(
|
||||
'title' => 'item test',
|
||||
'description' => 'adasdasdsa',
|
||||
'collection' => $collection
|
||||
'collection' => $collection,
|
||||
'status' => 'publish'
|
||||
),
|
||||
true
|
||||
);
|
||||
|
@ -91,6 +75,19 @@ class CoreMetadatumTypes extends TAINACAN_UnitTestCase {
|
|||
$check_item_metadata = new \Tainacan\Entities\Item_Metadata_Entity($checkItem, $metadatumDescription);
|
||||
$this->assertEquals('changed description', $check_item_metadata->get_value());
|
||||
|
||||
// check that the value was also stored in postmeta table
|
||||
$checkMeta = $Tainacan_Items->fetch([
|
||||
'meta_query' => [
|
||||
[
|
||||
'key' => $metadatumDescription->get_id(),
|
||||
'value' => 'changed description'
|
||||
]
|
||||
]
|
||||
], [], 'OBJECT');
|
||||
|
||||
$this->assertEquals(1, sizeof($checkMeta));
|
||||
$this->assertEquals('changed description', $checkMeta[0]->get_description());
|
||||
|
||||
}
|
||||
|
||||
function test_validate_required_title() {
|
||||
|
|
Loading…
Reference in New Issue