commit
fd562998a9
15
.travis.yml
15
.travis.yml
|
@ -45,21 +45,6 @@ install:
|
|||
- echo 'if ( php -v|grep -q --only-matching --perl-regexp "5\.\\d+\.\\d+" );then /usr/local/bin/phpunit-5 $@;else /usr/local/bin/phpunit-6 $@;fi;exit $?' |sudo tee -a /usr/local/bin/phpunit > /dev/null
|
||||
- sudo chmod +x /usr/local/bin/phpunit
|
||||
script: /usr/local/bin/phpunit # phpunit
|
||||
before_deploy:
|
||||
- echo "Seção executada antes do deploy!"
|
||||
- openssl aes-256-cbc -K $encrypted_cb93ef43fcd2_key -iv $encrypted_cb93ef43fcd2_iv
|
||||
-in deploy_rsa.enc -out /tmp/deploy_rsa -d
|
||||
- eval "$(ssh-agent -s)"
|
||||
- chmod 600 /tmp/deploy_rsa
|
||||
- ssh-add /tmp/deploy_rsa
|
||||
- echo -e "Host $ssh_host\n\tStrictHostKeyChecking no\n" >> ~/.ssh/config
|
||||
- ssh-add -l
|
||||
deploy:
|
||||
- provider: script
|
||||
script: sshpass -p '$ssh_password' ssh $ssh_user@$ssh_host sh /home/l3p/atualiza_git/atualiza_todos.sh #MECHI AQUI!! #ssh $ssh_user@$ssh_host $script_deploy_tainacan
|
||||
skip_cleanup: true
|
||||
on:
|
||||
branch: develop
|
||||
cache:
|
||||
directories:
|
||||
- vendor
|
||||
|
|
2
build.sh
2
build.sh
|
@ -72,6 +72,8 @@ rsync -axz --exclude='vendor/bin/phpc*' --exclude='vendor/squizlabs' --exclude='
|
|||
--exclude='vendor/respect/validation/docs' --exclude='vendor/respect/validation/tests' \
|
||||
--exclude='pdf-viewer/pdfjs-dist/web/compressed.tracemonkey-pldi-09.pdf' \
|
||||
--exclude='vendor/tecnickcom/tcpdf/fonts' \
|
||||
--exclude='vendor/smalot/pdfparser/src/Smalot/PdfParser/Tests/' \
|
||||
--exclude='vendor/tecnickcom/tcpdf/examples' \
|
||||
src/* $wp_plugin_dir/
|
||||
|
||||
rm -rf $wp_plugin_dir/scss
|
||||
|
|
|
@ -31,5 +31,7 @@ sass -E 'UTF-8' --cache-location .tmp/sass-cache-10 src/gutenberg-blocks/tainaca
|
|||
|
||||
sass -E 'UTF-8' --cache-location .tmp/sass-cache-11 src/gutenberg-blocks/tainacan-facets/facets-list/facets-list.scss:src/assets/css/tainacan-gutenberg-block-facets-list.css
|
||||
|
||||
sass -E 'UTF-8' --cache-location .tmp/sass-cache-12 src/gutenberg-blocks/tainacan-terms/carousel-terms-list/carousel-terms-list.scss:src/assets/css/tainacan-gutenberg-block-carousel-terms-list.css
|
||||
|
||||
echo "Compilação do Sass Concluído!"
|
||||
exit 0
|
||||
|
|
|
@ -1951,9 +1951,9 @@
|
|||
}
|
||||
},
|
||||
"buefy": {
|
||||
"version": "0.8.5",
|
||||
"resolved": "https://registry.npmjs.org/buefy/-/buefy-0.8.5.tgz",
|
||||
"integrity": "sha512-yGQUhIsZWTodCx1rpfDTA32v5OjILpDIDAP+X6KoE6du3F3EZwJ/k5aT8D6Ba6AxNzVdDa2M7f0hzMddLbm38A==",
|
||||
"version": "0.8.6",
|
||||
"resolved": "https://registry.npmjs.org/buefy/-/buefy-0.8.6.tgz",
|
||||
"integrity": "sha512-7woxrdwANcnJbe7lofPxkJLGRRGIVwFXOo0kzEpiNB6alQj18NV6UrdAKse+LWCOADz+AeHe5gyc6qdgRjG5mw==",
|
||||
"requires": {
|
||||
"bulma": "0.7.5"
|
||||
}
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
},
|
||||
"dependencies": {
|
||||
"axios": "^0.19.0",
|
||||
"buefy": "^0.8.5",
|
||||
"buefy": "^0.8.6",
|
||||
"bulma": "^0.7.5",
|
||||
"mdi": "^2.2.43",
|
||||
"moment": "^2.22.2",
|
||||
|
|
|
@ -41,14 +41,14 @@ class Admin {
|
|||
array( &$this, 'admin_page' ),
|
||||
plugin_dir_url( __FILE__ ) . 'images/tainacan_logo_symbol.svg'
|
||||
);
|
||||
|
||||
add_submenu_page(
|
||||
$this->menu_slug,
|
||||
__('System check', 'tainacan'),
|
||||
__('System check', 'tainacan'),
|
||||
'manage_options',
|
||||
'tainacan_systemcheck',
|
||||
array( &$this, 'systemcheck_page' )
|
||||
|
||||
add_submenu_page(
|
||||
$this->menu_slug,
|
||||
__('System check', 'tainacan'),
|
||||
__('System check', 'tainacan'),
|
||||
'manage_options',
|
||||
'tainacan_systemcheck',
|
||||
array( &$this, 'systemcheck_page' )
|
||||
);
|
||||
|
||||
add_action( 'load-' . $page_suffix, array( &$this, 'load_admin_page' ) );
|
||||
|
@ -57,6 +57,7 @@ class Admin {
|
|||
function load_admin_page() {
|
||||
add_action( 'admin_enqueue_scripts', array( &$this, 'add_admin_css' ), 90 );
|
||||
add_action( 'admin_enqueue_scripts', array( &$this, 'add_admin_js' ), 90 );
|
||||
add_action( 'admin_enqueue_scripts', array(&$this, 'add_theme_files') );
|
||||
}
|
||||
|
||||
|
||||
|
@ -74,18 +75,18 @@ class Admin {
|
|||
|
||||
function add_theme_files() {
|
||||
global $TAINACAN_BASE_URL;
|
||||
|
||||
|
||||
// wp_enqueue_style( 'style', $TAINACAN_BASE_URL . '/assets/css/fonts/materialdesignicons.css' );
|
||||
wp_enqueue_style( 'tainacan-fonts', $TAINACAN_BASE_URL . '/assets/css/fonts/tainacanicons.css', [], TAINACAN_VERSION );
|
||||
wp_enqueue_style( 'roboto-fonts', 'https://fonts.googleapis.com/css?family=Roboto:400,400i,500,500i,700,700i', [], TAINACAN_VERSION );
|
||||
wp_enqueue_script('underscore');
|
||||
}
|
||||
|
||||
|
||||
function add_admin_css() {
|
||||
global $TAINACAN_BASE_URL;
|
||||
|
||||
|
||||
wp_enqueue_style( 'tainacan-admin-page', $TAINACAN_BASE_URL . '/assets/css/tainacan-admin.css', [], TAINACAN_VERSION );
|
||||
|
||||
|
||||
// $undesired_wp_styles = [
|
||||
// 'admin-menu',
|
||||
// 'admin-bar',
|
||||
|
@ -119,14 +120,14 @@ class Admin {
|
|||
//
|
||||
// wp_dequeue_style( $undesired_wp_styles );
|
||||
// wp_deregister_style( $undesired_wp_styles );
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
function add_admin_js() {
|
||||
global $TAINACAN_BASE_URL;
|
||||
|
||||
wp_enqueue_script( 'tainacan-user-admin', $TAINACAN_BASE_URL . '/assets/user_admin-components.js', ['underscore', 'media-editor', 'media-views', 'customize-controls'], TAINACAN_VERSION, true );
|
||||
|
||||
|
||||
$settings = $this->get_admin_js_localization_params();
|
||||
|
||||
wp_localize_script( 'tainacan-user-admin', 'tainacan_plugin', $settings );
|
||||
|
@ -134,23 +135,23 @@ class Admin {
|
|||
wp_enqueue_script('underscore');
|
||||
wp_enqueue_script('jcrop');
|
||||
wp_enqueue_script( 'customize-controls' );
|
||||
|
||||
|
||||
do_action('tainacan-enqueue-admin-scripts');
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Also used by DevInterface
|
||||
*/
|
||||
function get_admin_js_localization_params() {
|
||||
global $TAINACAN_BASE_URL, $TAINACAN_API_MAX_ITEMS_PER_PAGE;
|
||||
|
||||
|
||||
$Tainacan_Collections = \Tainacan\Repositories\Collections::get_instance();
|
||||
$Tainacan_Metadata = \Tainacan\Repositories\Metadata::get_instance();
|
||||
$Tainacan_Filters = \Tainacan\Repositories\Filters::get_instance();
|
||||
$Tainacan_Items = \Tainacan\Repositories\Items::get_instance();
|
||||
$Tainacan_Taxonomies = \Tainacan\Repositories\Taxonomies::get_instance();
|
||||
|
||||
|
||||
$tainacan_admin_i18n = require( 'tainacan-admin-i18n.php' );
|
||||
|
||||
$entities_labels = [
|
||||
|
@ -222,33 +223,33 @@ class Admin {
|
|||
}
|
||||
|
||||
$filter_types = $Tainacan_Filters->fetch_filter_types();
|
||||
|
||||
|
||||
foreach ( $filter_types as $index => $filter_type){
|
||||
$class = new $filter_type;
|
||||
$settings['i18n']['helpers_label'][$class->get_component()] = $class->get_form_labels();
|
||||
}
|
||||
|
||||
|
||||
$settings['form_hooks'] = Admin_Hooks::get_instance()->get_registered_hooks();
|
||||
|
||||
|
||||
$wp_post_types = get_post_types(['show_ui' => true], 'objects');
|
||||
if (isset($wp_post_types['attachment'])) {
|
||||
unset($wp_post_types['attachment']);
|
||||
}
|
||||
|
||||
|
||||
$wp_post_types = array_map(function($i) {
|
||||
return [
|
||||
'slug' => $i->name,
|
||||
'label' => $i->label
|
||||
];
|
||||
}, $wp_post_types);
|
||||
|
||||
|
||||
$settings['wp_post_types'] = $wp_post_types;
|
||||
|
||||
|
||||
// add an alternative to enable select all items in all pages while we temporarly disable bulk edit for all (see #199)
|
||||
$settings['enable_select_all_items_pages'] = defined('TAINACAN_ENABLE_SELECT_ALL_ITEMS_PAGES') ? TAINACAN_ENABLE_SELECT_ALL_ITEMS_PAGES : false;
|
||||
|
||||
$settings['enable_select_all_items_pages'] = defined('TAINACAN_ENABLE_SELECT_ALL_ITEMS_PAGES') ? TAINACAN_ENABLE_SELECT_ALL_ITEMS_PAGES : false;
|
||||
|
||||
return $settings;
|
||||
|
||||
|
||||
}
|
||||
|
||||
function admin_body_class( $classes ) {
|
||||
|
@ -334,7 +335,7 @@ class Admin {
|
|||
|
||||
wp_die();
|
||||
}
|
||||
|
||||
|
||||
public function systemcheck_page() {
|
||||
require_once('system-check/class-tainacan-system-check.php');
|
||||
$check = new System_Check();
|
||||
|
|
|
@ -54,7 +54,7 @@
|
|||
:value="`${metadatum.id}-${metadatum.metadata_type_options.taxonomy}-${metadatum.metadata_type_object.primitive_type}`"
|
||||
:key="metadatum.id"
|
||||
>{{ metadatum.name }}</option>
|
||||
<option value="_document_content_index-undefined-string">Documento</option>
|
||||
<option value="document_content_index-undefined-string">Documento</option>
|
||||
</b-select>
|
||||
</b-field>
|
||||
|
||||
|
|
|
@ -97,8 +97,6 @@
|
|||
:maxtags="1"
|
||||
:class="{'is-field-history': bulkEditionProcedures[criterion].isDone}"
|
||||
:disabled="bulkEditionProcedures[criterion].isDone"
|
||||
:id="getMetadataByID(bulkEditionProcedures[criterion].metadatumID).metadata_type_object.component +
|
||||
'-' + getMetadataByID(bulkEditionProcedures[criterion].metadatumID).slug"
|
||||
:is="getMetadataByID(bulkEditionProcedures[criterion].metadatumID).metadata_type_object.component"
|
||||
:metadatum="{metadatum: getMetadataByID(bulkEditionProcedures[criterion].metadatumID)}"
|
||||
class="tainacan-bulk-edition-field"
|
||||
|
@ -152,8 +150,6 @@
|
|||
:maxtags="1"
|
||||
:class="{'is-field-history': bulkEditionProcedures[criterion].isDone}"
|
||||
:disabled="bulkEditionProcedures[criterion].isDone || bulkEditionProcedures[criterion].isExecuting"
|
||||
:id="getMetadataByID(bulkEditionProcedures[criterion].metadatumID).metadata_type_object.component +
|
||||
'-' + getMetadataByID(bulkEditionProcedures[criterion].metadatumID).slug"
|
||||
:is="getMetadataByID(bulkEditionProcedures[criterion].metadatumID).metadata_type_object.component"
|
||||
:metadatum="{metadatum: getMetadataByID(bulkEditionProcedures[criterion].metadatumID)}"
|
||||
class="tainacan-bulk-edition-field tainacan-bulk-edition-field-last"
|
||||
|
|
|
@ -182,7 +182,7 @@
|
|||
</span>
|
||||
<br>
|
||||
<a
|
||||
class="is-inline add-link"
|
||||
class="add-link"
|
||||
:class="{'disabled': form.enable_cover_page != 'yes'}"
|
||||
target="_blank"
|
||||
:href="newPagePath">
|
||||
|
@ -232,7 +232,7 @@
|
|||
</b-dropdown>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<!-- Default View Mode -------------------------------- -->
|
||||
<b-field
|
||||
v-if="form.enabled_view_modes.length > 0"
|
||||
|
@ -250,7 +250,7 @@
|
|||
@focus="clearErrors('default_view_mode')">
|
||||
<option
|
||||
v-for="(viewMode, index) of form.enabled_view_modes"
|
||||
v-if="registeredViewModes[viewMode] != undefined"
|
||||
v-if="registeredViewModes[viewMode] != undefined && registeredViewModes[viewMode].full_screen != true"
|
||||
:key="index"
|
||||
:value="viewMode">{{ registeredViewModes[viewMode].label }}
|
||||
</option>
|
||||
|
@ -298,7 +298,7 @@
|
|||
<div class="status-radios">
|
||||
<b-radio
|
||||
v-model="form.status"
|
||||
v-for="(statusOption, index) of $statusHelper.getStatuses()"
|
||||
v-for="(statusOption, index) of $statusHelper.getStatuses().filter((status) => status.slug != 'draft')"
|
||||
:key="index"
|
||||
:native-value="statusOption.slug">
|
||||
<span class="icon has-text-gray">
|
||||
|
|
|
@ -48,7 +48,7 @@
|
|||
</b-select>
|
||||
<router-link
|
||||
tag="a"
|
||||
class="is-inline add-link"
|
||||
class="add-link"
|
||||
:to="{ path: $routerHelper.getNewCollectionPath(), query: { fromImporter: true }}">
|
||||
<span class="icon">
|
||||
<i class="tainacan-icon tainacan-icon-add"/>
|
||||
|
@ -491,7 +491,7 @@ export default {
|
|||
|
||||
.source-file-upload {
|
||||
width: 100%;
|
||||
display: grid;
|
||||
@include display-grid;
|
||||
}
|
||||
|
||||
.selected-source-file {
|
||||
|
|
|
@ -74,7 +74,7 @@
|
|||
{{ metadatum.name }}
|
||||
</span>
|
||||
<span class="label-details">
|
||||
({{ $i18n.get(metadatum.metadata_type_object.component) }}) <em>{{ (metadatum.collection_id != collectionId) ? $i18n.get('label_inherited') : '' }}</em>
|
||||
({{ metadatum.metadata_type_object.name }}) <em>{{ (metadatum.collection_id != collectionId) ? $i18n.get('label_inherited') : '' }}</em>
|
||||
</span>
|
||||
</option>
|
||||
</b-select>
|
||||
|
@ -93,7 +93,9 @@
|
|||
<b-modal
|
||||
@close="onMetadatumEditionCanceled()"
|
||||
:active.sync="isNewMetadatumModalActive"
|
||||
trap-focus>
|
||||
trap-focus
|
||||
aria-modal
|
||||
aria-role="dialog">
|
||||
<div
|
||||
autofocus="true"
|
||||
tabindex="-1"
|
||||
|
|
|
@ -400,7 +400,7 @@ export default {
|
|||
.source-file-upload {
|
||||
width: 100%;
|
||||
padding: 0.75rem $page-side-padding;
|
||||
display: grid;
|
||||
@include display-grid;
|
||||
}
|
||||
.document-list {
|
||||
display: inline-block;
|
||||
|
|
|
@ -213,7 +213,9 @@
|
|||
:active.sync="isTextModalActive"
|
||||
:width="640"
|
||||
scroll="keep"
|
||||
trap-focus>
|
||||
trap-focus
|
||||
aria-modal
|
||||
aria-role="dialog">
|
||||
<div class="tainacan-modal-content">
|
||||
<div class="tainacan-modal-title">
|
||||
<h2>{{ $i18n.get('instruction_write_text') }}</h2>
|
||||
|
@ -250,11 +252,11 @@
|
|||
:active.sync="isURLModalActive"
|
||||
:width="640"
|
||||
scroll="keep"
|
||||
trap-focus
|
||||
autofocus
|
||||
trap-focus
|
||||
role="dialog"
|
||||
tabindex="-1"
|
||||
aria-modal>
|
||||
aria-modal
|
||||
aria-role="dialog">
|
||||
<div class="tainacan-modal-content">
|
||||
<div class="tainacan-modal-title">
|
||||
<h2>{{ $i18n.get('instruction_insert_url') }}</h2>
|
||||
|
|
|
@ -115,7 +115,7 @@
|
|||
<span
|
||||
v-if="metadatum.required == 'yes'"
|
||||
class="required-metadatum-asterisk">*</span>
|
||||
<span class="metadata-type">({{ $i18n.get(metadatum.metadata_type_object.component) }})</span>
|
||||
<span class="metadata-type">({{ metadatum.metadata_type_object.metadata }})</span>
|
||||
<help-button
|
||||
:title="metadatum.name"
|
||||
:message="metadatum.description"/>
|
||||
|
@ -132,8 +132,6 @@
|
|||
:metadatum="{ metadatum: metadatum }"
|
||||
:value="itemMetadata[index].value"
|
||||
@input="clearErrorMessage(metadatum.id); bulkEdit($event, metadatum)"/>
|
||||
<!-- :class="{'is-field-history': bulkEditionProcedures[criterion].isDone}"
|
||||
:disabled="bulkEditionProcedures[criterion].isDone || bulkEditionProcedures[criterion].isExecuting" -->
|
||||
</div>
|
||||
</transition>
|
||||
</b-field>
|
||||
|
|
|
@ -150,7 +150,7 @@
|
|||
</b-field>
|
||||
|
||||
<b-field :addons="false">
|
||||
<label class="label is-inline-block">{{ $i18n.get('label_options') }}</label>
|
||||
<label class="label is-inline-block">{{ $i18n.get('label_insert_options') }}</label>
|
||||
<b-field
|
||||
:type="formErrors['required'] != undefined ? 'is-danger' : ''"
|
||||
:message="formErrors['required'] != undefined ? formErrors['required'] : ''">
|
||||
|
|
|
@ -5,6 +5,15 @@
|
|||
@submit.prevent="saveEdition(editForm)">
|
||||
<div class="tainacan-page-title">
|
||||
<h2>{{ $i18n.get("title_term_edition") }}</h2>
|
||||
<a
|
||||
v-if="editForm && editForm.url != undefined && editForm.url!= ''"
|
||||
target="_blank"
|
||||
:href="editForm.url">
|
||||
<span class="icon">
|
||||
<i class="tainacan-icon tainacan-icon-20px tainacan-icon-see"/>
|
||||
</span>
|
||||
<span class="menu-text">{{ $i18n.get('label_view_on_theme') }}</span>
|
||||
</a>
|
||||
<hr>
|
||||
</div>
|
||||
|
||||
|
@ -22,7 +31,7 @@
|
|||
<span class="required-term-asterisk">*</span>
|
||||
<help-button
|
||||
:title="$i18n.get('label_name')"
|
||||
:message="$i18n.get('info_help_term_name')"/>
|
||||
:message="$i18n.get('info_help_term_name')"/>
|
||||
</label>
|
||||
<b-input
|
||||
:placeholder="$i18n.get('label_term_without_name')"
|
||||
|
@ -135,7 +144,7 @@
|
|||
:message="$i18n.get('info_help_parent_term')"/>
|
||||
</label>
|
||||
<b-autocomplete
|
||||
id="tainacan-text-cover-page"
|
||||
id="tainacan-add-parent-field"
|
||||
:placeholder="$i18n.get('instruction_parent_term')"
|
||||
:data="parentTerms"
|
||||
field="name"
|
||||
|
@ -146,7 +155,18 @@
|
|||
@focus="clearErrors('parent');"
|
||||
:disabled="!hasParent">
|
||||
<template slot-scope="props">
|
||||
{{ props.option.name }}
|
||||
<div class="media">
|
||||
<div
|
||||
v-if="props.option.header_image"
|
||||
class="media-left">
|
||||
<img
|
||||
width="28"
|
||||
:src="props.option.header_image">
|
||||
</div>
|
||||
<div class="media-content">
|
||||
{{ props.option.name }}
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
<template slot="empty">{{ $i18n.get('info_no_parent_term_found') }}</template>
|
||||
</b-autocomplete>
|
||||
|
@ -181,16 +201,6 @@
|
|||
{{ $i18n.get('cancel') }}
|
||||
</button>
|
||||
</div>
|
||||
<div class="control">
|
||||
<a
|
||||
type="button"
|
||||
v-if="editForm.url != undefined && editForm.url!= ''"
|
||||
class="button is-secondary"
|
||||
target="_blank"
|
||||
:href="editForm.url">
|
||||
{{ $i18n.get('label_view_term') }}
|
||||
</a>
|
||||
</div>
|
||||
<div class="control">
|
||||
<button
|
||||
class="button is-success"
|
||||
|
@ -443,16 +453,21 @@
|
|||
animation-duration: 0.5s;
|
||||
|
||||
.tainacan-page-title {
|
||||
margin-bottom: 35px;
|
||||
margin-bottom: 30px;
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
align-items: baseline;
|
||||
|
||||
h2 {
|
||||
font-size: 20px;
|
||||
font-weight: 500;
|
||||
color: $blue5;
|
||||
display: inline-block;
|
||||
margin-right: auto;
|
||||
}
|
||||
hr{
|
||||
hr {
|
||||
margin: 3px 0px 4px 0px;
|
||||
width: 100%;
|
||||
height: 1px;
|
||||
background-color: $secondary;
|
||||
}
|
||||
|
|
|
@ -154,9 +154,9 @@
|
|||
'approve',
|
||||
'notApprove'
|
||||
]),
|
||||
getThis(){
|
||||
return this;
|
||||
},
|
||||
// getThis(){
|
||||
// return this;
|
||||
// },
|
||||
approveActivity(activity) {
|
||||
this.approve(activity.id)
|
||||
.then(data => {
|
||||
|
|
|
@ -96,7 +96,7 @@
|
|||
<span
|
||||
v-if="filter.filter_type_object != undefined"
|
||||
class="label-details">
|
||||
({{ $i18n.get(filter.filter_type_object.component) }})
|
||||
({{ filter.filter_type_object.name }})
|
||||
<span
|
||||
class="not-saved"
|
||||
v-if="(editForms[filter.id] != undefined && editForms[filter.id].saved != true) ||filter.status == 'auto-draft'">
|
||||
|
@ -235,7 +235,9 @@
|
|||
ref="filterTypeModal"
|
||||
:width="680"
|
||||
:active.sync="isSelectingFilterType"
|
||||
trap-focus>
|
||||
trap-focus
|
||||
aria-modal
|
||||
aria-role="dialog">
|
||||
<div
|
||||
autofocus
|
||||
role="dialog"
|
||||
|
@ -481,9 +483,9 @@ export default {
|
|||
// Removes element from filters list
|
||||
this.activeFilterList.splice(this.newFilterIndex, 1);
|
||||
},
|
||||
handleChangeOnMetadata($event) {
|
||||
handleChangeOnMetadata($event) {
|
||||
if ($event.removed) {
|
||||
this.oldMetadatumIndex = $event.removed.oldIndex;
|
||||
this.oldMetadatumIndex = $event.removed.oldIndex;
|
||||
}
|
||||
},
|
||||
updateFiltersOrder() {
|
||||
|
@ -527,7 +529,7 @@ export default {
|
|||
collectionId: this.collectionId,
|
||||
metadatumId: this.choosenMetadatum.id,
|
||||
name: this.choosenMetadatum.name,
|
||||
filterType: this.selectedFilterType.name,
|
||||
filterType: this.selectedFilterType.className,
|
||||
status: 'auto-draft',
|
||||
isRepositoryLevel: this.isRepositoryLevel,
|
||||
newIndex: this.newFilterIndex
|
||||
|
@ -1172,6 +1174,10 @@ export default {
|
|||
font-size: 1rem;
|
||||
margin-left: -16px;
|
||||
}
|
||||
|
||||
.field .collapse-handle {
|
||||
display: flex;
|
||||
}
|
||||
|
||||
input, select, textarea,
|
||||
.input, .tags, .tag {
|
||||
|
|
|
@ -98,19 +98,17 @@
|
|||
{{ metadatum.name }}
|
||||
</span>
|
||||
<span
|
||||
v-if="metadatum.id != undefined"
|
||||
v-if="metadatum.id != undefined && metadatum.metadata_type_object"
|
||||
class="label-details">
|
||||
({{ $i18n.get(metadatum.metadata_type_object.component) }})
|
||||
({{ metadatum.metadata_type_object.name }})
|
||||
<em v-if="metadatum.collection_id != collectionId">{{ $i18n.get('label_inherited') }}</em>
|
||||
<em
|
||||
v-if="metadatum.metadata_type_object &&
|
||||
metadatum.metadata_type_object.core &&
|
||||
v-if="metadatum.metadata_type_object.core &&
|
||||
metadatum.metadata_type_object.related_mapped_prop == 'title'">
|
||||
{{ $i18n.get('label_core_title') }}
|
||||
</em>
|
||||
<em
|
||||
v-if="metadatum.metadata_type_object &&
|
||||
metadatum.metadata_type_object.core &&
|
||||
v-if="metadatum.metadata_type_object.core &&
|
||||
metadatum.metadata_type_object.related_mapped_prop == 'description'">
|
||||
{{ $i18n.get('label_core_description') }}
|
||||
</em>
|
||||
|
@ -235,7 +233,7 @@
|
|||
</div>
|
||||
</b-tab-item>
|
||||
|
||||
<!-- Exposer --------------- -->
|
||||
<!-- Mapping --------------- -->
|
||||
<b-tab-item :label="$i18n.get('mapping')">
|
||||
<div>
|
||||
<section
|
||||
|
@ -247,11 +245,10 @@
|
|||
<i class="tainacan-icon tainacan-icon-36px tainacan-icon-metadata"/>
|
||||
</span>
|
||||
</p>
|
||||
<p>{{ $i18n.get('info_there_is_no_metadatum') }}</p>
|
||||
<p>{{ $i18n.get('info_create_metadata') }}</p>
|
||||
<p>{{ $i18n.get('info_there_is_no_metadatum') }}</p>
|
||||
</div>
|
||||
</section>
|
||||
<section>
|
||||
<section v-else>
|
||||
<div class="field is-grouped form-submit">
|
||||
<b-select
|
||||
id="mappers-options-dropdown"
|
||||
|
@ -373,7 +370,9 @@
|
|||
<b-modal
|
||||
@close="onCancelNewMetadataMapperMetadata"
|
||||
:active.sync="isMapperMetadataCreating"
|
||||
trap-focus>
|
||||
trap-focus
|
||||
aria-modal
|
||||
aria-role="dialog">
|
||||
<div
|
||||
autofocus
|
||||
role="dialog"
|
||||
|
|
|
@ -477,7 +477,7 @@
|
|||
v-for="(attributeValue, attributeName, index) in activity.new_value">
|
||||
<p class="is-capitalized has-text-blue5 has-text-weight-bold">
|
||||
{{ attributeName }}
|
||||
<small class="has-text-gray4 has-text-weight-normal"> {{ `(${$i18n.get('info_logs_before')})` }}</small>
|
||||
<small class="has-text-gray4 has-text-weight-normal"> {{ `(${$i18n.get('info_logs_after')})` }}</small>
|
||||
</p>
|
||||
|
||||
<div class="content">
|
||||
|
|
|
@ -137,7 +137,7 @@
|
|||
</b-field>
|
||||
<li v-if="finderColumn.children.length">
|
||||
<div
|
||||
v-if="totalRemaining[key].remaining === true || (finderColumn.length < totalRemaining[key].remaining)"
|
||||
v-if="shouldShowMoreButton(key)"
|
||||
@click="getMoreOptions(finderColumn, key)"
|
||||
class="tainacan-show-more">
|
||||
<span class="icon">
|
||||
|
@ -206,7 +206,7 @@
|
|||
</b-tab-item>
|
||||
</b-tabs>
|
||||
<!--<pre>{{ hierarchicalPath }}</pre>-->
|
||||
<!-- <pre>{{ totalRemaining }}</pre> -->
|
||||
<!--<pre>{{ totalRemaining }}</pre>-->
|
||||
<!--<pre>{{ selected }}</pre>-->
|
||||
<!--<pre>{{ options }}</pre>-->
|
||||
<!--<pre>{{ searchResults }}</pre>-->
|
||||
|
@ -278,11 +278,11 @@
|
|||
<script>
|
||||
import qs from 'qs';
|
||||
import { tainacan as axios, isCancel } from '../../../js/axios/axios';
|
||||
import { filterTypeMixin } from '../../../classes/filter-types/filter-types-mixin';
|
||||
import { dynamicFilterTypeMixin } from '../../../classes/filter-types/filter-types-mixin';
|
||||
|
||||
export default {
|
||||
name: 'CheckboxFilterModal',
|
||||
mixins: [ filterTypeMixin ],
|
||||
mixins: [ dynamicFilterTypeMixin ],
|
||||
props: {
|
||||
isFilter: {
|
||||
type: Boolean,
|
||||
|
@ -301,7 +301,7 @@
|
|||
default: false,
|
||||
},
|
||||
metadatum_type: String,
|
||||
metadatum_object: Object,
|
||||
query: Object,
|
||||
isRepositoryLevel: Boolean,
|
||||
isCheckbox: {
|
||||
type: Boolean,
|
||||
|
@ -355,40 +355,43 @@
|
|||
this.$refs.checkboxRadioModal.focus()
|
||||
},
|
||||
methods: {
|
||||
shouldShowMoreButton(key) {
|
||||
return this.totalRemaining[key].remaining === true || (this.finderColumns[key].children.length < this.totalRemaining[key].remaining);
|
||||
},
|
||||
fetchSelectedLabels() {
|
||||
|
||||
let selected = this.selected instanceof Array ? this.selected : [this.selected];
|
||||
|
||||
if (this.taxonomy_id && selected.length) {
|
||||
for (const term of selected) {
|
||||
|
||||
this.isSelectedTermsLoading = true;
|
||||
this.isSelectedTermsLoading = true;
|
||||
|
||||
axios.get(`/taxonomy/${this.taxonomy_id}/terms/${term}`)
|
||||
.then((res) => {
|
||||
this.saveSelectedTagName(res.data.id, res.data.name);
|
||||
this.isSelectedTermsLoading = false;
|
||||
})
|
||||
.catch((error) => {
|
||||
this.$console.log(error);
|
||||
this.isSelectedTermsLoading = false;
|
||||
});
|
||||
}
|
||||
axios.get(`/taxonomy/${this.taxonomy_id}/terms/?${qs.stringify({ hideempty: 0, include: selected})}`)
|
||||
.then((res) => {
|
||||
for (const term of res.data)
|
||||
this.saveSelectedTagName(term.id, term.name);
|
||||
|
||||
this.isSelectedTermsLoading = false;
|
||||
})
|
||||
.catch((error) => {
|
||||
this.$console.log(error);
|
||||
this.isSelectedTermsLoading = false;
|
||||
});
|
||||
|
||||
} else if (this.metadatum_type === 'Tainacan\\Metadata_Types\\Relationship' && selected.length) {
|
||||
this.isSelectedTermsLoading = true;
|
||||
|
||||
for (const item of selected) {
|
||||
axios.get(`/items/?${qs.stringify({ fetch_only: 'title', postin: selected})}`)
|
||||
.then((res) => {
|
||||
for (const item of res.data)
|
||||
this.saveSelectedTagName(item.id, item.title);
|
||||
|
||||
axios.get('/items/' + item + '?fetch_only=title')
|
||||
.then((res) => {
|
||||
this.saveSelectedTagName(res.data.id, res.data.title);
|
||||
this.isSelectedTermsLoading = false;
|
||||
})
|
||||
.catch((error) => {
|
||||
this.$console.log(error);
|
||||
this.isSelectedTermsLoading = false;
|
||||
});
|
||||
}
|
||||
this.isSelectedTermsLoading = false;
|
||||
})
|
||||
.catch((error) => {
|
||||
this.$console.log(error);
|
||||
this.isSelectedTermsLoading = false;
|
||||
});
|
||||
}
|
||||
},
|
||||
saveSelectedTagName(value, label){
|
||||
|
|
|
@ -25,14 +25,20 @@
|
|||
:key="index"
|
||||
@click="onSelectCollection(collection)">
|
||||
<h4>{{ collection.name }}</h4>
|
||||
<p>{{ collection.length > 200 ? (collection.description.substring(0,197) + '...') : collection.description }}</p>
|
||||
<p>{{ collection.description.length > 200 ? (collection.description.substring(0,197) + '...') : collection.description }}</p>
|
||||
</div>
|
||||
|
||||
<b-loading
|
||||
<div
|
||||
v-if="collections.length <= 0"
|
||||
class="block">
|
||||
<p class="has-text-gray">
|
||||
{{ $i18n.get('info_no_collection_created') }}
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
<b-loading
|
||||
:is-full-page="false"
|
||||
:active.sync="isLoading"
|
||||
:can-cancel="false"/>
|
||||
</div>
|
||||
|
||||
<footer class="field is-grouped form-submit">
|
||||
<div class="control">
|
||||
|
|
|
@ -12,7 +12,9 @@
|
|||
<b-modal
|
||||
:active.sync="isPreviewModalActive"
|
||||
scroll="keep"
|
||||
trap-focus>
|
||||
trap-focus
|
||||
aria-modal
|
||||
aria-role="dialog">
|
||||
<!-- <div class="tainacan-modal-content">
|
||||
<div class="tainacan-modal-title">
|
||||
<h2>{{ $i18n.get('label_document') }}</h2>
|
||||
|
|
|
@ -33,7 +33,9 @@
|
|||
:active.sync="isPreviewModalActive"
|
||||
:width="1024"
|
||||
scroll="keep"
|
||||
trap-focus>
|
||||
trap-focus
|
||||
aria-modal
|
||||
aria-role="dialog">
|
||||
<div
|
||||
autofocus
|
||||
role="dialog"
|
||||
|
@ -85,13 +87,12 @@ export default {
|
|||
getIconForMimeType(mimeType) {
|
||||
|
||||
let type = mimeType.split('/');
|
||||
|
||||
if (type[0] == 'application' && type[1] != undefined){
|
||||
switch (type[1]) {
|
||||
case 'pdf':
|
||||
return 'pdf';
|
||||
default:
|
||||
return '';
|
||||
return 'attachments';
|
||||
}
|
||||
} else {
|
||||
switch (type[0]) {
|
||||
|
@ -102,7 +103,7 @@ export default {
|
|||
case 'text':
|
||||
return 'text';
|
||||
default:
|
||||
return '';
|
||||
return 'attachments';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -54,7 +54,7 @@ export default {
|
|||
display: block;
|
||||
border-radius: 5px;
|
||||
min-width: 250px;
|
||||
min-width: 250px;
|
||||
max-width: 100%;
|
||||
transition: margin-bottom 0.2s ease, opacity 0.3s ease;
|
||||
position: absolute;
|
||||
bottom: calc(100% - 6px);
|
||||
|
@ -76,6 +76,7 @@ export default {
|
|||
padding: 0.8em 1.0em 1.0em 1.0em;
|
||||
font-size: 11px;
|
||||
font-weight: normal;
|
||||
white-space: normal;
|
||||
}
|
||||
|
||||
&:before {
|
||||
|
|
|
@ -18,6 +18,7 @@
|
|||
</label>
|
||||
|
||||
<div
|
||||
v-if="collections && collections.length"
|
||||
class="block">
|
||||
<div
|
||||
v-for="(collection, key) in collections"
|
||||
|
@ -31,6 +32,13 @@
|
|||
</b-checkbox>
|
||||
</div>
|
||||
</div>
|
||||
<div
|
||||
v-else
|
||||
class="block">
|
||||
<p class="has-text-gray">
|
||||
{{ $i18n.get('info_no_collection_created') }}
|
||||
</p>
|
||||
</div>
|
||||
</b-collapse>
|
||||
</b-field>
|
||||
</template>
|
||||
|
|
|
@ -1,25 +1,27 @@
|
|||
<template>
|
||||
<div
|
||||
class="is-inline-flex"
|
||||
v-if="filterTags != undefined && filterTags.length > 0">
|
||||
<b-tag
|
||||
v-for="(filterTag, index) of filterTags"
|
||||
:key="index"
|
||||
attached
|
||||
closable
|
||||
@close="removeMetaQuery(filterTag.filterId, filterTag.value, filterTag.singleValue)">
|
||||
{{ filterTag.singleValue != undefined ? filterTag.singleValue : filterTag.value }}
|
||||
</b-tag>
|
||||
<button
|
||||
@click="clearAllFilters()"
|
||||
id="button-clear-all"
|
||||
class="button is-outlined">
|
||||
{{ $i18n.get('label_clear_filters') }}
|
||||
</button>
|
||||
</div>
|
||||
<transition name="filter-item">
|
||||
<div
|
||||
class="is-inline-flex"
|
||||
v-if="filterTags != undefined && filterTags.length > 0">
|
||||
<b-tag
|
||||
v-for="(filterTag, index) of filterTags"
|
||||
:key="index"
|
||||
attached
|
||||
closable
|
||||
@close="removeMetaQuery(filterTag)">
|
||||
{{ filterTag.singleLabel != undefined ? filterTag.singleLabel : filterTag.label }}
|
||||
</b-tag>
|
||||
<button
|
||||
@click="clearAllFilters()"
|
||||
id="button-clear-all"
|
||||
class="button is-outlined">
|
||||
{{ $i18n.get('label_clear_filters') }}
|
||||
</button>
|
||||
</div>
|
||||
</transition>
|
||||
</template>
|
||||
<script>
|
||||
import { mapGetters, mapActions } from 'vuex';
|
||||
import { mapGetters } from 'vuex';
|
||||
|
||||
export default {
|
||||
name: 'FiltersTagsList',
|
||||
|
@ -31,9 +33,9 @@
|
|||
let tags = this.getFilterTags();
|
||||
let flattenTags = [];
|
||||
for (let tag of tags) {
|
||||
if (Array.isArray(tag.value)) {
|
||||
for (let valueTag of tag.value)
|
||||
flattenTags.push({filterId: tag.filterId, value: tag, singleValue: valueTag});
|
||||
if (Array.isArray(tag.label)) {
|
||||
for (let i = 0; i < tag.label.length; i++)
|
||||
flattenTags.push({filterId: tag.filterId, label: tag.label, singleLabel: tag.label[i], value: tag.value[i], taxonomy: tag.taxonomy, metadatumId: tag.metadatumId});
|
||||
} else {
|
||||
flattenTags.push(tag);
|
||||
}
|
||||
|
@ -43,22 +45,22 @@
|
|||
},
|
||||
methods: {
|
||||
...mapGetters('search',[
|
||||
'getPostQuery',
|
||||
'getFilterTags'
|
||||
]),
|
||||
...mapActions('metadata',[
|
||||
'fetchMetadatum'
|
||||
]),
|
||||
removeMetaQuery(filterId, value, singleValue) {
|
||||
if (singleValue != undefined)
|
||||
this.$eventBusSearch.removeMetaFromFilterTag({ filterId: filterId, singleValue: singleValue });
|
||||
else
|
||||
this.$eventBusSearch.removeMetaFromFilterTag({ filterId: filterId, value: value });
|
||||
removeMetaQuery({ filterId, value, singleLabel, label, taxonomy, metadatumId }) {
|
||||
this.$eventBusSearch.removeMetaFromFilterTag({
|
||||
filterId: filterId,
|
||||
singleLabel: singleLabel,
|
||||
label: label,
|
||||
value: value,
|
||||
taxonomy: taxonomy,
|
||||
metadatumId: metadatumId
|
||||
});
|
||||
},
|
||||
clearAllFilters() {
|
||||
// this.$eventBusSearch.clearAllFilters();
|
||||
for (let tag of this.filterTags) {
|
||||
this.removeMetaQuery(tag.filterId, tag.value, tag.singleValue);
|
||||
this.removeMetaQuery(tag);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,255 +0,0 @@
|
|||
<template>
|
||||
<div class="table-container">
|
||||
<div class="selection-control">
|
||||
<div class="field select-all is-pulled-left">
|
||||
<span>
|
||||
<b-checkbox disabled>{{ $i18n.get('label_select_all_items_page') }}</b-checkbox>
|
||||
</span>
|
||||
</div>
|
||||
<div class="field is-pulled-right">
|
||||
<b-dropdown
|
||||
position="is-bottom-left"
|
||||
disabled
|
||||
trap-focus>
|
||||
<button
|
||||
class="button is-white"
|
||||
slot="trigger">
|
||||
<span>{{ $i18n.get('label_bulk_actions') }}</span>
|
||||
<span class="icon">
|
||||
<i class="tainacan-icon tainacan-icon-20px tainacan-icon-arrowdown"/>
|
||||
</span>
|
||||
</button>
|
||||
</b-dropdown>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="table-wrapper">
|
||||
<table
|
||||
v-if="viewMode == 'table'"
|
||||
class="tainacan-table">
|
||||
<thead>
|
||||
<th class="skeleton column-default-width" />
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr
|
||||
class="skeleton"
|
||||
:key="item"
|
||||
v-for="item in itemsPerPage">
|
||||
<td class="column-default-width"/>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<div
|
||||
v-if="viewMode == 'cards' || viewMode == 'grid'"
|
||||
:class="{
|
||||
'tainacan-cards-container': viewMode == 'cards',
|
||||
'tainacan-grid-container': viewMode == 'grid'
|
||||
}">
|
||||
<div
|
||||
:key="item"
|
||||
v-for="item in itemsPerPage"
|
||||
class="skeleton"
|
||||
:class="{
|
||||
'tainacan-card': viewMode == 'cards',
|
||||
'tainacan-grid-item': viewMode == 'grid'
|
||||
}"/>
|
||||
</div>
|
||||
<masonry
|
||||
:cols="getMasonryColsSettings()"
|
||||
:gutter="viewMode == 'masonry' ? 25 : 30"
|
||||
v-if="viewMode == 'masonry' || viewMode == 'records'"
|
||||
:class="{
|
||||
'tainacan-masonry-container': viewMode == 'masonry',
|
||||
'tainacan-records-container': viewMode == 'records'
|
||||
}">
|
||||
<div
|
||||
:key="item"
|
||||
v-for="item in itemsPerPage"
|
||||
:style="{'min-height': randomHeightForMasonryItem() + 'px' }"
|
||||
class="skeleton"
|
||||
:class="{
|
||||
'tainacan-masonry-item': viewMode == 'masonry',
|
||||
'tainacan-record': viewMode == 'records'
|
||||
}"/>
|
||||
</masonry>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { mapGetters } from 'vuex';
|
||||
|
||||
export default {
|
||||
name: 'SkeletonItemsList',
|
||||
computed: {
|
||||
itemsPerPage(){
|
||||
return this.getItemsPerPage();
|
||||
},
|
||||
viewMode() {
|
||||
return this.getAdminViewMode();
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
...mapGetters('search', [
|
||||
'getItemsPerPage',
|
||||
'getAdminViewMode',
|
||||
]),
|
||||
getMasonryColsSettings() {
|
||||
if (this.viewMode == 'masonry')
|
||||
return { default: 7, 1919: 6, 1407: 5, 1215: 4, 1023: 3, 767: 2, 343: 1 }
|
||||
else
|
||||
return { default: 4, 1919: 3, 1407: 2, 1215: 2, 1023: 1, 767: 1, 343: 1 }
|
||||
|
||||
},
|
||||
randomHeightForMasonryItem() {
|
||||
let min = 255;
|
||||
let max = 255;
|
||||
|
||||
if (this.viewMode == 'masonry') {
|
||||
min = 140;
|
||||
max = 420;
|
||||
} else if (this.viewMode == 'records') {
|
||||
min = 380;
|
||||
max = 480;
|
||||
}
|
||||
|
||||
return Math.floor(Math.random()*(max-min+1)+min);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
|
||||
@import '../../scss/_variables.scss';
|
||||
|
||||
// Selection Area
|
||||
.selection-control {
|
||||
|
||||
padding: 6px 0px 0px 12px;
|
||||
background: white;
|
||||
height: 40px;
|
||||
|
||||
.select-all {
|
||||
color: $gray4;
|
||||
font-size: 0.875rem;
|
||||
&:hover {
|
||||
color: $gray4;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Cards View Mode
|
||||
.tainacan-cards-container {
|
||||
min-height: 50vh;
|
||||
padding: 0;
|
||||
display: -ms-grid;
|
||||
display: grid;
|
||||
grid-template-columns: repeat(auto-fill, 455px);
|
||||
grid-gap: 0px;
|
||||
justify-content: space-evenly;
|
||||
animation-name: item-appear;
|
||||
animation-duration: 0.5s;
|
||||
|
||||
@media screen and (max-width: 480px) {
|
||||
width: 91.666666667%;
|
||||
grid-template-columns: repeat(auto-fill, 100%);
|
||||
}
|
||||
|
||||
.tainacan-card {
|
||||
padding: 0px;
|
||||
flex-basis: 0;
|
||||
margin: 15px;
|
||||
max-width: 425px;
|
||||
min-width: 425px;
|
||||
min-height: 210px;
|
||||
max-height: 210px;
|
||||
|
||||
@media screen and (max-width: 480px) {
|
||||
max-width: 100%;
|
||||
min-width: 100%;
|
||||
min-height: 171px;
|
||||
max-height: 171px;
|
||||
|
||||
img {
|
||||
width: 130px !important;
|
||||
height: 130px !important;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Thumbnails (Grid) View Mode
|
||||
.tainacan-grid-container {
|
||||
min-height: 50vh;
|
||||
padding: 0;
|
||||
display: -ms-grid;
|
||||
display: grid;
|
||||
grid-template-columns: repeat(auto-fill, 285px);
|
||||
grid-gap: 0px;
|
||||
justify-content: space-evenly;
|
||||
animation-name: appear;
|
||||
animation-duration: 0.5s;
|
||||
|
||||
.tainacan-grid-item {
|
||||
max-width: 255px;
|
||||
min-height: 300px;
|
||||
flex-basis: 0;
|
||||
margin: 15px;
|
||||
text-align: center;
|
||||
}
|
||||
}
|
||||
|
||||
// Masonry View Mode
|
||||
.tainacan-masonry-container {
|
||||
min-height: 50vh;
|
||||
padding: 0;
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
flex-grow: 1;
|
||||
flex-shrink: 1;
|
||||
justify-content: space-evenly;
|
||||
animation-name: item-appear;
|
||||
animation-duration: 0.5s;
|
||||
|
||||
.tainacan-masonry-item {
|
||||
display: block;
|
||||
width: 100%;
|
||||
flex-basis: 0;
|
||||
margin-bottom: 25px;
|
||||
}
|
||||
}
|
||||
|
||||
// Records View Mode
|
||||
.tainacan-records-container {
|
||||
min-height: 50vh;
|
||||
padding: 0;
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
flex-grow: 1;
|
||||
flex-shrink: 1;
|
||||
justify-content: space-evenly;
|
||||
animation-name: item-appear;
|
||||
animation-duration: 0.5s;
|
||||
|
||||
.tainacan-record {
|
||||
background-color: #f6f6f6;
|
||||
padding: 0px;
|
||||
flex-basis: 0;
|
||||
margin: 0 auto 30px auto;
|
||||
width: 100%;
|
||||
max-width: 425px;
|
||||
min-height: 100px;
|
||||
display: block;
|
||||
}
|
||||
}
|
||||
|
||||
// Table View Mode
|
||||
table.tainacan-table {
|
||||
border-spacing: 6px !important;
|
||||
th { height: 38px; }
|
||||
td { height: 52px; }
|
||||
}
|
||||
|
||||
</style>
|
|
@ -22,8 +22,8 @@ import Taxonomy from '../../classes/metadata-types/taxonomy/Taxonomy.vue';
|
|||
import FormRelationship from '../../classes/metadata-types/relationship/FormRelationship.vue';
|
||||
import FormTaxonomy from '../../classes/metadata-types/taxonomy/FormTaxonomy.vue';
|
||||
import FormSelectbox from '../../classes/metadata-types/selectbox/FormSelectbox.vue';
|
||||
import FormNumeric from '../../classes/metadata-types/numeric/FormNumeric.vue';
|
||||
|
||||
import FilterCustomInterval from '../../classes/filter-types/custom-interval/CustomInterval.vue';
|
||||
import FilterNumeric from '../../classes/filter-types/numeric/Numeric.vue';
|
||||
import FilterDate from '../../classes/filter-types/date/Date.vue';
|
||||
import FilterSelectbox from '../../classes/filter-types/selectbox/Selectbox.vue';
|
||||
|
@ -31,12 +31,14 @@ import FilterAutocomplete from '../../classes/filter-types/autocomplete/Autocomp
|
|||
import FilterCheckbox from '../../classes/filter-types/checkbox/Checkbox.vue';
|
||||
import FilterTaginput from '../../classes/filter-types/taginput/Taginput.vue';
|
||||
import FilterNumericInterval from '../../classes/filter-types/numeric-interval/NumericInterval.vue';
|
||||
|
||||
import FilterDateInterval from '../../classes/filter-types/date-interval/DateInterval.vue';
|
||||
import FilterNumericListInterval from '../../classes/filter-types/numeric-list-interval/NumericListInterval.vue';
|
||||
import FilterTaxonomyCheckbox from '../../classes/filter-types/taxonomy/Checkbox.vue';
|
||||
import FilterTaxonomyTaginput from '../../classes/filter-types/taxonomy/Taginput.vue';
|
||||
|
||||
import FormNumeric from '../../classes/filter-types/numeric/FormNumeric.vue';
|
||||
import FormNumericInterval from '../../classes/filter-types/numeric-interval/FormNumericInterval.vue';
|
||||
import FormFilterNumeric from '../../classes/filter-types/numeric/FormNumeric.vue';
|
||||
import FormFilterNumericInterval from '../../classes/filter-types/numeric-interval/FormNumericInterval.vue';
|
||||
import FormFilterNumericListInterval from '../../classes/filter-types/numeric-list-interval/FormNumericListInterval.vue';
|
||||
// import FormDate from '../../classes/filter-types/date/FormDate.vue';
|
||||
|
||||
import TainacanFormItem from '../../classes/metadata-types/tainacan-form-item.vue';
|
||||
|
@ -52,13 +54,9 @@ import eventBusSearch from '../../js/event-bus-search';
|
|||
import termsListBus from './terms-list-bus.js';
|
||||
import { I18NPlugin, UserPrefsPlugin, RouterHelperPlugin, ConsolePlugin, UserCapabilitiesPlugin, StatusHelperPlugin } from './utilities';
|
||||
|
||||
import FilterNumericListInterval from '../../classes/filter-types/numeric-list-interval/NumericListInterval.vue';
|
||||
import FormNumericListInterval from '../../classes/filter-types/numeric-list-interval/FormNumericListInterval.vue';
|
||||
|
||||
|
||||
// Configure and Register Plugins
|
||||
Vue.use(Buefy, {
|
||||
defaultTooltipAnimated: true
|
||||
defaultTooltipAnimated: true
|
||||
});
|
||||
Vue.use(VTooltip);
|
||||
Vue.use(VueMasonry);
|
||||
|
@ -78,15 +76,16 @@ Vue.component('tainacan-numeric', Numeric);
|
|||
Vue.component('tainacan-date', Date);
|
||||
Vue.component('tainacan-relationship', Relationship);
|
||||
Vue.component('tainacan-taxonomy', Taxonomy);
|
||||
|
||||
/* Metadata Option forms */
|
||||
Vue.component('tainacan-form-relationship', FormRelationship);
|
||||
Vue.component('tainacan-form-taxonomy', FormTaxonomy);
|
||||
Vue.component('tainacan-form-selectbox', FormSelectbox);
|
||||
Vue.component('tainacan-form-numeric', FormNumeric);
|
||||
Vue.component('tainacan-form-item', TainacanFormItem);
|
||||
Vue.component('tainacan-filter-item', TainacanFiltersList);
|
||||
|
||||
/* Filters */
|
||||
Vue.component('tainacan-filter-custom-interval', FilterCustomInterval);
|
||||
Vue.component('tainacan-filter-numeric', FilterNumeric);
|
||||
Vue.component('tainacan-filter-date', FilterDate);
|
||||
Vue.component('tainacan-filter-selectbox', FilterSelectbox);
|
||||
|
@ -97,11 +96,12 @@ Vue.component('tainacan-filter-taxonomy-checkbox', FilterTaxonomyCheckbox);
|
|||
Vue.component('tainacan-filter-taxonomy-taginput', FilterTaxonomyTaginput);
|
||||
Vue.component('tainacan-filter-numeric-interval', FilterNumericInterval);
|
||||
Vue.component('tainacan-filter-numeric-list-interval', FilterNumericListInterval);
|
||||
Vue.component('tainacan-filter-date-interval', FilterDateInterval);
|
||||
|
||||
/* Filter Metadata Option forms */
|
||||
Vue.component('tainacan-filter-form-numeric', FormNumeric);
|
||||
Vue.component('tainacan-filter-form-numeric-interval', FormNumericInterval);
|
||||
Vue.component('tainacan-filter-form-numeric-list-interval', FormNumericListInterval);
|
||||
Vue.component('tainacan-filter-form-numeric', FormFilterNumeric);
|
||||
Vue.component('tainacan-filter-form-numeric-interval', FormFilterNumericInterval);
|
||||
Vue.component('tainacan-filter-form-numeric-list-interval', FormFilterNumericListInterval);
|
||||
// Vue.component('tainacan-filter-form-date', FormDate);
|
||||
|
||||
/* Others */
|
||||
|
@ -126,7 +126,7 @@ new Vue({
|
|||
render: h => h(AdminPage)
|
||||
});
|
||||
|
||||
// Display Icons only once everything is loaded
|
||||
// Display Icons only once everything is loaded
|
||||
function listen(evnt, elem, func) {
|
||||
if (elem.addEventListener) // W3C DOM
|
||||
elem.addEventListener(evnt,func,false);
|
||||
|
|
|
@ -5,7 +5,6 @@ import VTooltip from 'v-tooltip';
|
|||
import VueMasonry from 'vue-masonry-css';
|
||||
|
||||
// Custom elements
|
||||
import FilterCustomInterval from '../../classes/filter-types/custom-interval/CustomInterval.vue';
|
||||
import FilterNumeric from '../../classes/filter-types/numeric/Numeric.vue';
|
||||
import FilterDate from '../../classes/filter-types/date/Date.vue';
|
||||
import FilterSelectbox from '../../classes/filter-types/selectbox/Selectbox.vue';
|
||||
|
@ -34,7 +33,7 @@ import { I18NPlugin, UserPrefsPlugin, RouterHelperPlugin, ConsolePlugin, StatusH
|
|||
|
||||
// Configure and Register Plugins
|
||||
Vue.use(Buefy, {
|
||||
defaultTooltipAnimated: true
|
||||
defaultTooltipAnimated: true
|
||||
});
|
||||
Vue.use(VTooltip);
|
||||
Vue.use(VueMasonry);
|
||||
|
@ -44,11 +43,9 @@ Vue.use(RouterHelperPlugin);
|
|||
Vue.use(StatusHelperPlugin);
|
||||
Vue.use(ConsolePlugin, {visual: false});
|
||||
|
||||
|
||||
Vue.component('tainacan-filter-item', TaincanFiltersList);
|
||||
|
||||
/* Filters */
|
||||
Vue.component('tainacan-filter-custom-interval', FilterCustomInterval);
|
||||
Vue.component('tainacan-filter-numeric', FilterNumeric);
|
||||
Vue.component('tainacan-filter-date', FilterDate);
|
||||
Vue.component('tainacan-filter-selectbox', FilterSelectbox);
|
||||
|
@ -79,7 +76,7 @@ import ThemeItemsList from '../theme-items-list.vue';
|
|||
export const ThemeItemsListing = new Vue({
|
||||
el: '#tainacan-items-page',
|
||||
store,
|
||||
router: routerTheme,
|
||||
router: routerTheme,
|
||||
data: {
|
||||
termId: '',
|
||||
taxonomy: '',
|
||||
|
@ -90,9 +87,9 @@ export const ThemeItemsListing = new Vue({
|
|||
},
|
||||
render: h => h(ThemeItemsList),
|
||||
beforeMount () {
|
||||
|
||||
|
||||
this.collectionId = this.$el.attributes['collection-id'] != undefined ? this.$el.attributes['collection-id'].value : undefined;
|
||||
|
||||
|
||||
if (this.$el.attributes['default-view-mode'] != undefined)
|
||||
this.defaultViewMode = this.$el.attributes['default-view-mode'].value;
|
||||
else
|
||||
|
@ -107,10 +104,10 @@ export const ThemeItemsListing = new Vue({
|
|||
this.taxonomy = this.$el.attributes['taxonomy'].value;
|
||||
|
||||
}
|
||||
|
||||
|
||||
});
|
||||
|
||||
// Display Icons only once everything is loaded
|
||||
// Display Icons only once everything is loaded
|
||||
function listen(evnt, elem, func) {
|
||||
if (elem.addEventListener) // W3C DOM
|
||||
elem.addEventListener(evnt,func,false);
|
||||
|
|
|
@ -140,7 +140,7 @@
|
|||
{{ $i18n.getWithVariables('label_view_all_%s_collections', [collectionsTotal]) }}
|
||||
</span>
|
||||
<span
|
||||
v-if="collectionsTotal != undefined && collectionsTotal == 1"
|
||||
v-if="collectionsTotal != undefined && collectionsTotal <= 1"
|
||||
class="menu-text">
|
||||
{{ $i18n.get('label_view_collections_list') }}
|
||||
</span>
|
||||
|
|
|
@ -43,6 +43,7 @@
|
|||
:date-parser="(date) => dateParser(date)"
|
||||
size="is-small"
|
||||
icon="calendar-today"
|
||||
:years-range="[-50, 3]"
|
||||
:day-names="[
|
||||
$i18n.get('datepicker_short_sunday'),
|
||||
$i18n.get('datepicker_short_monday'),
|
||||
|
@ -77,6 +78,40 @@
|
|||
</p>
|
||||
</b-field>
|
||||
|
||||
<b-field
|
||||
style="margin-left: auto"
|
||||
class="header-item">
|
||||
<div class="control has-icons-right is-small is-clearfix">
|
||||
<b-autocomplete
|
||||
:data="users"
|
||||
:placeholder="$i18n.get('instruction_type_search_users_filter')"
|
||||
keep-first
|
||||
open-on-focus
|
||||
@input="fetchUsersForFiltering"
|
||||
@focus.once="($event) => fetchUsersForFiltering($event.target.value)"
|
||||
@select="filterActivitiesByUser"
|
||||
:loading="isFetchingUsers"
|
||||
field="name"
|
||||
icon="account">
|
||||
<template slot-scope="props">
|
||||
<div class="media">
|
||||
<div
|
||||
v-if="props.option.avatar_urls && props.option.avatar_urls['24']"
|
||||
class="media-left">
|
||||
<img
|
||||
width="24"
|
||||
:src="props.option.avatar_urls['24']">
|
||||
</div>
|
||||
<div class="media-content">
|
||||
{{ props.option.name }}
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
<template slot="empty">{{ $i18n.get('info_no_user_found') }}</template>
|
||||
</b-autocomplete>
|
||||
</div>
|
||||
</b-field>
|
||||
|
||||
<b-field class="header-item">
|
||||
<div class="control has-icons-right is-small is-clearfix">
|
||||
<input
|
||||
|
@ -236,7 +271,10 @@
|
|||
tab: '',
|
||||
isItemLevel: false,
|
||||
searchQuery: '',
|
||||
searchDates: []
|
||||
searchDates: [],
|
||||
users: [],
|
||||
isFetchingUsers: false,
|
||||
userIdForFiltering: null
|
||||
}
|
||||
},
|
||||
components: {
|
||||
|
@ -247,7 +285,8 @@
|
|||
...mapActions('activity', [
|
||||
'fetchActivities',
|
||||
'fetchCollectionActivities',
|
||||
'fetchItemActivities'
|
||||
'fetchItemActivities',
|
||||
'fetchUsers'
|
||||
]),
|
||||
...mapGetters('activity', [
|
||||
'getActivities'
|
||||
|
@ -314,10 +353,11 @@
|
|||
|
||||
if(this.isRepositoryLevel) {
|
||||
this.fetchActivities({
|
||||
'page': this.activitiesPage,
|
||||
'activitiesPerPage': this.activitiesPerPage,
|
||||
'search': this.searchQuery,
|
||||
'searchDates': [dataInit, dataEnd]
|
||||
page: this.activitiesPage,
|
||||
activitiesPerPage: this.activitiesPerPage,
|
||||
search: this.searchQuery,
|
||||
searchDates: [dataInit, dataEnd],
|
||||
authorId: this.userIdForFiltering
|
||||
})
|
||||
.then((res) => {
|
||||
this.isLoading = false;
|
||||
|
@ -328,11 +368,12 @@
|
|||
});
|
||||
} else if (!this.isRepositoryLevel && !this.isItemLevel) {
|
||||
this.fetchCollectionActivities({
|
||||
'page': this.activitiesPage,
|
||||
'activitiesPerPage': this.activitiesPerPage,
|
||||
'collectionId': this.$route.params.collectionId,
|
||||
'search': this.searchQuery,
|
||||
'searchDates': [dataInit, dataEnd]
|
||||
page: this.activitiesPage,
|
||||
activitiesPerPage: this.activitiesPerPage,
|
||||
collectionId: this.$route.params.collectionId,
|
||||
search: this.searchQuery,
|
||||
searchDates: [dataInit, dataEnd],
|
||||
authorId: this.userIdForFiltering
|
||||
})
|
||||
.then((res) => {
|
||||
this.isLoading = false;
|
||||
|
@ -343,11 +384,12 @@
|
|||
});
|
||||
} else {
|
||||
this.fetchItemActivities({
|
||||
'page': this.activitiesPage,
|
||||
'activitiesPerPage': this.activitiesPerPage,
|
||||
'itemId': this.$route.params.itemId,
|
||||
'search': this.searchQuery,
|
||||
'searchDates': [dataInit, dataEnd]
|
||||
page: this.activitiesPage,
|
||||
activitiesPerPage: this.activitiesPerPage,
|
||||
itemId: this.$route.params.itemId,
|
||||
search: this.searchQuery,
|
||||
searchDates: [dataInit, dataEnd],
|
||||
authorId: this.userIdForFiltering
|
||||
})
|
||||
.then((res) => {
|
||||
this.isLoading = false;
|
||||
|
@ -390,6 +432,10 @@
|
|||
this.searchDates = null;
|
||||
this.searchActivities();
|
||||
},
|
||||
filterActivitiesByUser(user) {
|
||||
this.userIdForFiltering = user != null && user.id != undefined ? user.id : null;
|
||||
this.loadActivities();
|
||||
},
|
||||
dateFormatter(dateObject) {
|
||||
if (dateObject == null || dateObject.length == 0 || dateObject[0] == null || dateObject[1] == null)
|
||||
return "";
|
||||
|
@ -400,7 +446,21 @@
|
|||
moment(dateString[0], this.dateFormat).toDate(),
|
||||
moment(dateString[1], this.dateFormat).toDate()
|
||||
];
|
||||
}
|
||||
},
|
||||
fetchUsersForFiltering: _.debounce(function (search) {
|
||||
|
||||
this.isFetchingUsers = true;
|
||||
|
||||
this.fetchUsers({ search: search })
|
||||
.then((users) => {
|
||||
this.users = users;
|
||||
this.isFetchingUsers = false;
|
||||
})
|
||||
.catch((error) => {
|
||||
this.$console.error(error);
|
||||
this.isFetchingPages = false;
|
||||
});
|
||||
}, 500)
|
||||
},
|
||||
computed: {
|
||||
activities(){
|
||||
|
@ -456,7 +516,7 @@
|
|||
<style lang="scss" scoped>
|
||||
@import '../../scss/_variables.scss';
|
||||
|
||||
.sub-header {
|
||||
.sub-header {
|
||||
min-height: $subheader-height;
|
||||
height: $header-height;
|
||||
padding-left: 0;
|
||||
|
@ -485,7 +545,7 @@
|
|||
.button {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
border-radius: 0 !important;
|
||||
border-radius: 0px !important;
|
||||
height: 1.95rem !important;
|
||||
}
|
||||
|
||||
|
@ -509,7 +569,7 @@
|
|||
color: $blue5;
|
||||
height: 27px;
|
||||
font-size: 18px !important;
|
||||
height: 1.5rem !important;
|
||||
height: 1.75rem !important;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -122,6 +122,25 @@
|
|||
</option>
|
||||
</b-select>
|
||||
</b-field>
|
||||
|
||||
<!-- Textual Search -------------->
|
||||
<b-field class="header-item">
|
||||
<div class="control has-icons-right is-small is-clearfix">
|
||||
<input
|
||||
class="input is-small"
|
||||
:placeholder="$i18n.get('instruction_search')"
|
||||
type="search"
|
||||
:aria-label="$i18n.get('instruction_search') + ' ' + $i18n.get('collections')"
|
||||
autocomplete="on"
|
||||
v-model="searchQuery"
|
||||
@keyup.enter="searchCollections()">
|
||||
<span
|
||||
@click="searchCollections()"
|
||||
class="icon is-right">
|
||||
<i class="tainacan-icon tainacan-icon-search" />
|
||||
</span>
|
||||
</div>
|
||||
</b-field>
|
||||
</div>
|
||||
|
||||
<div class="above-subheader">
|
||||
|
@ -141,11 +160,11 @@
|
|||
</a>
|
||||
</li>
|
||||
<li
|
||||
v-for="(statusOption, index) of $statusHelper.getStatuses()"
|
||||
v-for="(statusOption, index) of $statusHelper.getStatuses().filter((status) => status.slug != 'draft')"
|
||||
:key="index"
|
||||
@click="onChangeTab(statusOption.slug)"
|
||||
:class="{ 'is-active': status == statusOption.slug}"
|
||||
:style="{ marginRight: statusOption.slug == 'private' ? 'auto' : '', marginLeft: statusOption.slug == 'draft' ? 'auto' : '' }"
|
||||
:style="{ marginRight: statusOption.slug == 'private' ? 'auto' : '', marginLeft: statusOption.slug == 'trash' ? 'auto' : '' }"
|
||||
v-tooltip="{
|
||||
content: $i18n.getWithVariables('info_%s_tab_' + statusOption.slug,[$i18n.get('collections')]),
|
||||
autoHide: true,
|
||||
|
@ -310,6 +329,7 @@ export default {
|
|||
status: '',
|
||||
order: 'desc',
|
||||
ordeBy: 'date',
|
||||
searchQuery: '',
|
||||
sortingOptions: [
|
||||
{ label: this.$i18n.get('label_title'), value: 'title' },
|
||||
{ label: this.$i18n.get('label_creation_date'), value: 'date' },
|
||||
|
@ -405,7 +425,8 @@ export default {
|
|||
status: this.status,
|
||||
contextEdit: true,
|
||||
order: this.order,
|
||||
orderby: this.orderBy
|
||||
orderby: this.orderBy,
|
||||
search: this.searchQuery
|
||||
})
|
||||
.then((res) => {
|
||||
this.isLoading = false;
|
||||
|
@ -427,7 +448,11 @@ export default {
|
|||
hasModalCard: true,
|
||||
trapFocus: true
|
||||
});
|
||||
}
|
||||
},
|
||||
searchCollections() {
|
||||
this.page = 1;
|
||||
this.loadCollections();
|
||||
},
|
||||
},
|
||||
created() {
|
||||
this.collectionsPerPage = this.$userPrefs.get('collections_per_page');
|
||||
|
@ -473,18 +498,23 @@ export default {
|
|||
@import '../../scss/_variables.scss';
|
||||
|
||||
.sub-header {
|
||||
min-height: $subheader-height;
|
||||
height: $header-height;
|
||||
min-height: $header-height;
|
||||
height: auto;
|
||||
padding-left: 0;
|
||||
padding-right: 0;
|
||||
border-bottom: 1px solid #ddd;
|
||||
display: inline-flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
flex-wrap: wrap;
|
||||
width: 100%;
|
||||
|
||||
.header-item {
|
||||
margin-bottom: 0 !important;
|
||||
|
||||
&:first-child {
|
||||
margin-right: auto;
|
||||
}
|
||||
&:not(:last-child) {
|
||||
padding-right: 0.5em;
|
||||
}
|
||||
|
@ -497,9 +527,13 @@ export default {
|
|||
cursor: default;
|
||||
}
|
||||
|
||||
.button {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
&:not(:first-child) {
|
||||
.button {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
border-radius: 0 !important;
|
||||
height: 1.95rem !important;
|
||||
}
|
||||
}
|
||||
|
||||
.field {
|
||||
|
@ -515,14 +549,23 @@ export default {
|
|||
font-size: 1.3125rem !important;
|
||||
max-width: 26px;
|
||||
}
|
||||
|
||||
.icon {
|
||||
pointer-events: all;
|
||||
cursor: pointer;
|
||||
color: $blue5;
|
||||
height: 27px;
|
||||
font-size: 18px !important;
|
||||
height: 1.75rem !important;
|
||||
}
|
||||
}
|
||||
|
||||
@media screen and (max-width: 769px) {
|
||||
height: 60px;
|
||||
height: 120px;
|
||||
margin-top: -0.5em;
|
||||
padding-top: 0.9em;
|
||||
|
||||
.header-item {
|
||||
|
||||
.header-item:not(:last-child) {
|
||||
padding-right: 0.2em;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -705,9 +705,6 @@
|
|||
<div
|
||||
v-if="(registeredViewModes[viewMode] != undefined && registeredViewModes[viewMode].skeleton_template != undefined)"
|
||||
v-html="registeredViewModes[viewMode].skeleton_template"/>
|
||||
|
||||
<!-- Admin view modes skeleton -->
|
||||
<!-- <skeleton-items-list v-if="!isOnTheme"/> -->
|
||||
</div>
|
||||
|
||||
<!-- Alert if custom metada is being used for sorting -->
|
||||
|
@ -794,13 +791,20 @@
|
|||
</p>
|
||||
|
||||
<router-link
|
||||
v-if="!isSortingByCustomMetadata && !hasFiltered && (status == undefined || status == '') && !$route.query.iframemode"
|
||||
v-if="!isRepositoryLevel && !isSortingByCustomMetadata && !hasFiltered && (status == undefined || status == '') && !$route.query.iframemode"
|
||||
id="button-create-item"
|
||||
tag="button"
|
||||
class="button is-secondary"
|
||||
:to="{ path: $routerHelper.getNewItemPath(collectionId) }">
|
||||
{{ $i18n.getFrom('items', 'add_new') }}
|
||||
</router-link>
|
||||
<button
|
||||
v-else-if="isRepositoryLevel && !isSortingByCustomMetadata && !hasFiltered && (status == undefined || status == '') && !$route.query.iframemode"
|
||||
id="button-create-item"
|
||||
class="button is-secondary"
|
||||
@click="onOpenCollectionsModal">
|
||||
{{ $i18n.get('add_one_item') }}
|
||||
</button>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
|
@ -821,7 +825,9 @@
|
|||
:active.sync="isFilterModalActive"
|
||||
:width="736"
|
||||
animation="slide-menu"
|
||||
trap-focus>
|
||||
trap-focus
|
||||
aria-modal
|
||||
aria-role="dialog">
|
||||
<div
|
||||
ref="filters-mobile-modal"
|
||||
class="modal-inner-content"
|
||||
|
@ -893,7 +899,6 @@
|
|||
import FiltersTagsList from '../../components/search/filters-tags-list.vue';
|
||||
import FiltersItemsList from '../../components/search/filters-items-list.vue';
|
||||
import Pagination from '../../components/search/pagination.vue'
|
||||
import SkeletonItemsList from '../../components/search/skeleton-items-list.vue'
|
||||
import AdvancedSearch from '../../components/advanced-search/advanced-search.vue';
|
||||
import AvailableImportersModal from '../../components/other/available-importers-modal.vue';
|
||||
import ExposersModal from '../../components/other/exposers-modal.vue';
|
||||
|
@ -1027,7 +1032,6 @@
|
|||
ItemsList,
|
||||
FiltersTagsList,
|
||||
FiltersItemsList,
|
||||
SkeletonItemsList,
|
||||
Pagination,
|
||||
AdvancedSearch,
|
||||
ExposersModal
|
||||
|
@ -1998,7 +2002,7 @@
|
|||
|
||||
.loading-container {
|
||||
position: relative;
|
||||
min-height: 200px;
|
||||
min-height: 50vh;
|
||||
height: auto;
|
||||
}
|
||||
}
|
||||
|
@ -2058,10 +2062,9 @@
|
|||
}
|
||||
|
||||
.table-container {
|
||||
padding-left: 4.166666667%;
|
||||
padding-right: 4.166666667%;
|
||||
padding-left: $page-side-padding;
|
||||
padding-right: $page-side-padding;
|
||||
min-height: 50vh;
|
||||
//height: calc(100% - 82px);
|
||||
}
|
||||
|
||||
.pagination-area {
|
||||
|
|
|
@ -84,6 +84,25 @@
|
|||
</option>
|
||||
</b-select>
|
||||
</b-field>
|
||||
|
||||
<!-- Textual Search -------------->
|
||||
<b-field class="header-item">
|
||||
<div class="control has-icons-right is-small is-clearfix">
|
||||
<input
|
||||
class="input is-small"
|
||||
:placeholder="$i18n.get('instruction_search')"
|
||||
type="search"
|
||||
:aria-label="$i18n.get('instruction_search') + ' ' + $i18n.get('taxonomies')"
|
||||
autocomplete="on"
|
||||
v-model="searchQuery"
|
||||
@keyup.enter="searchTaxonomies()">
|
||||
<span
|
||||
@click="searchTaxonomies()"
|
||||
class="icon is-right">
|
||||
<i class="tainacan-icon tainacan-icon-search" />
|
||||
</span>
|
||||
</div>
|
||||
</b-field>
|
||||
</div>
|
||||
|
||||
<div class="above-subheader">
|
||||
|
@ -231,6 +250,7 @@
|
|||
status: '',
|
||||
order: 'asc',
|
||||
ordeBy: 'date',
|
||||
searchQuery: '',
|
||||
sortingOptions: [
|
||||
{ label: this.$i18n.get('label_title'), value: 'title' },
|
||||
{ label: this.$i18n.get('label_creation_date'), value: 'date' },
|
||||
|
@ -305,7 +325,8 @@
|
|||
taxonomiesPerPage: this.taxonomiesPerPage,
|
||||
status: this.status,
|
||||
order: this.order,
|
||||
orderby: this.orderBy
|
||||
orderby: this.orderBy,
|
||||
search: this.searchQuery
|
||||
})
|
||||
.then((res) => {
|
||||
this.isLoading = false;
|
||||
|
@ -318,6 +339,10 @@
|
|||
getLastTaxonomyNumber() {
|
||||
let last = (Number(this.taxonomiesPerPage * (this.page - 1)) + Number(this.taxonomiesPerPage));
|
||||
return last > this.total ? this.total : last;
|
||||
},
|
||||
searchTaxonomies() {
|
||||
this.page = 1;
|
||||
this.load();
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
|
@ -371,10 +396,15 @@
|
|||
display: inline-flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
flex-wrap: wrap;
|
||||
width: 100%;
|
||||
|
||||
.header-item {
|
||||
margin-bottom: 0 !important;
|
||||
|
||||
&:first-child {
|
||||
margin-right: auto;
|
||||
}
|
||||
&:not(:last-child) {
|
||||
padding-right: 0.5em;
|
||||
}
|
||||
|
@ -387,9 +417,13 @@
|
|||
cursor: default;
|
||||
}
|
||||
|
||||
.button {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
&:not(:first-child) {
|
||||
.button {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
border-radius: 0 !important;
|
||||
height: 1.95rem !important;
|
||||
}
|
||||
}
|
||||
|
||||
.field {
|
||||
|
@ -405,10 +439,19 @@
|
|||
font-size: 1.3125rem !important;
|
||||
max-width: 26px;
|
||||
}
|
||||
|
||||
.icon {
|
||||
pointer-events: all;
|
||||
cursor: pointer;
|
||||
color: $blue5;
|
||||
height: 27px;
|
||||
font-size: 18px !important;
|
||||
height: 1.75rem !important;
|
||||
}
|
||||
}
|
||||
|
||||
@media screen and (max-width: 769px) {
|
||||
height: 60px;
|
||||
height: 160px;
|
||||
margin-top: -0.5em;
|
||||
padding-top: 0.9em;
|
||||
|
||||
|
|
|
@ -681,9 +681,7 @@
|
|||
<div
|
||||
v-if="(registeredViewModes[viewMode] != undefined && registeredViewModes[viewMode].skeleton_template != undefined)"
|
||||
v-html="registeredViewModes[viewMode].skeleton_template"/>
|
||||
|
||||
<!-- Admin view modes skeleton -->
|
||||
<!-- <skeleton-items-list v-if="!isOnTheme"/> -->
|
||||
|
||||
</div>
|
||||
|
||||
<!-- Alert if custom metada is being used for sorting -->
|
||||
|
@ -798,7 +796,9 @@
|
|||
:active.sync="isFilterModalActive"
|
||||
:width="736"
|
||||
animation="slide-menu"
|
||||
trap-focus>
|
||||
trap-focus
|
||||
aria-modal
|
||||
aria-role="dialog">
|
||||
<div
|
||||
autofocus="true"
|
||||
tabindex="-1"
|
||||
|
@ -1918,7 +1918,7 @@
|
|||
|
||||
.loading-container {
|
||||
position: relative;
|
||||
min-height: 200px;
|
||||
min-height: 50vh;
|
||||
height: auto;
|
||||
}
|
||||
}
|
||||
|
@ -1938,8 +1938,8 @@
|
|||
}
|
||||
|
||||
.table-container {
|
||||
padding-left: 4.166666667%;
|
||||
padding-right: 4.166666667%;
|
||||
padding-left: $page-side-padding;
|
||||
padding-right: $page-side-padding;
|
||||
min-height: 50vh;
|
||||
//height: calc(100% - 82px);
|
||||
}
|
||||
|
|
|
@ -20,12 +20,17 @@
|
|||
cursor: default;
|
||||
}
|
||||
}
|
||||
&>.control.has-icons-left .icon {
|
||||
height: 2.125rem;
|
||||
width: 2.125rem;
|
||||
}
|
||||
.dropdown-menu {
|
||||
padding: 0px;
|
||||
margin-top: 0;
|
||||
border-radius: 0px;
|
||||
min-width: 6rem;
|
||||
border: none;
|
||||
z-index: 99;
|
||||
|
||||
.dropdown-content {
|
||||
padding: 0px;
|
||||
|
@ -50,25 +55,29 @@
|
|||
.is-small { color: $gray4; }
|
||||
&.is-active { background-color: $turquoise2; }
|
||||
|
||||
.media-left {
|
||||
margin-right: 0.5rem;
|
||||
}
|
||||
.media-content {
|
||||
display: flex;
|
||||
width: 80%;
|
||||
.media {
|
||||
align-items: center;
|
||||
|
||||
.media-left {
|
||||
margin-right: 0.5rem;
|
||||
}
|
||||
.media-content {
|
||||
display: flex;
|
||||
width: 80%;
|
||||
|
||||
.ellipsed-text {
|
||||
overflow-x: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
margin-right: 3px;
|
||||
.ellipsed-text {
|
||||
overflow-x: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
margin-right: 3px;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
&.is-mobile-modal {
|
||||
@media screen and (max-width: 1088px) {
|
||||
@media screen and (max-width: 768px) {
|
||||
.dropdown-content {
|
||||
max-height: 100vh;
|
||||
}
|
||||
|
@ -130,16 +139,16 @@
|
|||
.tag {
|
||||
background: white;
|
||||
padding-right: 0;
|
||||
padding-left: 0.5em;
|
||||
padding-left: 0.6em;
|
||||
|
||||
&.is-delete {
|
||||
color: $gray4;
|
||||
&::after {
|
||||
height: 30% !important;
|
||||
height: 47% !important;
|
||||
width: 1px !important;
|
||||
}
|
||||
&::before {
|
||||
width: 30% !important;
|
||||
width: 47% !important;
|
||||
height: 1px !important;
|
||||
}
|
||||
&:hover, &:focus {
|
||||
|
@ -278,7 +287,7 @@
|
|||
}
|
||||
}
|
||||
|
||||
@media screen and (min-width: 1024px) {
|
||||
@media screen and (min-width: 768px) {
|
||||
|
||||
.datepicker-header {
|
||||
margin-bottom: 0.5rem;
|
||||
|
|
|
@ -6,12 +6,9 @@
|
|||
margin-right: 0.375rem;
|
||||
max-width: 100%;
|
||||
overflow: hidden;
|
||||
transition: all 0.2s ease;
|
||||
animation-name: appear;
|
||||
animation-duration: 0.2s;
|
||||
|
||||
&:hover, &:hover .tag {
|
||||
background-color: $gray2;
|
||||
}
|
||||
animation-duration: 0.3s;
|
||||
|
||||
.tag {
|
||||
background-color: white;
|
||||
|
@ -22,6 +19,8 @@
|
|||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
animation-name: appear;
|
||||
animation-duration: 0.3s;
|
||||
|
||||
&.is-delete,
|
||||
&.is-delete:hover,
|
||||
|
@ -29,12 +28,28 @@
|
|||
&.is-delete:active {
|
||||
border-radius: 50px !important;
|
||||
border-radius: 50px !important;
|
||||
margin-right: 0px !important;
|
||||
color: $gray4;
|
||||
background-color: transparent;
|
||||
background-color: white;
|
||||
transition: border-width 0.15s linear, background-color 0.15s linear;
|
||||
|
||||
&:hover {
|
||||
background-color: transparent;
|
||||
color: $gray4;
|
||||
&:after,
|
||||
&:before {
|
||||
transition: transform 0.15s linear;
|
||||
}
|
||||
|
||||
&:hover,
|
||||
&:focus {
|
||||
border: solid 1px $gray3 !important;
|
||||
background-color: $gray2;
|
||||
color: $gray5;
|
||||
|
||||
&:after {
|
||||
transform: translateX(-50%) translateY(-50%) rotate(45deg) scale(1.15);
|
||||
}
|
||||
&:before {
|
||||
transform: translateX(-50%) translateY(-50%) rotate(45deg) scale(1.15);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -51,6 +51,7 @@
|
|||
}
|
||||
.b-numberinput {
|
||||
height: 30px;
|
||||
padding: 0 !important;
|
||||
|
||||
.control {
|
||||
margin-right: 0 !important;
|
||||
|
@ -62,6 +63,7 @@
|
|||
button,
|
||||
input {
|
||||
height: 30px !important;
|
||||
text-align: start;
|
||||
}
|
||||
button.is-primary,
|
||||
button.is-primary:hover,
|
||||
|
|
|
@ -111,8 +111,9 @@ $addColors: (
|
|||
);
|
||||
$colors: map-merge($colors, $addColors);
|
||||
|
||||
// Small size
|
||||
// Bulma Variables
|
||||
$size-small: 0.85em; // 0.75em on Bulma.
|
||||
$dropdown-mobile-breakpoint: $tablet;
|
||||
|
||||
// Tainacan Header and side menus
|
||||
$header-height: 52px;
|
||||
|
@ -120,7 +121,7 @@ $subheader-height: 42px;
|
|||
$side-menu-width: 160px;
|
||||
$filter-menu-width: 16.666666667%;
|
||||
$filter-menu-width-theme: 20.833333333%;
|
||||
$page-height: calc(100% - 94px);
|
||||
$page-height: calc(100vh - 94px);
|
||||
|
||||
// Overall Pages padding:
|
||||
$page-side-padding: 4.166666667%;//82px;
|
||||
|
@ -149,11 +150,19 @@ $table-foot-cell-border-width: 1px 0 0 !important;
|
|||
$table-cell-padding: 1.0em 0.75em;
|
||||
|
||||
// Roboto font
|
||||
$family-sans-serif: 'Roboto', sans-serif;
|
||||
$family-sans-serif: 'Roboto', 'Source Sans', 'Helvetica', sans-serif;
|
||||
|
||||
// Bulma's modal (needs to be greather than tainacan-admin-app)
|
||||
$modal-z: 9999999;
|
||||
|
||||
// Grid mixin for display: grid compatibility
|
||||
@mixin display-grid {
|
||||
flex-wrap: wrap;
|
||||
display: flex;
|
||||
display: -ms-grid;
|
||||
display: grid;
|
||||
}
|
||||
|
||||
// A copy of bootstrap's screen reader only class to be used for accessibility.
|
||||
.sr-only {
|
||||
position: absolute;
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
.tainacan-cards-container {
|
||||
min-height: 50vh;
|
||||
padding: 0;
|
||||
display: -ms-grid;
|
||||
display: grid;
|
||||
@include display-grid;
|
||||
-ms-grid-columns: 455px 455px;
|
||||
grid-template-columns: repeat(auto-fill, 455px);
|
||||
grid-gap: 0px;
|
||||
justify-content: space-evenly;
|
||||
|
@ -11,6 +11,7 @@
|
|||
|
||||
@media screen and (max-width: 480px) {
|
||||
width: 91.666666667%;
|
||||
-ms-grid-columns: 100%;
|
||||
grid-template-columns: repeat(auto-fill, 100%);
|
||||
}
|
||||
|
||||
|
|
|
@ -1,8 +1,7 @@
|
|||
.tainacan-grid-container {
|
||||
min-height: 50vh;
|
||||
padding: 0;
|
||||
display: -ms-grid;
|
||||
display: grid;
|
||||
@include display-grid;
|
||||
grid-template-columns: repeat(auto-fill, 285px);
|
||||
grid-gap: 0px;
|
||||
justify-content: space-evenly;
|
||||
|
|
|
@ -78,12 +78,14 @@ body.tainacan-admin-page #adminmenumain, body.tainacan-admin-page #wpfooter, bod
|
|||
border: none;
|
||||
border-radius: 0;
|
||||
animation: none;
|
||||
height: 50px;
|
||||
width: 50px;
|
||||
height: 46px;
|
||||
width: 46px;
|
||||
background-size: initial;
|
||||
}
|
||||
.loading-overlay.is-full-page .loading-icon::after {
|
||||
height: 50px;
|
||||
width: 50px;
|
||||
height: 46px;
|
||||
width: 46px;
|
||||
background-size: initial;
|
||||
top: calc(50% - 25px);
|
||||
left: calc(50% - 25px);
|
||||
}
|
||||
|
@ -94,8 +96,10 @@ a:hover {
|
|||
text-decoration: underline;
|
||||
}
|
||||
.add-link {
|
||||
display: inline;
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
font-size: 0.75rem;
|
||||
margin: 3px 0 6px 0;
|
||||
&.disabled {
|
||||
pointer-events: none;
|
||||
cursor: default;
|
||||
|
@ -105,6 +109,9 @@ a:hover {
|
|||
color: $gray2 !important;
|
||||
}
|
||||
}
|
||||
.tainacan-icon::before {
|
||||
font-size: 0.875rem;
|
||||
}
|
||||
}
|
||||
|
||||
// Generic page container
|
||||
|
|
|
@ -8,4 +8,4 @@
|
|||
@import "../../../node_modules/bulma/sass/elements/button.sass"
|
||||
@import "../../../node_modules/bulma/sass/grid/columns.sass"
|
||||
@import "../../../node_modules/bulma/sass/components/dropdown.sass"
|
||||
@import "../../../node_modules/bulma/sass/components/modal.sass"
|
||||
@import "../../../node_modules/bulma/sass/components/modal.sass"
|
|
@ -133,8 +133,9 @@ return apply_filters( 'tainacan-admin-i18n', [
|
|||
'title_exporter_page' => __( 'Exporter', 'tainacan'),
|
||||
|
||||
// Labels (used mainly on Aria Labels and Inputs)
|
||||
'label' => __( 'label', 'tainacan' ),
|
||||
'label' => __( 'Label', 'tainacan' ),
|
||||
'label_clean' => __( 'Clear', 'tainacan' ),
|
||||
'label_none' => __( 'None', 'tainacan' ),
|
||||
'label_clear_filters' => __( 'Clear filters', 'tainacan' ),
|
||||
'label_and' => __( 'and', 'tainacan' ),
|
||||
'label_selected' => __( 'Selected', 'tainacan' ),
|
||||
|
@ -198,7 +199,9 @@ return apply_filters( 'tainacan-admin-i18n', [
|
|||
'label_select_taxonomy_input_type' => __( 'Input type', 'tainacan' ),
|
||||
'label_taxonomy_allow_new_terms' => __( 'Allow new terms', 'tainacan' ),
|
||||
'label_selectbox_init' => __( 'Select', 'tainacan' ),
|
||||
'label_options' => __( 'Insert options', 'tainacan' ),
|
||||
'label_insert_options' => __( 'Insert options', 'tainacan'),
|
||||
'label_available_terms' => __( 'Available terms', 'tainacan' ),
|
||||
'label_some_available_terms' => __( 'Some available terms', 'tainacan' ),
|
||||
'label_attachments' => __( 'Attachments', 'tainacan' ),
|
||||
'label_attachment' => __( 'Attachment', 'tainacan' ),
|
||||
'label_enabled' => __( 'Enabled', 'tainacan' ),
|
||||
|
@ -211,6 +214,7 @@ return apply_filters( 'tainacan-admin-i18n', [
|
|||
'label_parent_term' => __( 'Parent Term', 'tainacan' ),
|
||||
'label_children_terms' => __( 'children terms', 'tainacan' ),
|
||||
'label_new_term' => __( 'Create New Term', 'tainacan' ),
|
||||
'label_create_and_select' => __( 'Create and Select', 'tainacan' ),
|
||||
'label_new_child' => __( 'New Child', 'tainacan' ),
|
||||
'label_taxonomy_terms' => __( 'Taxonomy Terms', 'tainacan' ),
|
||||
'label_no_parent_term' => __( 'No parent term', 'tainacan' ),
|
||||
|
@ -346,6 +350,7 @@ return apply_filters( 'tainacan-admin-i18n', [
|
|||
'label_show_metadata' => __( 'Show metadata', 'tainacan' ),
|
||||
'label_all_terms' => __( 'All terms', 'tainacan' ),
|
||||
'label_selected_terms' => __( 'Selected terms', 'tainacan' ),
|
||||
'label_selected_term' => __( 'Selected term', 'tainacan' ),
|
||||
'label_all_metadatum_values' => __( 'All metadatum values', 'tainacan' ),
|
||||
'label_selected_metadatum_values' => __( 'Selected metadatum values', 'tainacan' ),
|
||||
'label_editing_item_number' => __( 'Editing item n.', 'tainacan' ),
|
||||
|
@ -444,11 +449,12 @@ return apply_filters( 'tainacan-admin-i18n', [
|
|||
'instruction_image_upload_box' => __( 'Drop an image here or click to upload.', 'tainacan' ),
|
||||
'instruction_select_a_status' => __( 'Select a status:', 'tainacan' ),
|
||||
'instruction_select_a_status2' => __( 'Select a status', 'tainacan' ),
|
||||
'instruction_click_to_select_a_filter_type' => __( 'Click to select a filter type:', 'tainacan' ),
|
||||
'instruction_click_to_select_a_filter_type' => __( 'Click to select a filter type:', 'tainacan' ),
|
||||
'instruction_select_a_parent_term' => __( 'Select a parent term:', 'tainacan' ),
|
||||
'instruction_select_a_metadatum' => __( 'Select a metadatum', 'tainacan' ),
|
||||
'instruction_cover_page' => __( 'Type to search a Page to choose.', 'tainacan' ),
|
||||
'instruction_moderators' => __( 'Type to search a User to add.', 'tainacan' ),
|
||||
'instruction_type_search_users_filter' => __( 'Type to search users to filter...', 'tainacan' ),
|
||||
'instruction_select_a_parent_collection' => __( 'Select a parent collection.', 'tainacan' ),
|
||||
'instruction_select_collection_thumbnail' => __( 'Select a thumbnail image for collection', 'tainacan' ),
|
||||
'instruction_select_item_thumbnail' => __( 'Select a thumbnail image for item', 'tainacan' ),
|
||||
|
@ -532,7 +538,7 @@ return apply_filters( 'tainacan-admin-i18n', [
|
|||
'info_no_terms_created_on_taxonomy' => __( 'No term was created for this taxonomy.', 'tainacan' ),
|
||||
'info_no_terms_found' => __( 'No term was found here', 'tainacan' ),
|
||||
'info_no_more_terms_found' => __( 'No more terms found', 'tainacan' ),
|
||||
'info_no_item_created' => __( 'No item was created in this collection.', 'tainacan' ),
|
||||
'info_no_item_created' => __( 'No item was created so far.', 'tainacan' ),
|
||||
'info_no_page_found' => __( 'No page was found with this name.', 'tainacan' ),
|
||||
'info_no_user_found' => __( 'No user was found with this name.', 'tainacan' ),
|
||||
'info_no_item_found_filter' => __( 'No item was found here with these filters.', 'tainacan' ),
|
||||
|
@ -568,6 +574,7 @@ return apply_filters( 'tainacan-admin-i18n', [
|
|||
'info_showing_taxonomies' => __( 'Showing taxonomies ', 'tainacan' ),
|
||||
'info_showing_activities' => __( 'Showing activities ', 'tainacan' ),
|
||||
'info_showing_processes' => __( 'Showing processes ', 'tainacan' ),
|
||||
'info_showing_terms' => __( 'Showing terms ', 'tainacan' ),
|
||||
'info_warning_remove_from_trash_first' => __( 'Remove this item from trash first' ),
|
||||
'info_to' => __( ' to ', 'tainacan' ),
|
||||
'info_of' => __( ' of ', 'tainacan' ),
|
||||
|
@ -582,7 +589,7 @@ return apply_filters( 'tainacan-admin-i18n', [
|
|||
'info_warning_taxonomy_not_saved' => __( 'Are you sure? The taxonomy is not saved, changes will be lost.', 'tainacan' ),
|
||||
'info_warning_terms_not_saved' => __( 'Are you sure? There are terms not saved, changes will be lost.', 'tainacan' ),
|
||||
'info_warning_orphan_terms' => __( 'Are you sure? This term is parent of other terms. These will be converted to root terms.', 'tainacan' ),
|
||||
'info_no_activities' => __( 'No activities', 'tainacan' ),
|
||||
'info_no_activities' => __( 'No activities yet.', 'tainacan' ),
|
||||
'info_logs_before' => __( 'Before', 'tainacan' ),
|
||||
'info_logs_after' => __( 'After', 'tainacan' ),
|
||||
'info_there_is_no_metadatum' => __( 'There is no metadata here yet.', 'tainacan' ),
|
||||
|
@ -610,11 +617,11 @@ return apply_filters( 'tainacan-admin-i18n', [
|
|||
'info_updated_at' => __( 'Updated at', 'tainacan' ),
|
||||
'info_editing_metadata_values' => __( 'Editing metadata values...', 'tainacan' ),
|
||||
'info_updating_metadata_values' => __( 'Updating metadata values...', 'tainacan' ),
|
||||
'info_type_to_add_items' => __( 'Add items...', 'tainacan' ),
|
||||
'info_type_to_add_items' => __( 'Add items to filter...', 'tainacan' ),
|
||||
'info_type_to_search_items' => __( 'Search items...', 'tainacan' ),
|
||||
'info_type_to_add_terms' => __( 'Add terms...', 'tainacan' ),
|
||||
'info_type_to_add_terms' => __( 'Add terms to filter...', 'tainacan' ),
|
||||
'info_type_to_search_metadata' => __( 'Search metadata...', 'tainacan' ),
|
||||
'info_type_to_add_metadata' => __( 'Add metadata...', 'tainacan' ),
|
||||
'info_type_to_add_metadata' => __( 'Add metadata to filter...', 'tainacan' ),
|
||||
'info_visibility_helper' => __( 'How the item will be available to visualization.', 'tainacan' ),
|
||||
'info_errors_in_form' => __( 'There are errors in the form', 'tainacan' ),
|
||||
'info_no_document_to_item' => __( 'No document was uploaded to this item.', 'tainacan' ),
|
||||
|
@ -649,7 +656,7 @@ return apply_filters( 'tainacan-admin-i18n', [
|
|||
'info_process_status_cancelled' => __('Cancelled', 'tainacan'),
|
||||
'info_process_status_paused' => __('Paused', 'tainacan'),
|
||||
'info_process_status_running' => __('Running', 'tainacan'),
|
||||
'info_warning_process_cancelled' => __( 'Are you sure? This process will be cancelled', 'tainacan' ),
|
||||
'info_warning_process_cancelled' => __( 'Are you sure? This process will be cancelled', 'tainacan' ),
|
||||
'info_empty' => __( 'empty', 'tainacan' ),
|
||||
'info_url_copied' => __( 'URL link copied', 'tainacan' ),
|
||||
'info_other_options' => __( 'Other options: ', 'tainacan'),
|
||||
|
@ -664,31 +671,7 @@ return apply_filters( 'tainacan-admin-i18n', [
|
|||
'info_expose_only_displayed_metadata' => __( 'By checking this option, only metatada that are displayed on the current list will be exposed', 'tainacan' ),
|
||||
'info_initial_value' => __( 'Initial value', 'tainacan' ),
|
||||
'info_final_value' => __( 'Final value', 'tainacan' ),
|
||||
'info_show_interval_on_tag' => __( 'Show interval on tag', 'tainacan' ),
|
||||
|
||||
// Tainacan Metadatum Types
|
||||
'tainacan-text' => __( 'Text', 'tainacan' ),
|
||||
'tainacan-textarea' => __( 'Text area', 'tainacan' ),
|
||||
'tainacan-date' => __( 'Date', 'tainacan' ),
|
||||
'tainacan-numeric' => __( 'Numeric', 'tainacan' ),
|
||||
'tainacan-selectbox' => __( 'Select box', 'tainacan' ),
|
||||
'tainacan-relationship' => __( 'Relationship', 'tainacan' ),
|
||||
'tainacan-taxonomy' => __( 'Taxonomy', 'tainacan' ),
|
||||
'tainacan-compound' => __( 'Compound', 'tainacan' ),
|
||||
|
||||
// Tainacan Filter Types
|
||||
'tainacan-filter-custom-interval' => __( 'Custom Interval', 'tainacan' ),
|
||||
'tainacan-filter-numeric' => __( 'Numeric', 'tainacan' ),
|
||||
'tainacan-filter-date' => __( 'Date', 'tainacan' ),
|
||||
'tainacan-filter-selectbox' => __( 'Select Box', 'tainacan' ),
|
||||
'tainacan-filter-autocomplete' => __( 'Autocomplete', 'tainacan' ),
|
||||
'tainacan-filter-taginput' => __( 'Tag Input', 'tainacan' ),
|
||||
'tainacan-filter-checkbox' => __( 'Check Box', 'tainacan' ),
|
||||
'tainacan-filter-taxonomy-taginput' => __( 'Taxonomy Tag Input', 'tainacan' ),
|
||||
'tainacan-filter-taxonomy-checkbox' => __( 'Taxonomy Check Box', 'tainacan' ),
|
||||
'tainacan-filter-taxonomy-selectbox' => __( 'Taxonomy Select Box', 'tainacan' ),
|
||||
'tainacan-filter-numeric-interval' => __( 'Numeric Interval', 'tainacan' ),
|
||||
'tainacan-filter-numeric-list-interval' => __( 'Numeric Interval List', 'tainacan' ),
|
||||
'info_show_interval_on_tag' => __( 'Show applied interval on tags', 'tainacan' ),
|
||||
|
||||
// Datepicker months
|
||||
'datepicker_month_january' => __( 'January', 'tainacan' ),
|
||||
|
|
|
@ -66,7 +66,7 @@ class REST_Controller extends \WP_REST_Controller {
|
|||
'name' => 'title',
|
||||
'title' => 'title',
|
||||
'id' => 'p',
|
||||
'authorid' => 'author_id',
|
||||
'authorid' => 'author',
|
||||
'authorname' => 'author_name',
|
||||
'search' => 's',
|
||||
'searchterm' => 'search',
|
||||
|
@ -92,7 +92,8 @@ class REST_Controller extends \WP_REST_Controller {
|
|||
'metatype' => 'meta_type',
|
||||
'hierarchical' => 'hierarchical',
|
||||
'exclude' => 'exclude',
|
||||
'excludetree' => 'exclude_tree'
|
||||
'excludetree' => 'exclude_tree',
|
||||
'include' => 'include'
|
||||
];
|
||||
|
||||
$meta_query = [
|
||||
|
@ -147,37 +148,39 @@ class REST_Controller extends \WP_REST_Controller {
|
|||
|
||||
return apply_filters('tainacan-api-prepare-items-args', $args, $request);
|
||||
}
|
||||
|
||||
|
||||
public function add_support_to_tax_query_like($args) {
|
||||
|
||||
|
||||
if (!isset($args['tax_query']) || !is_array($args['tax_query'])) {
|
||||
return $args;
|
||||
}
|
||||
|
||||
|
||||
$new_tax_query = [];
|
||||
|
||||
|
||||
foreach ($args['tax_query'] as $index => $tax_query) {
|
||||
|
||||
|
||||
if ( isset($tax_query['operator']) && $tax_query['operator'] == 'LIKE' &&
|
||||
isset($tax_query['terms']) && is_string($tax_query['terms']) ) {
|
||||
|
||||
|
||||
$terms = get_terms([
|
||||
'taxonomy' => $tax_query['taxonomy'],
|
||||
'fields' => 'ids',
|
||||
'hide_empty' => isset($args['hide_empty']) ? $args['hide_empty'] : true,
|
||||
'search' => $tax_query['terms']
|
||||
]);
|
||||
|
||||
|
||||
$new_tax_query[] = [
|
||||
'taxonomy' => $tax_query['taxonomy'],
|
||||
'terms' => $terms,
|
||||
];
|
||||
|
||||
|
||||
} elseif ( isset($tax_query['operator']) && $tax_query['operator'] == 'NOT LIKE' &&
|
||||
isset($tax_query['terms']) && is_string($tax_query['terms']) ) {
|
||||
|
||||
|
||||
$terms = get_terms([
|
||||
'taxonomy' => $tax_query['taxonomy'],
|
||||
'fields' => 'ids',
|
||||
'hide_empty' => isset($args['hide_empty']) ? $args['hide_empty'] : true,
|
||||
'search' => $tax_query['terms']
|
||||
]);
|
||||
if ($terms) {
|
||||
|
@ -187,18 +190,18 @@ class REST_Controller extends \WP_REST_Controller {
|
|||
'operator' => 'NOT IN'
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
} else {
|
||||
$new_tax_query[] = $tax_query;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
$args['tax_query'] = $new_tax_query;
|
||||
|
||||
|
||||
return $args;
|
||||
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -228,7 +231,7 @@ class REST_Controller extends \WP_REST_Controller {
|
|||
$args[ $mapped_v ][ $index1 ][ $meta_v ] = $request[ $mapped ][ $index1 ][ $meta_v ];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
} else {
|
||||
|
@ -259,7 +262,7 @@ class REST_Controller extends \WP_REST_Controller {
|
|||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Return the fetch_only param
|
||||
*
|
||||
|
@ -269,11 +272,11 @@ class REST_Controller extends \WP_REST_Controller {
|
|||
*/
|
||||
public function get_fetch_only_param(){
|
||||
return [
|
||||
'fetch_only' => [
|
||||
'fetch_only' => array(
|
||||
'type' => 'string/array',
|
||||
'description' => __( 'Fetch only specific attribute. The specifics attributes are the same in schema.', 'tainacan' ),
|
||||
//TODO: explicar o fetch only meta.. cabe aqui?
|
||||
]
|
||||
)
|
||||
];
|
||||
}
|
||||
|
||||
|
@ -285,11 +288,22 @@ class REST_Controller extends \WP_REST_Controller {
|
|||
* @return array|void
|
||||
*/
|
||||
public function get_wp_query_params(){
|
||||
|
||||
$query_params['id'] = array(
|
||||
'description' => __("Limit result to objects with specific id.", 'tainacan'),
|
||||
'type' => 'integer',
|
||||
);
|
||||
|
||||
$query_params['context'] = array(
|
||||
'type' => 'string',
|
||||
'default' => 'view',
|
||||
'description' => 'The context in which the request is made.',
|
||||
'enum' => array(
|
||||
'view',
|
||||
'edit'
|
||||
),
|
||||
);
|
||||
|
||||
$query_params['search'] = array(
|
||||
'description' => __( 'Limit results to those matching a string.', 'tainacan' ),
|
||||
'type' => 'string',
|
||||
|
@ -299,10 +313,7 @@ class REST_Controller extends \WP_REST_Controller {
|
|||
|
||||
$query_params['authorid'] = array(
|
||||
'description' => __("Limit result set to objects assigned to specific authors by id.", 'tainacan'),
|
||||
'type' => 'array',
|
||||
'items' => array(
|
||||
'type' => 'integer',
|
||||
),
|
||||
'type' => 'integer',
|
||||
);
|
||||
|
||||
$query_params['authorname'] = array(
|
||||
|
@ -328,7 +339,7 @@ class REST_Controller extends \WP_REST_Controller {
|
|||
'description' => __( 'Order sort attribute ascending or descending.', 'tainacan' ),
|
||||
'type' => 'string/array',
|
||||
'default' => 'desc',
|
||||
'enum' => array( 'asc', 'desc' ),
|
||||
'enum' => array( 'asc', 'desc', 'ASC', 'DESC' ),
|
||||
);
|
||||
|
||||
$query_params['orderby'] = array(
|
||||
|
@ -386,8 +397,26 @@ class REST_Controller extends \WP_REST_Controller {
|
|||
),
|
||||
'metacompare' => array(
|
||||
'type' => 'string',
|
||||
'description' => __('Operator to test the meta_value. Possible values are =, !=, >, >=, <, <=, LIKE, NOT LIKE, IN, NOT IN, BETWEEN, NOT BETWEEN, NOT EXISTS, REGEXP, NOT REGEXP or RLIKE.'),
|
||||
'description' => __('Operator to test the metavalue'),
|
||||
'default' => '=',
|
||||
'enum' => array(
|
||||
'=',
|
||||
'!=',
|
||||
'>',
|
||||
'>=',
|
||||
'<',
|
||||
'<=',
|
||||
'LIKE',
|
||||
'NOT LIKE',
|
||||
'IN',
|
||||
'NOT IN',
|
||||
'BETWEEN',
|
||||
'NOT BETWEEN',
|
||||
'NOT EXISTS',
|
||||
'REGEXP',
|
||||
'NOT REGEXP',
|
||||
'RLIKE'
|
||||
)
|
||||
),
|
||||
'metaquery' => array(
|
||||
'description' => __('Limits result set to items that have specific custom metadata'),
|
||||
|
@ -405,8 +434,24 @@ class REST_Controller extends \WP_REST_Controller {
|
|||
),
|
||||
'compare' => array(
|
||||
'type' => 'string',
|
||||
'description' => __('Operator to test. Possible values are =, !=, >, >=, <, <=, LIKE, NOT LIKE, IN, NOT IN, BETWEEN, NOT BETWEEN, EXISTS and NOT EXISTS.'),
|
||||
'default' => '='
|
||||
'description' => __('Operator to test.'),
|
||||
'default' => '=',
|
||||
'enum' => array(
|
||||
'=',
|
||||
'!=',
|
||||
'>',
|
||||
'>=',
|
||||
'<',
|
||||
'<=',
|
||||
'LIKE',
|
||||
'NOT LIKE',
|
||||
'IN',
|
||||
'NOT IN',
|
||||
'BETWEEN',
|
||||
'NOT BETWEEN',
|
||||
'EXISTS',
|
||||
'NOT EXISTS'
|
||||
)
|
||||
),
|
||||
'relation' => array(
|
||||
'type' => 'string',
|
||||
|
@ -456,8 +501,24 @@ class REST_Controller extends \WP_REST_Controller {
|
|||
),
|
||||
'compare' => array(
|
||||
'type' => 'string',
|
||||
'description' => __('Operator to test. Possible values are =, !=, >, >=, <, <=, LIKE, NOT LIKE, IN, NOT IN, BETWEEN, NOT BETWEEN, EXISTS and NOT EXISTS.'),
|
||||
'default' => '='
|
||||
'description' => __('Operator to test.'),
|
||||
'default' => '=',
|
||||
'enum' => array(
|
||||
'=',
|
||||
'!=',
|
||||
'>',
|
||||
'>=',
|
||||
'<',
|
||||
'<=',
|
||||
'LIKE',
|
||||
'NOT LIKE',
|
||||
'IN',
|
||||
'NOT IN',
|
||||
'BETWEEN',
|
||||
'NOT BETWEEN',
|
||||
'EXISTS',
|
||||
'NOT EXISTS'
|
||||
)
|
||||
),
|
||||
'dayofweek' => array('type' => 'array'),
|
||||
'inclusive' => array(
|
||||
|
@ -487,7 +548,14 @@ class REST_Controller extends \WP_REST_Controller {
|
|||
),
|
||||
'metadatum' => array(
|
||||
'type' => 'string',
|
||||
'description' => __('Select taxonomy term by. Possible values are term_id, name, slug or term_taxonomy_id. Default value is term_id.')
|
||||
'default' => 'term_id',
|
||||
'description' => __('Select taxonomy term by'),
|
||||
'enum' => array(
|
||||
'term_id',
|
||||
'name',
|
||||
'slug',
|
||||
'term_taxonomy_id'
|
||||
)
|
||||
),
|
||||
'terms' => array(
|
||||
'type' => 'int/string/array',
|
||||
|
@ -495,13 +563,24 @@ class REST_Controller extends \WP_REST_Controller {
|
|||
),
|
||||
'operator' => array(
|
||||
'type' => 'string',
|
||||
'description' => __('Operator to test. Possible values are IN, NOT IN, AND, EXISTS and NOT EXISTS'),
|
||||
'default' => 'IN'
|
||||
'description' => __('Operator to test.'),
|
||||
'default' => 'IN',
|
||||
'enum' => array(
|
||||
'IN',
|
||||
'NOT IN',
|
||||
'AND',
|
||||
'EXISTS',
|
||||
'NOT EXISTS'
|
||||
)
|
||||
),
|
||||
'relation' => array(
|
||||
'type' => 'string',
|
||||
'description' => __('The logical relationship between each inner taxonomy array when there is more than one. Possible values are AND, OR. Do not use with a single inner taxonomy array.'),
|
||||
'default' => 'AND'
|
||||
'description' => __('The logical relationship between each inner taxonomy array when there is more than one. Do not use with a single inner taxonomy array.'),
|
||||
'default' => 'AND',
|
||||
'enum' => array(
|
||||
'AND',
|
||||
'OR'
|
||||
)
|
||||
),
|
||||
),
|
||||
'type' => 'array'
|
||||
|
@ -509,11 +588,11 @@ class REST_Controller extends \WP_REST_Controller {
|
|||
),
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
function get_repository_schema( \Tainacan\Repositories\Repository $repository ) {
|
||||
|
||||
|
||||
$schema = [];
|
||||
|
||||
|
||||
$map = $repository->get_map();
|
||||
|
||||
foreach ($map as $mapped => $value){
|
||||
|
@ -522,14 +601,14 @@ class REST_Controller extends \WP_REST_Controller {
|
|||
'type' => $value['type']
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
return $schema;
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
function get_permissions_schema() {
|
||||
|
||||
|
||||
return [
|
||||
'current_user_can_edit' => [
|
||||
'description' => esc_html__('Whether current user can edit this object', 'tainacan'),
|
||||
|
@ -542,12 +621,12 @@ class REST_Controller extends \WP_REST_Controller {
|
|||
'context' => 'edit'
|
||||
]
|
||||
];
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
function get_base_properties_schema() {
|
||||
return [
|
||||
|
||||
|
||||
'id' => [
|
||||
'description' => esc_html__( 'Unique identifier for the object.', 'tainacan' ),
|
||||
'type' => 'integer',
|
||||
|
@ -556,7 +635,7 @@ class REST_Controller extends \WP_REST_Controller {
|
|||
]
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
?>
|
||||
|
|
|
@ -42,38 +42,48 @@ class REST_Background_Processes_Controller extends REST_Controller {
|
|||
],
|
||||
'all_users' => [
|
||||
'type' => 'bool',
|
||||
'description' => __( 'Whether to return processes from all users (if current user is admin). Default false.', 'tainacan' ),
|
||||
'description' => __( 'Whether to return processes from all users (if current user is admin).', 'tainacan' ),
|
||||
'default' => false,
|
||||
],
|
||||
'status' => [
|
||||
'type' => 'string',
|
||||
'description' => __( '"open" returns only processes currently running. "closed" returns only finished or aborted. "all" returns all. Default "all"', 'tainacan' ),
|
||||
'description' => __( '"open" returns only processes currently running. "closed" returns only finished or aborted. "all" returns all.', 'tainacan' ),
|
||||
'default' => 'all',
|
||||
'enum' => array(
|
||||
'open',
|
||||
'closed',
|
||||
'all'
|
||||
)
|
||||
],
|
||||
'perpage' => [
|
||||
'type' => 'integer',
|
||||
'description' => __( 'Number of processes to return per page. Default 10', 'tainacan' ),
|
||||
'description' => __( 'Number of processes to return per page', 'tainacan' ),
|
||||
'default' => 10,
|
||||
],
|
||||
'paged' => [
|
||||
'type' => 'integer',
|
||||
'description' => __( 'Page to retrieve. Default 1', 'tainacan' ),
|
||||
'description' => __( 'Page to retrieve', 'tainacan' ),
|
||||
'default' => 1
|
||||
],
|
||||
'recent' => [
|
||||
'type' => 'bool',
|
||||
'description' => __( 'Returns only processes created or updated recently', 'tainacan' ),
|
||||
'default' => false
|
||||
],
|
||||
],
|
||||
),
|
||||
));
|
||||
register_rest_route($this->namespace, '/' . $this->rest_base . '/(?P<id>[0-9]+)', array(
|
||||
|
||||
|
||||
array(
|
||||
'methods' => \WP_REST_Server::READABLE,
|
||||
'callback' => array($this, 'get_item'),
|
||||
'permission_callback' => array($this, 'bg_processes_permissions_check'),
|
||||
),
|
||||
|
||||
|
||||
));
|
||||
register_rest_route($this->namespace, '/' . $this->rest_base . '/(?P<id>[0-9]+)', array(
|
||||
|
||||
|
||||
array(
|
||||
'methods' => \WP_REST_Server::EDITABLE,
|
||||
'callback' => array($this, 'update_item'),
|
||||
|
@ -82,27 +92,31 @@ class REST_Background_Processes_Controller extends REST_Controller {
|
|||
'status' => [
|
||||
'type' => 'string',
|
||||
'description' => __( '"open" or "closed" ', 'tainacan' ),
|
||||
'enum' => array(
|
||||
'open',
|
||||
'closed'
|
||||
)
|
||||
]
|
||||
],
|
||||
),
|
||||
|
||||
|
||||
));
|
||||
|
||||
register_rest_route($this->namespace, '/' . $this->rest_base . '/(?P<id>[0-9]+)', array(
|
||||
|
||||
|
||||
array(
|
||||
'methods' => \WP_REST_Server::DELETABLE,
|
||||
'callback' => array($this, 'delete_item'),
|
||||
'permission_callback' => array($this, 'bg_processes_permissions_check'),
|
||||
|
||||
|
||||
),
|
||||
|
||||
|
||||
));
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @param \WP_REST_Request $request
|
||||
|
@ -141,7 +155,7 @@ class REST_Background_Processes_Controller extends REST_Controller {
|
|||
$user_q = $wpdb->prepare("AND user_id = %d", $request['user_id']);
|
||||
}
|
||||
|
||||
if ( isset($user_q['all_users']) && $user_q['all_users'] ) {
|
||||
if ( isset($request['all_users']) && $request['all_users'] ) {
|
||||
$user_q = "";
|
||||
}
|
||||
}
|
||||
|
@ -154,7 +168,7 @@ class REST_Background_Processes_Controller extends REST_Controller {
|
|||
$status_q = "AND done = 1";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$recent_q = '';
|
||||
if ( isset($request['recent']) && $request['recent'] !== false ) {
|
||||
$recent_q = "AND (processed_last >= NOW() - INTERVAL 10 MINUTE OR queued_on >= NOW() - INTERVAL 10 MINUTE)";
|
||||
|
@ -180,7 +194,7 @@ class REST_Background_Processes_Controller extends REST_Controller {
|
|||
|
||||
$rest_response->header('X-WP-Total', (int) $total_items);
|
||||
$rest_response->header('X-WP-TotalPages', (int) $max_pages);
|
||||
|
||||
|
||||
return $rest_response;
|
||||
|
||||
}
|
||||
|
@ -314,9 +328,9 @@ class REST_Background_Processes_Controller extends REST_Controller {
|
|||
|
||||
public function get_log_url($id, $action, $type = '') {
|
||||
$suffix = $type ? '-' . $type : '';
|
||||
|
||||
|
||||
$filename = 'bg-' . $action . '-' . $id . $suffix . '.log';
|
||||
|
||||
|
||||
$upload_url = wp_upload_dir();
|
||||
|
||||
if (!file_exists( $upload_url['basedir'] . '/tainacan/' . $filename )) {
|
||||
|
@ -325,7 +339,7 @@ class REST_Background_Processes_Controller extends REST_Controller {
|
|||
|
||||
$upload_url = trailingslashit( $upload_url['baseurl'] );
|
||||
$logs_url = $upload_url . 'tainacan/' . $filename;
|
||||
|
||||
|
||||
return $logs_url;
|
||||
|
||||
}
|
||||
|
|
|
@ -455,9 +455,6 @@ class REST_Bulkedit_Controller extends REST_Controller {
|
|||
* @return array|void
|
||||
*/
|
||||
public function get_create_params($object_name = null) {
|
||||
$query_params['context']['default'] = 'view';
|
||||
|
||||
array_merge($query_params, parent::get_wp_query_params());
|
||||
|
||||
$query_params['title'] = array(
|
||||
'description' => __('Limits the result set to items with a specific title'),
|
||||
|
@ -477,7 +474,11 @@ class REST_Bulkedit_Controller extends REST_Controller {
|
|||
'description' => __( 'Whether to use the current query to select posts', 'tainacan' ),
|
||||
];
|
||||
|
||||
$query_params = array_merge($query_params, parent::get_meta_queries_params());
|
||||
$query_params = array_merge(
|
||||
$query_params,
|
||||
parent::get_wp_query_params(),
|
||||
parent::get_meta_queries_params()
|
||||
);
|
||||
|
||||
return $query_params;
|
||||
}
|
||||
|
|
|
@ -43,7 +43,7 @@ class REST_Collections_Controller extends REST_Controller {
|
|||
'methods' => \WP_REST_Server::READABLE,
|
||||
'callback' => array($this, 'get_items'),
|
||||
'permission_callback' => array($this, 'get_items_permissions_check'),
|
||||
'args' => $this->get_wp_query_params(),
|
||||
'args' => $this->get_endpoint_args_for_item_schema(\WP_REST_Server::READABLE),
|
||||
),
|
||||
array(
|
||||
'methods' => \WP_REST_Server::CREATABLE,
|
||||
|
@ -58,7 +58,7 @@ class REST_Collections_Controller extends REST_Controller {
|
|||
'methods' => \WP_REST_Server::READABLE,
|
||||
'callback' => array($this, 'get_item'),
|
||||
'permission_callback' => array($this, 'get_item_permissions_check'),
|
||||
'args' => $this->get_endpoint_args_for_item_schema(\WP_REST_Server::READABLE),
|
||||
'args' => $this->get_wp_query_params(),
|
||||
|
||||
),
|
||||
array(
|
||||
|
@ -73,8 +73,8 @@ class REST_Collections_Controller extends REST_Controller {
|
|||
'permission_callback' => array($this, 'delete_item_permissions_check'),
|
||||
'args' => array(
|
||||
'permanently' => array(
|
||||
'description' => __('To delete permanently, you can pass \'permanently\' as true. By default this will only trash collection'),
|
||||
'default' => 'false'
|
||||
'description' => __('To delete permanently, you can pass \'permanently\' as 1. By default this will only trash collection'),
|
||||
'default' => '0',
|
||||
),
|
||||
)
|
||||
),
|
||||
|
@ -478,12 +478,6 @@ class REST_Collections_Controller extends REST_Controller {
|
|||
$endpoint_args = [];
|
||||
if($method === \WP_REST_Server::READABLE) {
|
||||
|
||||
$endpoint_args['context'] = array(
|
||||
'type' => 'string',
|
||||
'default' => 'view',
|
||||
'items' => array( 'view, edit' )
|
||||
);
|
||||
|
||||
$endpoint_args['name'] = array(
|
||||
'description' => __('Limits the result set to collections with a specific name'),
|
||||
'type' => 'string',
|
||||
|
|
|
@ -1,336 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace Tainacan\API\EndPoints;
|
||||
|
||||
use \Tainacan\API\REST_Controller;
|
||||
use Tainacan\Entities;
|
||||
use Tainacan\Repositories;
|
||||
use Tainacan\Entities\Entity;
|
||||
use Tainacan\Tests\TAINACAN_REST_Collections_Controller;
|
||||
|
||||
class REST_Export_Controller extends REST_Controller {
|
||||
private $item_metadata_repository;
|
||||
private $items_repository;
|
||||
private $collection_repository;
|
||||
private $metadatum_repository;
|
||||
|
||||
public function __construct() {
|
||||
$this->rest_base = 'export';
|
||||
parent::__construct();
|
||||
add_action('init', array(&$this, 'init_objects'), 11);
|
||||
}
|
||||
|
||||
/**
|
||||
* Initialize objects after post_type register
|
||||
*
|
||||
* @throws \Exception
|
||||
*/
|
||||
public function init_objects() {
|
||||
$this->metadatum_repository = Repositories\Metadata::get_instance();
|
||||
$this->item_metadata_repository = Repositories\Item_Metadata::get_instance();
|
||||
$this->items_repository = Repositories\Items::get_instance();
|
||||
$this->collection_repository = Repositories\Collections::get_instance();
|
||||
}
|
||||
|
||||
/**
|
||||
* If POST on metadatum/collection/<collection_id>, then
|
||||
* a metadatum will be created in matched collection and all your item will receive this metadatum
|
||||
*
|
||||
* If POST on metadatum/item/<item_id>, then a value will be added in a metadatum and metadatum passed
|
||||
* id body of requisition
|
||||
*
|
||||
* Both of GETs return the metadatum of matched objects
|
||||
*
|
||||
* @throws \Exception
|
||||
*/
|
||||
public function register_routes() {
|
||||
register_rest_route($this->namespace, '/' . $this->rest_base. '/collection/(?P<collection_id>[\d]+)',
|
||||
array(
|
||||
array(
|
||||
'methods' => \WP_REST_Server::READABLE,
|
||||
'callback' => array($this, 'get_items'),
|
||||
'permission_callback' => array($this, 'get_items_permissions_check'),
|
||||
'args' => $this->get_endpoint_args_for_item_schema(\WP_REST_Server::READABLE),
|
||||
),
|
||||
)
|
||||
);
|
||||
register_rest_route($this->namespace, '/' . $this->rest_base. '/item/(?P<item_id>[\d]+)',
|
||||
array(
|
||||
array(
|
||||
'methods' => \WP_REST_Server::READABLE,
|
||||
'callback' => array($this, 'get_item'),
|
||||
'permission_callback' => array($this, 'get_item_permissions_check'),
|
||||
'args' => $this->get_endpoint_args_for_item_schema(\WP_REST_Server::READABLE),
|
||||
),
|
||||
)
|
||||
);
|
||||
register_rest_route($this->namespace, '/' . $this->rest_base,
|
||||
array(
|
||||
array(
|
||||
'methods' => \WP_REST_Server::READABLE,
|
||||
'callback' => array($this, 'get_items'),
|
||||
'permission_callback' => array($this, 'get_items_permissions_check'),
|
||||
'args' => $this->get_wp_query_params(),
|
||||
)
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param \WP_REST_Request $request
|
||||
*
|
||||
* @return \WP_Error|\WP_REST_Response
|
||||
*/
|
||||
public function get_item( $request ) { }
|
||||
|
||||
/**
|
||||
* @param \WP_REST_Request $request
|
||||
*
|
||||
* @return bool|\WP_Error
|
||||
* @throws \Exception
|
||||
*/
|
||||
public function get_item_permissions_check( $request ) {
|
||||
if(isset($request['collection_id'])) {
|
||||
$collection = $this->collection_repository->fetch($request['collection_id']);
|
||||
if($collection instanceof Entities\Collection) {
|
||||
if (! $collection->can_read()) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
} elseif(isset($request['item_id'])) {
|
||||
$item = $this->items_repository->fetch($request['item_id']);
|
||||
if($item instanceof Entities\Item) {
|
||||
if (! $item->can_read()) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
} else { // Exporting all
|
||||
$dummy = new Entities\Collection();
|
||||
return current_user_can($dummy->get_capabilities()->read); // Need to check Colletion by collection
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param \Tainacan\Entities\Item $item
|
||||
* @param \WP_REST_Request $request
|
||||
*
|
||||
* @return array|\WP_Error|\WP_REST_Response
|
||||
*/
|
||||
public function prepare_item_for_response( $item, $request ) {
|
||||
$items_metadata = $item->get_metadata();
|
||||
|
||||
$prepared_item = [];
|
||||
|
||||
foreach ($items_metadata as $item_metadata){
|
||||
$prepared_item[] = $item_metadata->_toArray();
|
||||
}
|
||||
|
||||
return $prepared_item;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param \WP_REST_Request $request
|
||||
* @param \WP_Query|Entities\Item $query
|
||||
* @param array $args
|
||||
* @return \WP_Error|number
|
||||
*/
|
||||
public function export($request, $query, $args) {
|
||||
|
||||
$type = \Tainacan\Exposers_Handler::request_has_type($request);
|
||||
$path = wp_upload_dir();
|
||||
$path = $path['path'];
|
||||
$filename = $path.date('YmdHis').'-tainacan-export.'.$type->get_extension();
|
||||
$pid = -1;
|
||||
|
||||
$log = \Tainacan\Entities\Log::create(
|
||||
__('Export Process', 'tainacan'),
|
||||
__('Exporting Data', 'tainacan').'\nArgs: '.print_r($args, true),
|
||||
['file' => $filename],
|
||||
[],
|
||||
'processing'
|
||||
);
|
||||
|
||||
$body = json_decode( $request->get_body(), true );
|
||||
$background = ! (isset($body['export-background']) && $body['export-background'] == false);
|
||||
if( $background ) {
|
||||
$pid = pcntl_fork();
|
||||
} else {
|
||||
$pid = true;
|
||||
}
|
||||
if ($pid === -1) {
|
||||
$error = new \WP_Error('could not fork');
|
||||
$log = \Tainacan\Entities\Log::create(
|
||||
__('Export Process Error', 'tainacan'),
|
||||
__('Exporting Error', 'tainacan').'\\nArgs: '.print_r($args, true).'\\nError: could not fork',
|
||||
$error,
|
||||
[],
|
||||
'error'
|
||||
);
|
||||
remove_filter( 'rest_request_after_callbacks', [\Tainacan\Exposers_Handler::get_instance(), 'rest_request_after_callbacks'], 10, 3 ); //exposer mapping
|
||||
remove_filter( 'tainacan-rest-response', [\Tainacan\Exposers_Handler::get_instance(), 'rest_response'], 10, 2 ); // exposer types
|
||||
return $log;
|
||||
} elseif ($pid) { // we are the parent or run at foreground
|
||||
try {
|
||||
ignore_user_abort(true);
|
||||
set_time_limit(0);
|
||||
ini_set("memory_limit", "256M");
|
||||
|
||||
if($background) { // wait for child to respond and exit and reconnect database if is forked
|
||||
$status = null;
|
||||
pcntl_wait($status);
|
||||
global $wpdb;
|
||||
$wpdb->db_connect();
|
||||
}
|
||||
|
||||
$response = [];
|
||||
if(isset($request['collection_id'])) { // One Colletion
|
||||
$collection_id = $request['collection_id'];
|
||||
$items = $query;
|
||||
if ($items->have_posts()) {
|
||||
while ( $items->have_posts() ) { //TODO write line by line
|
||||
$items->the_post();
|
||||
|
||||
$item = new Entities\Item($items->post);
|
||||
|
||||
$prepared_item = $this->prepare_item_for_response($item, $request);
|
||||
|
||||
array_push($response, $prepared_item);
|
||||
}
|
||||
wp_reset_postdata();
|
||||
}
|
||||
} elseif (isset($request['item_id'])) { // One Item
|
||||
|
||||
$item = new Entities\Item($request['item_id']);
|
||||
if($item->get_id() > 0) {
|
||||
$prepared_item = $this->prepare_item_for_response($item, $request);
|
||||
|
||||
$response = [$prepared_item];
|
||||
}
|
||||
} else { // Export All
|
||||
$collections = $query;
|
||||
$collection_controller = new REST_Collections_Controller();
|
||||
if ($collections->have_posts()) {
|
||||
while ($collections->have_posts()) {
|
||||
$collections->the_post();
|
||||
$collection_id = $collections->post->ID;
|
||||
$collection = \Tainacan\Repositories\Repository::get_entity_by_post($collections->post);
|
||||
|
||||
$prepared_collection = $collection_controller->prepare_item_for_response($collection, $request);
|
||||
|
||||
$prepared_items = [];
|
||||
|
||||
$items = $this->items_repository->fetch($args, $collection_id, 'WP_Query');
|
||||
if ($items->have_posts()) {
|
||||
while ( $items->have_posts() ) { //TODO write line by line
|
||||
$items->the_post();
|
||||
|
||||
$item = new Entities\Item($items->post);
|
||||
|
||||
$prepared_item = $this->prepare_item_for_response($item, $request);
|
||||
|
||||
array_push($prepared_items, $prepared_item);
|
||||
}
|
||||
wp_reset_postdata();
|
||||
}
|
||||
|
||||
$prepared_collection['items'] = $prepared_items;
|
||||
array_push($prepared_collection, $response);
|
||||
}
|
||||
wp_reset_postdata();
|
||||
}
|
||||
}
|
||||
|
||||
$rest_response = new \WP_REST_Response(apply_filters('tainacan-rest-response', $response, $request));
|
||||
$data = $rest_response->get_data();
|
||||
file_put_contents($filename, is_string($data) ? $data : print_r($data, true));
|
||||
|
||||
if($background) {
|
||||
$log->set_status('publish');
|
||||
$logs = \Tainacan\Repositories\Logs::get_instance();
|
||||
$logs->update($log);
|
||||
exit(1);
|
||||
} else {
|
||||
return $rest_response->get_data();
|
||||
}
|
||||
} catch (\Exception $e) {
|
||||
if($background) {
|
||||
exit(1);
|
||||
} else {
|
||||
throw $e;
|
||||
}
|
||||
}
|
||||
} else { // we are the child
|
||||
|
||||
remove_filter( 'rest_request_after_callbacks', [\Tainacan\Exposers_Handler::get_instance(), 'rest_request_after_callbacks'], 10, 3 ); //exposer mapping
|
||||
remove_filter( 'tainacan-rest-response', [\Tainacan\Exposers_Handler::get_instance(), 'rest_response'], 10, 2 ); // exposer types
|
||||
return $log;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @param \WP_REST_Request $request
|
||||
*
|
||||
* @return \WP_Error|\WP_REST_Response
|
||||
*/
|
||||
public function get_items( $request ) {
|
||||
$args = $this->prepare_filters($request); // TODO default args
|
||||
$rest_response = new \WP_REST_Response([], 200); // TODO error, empty response
|
||||
|
||||
if(isset($request['collection_id'])) { // One Colletion
|
||||
$collection_id = $request['collection_id'];
|
||||
$items = $this->items_repository->fetch($args, $collection_id, 'WP_Query');
|
||||
|
||||
$response = $this->export($request, $items, $args);
|
||||
|
||||
$total_items = $items->found_posts;
|
||||
$ret = $response instanceof Entity ? $response->__toArray() : $response;
|
||||
$rest_response = new \WP_REST_Response($ret, 200);
|
||||
|
||||
$rest_response->header('X-WP-Total', (int) $total_items);
|
||||
} elseif (isset($request['item_id'])) { // One Item
|
||||
|
||||
$item = new Entities\Item($request['item_id']);
|
||||
if($item->get_id() > 0) {
|
||||
$response = $this->export($request, $item, $args);
|
||||
|
||||
$total_items = 1;
|
||||
$max_pages = 1;
|
||||
|
||||
$rest_response = new \WP_REST_Response($response->__toArray(), 200);
|
||||
|
||||
$rest_response->header('X-WP-Total', 1);
|
||||
$rest_response->header('X-WP-TotalPages', 1);
|
||||
}
|
||||
} else { // Export All
|
||||
$Tainacan_Collection = \Tainacan\Repositories\Collections::get_instance();
|
||||
$collections = $Tainacan_Collection->fetch(['post_status' => 'publish'], 'WP_Query');
|
||||
|
||||
$response = $this->export($request, $collections, $args);
|
||||
$total_items = $collections->found_posts;
|
||||
$ret = $response instanceof Entity ? $response->__toArray() : $response;
|
||||
$rest_response = new \WP_REST_Response($ret, 200);
|
||||
|
||||
$rest_response->header('X-WP-Total', (int) $total_items);
|
||||
}
|
||||
|
||||
return $rest_response;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param \WP_REST_Request $request
|
||||
*
|
||||
* @return bool|\WP_Error
|
||||
* @throws \Exception
|
||||
*/
|
||||
public function get_items_permissions_check( $request ) {
|
||||
return $this->get_item_permissions_check($request);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
|
@ -121,6 +121,7 @@ class REST_Exporters_Controller extends REST_Controller {
|
|||
|
||||
if ($object = $Tainacan_Exporter_Handler->initialize_exporter($slug)) {
|
||||
$response = $object->_to_Array();
|
||||
$Tainacan_Exporter_Handler->save_exporter_instance($object);
|
||||
return new \WP_REST_Response($response, 201);
|
||||
} else {
|
||||
return new \WP_REST_Response([
|
||||
|
@ -146,13 +147,14 @@ class REST_Exporters_Controller extends REST_Controller {
|
|||
foreach ($body as $att => $value) {
|
||||
$attributes[$att] = $value;
|
||||
}
|
||||
|
||||
$importer = $_SESSION['tainacan_exporter'][$session_id];
|
||||
if($importer) {
|
||||
global $Tainacan_Exporter_Handler;
|
||||
$exporter = $Tainacan_Exporter_Handler->get_exporter_instance_by_session_id($session_id);
|
||||
|
||||
if($exporter) {
|
||||
foreach ($body as $att => $value) {
|
||||
if ($att == 'collection') {
|
||||
if (is_array($value) && isset($value['id'])) {
|
||||
$importer->add_collection($value);
|
||||
$exporter->add_collection($value);
|
||||
continue;
|
||||
} else {
|
||||
return new \WP_REST_Response([
|
||||
|
@ -162,12 +164,13 @@ class REST_Exporters_Controller extends REST_Controller {
|
|||
}
|
||||
}
|
||||
$method = 'set_' . $att;
|
||||
if (method_exists($importer, $method)) {
|
||||
$importer->$method($value);
|
||||
if (method_exists($exporter, $method)) {
|
||||
$exporter->$method($value);
|
||||
}
|
||||
}
|
||||
|
||||
$response = $importer->_to_Array();
|
||||
$response = $exporter->_to_Array();
|
||||
$Tainacan_Exporter_Handler->save_exporter_instance($exporter);
|
||||
return new \WP_REST_Response( $response, 200 );
|
||||
}
|
||||
|
||||
|
@ -192,7 +195,8 @@ class REST_Exporters_Controller extends REST_Controller {
|
|||
*/
|
||||
public function run($request) {
|
||||
$session_id = $request['session_id'];
|
||||
$exporter = $_SESSION['tainacan_exporter'][$session_id];
|
||||
global $Tainacan_Exporter_Handler;
|
||||
$exporter = $Tainacan_Exporter_Handler->get_exporter_instance_by_session_id($session_id);
|
||||
|
||||
if(!$exporter) {
|
||||
return new \WP_REST_Response([
|
||||
|
@ -212,6 +216,7 @@ class REST_Exporters_Controller extends REST_Controller {
|
|||
$response = [
|
||||
'bg_process_id' => $process->ID
|
||||
];
|
||||
$Tainacan_Exporter_Handler->delete_exporter_instance($exporter);
|
||||
return new \WP_REST_Response( $response, 200 );
|
||||
}
|
||||
|
||||
|
|
|
@ -59,7 +59,6 @@ class REST_Filter_Types_Controller extends REST_Controller {
|
|||
$filter_type = new $name();
|
||||
|
||||
$filter_arr = $filter_type->_toArray();
|
||||
$filter_arr['name'] = $item;
|
||||
|
||||
return $filter_arr;
|
||||
}
|
||||
|
|
|
@ -83,8 +83,8 @@ class REST_Filters_Controller extends REST_Controller {
|
|||
'permission_callback' => array($this, 'delete_item_permissions_check'),
|
||||
'args' => array(
|
||||
'permanently' => array(
|
||||
'description' => __('To delete permanently, you can pass \'permanently\' as true. By default this will only trash collection'),
|
||||
'default' => 'false'
|
||||
'description' => __('To delete permanently, you can pass \'permanently\' as 1. By default this will only trash collection'),
|
||||
'default' => '0'
|
||||
),
|
||||
)
|
||||
),
|
||||
|
@ -122,13 +122,11 @@ class REST_Filters_Controller extends REST_Controller {
|
|||
if(empty($received_type)){
|
||||
throw new \InvalidArgumentException('The type can\'t be empty');
|
||||
} elseif(!strrchr($received_type, '_')){
|
||||
$received_type = ucfirst(strtolower($received_type));
|
||||
$type = ucfirst(strtolower($received_type));
|
||||
} else {
|
||||
$received_type = ucwords(strtolower($received_type), '_');
|
||||
$type = ucwords(strtolower($received_type), '_\\');
|
||||
}
|
||||
|
||||
$type = "Tainacan\Filter_Types\\$received_type";
|
||||
|
||||
$filter_type = new $type();
|
||||
|
||||
foreach ($filter as $attribute => $value){
|
||||
|
@ -471,11 +469,10 @@ class REST_Filters_Controller extends REST_Controller {
|
|||
public function get_endpoint_args_for_item_schema( $method = null ) {
|
||||
$endpoint_args = [];
|
||||
if($method === \WP_REST_Server::READABLE) {
|
||||
$endpoint_args['context'] = array(
|
||||
'type' => 'string',
|
||||
'default' => 'view',
|
||||
'items' => array( 'view, edit' )
|
||||
);
|
||||
$endpoint_args = array_merge(
|
||||
$endpoint_args,
|
||||
parent::get_wp_query_params()
|
||||
);
|
||||
} elseif ($method === \WP_REST_Server::CREATABLE || $method === \WP_REST_Server::EDITABLE) {
|
||||
$map = $this->filter_repository->get_map();
|
||||
|
||||
|
@ -500,16 +497,17 @@ class REST_Filters_Controller extends REST_Controller {
|
|||
* @return array|void
|
||||
*/
|
||||
public function get_wp_query_params() {
|
||||
$query_params['context']['default'] = 'view';
|
||||
|
||||
$query_params = array_merge($query_params, parent::get_wp_query_params());
|
||||
|
||||
$query_params['name'] = array(
|
||||
'description' => __('Limits the result set to filters with a specific name'),
|
||||
'type' => 'string',
|
||||
);
|
||||
|
||||
$query_params = array_merge($query_params, parent::get_meta_queries_params());
|
||||
$query_params = array_merge(
|
||||
$query_params,
|
||||
parent::get_wp_query_params(),
|
||||
parent::get_meta_queries_params()
|
||||
);
|
||||
|
||||
return $query_params;
|
||||
}
|
||||
|
|
|
@ -165,6 +165,7 @@ class REST_Importers_Controller extends REST_Controller {
|
|||
|
||||
if ($object = $Tainacan_Importer_Handler->initialize_importer($slug)) {
|
||||
$response = $object->_to_Array();
|
||||
$Tainacan_Importer_Handler->save_importer_instance($object);
|
||||
return new \WP_REST_Response($response, 201);
|
||||
} else {
|
||||
return new \WP_REST_Response([
|
||||
|
@ -192,9 +193,10 @@ class REST_Importers_Controller extends REST_Controller {
|
|||
foreach ($body as $att => $value){
|
||||
$attributes[$att] = $value;
|
||||
}
|
||||
|
||||
$importer = $_SESSION['tainacan_importer'][$session_id];
|
||||
|
||||
|
||||
global $Tainacan_Importer_Handler;
|
||||
$importer = $Tainacan_Importer_Handler->get_importer_instance_by_session_id($session_id);
|
||||
|
||||
if($importer) {
|
||||
|
||||
foreach ($body as $att => $value){
|
||||
|
@ -218,6 +220,7 @@ class REST_Importers_Controller extends REST_Controller {
|
|||
}
|
||||
|
||||
$response = $importer->_to_Array();
|
||||
$Tainacan_Importer_Handler->save_importer_instance($importer);
|
||||
return new \WP_REST_Response( $response, 200 );
|
||||
|
||||
}
|
||||
|
@ -237,7 +240,8 @@ class REST_Importers_Controller extends REST_Controller {
|
|||
|
||||
public function source_info( $request ) {
|
||||
$session_id = $request['session_id'];
|
||||
$importer = $_SESSION['tainacan_importer'][$session_id];
|
||||
global $Tainacan_Importer_Handler;
|
||||
$importer = $Tainacan_Importer_Handler->get_importer_instance_by_session_id($session_id);
|
||||
|
||||
if(!$importer) {
|
||||
return new \WP_REST_Response([
|
||||
|
@ -263,7 +267,7 @@ class REST_Importers_Controller extends REST_Controller {
|
|||
if ( method_exists($importer, 'get_source_special_fields') ) {
|
||||
$response['source_special_fields'] = $importer->get_source_special_fields();
|
||||
}
|
||||
|
||||
$Tainacan_Importer_Handler->save_importer_instance($importer);
|
||||
return new \WP_REST_Response( $response, 200 );
|
||||
|
||||
}
|
||||
|
@ -271,7 +275,8 @@ class REST_Importers_Controller extends REST_Controller {
|
|||
public function get_saved_mapping( $request ){
|
||||
$session_id = $request['session_id'];
|
||||
$collection_id = $request['collection_id'];
|
||||
$importer = $_SESSION['tainacan_importer'][$session_id];
|
||||
global $Tainacan_Importer_Handler;
|
||||
$importer = $Tainacan_Importer_Handler->get_importer_instance_by_session_id($session_id);
|
||||
$response = false;
|
||||
|
||||
if(!$importer) {
|
||||
|
@ -290,7 +295,8 @@ class REST_Importers_Controller extends REST_Controller {
|
|||
|
||||
public function get_item( $request ) {
|
||||
$session_id = $request['session_id'];
|
||||
$importer = $_SESSION['tainacan_importer'][$session_id];
|
||||
global $Tainacan_Importer_Handler;
|
||||
$importer = $Tainacan_Importer_Handler->get_importer_instance_by_session_id($session_id);
|
||||
|
||||
if(!$importer) {
|
||||
return new \WP_REST_Response([
|
||||
|
@ -306,7 +312,8 @@ class REST_Importers_Controller extends REST_Controller {
|
|||
|
||||
public function add_file( $request ) {
|
||||
$session_id = $request['session_id'];
|
||||
$importer = $_SESSION['tainacan_importer'][$session_id];
|
||||
global $Tainacan_Importer_Handler;
|
||||
$importer = $Tainacan_Importer_Handler->get_importer_instance_by_session_id($session_id);
|
||||
|
||||
if(!$importer) {
|
||||
return new \WP_REST_Response([
|
||||
|
@ -320,6 +327,7 @@ class REST_Importers_Controller extends REST_Controller {
|
|||
|
||||
if ( isset($files['file']) && $importer->add_file($files['file']) ) {
|
||||
$response = $importer->_to_Array();
|
||||
$Tainacan_Importer_Handler->save_importer_instance($importer);
|
||||
return new \WP_REST_Response( $response, 200 );
|
||||
} else {
|
||||
return new \WP_REST_Response([
|
||||
|
@ -335,7 +343,8 @@ class REST_Importers_Controller extends REST_Controller {
|
|||
|
||||
public function run($request) {
|
||||
$session_id = $request['session_id'];
|
||||
$importer = $_SESSION['tainacan_importer'][$session_id];
|
||||
global $Tainacan_Importer_Handler;
|
||||
$importer = $Tainacan_Importer_Handler->get_importer_instance_by_session_id($session_id);
|
||||
|
||||
if(!$importer) {
|
||||
return new \WP_REST_Response([
|
||||
|
@ -358,6 +367,7 @@ class REST_Importers_Controller extends REST_Controller {
|
|||
$response = [
|
||||
'bg_process_id' => $process->ID
|
||||
];
|
||||
$Tainacan_Importer_Handler->delete_importer_instance($importer);
|
||||
return new \WP_REST_Response( $response, 200 );
|
||||
|
||||
}
|
||||
|
|
|
@ -56,7 +56,7 @@ class REST_Item_Metadata_Controller extends REST_Controller {
|
|||
'methods' => \WP_REST_Server::READABLE,
|
||||
'callback' => array($this, 'get_items'),
|
||||
'permission_callback' => array($this, 'get_items_permissions_check'),
|
||||
'args' => $this->get_wp_query_params(),
|
||||
'args' => $this->get_endpoint_args_for_item_schema(\WP_REST_Server::READABLE),
|
||||
)
|
||||
)
|
||||
);
|
||||
|
@ -268,7 +268,12 @@ class REST_Item_Metadata_Controller extends REST_Controller {
|
|||
public function get_endpoint_args_for_item_schema( $method = null ) {
|
||||
$endpoint_args = [];
|
||||
|
||||
if ($method === \WP_REST_Server::EDITABLE) {
|
||||
if($method === \WP_REST_Server::READABLE) {
|
||||
$endpoint_args = array_merge(
|
||||
$endpoint_args,
|
||||
$this->get_wp_query_params()
|
||||
);
|
||||
} elseif ($method === \WP_REST_Server::EDITABLE) {
|
||||
$endpoint_args['values'] = [
|
||||
'type' => 'array/string/object/integer',
|
||||
'items' => [
|
||||
|
@ -290,7 +295,15 @@ class REST_Item_Metadata_Controller extends REST_Controller {
|
|||
* @return array
|
||||
*/
|
||||
public function get_wp_query_params() {
|
||||
$query_params['context']['default'] = 'view';
|
||||
$query_params['context'] = array(
|
||||
'type' => 'string',
|
||||
'default' => 'view',
|
||||
'description' => 'The context in which the request is made.',
|
||||
'enum' => array(
|
||||
'view',
|
||||
'edit'
|
||||
),
|
||||
);
|
||||
|
||||
return $query_params;
|
||||
}
|
||||
|
|
|
@ -80,8 +80,8 @@ class REST_Items_Controller extends REST_Controller {
|
|||
'permission_callback' => array($this, 'delete_item_permissions_check'),
|
||||
'args' => array(
|
||||
'permanently' => array(
|
||||
'description' => __('To delete permanently, you can pass \'permanently\' as true. By default this will only trash collection', 'tainacan'),
|
||||
'default' => 'false'
|
||||
'description' => __('To delete permanently, you can pass \'permanently\' as 1. By default this will only trash collection', 'tainacan'),
|
||||
'default' => '0'
|
||||
),
|
||||
)
|
||||
),
|
||||
|
@ -757,15 +757,18 @@ class REST_Items_Controller extends REST_Controller {
|
|||
$endpoint_args = [];
|
||||
|
||||
if($method === \WP_REST_Server::READABLE) {
|
||||
$endpoint_args['fetch_only'] = array(
|
||||
'type' => 'string/array',
|
||||
'description' => __( 'Fetch only specific attribute. The specifics attributes are the same in schema.' ),
|
||||
);
|
||||
|
||||
$endpoint_args['context'] = array(
|
||||
'type' => 'string',
|
||||
'default' => 'view',
|
||||
'items' => array( 'view, edit' )
|
||||
'type' => 'string',
|
||||
'default' => 'view',
|
||||
'description' => 'The context in which the request is made.',
|
||||
'enum' => array(
|
||||
'view',
|
||||
'edit'
|
||||
),
|
||||
);
|
||||
$endpoint_args = array_merge(
|
||||
$endpoint_args,
|
||||
parent::get_fetch_only_param()
|
||||
);
|
||||
} elseif ($method === \WP_REST_Server::CREATABLE || $method === \WP_REST_Server::EDITABLE) {
|
||||
$map = $this->items_repository->get_map();
|
||||
|
@ -791,16 +794,16 @@ class REST_Items_Controller extends REST_Controller {
|
|||
* @return array|void
|
||||
*/
|
||||
public function get_wp_query_params() {
|
||||
$query_params['context']['default'] = 'view';
|
||||
|
||||
array_merge($query_params, parent::get_wp_query_params());
|
||||
|
||||
$query_params['title'] = array(
|
||||
'description' => __('Limits the result set to items with a specific title'),
|
||||
'type' => 'string',
|
||||
);
|
||||
|
||||
$query_params = array_merge($query_params, parent::get_meta_queries_params());
|
||||
$query_params = array_merge(
|
||||
$query_params,
|
||||
parent::get_wp_query_params(),
|
||||
parent::get_meta_queries_params()
|
||||
);
|
||||
|
||||
return $query_params;
|
||||
}
|
||||
|
|
|
@ -38,7 +38,17 @@ class REST_Logs_Controller extends REST_Controller {
|
|||
'methods' => \WP_REST_Server::READABLE,
|
||||
'callback' => array($this, 'get_item'),
|
||||
'permission_callback' => array($this, 'get_item_permissions_check'),
|
||||
'args' => $this->get_endpoint_args_for_item_schema(\WP_REST_Server::READABLE)
|
||||
'args' => array(
|
||||
'context' => array(
|
||||
'type' => 'string',
|
||||
'default' => 'view',
|
||||
'description' => 'The context in which the request is made.',
|
||||
'enum' => array(
|
||||
'view',
|
||||
'edit'
|
||||
)
|
||||
),
|
||||
),
|
||||
),
|
||||
'schema' => [$this, 'get_schema']
|
||||
)
|
||||
|
@ -351,11 +361,10 @@ class REST_Logs_Controller extends REST_Controller {
|
|||
public function get_endpoint_args_for_item_schema( $method = null ) {
|
||||
$endpoint_args = [];
|
||||
if($method === \WP_REST_Server::READABLE) {
|
||||
$endpoint_args['context'] = array(
|
||||
'type' => 'string',
|
||||
'default' => 'view',
|
||||
'items' => array( 'view' )
|
||||
);
|
||||
$endpoint_args = array_merge(
|
||||
$endpoint_args,
|
||||
parent::get_wp_query_params()
|
||||
);
|
||||
}
|
||||
|
||||
return $endpoint_args;
|
||||
|
|
|
@ -44,24 +44,33 @@ class REST_Metadata_Controller extends REST_Controller {
|
|||
public function register_routes() {
|
||||
register_rest_route($this->namespace, '/collection/(?P<collection_id>[\d]+)/' . $this->rest_base . '/(?P<metadatum_id>[\d]+)',
|
||||
array(
|
||||
array(
|
||||
'methods' => \WP_REST_Server::READABLE,
|
||||
'callback' => array($this, 'get_item'),
|
||||
'permission_callback' => array($this, 'get_item_permissions_check'),
|
||||
'args' => array(
|
||||
'context' => array(
|
||||
'type' => 'string',
|
||||
'default' => 'view',
|
||||
'description' => 'The context in which the request is made.',
|
||||
'enum' => array(
|
||||
'view',
|
||||
'edit'
|
||||
)
|
||||
),
|
||||
),
|
||||
),
|
||||
array(
|
||||
'methods' => \WP_REST_Server::EDITABLE,
|
||||
'callback' => array($this, 'update_item'),
|
||||
'permission_callback' => array($this, 'update_item_permissions_check'),
|
||||
'args' => $this->get_endpoint_args_for_item_schema(\WP_REST_Server::EDITABLE)
|
||||
),
|
||||
// ENDPOINT X. THIS ENDPOINT DO THE SAME THING OF ENDPOINT Z. I hope in a brief future it function changes.
|
||||
array(
|
||||
'methods' => \WP_REST_Server::DELETABLE,
|
||||
'callback' => array($this, 'delete_item'),
|
||||
'permission_callback' => array($this, 'delete_item_permissions_check'),
|
||||
),
|
||||
array(
|
||||
'methods' => \WP_REST_Server::READABLE,
|
||||
'callback' => array($this, 'get_item'),
|
||||
'permission_callback' => array($this, 'get_item_permissions_check'),
|
||||
'args' => $this->get_endpoint_args_for_item_schema(\WP_REST_Server::READABLE),
|
||||
),
|
||||
'schema' => [$this, 'get_schema']
|
||||
)
|
||||
);
|
||||
|
@ -84,28 +93,38 @@ class REST_Metadata_Controller extends REST_Controller {
|
|||
);
|
||||
register_rest_route($this->namespace, '/' . $this->rest_base,
|
||||
array(
|
||||
array(
|
||||
'methods' => \WP_REST_Server::CREATABLE,
|
||||
'callback' => array($this, 'create_item'),
|
||||
'permission_callback' => array($this, 'create_item_permissions_check'),
|
||||
'args' => $this->get_endpoint_args_for_item_schema(\WP_REST_Server::CREATABLE),
|
||||
),
|
||||
array(
|
||||
'methods' => \WP_REST_Server::READABLE,
|
||||
'callback' => array($this, 'get_items'),
|
||||
'permission_callback' => array($this, 'get_items_permissions_check'),
|
||||
'args' => $this->get_wp_query_params(),
|
||||
),
|
||||
array(
|
||||
'methods' => \WP_REST_Server::CREATABLE,
|
||||
'callback' => array($this, 'create_item'),
|
||||
'permission_callback' => array($this, 'create_item_permissions_check'),
|
||||
'args' => $this->get_endpoint_args_for_item_schema(\WP_REST_Server::CREATABLE),
|
||||
),
|
||||
'schema' => [$this, 'get_schema'],
|
||||
)
|
||||
);
|
||||
register_rest_route($this->namespace, '/'. $this->rest_base . '/(?P<metadatum_id>[\d]+)',
|
||||
array(
|
||||
// ENDPOINT Z.
|
||||
array(
|
||||
'methods' => \WP_REST_Server::DELETABLE,
|
||||
'callback' => array($this, 'delete_item'),
|
||||
'permission_callback' => array($this, 'delete_item_permissions_check')
|
||||
'methods' => \WP_REST_Server::READABLE,
|
||||
'callback' => array($this, 'get_item'),
|
||||
'permission' => array($this, 'get_item_permissions_check'),
|
||||
'args' => array(
|
||||
'context' => array(
|
||||
'type' => 'string',
|
||||
'default' => 'view',
|
||||
'description' => 'The context in which the request is made.',
|
||||
'enum' => array(
|
||||
'view',
|
||||
'edit'
|
||||
)
|
||||
),
|
||||
),
|
||||
),
|
||||
array(
|
||||
'methods' => \WP_REST_Server::EDITABLE,
|
||||
|
@ -114,10 +133,9 @@ class REST_Metadata_Controller extends REST_Controller {
|
|||
'args' => $this->get_endpoint_args_for_item_schema(\WP_REST_Server::EDITABLE)
|
||||
),
|
||||
array(
|
||||
'methods' => \WP_REST_Server::READABLE,
|
||||
'callback' => array($this, 'get_item'),
|
||||
'permission' => array($this, 'get_item_permissions_check'),
|
||||
'args' => $this->get_endpoint_args_for_item_schema(\WP_REST_Server::READABLE)
|
||||
'methods' => \WP_REST_Server::DELETABLE,
|
||||
'callback' => array($this, 'delete_item'),
|
||||
'permission_callback' => array($this, 'delete_item_permissions_check')
|
||||
),
|
||||
'schema' => [$this, 'get_schema'],
|
||||
)
|
||||
|
@ -564,11 +582,10 @@ class REST_Metadata_Controller extends REST_Controller {
|
|||
public function get_endpoint_args_for_item_schema( $method = null ) {
|
||||
$endpoint_args = [];
|
||||
if($method === \WP_REST_Server::READABLE) {
|
||||
$endpoint_args['context'] = array(
|
||||
'type' => 'string',
|
||||
'default' => 'view',
|
||||
'items' => array( 'view, edit' )
|
||||
);
|
||||
$endpoint_args = array_merge(
|
||||
$endpoint_args,
|
||||
parent::get_wp_query_params()
|
||||
);
|
||||
} elseif ($method === \WP_REST_Server::CREATABLE || $method === \WP_REST_Server::EDITABLE) {
|
||||
$map = $this->metadatum_repository->get_map();
|
||||
|
||||
|
|
|
@ -54,7 +54,21 @@ class REST_Taxonomies_Controller extends REST_Controller {
|
|||
'methods' => \WP_REST_Server::READABLE,
|
||||
'callback' => array($this, 'get_item'),
|
||||
'permission_callback' => array($this, 'get_item_permissions_check'),
|
||||
'args' => $this->get_endpoint_args_for_item_schema(\WP_REST_Server::READABLE)
|
||||
'args' => array(
|
||||
'context' => array(
|
||||
'type' => 'string',
|
||||
'default' => 'view',
|
||||
'description' => 'The context in which the request is made.',
|
||||
'enum' => array(
|
||||
'view',
|
||||
'edit'
|
||||
)
|
||||
),
|
||||
'fetch_only' => array(
|
||||
'type' => 'string/array',
|
||||
'description' => __( 'Fetch only specific attribute. The specifics attributes are the same in schema.', 'tainacan' ),
|
||||
)
|
||||
)
|
||||
),
|
||||
array(
|
||||
'methods' => \WP_REST_Server::DELETABLE,
|
||||
|
@ -62,8 +76,8 @@ class REST_Taxonomies_Controller extends REST_Controller {
|
|||
'permission_callback' => array($this, 'delete_item_permissions_check'),
|
||||
'args' => array(
|
||||
'permanently' => array(
|
||||
'description' => __('To delete permanently, you can pass \'permanently\' as true. By default this will only trash collection'),
|
||||
'default' => 'false',
|
||||
'description' => __('To delete permanently, you can pass \'permanently\' as 1. By default this will only trash collection'),
|
||||
'default' => '0',
|
||||
),
|
||||
)
|
||||
),
|
||||
|
@ -452,16 +466,11 @@ class REST_Taxonomies_Controller extends REST_Controller {
|
|||
public function get_endpoint_args_for_item_schema( $method = null ) {
|
||||
$endpoint_args = [];
|
||||
if($method === \WP_REST_Server::READABLE) {
|
||||
$endpoint_args['fetch_only'] = array(
|
||||
'type' => 'string/array',
|
||||
'description' => __( 'Fetch only specific attribute. The specifics attributes are the same in schema.' ),
|
||||
);
|
||||
|
||||
$endpoint_args['context'] = array(
|
||||
'type' => 'string',
|
||||
'default' => 'view',
|
||||
'items' => array( 'view, edit' )
|
||||
);
|
||||
$endpoint_args = array_merge(
|
||||
$endpoint_args,
|
||||
parent::get_wp_query_params(),
|
||||
parent::get_fetch_only_param()
|
||||
);
|
||||
} elseif ($method === \WP_REST_Server::CREATABLE || $method === \WP_REST_Server::EDITABLE) {
|
||||
$map = $this->taxonomy_repository->get_map();
|
||||
|
||||
|
|
|
@ -56,8 +56,9 @@ class REST_Terms_Controller extends REST_Controller {
|
|||
'callback' => array($this, 'delete_item'),
|
||||
'permission_callback' => array($this, 'delete_item_permissions_check'),
|
||||
'args' => [
|
||||
'info' => [
|
||||
'description' => __('Delete term permanently.')
|
||||
'permanently' => [
|
||||
'description' => __('Delete term permanently.'),
|
||||
'default' => '1'
|
||||
]
|
||||
]
|
||||
),
|
||||
|
@ -420,11 +421,10 @@ class REST_Terms_Controller extends REST_Controller {
|
|||
public function get_endpoint_args_for_item_schema( $method = null ) {
|
||||
$endpoint_args = [];
|
||||
if($method === \WP_REST_Server::READABLE) {
|
||||
$endpoint_args['context'] = array(
|
||||
'type' => 'string',
|
||||
'default' => 'view',
|
||||
'items' => array( 'view, edit' )
|
||||
);
|
||||
$endpoint_args = array_merge(
|
||||
$endpoint_args,
|
||||
parent::get_wp_query_params()
|
||||
);
|
||||
} elseif ($method === \WP_REST_Server::CREATABLE || $method === \WP_REST_Server::EDITABLE) {
|
||||
$map = $this->terms_repository->get_map();
|
||||
|
||||
|
|
|
@ -18,7 +18,6 @@ $rest_exporters_controller = new \Tainacan\API\EndPoints\REST_Exporters_Contr
|
|||
$rest_background_processes_controller = new \Tainacan\API\EndPoints\REST_Background_Processes_Controller();
|
||||
$rest_bulkedit_controller = new \Tainacan\API\EndPoints\REST_Bulkedit_Controller();
|
||||
$rest_exposers_controller = new \Tainacan\API\EndPoints\REST_Exposers_Controller();
|
||||
new \Tainacan\API\EndPoints\REST_Export_Controller();
|
||||
new \Tainacan\API\EndPoints\REST_Metadatum_Mappers_Controller();
|
||||
$rest_facets_controller = new \Tainacan\API\EndPoints\REST_Facets_Controller();
|
||||
$rest_oaipmh_expose_controller = new \Tainacan\API\EndPoints\REST_Oaipmh_Expose_Controller();
|
||||
|
|
|
@ -95,8 +95,11 @@
|
|||
.wp-block-tainacan-modal .modal-checkbox-list,
|
||||
.wp-block-tainacan-modal .modal-radio-list .components-base-control__field {
|
||||
padding: 0;
|
||||
flex-wrap: wrap;
|
||||
display: flex;
|
||||
display: -ms-grid;
|
||||
display: grid;
|
||||
-ms-grid-columns: 250px 250px;
|
||||
grid-template-columns: repeat(auto-fill, 250px);
|
||||
grid-gap: 0px;
|
||||
justify-content: space-evenly;
|
||||
|
@ -171,8 +174,13 @@
|
|||
.components-panel__body .collection-carousel-view-modes button.collection-carousel-view-mode-grid {
|
||||
margin-right: 6px; }
|
||||
.components-panel__body .collection-carousel-view-modes button.collection-carousel-view-mode-grid div {
|
||||
flex-wrap: wrap;
|
||||
display: flex;
|
||||
display: -ms-grid;
|
||||
display: grid;
|
||||
-ms-grid-columns: 33% 33% 33%;
|
||||
grid-template-columns: 33% 33% 33%;
|
||||
-ms-grid-rows: 50% 50%;
|
||||
grid-template-rows: 50% 50%;
|
||||
grid-column-gap: 2px;
|
||||
grid-row-gap: 2px;
|
||||
|
@ -180,13 +188,17 @@
|
|||
height: 40px;
|
||||
margin: 4px auto 8px auto; }
|
||||
.components-panel__body .collection-carousel-view-modes button.collection-carousel-view-mode-grid div > div:first-of-type {
|
||||
grid-column-start: 1;
|
||||
grid-column-end: span 2;
|
||||
grid-row-start: 1;
|
||||
grid-row-end: span 2;
|
||||
flex-basis: 100%;
|
||||
-ms-grid-column: 1;
|
||||
-ms-grid-column-span: 2;
|
||||
-ms-grid-row: 1;
|
||||
-ms-grid-row-span: 2;
|
||||
grid-column: 1/3;
|
||||
grid-row: 1/3;
|
||||
width: 41px;
|
||||
height: 42px; }
|
||||
.components-panel__body .collection-carousel-view-modes button.collection-carousel-view-mode-grid div > div {
|
||||
flex-basis: 50%;
|
||||
width: 20px;
|
||||
height: 20px;
|
||||
background: #555758;
|
||||
|
@ -280,16 +292,23 @@
|
|||
width: 100%;
|
||||
display: block; }
|
||||
.wp-block-tainacan-carousel-collections-list .tainacan-carousel .swiper-container .swiper-slide.collection-list-item-grid .collection-items-grid {
|
||||
flex-wrap: wrap;
|
||||
display: flex;
|
||||
display: -ms-grid;
|
||||
display: grid;
|
||||
grid-template-columns: 33% 33% 33%;
|
||||
grid-template-rows: 50% 50%;
|
||||
width: 100%; }
|
||||
.wp-block-tainacan-carousel-collections-list .tainacan-carousel .swiper-container .swiper-slide.collection-list-item-grid .collection-items-grid img:first-of-type {
|
||||
grid-column-start: 1;
|
||||
grid-column-end: span 2;
|
||||
grid-row-start: 1;
|
||||
grid-row-end: span 2; }
|
||||
flex-basis: 100%;
|
||||
-ms-grid-column: 1;
|
||||
-ms-grid-column-span: 2;
|
||||
-ms-grid-row: 1;
|
||||
-ms-grid-row-span: 2;
|
||||
grid-column: 1/3;
|
||||
grid-row: 1/3; }
|
||||
.wp-block-tainacan-carousel-collections-list .tainacan-carousel .swiper-container .swiper-slide.collection-list-item-grid .collection-items-grid img {
|
||||
flex-basis: 50%;
|
||||
width: 100%;
|
||||
height: auto;
|
||||
padding: 2px;
|
||||
|
@ -389,15 +408,22 @@
|
|||
background-color: white !important;
|
||||
border: 1px solid #cbcbcb !important; }
|
||||
.wp-block-tainacan-carousel-collections-list ul.collections-list-edit li.collection-list-item .collection-items-grid {
|
||||
flex-wrap: wrap;
|
||||
display: flex;
|
||||
display: -ms-grid;
|
||||
display: grid;
|
||||
grid-template-columns: 33% 33% 33%;
|
||||
grid-template-rows: 50% 50%; }
|
||||
.wp-block-tainacan-carousel-collections-list ul.collections-list-edit li.collection-list-item .collection-items-grid img:first-of-type {
|
||||
grid-column-start: 1;
|
||||
grid-column-end: span 2;
|
||||
grid-row-start: 1;
|
||||
grid-row-end: span 2; }
|
||||
flex-basis: 100%;
|
||||
-ms-grid-column: 1;
|
||||
-ms-grid-column-span: 2;
|
||||
-ms-grid-row: 1;
|
||||
-ms-grid-row-span: 2;
|
||||
grid-column: 1/3;
|
||||
grid-row: 1/3; }
|
||||
.wp-block-tainacan-carousel-collections-list ul.collections-list-edit li.collection-list-item .collection-items-grid img {
|
||||
flex-basis: 50%;
|
||||
padding: 2px;
|
||||
margin-bottom: 0px; }
|
||||
@media only screen and (max-width: 1686px) {
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -95,8 +95,11 @@
|
|||
.wp-block-tainacan-modal .modal-checkbox-list,
|
||||
.wp-block-tainacan-modal .modal-radio-list .components-base-control__field {
|
||||
padding: 0;
|
||||
flex-wrap: wrap;
|
||||
display: flex;
|
||||
display: -ms-grid;
|
||||
display: grid;
|
||||
-ms-grid-columns: 250px 250px;
|
||||
grid-template-columns: repeat(auto-fill, 250px);
|
||||
grid-gap: 0px;
|
||||
justify-content: space-evenly;
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -0,0 +1,450 @@
|
|||
[data-align='full'] .block-control {
|
||||
width: calc(100% + 14px); }
|
||||
|
||||
.block-control {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
padding: 5px;
|
||||
position: relative;
|
||||
top: -14px;
|
||||
left: -14px;
|
||||
width: calc(100% + 28px);
|
||||
background: #f2f2f2; }
|
||||
.block-control p {
|
||||
font-size: 0.875rem !important;
|
||||
margin: 12px 1.5rem 16px 0;
|
||||
fill: #555758; }
|
||||
.block-control p svg {
|
||||
top: 4px;
|
||||
margin-right: 0.75rem;
|
||||
position: relative;
|
||||
fill: #555758; }
|
||||
|
||||
.components-placeholder__fieldset p {
|
||||
font-size: 0.875rem !important;
|
||||
margin-top: -2px;
|
||||
fill: #555758; }
|
||||
.components-placeholder__fieldset p svg {
|
||||
margin-right: 1rem;
|
||||
top: 4px;
|
||||
position: relative;
|
||||
fill: #555758; }
|
||||
|
||||
.wp-block-tainacan-modal {
|
||||
width: 50%; }
|
||||
@media only screen and (max-width: 1024px) {
|
||||
.wp-block-tainacan-modal {
|
||||
width: 75%; } }
|
||||
@media only screen and (max-width: 768px) {
|
||||
.wp-block-tainacan-modal {
|
||||
width: 100%; } }
|
||||
.wp-block-tainacan-modal.dynamic-modal {
|
||||
width: 90%;
|
||||
height: 90%;
|
||||
width: 80vw;
|
||||
height: 80vh; }
|
||||
.wp-block-tainacan-modal.dynamic-modal iframe {
|
||||
width: calc(100% + 32px);
|
||||
height: calc(100% - 128px);
|
||||
margin-left: -16px; }
|
||||
.wp-block-tainacan-modal.dynamic-modal .modal-footer-area {
|
||||
height: 68px;
|
||||
width: calc(100% + 32px);
|
||||
margin-left: -16px !important;
|
||||
padding: 1.2rem 1.2rem !important;
|
||||
border-top: 1px solid #cbcbcb; }
|
||||
.wp-block-tainacan-modal .spinner-container {
|
||||
min-height: 56px;
|
||||
padding: 1rem;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
color: #555758; }
|
||||
.wp-block-tainacan-modal .spinner-container .components-spineer {
|
||||
margin: 8px; }
|
||||
.wp-block-tainacan-modal .components-modal__header .components-icon-button {
|
||||
padding-right: 0; }
|
||||
.wp-block-tainacan-modal hr {
|
||||
margin: 5px 0.75rem; }
|
||||
.wp-block-tainacan-modal .modal-search-area {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
margin-bottom: 14px; }
|
||||
.wp-block-tainacan-modal .modal-search-area .components-base-control {
|
||||
width: 60%; }
|
||||
@media only screen and (max-width: 1024px) {
|
||||
.wp-block-tainacan-modal .modal-search-area .components-base-control {
|
||||
width: 95%; } }
|
||||
.wp-block-tainacan-modal .modal-search-area .components-base-control:nth-child(2) {
|
||||
flex-shrink: 2; }
|
||||
.wp-block-tainacan-modal .modal-search-area .components-base-control .components-base-control__field {
|
||||
flex-wrap: wrap; }
|
||||
.wp-block-tainacan-modal .modal-search-area .components-base-control label.components-base-control__label {
|
||||
font-weight: 500;
|
||||
color: #454647;
|
||||
font-size: 0.875rem;
|
||||
text-align: center; }
|
||||
.wp-block-tainacan-modal .modal-search-area .components-base-control input.components-text-control__input {
|
||||
padding: 5px 8px;
|
||||
height: 28px; }
|
||||
.wp-block-tainacan-modal .modal-radio-area-label {
|
||||
font-weight: 500;
|
||||
margin-left: 1.75rem; }
|
||||
.wp-block-tainacan-modal .modal-checkbox-list,
|
||||
.wp-block-tainacan-modal .modal-radio-list .components-base-control__field {
|
||||
padding: 0;
|
||||
flex-wrap: wrap;
|
||||
display: flex;
|
||||
display: -ms-grid;
|
||||
display: grid;
|
||||
-ms-grid-columns: 250px 250px;
|
||||
grid-template-columns: repeat(auto-fill, 250px);
|
||||
grid-gap: 0px;
|
||||
justify-content: space-evenly;
|
||||
list-style-type: none;
|
||||
margin: 12px;
|
||||
max-height: 50vh;
|
||||
overflow-y: auto;
|
||||
overflow-x: hidden; }
|
||||
.wp-block-tainacan-modal .modal-checkbox-list .components-base-control,
|
||||
.wp-block-tainacan-modal .modal-radio-list .components-base-control__field .components-base-control {
|
||||
overflow: hidden; }
|
||||
.wp-block-tainacan-modal .modal-checkbox-list .modal-checkbox-list-item,
|
||||
.wp-block-tainacan-modal .modal-checkbox-list .components-radio-control__option,
|
||||
.wp-block-tainacan-modal .modal-radio-list .components-base-control__field .modal-checkbox-list-item,
|
||||
.wp-block-tainacan-modal .modal-radio-list .components-base-control__field .components-radio-control__option {
|
||||
display: flex;
|
||||
justify-content: flex-start; }
|
||||
.wp-block-tainacan-modal .modal-checkbox-list .modal-checkbox-list-item img,
|
||||
.wp-block-tainacan-modal .modal-checkbox-list .components-radio-control__option img,
|
||||
.wp-block-tainacan-modal .modal-radio-list .components-base-control__field .modal-checkbox-list-item img,
|
||||
.wp-block-tainacan-modal .modal-radio-list .components-base-control__field .components-radio-control__option img {
|
||||
width: 24px;
|
||||
height: 24px;
|
||||
margin-right: 10px; }
|
||||
.wp-block-tainacan-modal .modal-checkbox-list .modal-checkbox-list-item label,
|
||||
.wp-block-tainacan-modal .modal-checkbox-list .components-radio-control__option label,
|
||||
.wp-block-tainacan-modal .modal-radio-list .components-base-control__field .modal-checkbox-list-item label,
|
||||
.wp-block-tainacan-modal .modal-radio-list .components-base-control__field .components-radio-control__option label {
|
||||
white-space: nowrap;
|
||||
text-overflow: ellipsis;
|
||||
overflow: hidden;
|
||||
display: inline-block;
|
||||
max-width: 85%; }
|
||||
@media only screen and (max-width: 768px) {
|
||||
.wp-block-tainacan-modal .modal-checkbox-list .modal-checkbox-list-item label,
|
||||
.wp-block-tainacan-modal .modal-checkbox-list .components-radio-control__option label,
|
||||
.wp-block-tainacan-modal .modal-radio-list .components-base-control__field .modal-checkbox-list-item label,
|
||||
.wp-block-tainacan-modal .modal-radio-list .components-base-control__field .components-radio-control__option label {
|
||||
max-width: 80%; } }
|
||||
.wp-block-tainacan-modal .modal-loadmore-section {
|
||||
display: flex;
|
||||
align-items: baseline;
|
||||
justify-content: center; }
|
||||
.wp-block-tainacan-modal .modal-loadmore-section p {
|
||||
color: #555758;
|
||||
margin-right: 12px;
|
||||
margin-top: 2px; }
|
||||
.wp-block-tainacan-modal .modal-footer-area {
|
||||
border-top: 1px solid #e2e4e7;
|
||||
display: flex;
|
||||
align-items: baseline;
|
||||
justify-content: space-between;
|
||||
padding: 16px 16px 0 16px;
|
||||
margin: 0 -16px; }
|
||||
.wp-block-tainacan-modal .modal-footer-area p {
|
||||
padding: 0 12px;
|
||||
color: #454647; }
|
||||
|
||||
.components-panel__body .term-carousel-view-modes {
|
||||
display: flex;
|
||||
margin: 12px 0 24px 0; }
|
||||
.components-panel__body .term-carousel-view-modes button {
|
||||
background: transparent;
|
||||
border: 1px solid #cbcbcb;
|
||||
border-radius: 5px;
|
||||
padding: 2px;
|
||||
margin: 0;
|
||||
width: calc(50% - 6px);
|
||||
flex-shrink: 0;
|
||||
cursor: pointer;
|
||||
transition: border ease 0.5s, opacity ease 0.5; }
|
||||
.components-panel__body .term-carousel-view-modes button.term-carousel-view-mode-grid {
|
||||
margin-right: 6px; }
|
||||
.components-panel__body .term-carousel-view-modes button.term-carousel-view-mode-grid div {
|
||||
flex-wrap: wrap;
|
||||
display: flex;
|
||||
display: -ms-grid;
|
||||
display: grid;
|
||||
-ms-grid-columns: 33% 33% 33%;
|
||||
grid-template-columns: 33% 33% 33%;
|
||||
-ms-grid-rows: 50% 50%;
|
||||
grid-template-rows: 50% 50%;
|
||||
grid-column-gap: 2px;
|
||||
grid-row-gap: 2px;
|
||||
width: 60px;
|
||||
height: 40px;
|
||||
margin: 4px auto 8px auto; }
|
||||
.components-panel__body .term-carousel-view-modes button.term-carousel-view-mode-grid div > div:first-of-type {
|
||||
flex-basis: 100%;
|
||||
-ms-grid-column: 1;
|
||||
-ms-grid-column-span: 2;
|
||||
-ms-grid-row: 1;
|
||||
-ms-grid-row-span: 2;
|
||||
grid-column: 1/3;
|
||||
grid-row: 1/3;
|
||||
width: 41px;
|
||||
height: 42px; }
|
||||
.components-panel__body .term-carousel-view-modes button.term-carousel-view-mode-grid div > div {
|
||||
flex-basis: 50%;
|
||||
width: 20px;
|
||||
height: 20px;
|
||||
background: #555758;
|
||||
transition: background-color ease 0.5s; }
|
||||
.components-panel__body .term-carousel-view-modes button.term-carousel-view-mode-thumbnail {
|
||||
margin-left: 6px; }
|
||||
.components-panel__body .term-carousel-view-modes button.term-carousel-view-mode-thumbnail div {
|
||||
display: block;
|
||||
height: 40px;
|
||||
width: 40px;
|
||||
background: #555758;
|
||||
margin: 4px auto 8px auto;
|
||||
transition: background-color ease 0.5s; }
|
||||
.components-panel__body .term-carousel-view-modes button label {
|
||||
font-size: 0.75rem;
|
||||
color: #555758; }
|
||||
.components-panel__body .term-carousel-view-modes button.is-active {
|
||||
border: 2px solid #298596; }
|
||||
.components-panel__body .term-carousel-view-modes button.is-active.term-carousel-view-mode-thumbnail div, .components-panel__body .term-carousel-view-modes button.is-active.term-carousel-view-mode-grid div > div {
|
||||
background-color: #298596; }
|
||||
.components-panel__body .term-carousel-view-modes button:hover {
|
||||
opacity: 0.9;
|
||||
border-width: 2px; }
|
||||
.components-panel__body .term-carousel-view-modes button:hover button {
|
||||
background: #f2f2f2; }
|
||||
|
||||
.wp-block-tainacan-carousel-terms-list {
|
||||
margin: 2rem 0px; }
|
||||
.wp-block-tainacan-carousel-terms-list .spinner-container {
|
||||
min-height: 56px;
|
||||
padding: 1rem;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
color: #555758; }
|
||||
@-webkit-keyframes skeleton-animation {
|
||||
0% {
|
||||
opacity: 1.0; }
|
||||
50% {
|
||||
opacity: 0.2; }
|
||||
100% {
|
||||
opacity: 1.0; } }
|
||||
@-moz-keyframes skeleton-animation {
|
||||
0% {
|
||||
opacity: 1.0; }
|
||||
50% {
|
||||
opacity: 0.2; }
|
||||
100% {
|
||||
opacity: 1.0; } }
|
||||
@-o-keyframes skeleton-animation {
|
||||
0% {
|
||||
opacity: 1.0; }
|
||||
50% {
|
||||
opacity: 0.2; }
|
||||
100% {
|
||||
opacity: 1.0; } }
|
||||
@keyframes skeleton-animation {
|
||||
0% {
|
||||
opacity: 1.0; }
|
||||
50% {
|
||||
opacity: 0.2; }
|
||||
100% {
|
||||
opacity: 1.0; } }
|
||||
.wp-block-tainacan-carousel-terms-list .skeleton {
|
||||
border-radius: 2px;
|
||||
background: #f2f2f2;
|
||||
-webkit-animation: skeleton-animation 1.8s ease infinite;
|
||||
-moz-animation: skeleton-animation 1.8s ease infinite;
|
||||
-o-animation: skeleton-animation 1.8s ease infinite;
|
||||
animation: skeleton-animation 1.8s ease infinite; }
|
||||
.wp-block-tainacan-carousel-terms-list .tainacan-carousel {
|
||||
position: relative;
|
||||
width: calc(100% + 40px);
|
||||
left: -20px; }
|
||||
.wp-block-tainacan-carousel-terms-list .tainacan-carousel .swiper-container {
|
||||
margin: 0 50px; }
|
||||
.wp-block-tainacan-carousel-terms-list .tainacan-carousel .swiper-container a > span,
|
||||
.wp-block-tainacan-carousel-terms-list .tainacan-carousel .swiper-container a:hover > span {
|
||||
color: black;
|
||||
font-weight: bold;
|
||||
text-decoration: none;
|
||||
padding: 8px 16px;
|
||||
display: block;
|
||||
line-height: 1.2rem; }
|
||||
.wp-block-tainacan-carousel-terms-list .tainacan-carousel .swiper-container a > img {
|
||||
width: 100%;
|
||||
height: auto; }
|
||||
.wp-block-tainacan-carousel-terms-list .tainacan-carousel .swiper-container a:hover {
|
||||
text-decoration: none; }
|
||||
.wp-block-tainacan-carousel-terms-list .tainacan-carousel .swiper-container .swiper-slide.term-list-item-grid a {
|
||||
width: 100%;
|
||||
display: block; }
|
||||
.wp-block-tainacan-carousel-terms-list .tainacan-carousel .swiper-container .swiper-slide.term-list-item-grid .term-items-grid {
|
||||
flex-wrap: wrap;
|
||||
display: flex;
|
||||
display: -ms-grid;
|
||||
display: grid;
|
||||
grid-template-columns: 33% 33% 33%;
|
||||
grid-template-rows: 50% 50%;
|
||||
width: 100%; }
|
||||
.wp-block-tainacan-carousel-terms-list .tainacan-carousel .swiper-container .swiper-slide.term-list-item-grid .term-items-grid img:first-of-type {
|
||||
flex-basis: 100%;
|
||||
-ms-grid-column: 1;
|
||||
-ms-grid-column-span: 2;
|
||||
-ms-grid-row: 1;
|
||||
-ms-grid-row-span: 2;
|
||||
grid-column: 1/3;
|
||||
grid-row: 1/3; }
|
||||
.wp-block-tainacan-carousel-terms-list .tainacan-carousel .swiper-container .swiper-slide.term-list-item-grid .term-items-grid img {
|
||||
flex-basis: 50%;
|
||||
width: 100%;
|
||||
height: auto;
|
||||
padding: 2px;
|
||||
margin-bottom: 0px; }
|
||||
.wp-block-tainacan-carousel-terms-list .preview-warning {
|
||||
width: 100%;
|
||||
font-size: 0.875rem;
|
||||
font-style: italic;
|
||||
color: #898d8f;
|
||||
text-align: center;
|
||||
margin: 4px auto; }
|
||||
.wp-block-tainacan-carousel-terms-list .swiper-button-prev, .wp-block-tainacan-carousel-terms-list .swiper-button-next {
|
||||
top: calc(50% - 42px);
|
||||
bottom: initial;
|
||||
background: none;
|
||||
border: none;
|
||||
width: 42px;
|
||||
height: 42px;
|
||||
padding: 0;
|
||||
margin: 0 -4px; }
|
||||
.wp-block-tainacan-carousel-terms-list .swiper-button-prev svg, .wp-block-tainacan-carousel-terms-list .swiper-button-next svg {
|
||||
fill: #298596; }
|
||||
.wp-block-tainacan-carousel-terms-list .terms-list-edit-container,
|
||||
.wp-block-tainacan-carousel-terms-list .tainacan-carousel {
|
||||
position: relative; }
|
||||
.wp-block-tainacan-carousel-terms-list .terms-list-edit-container .skeleton,
|
||||
.wp-block-tainacan-carousel-terms-list .tainacan-carousel .skeleton {
|
||||
min-height: 150px;
|
||||
max-height: 150px; }
|
||||
.wp-block-tainacan-carousel-terms-list .terms-list-edit-container.has-arrows-none .swiper-button-prev, .wp-block-tainacan-carousel-terms-list .terms-list-edit-container.has-arrows-none .swiper-button-next,
|
||||
.wp-block-tainacan-carousel-terms-list .tainacan-carousel.has-arrows-none .swiper-button-prev,
|
||||
.wp-block-tainacan-carousel-terms-list .tainacan-carousel.has-arrows-none .swiper-button-next {
|
||||
display: none; }
|
||||
.wp-block-tainacan-carousel-terms-list .terms-list-edit-container.has-arrows-left .swiper-button-next,
|
||||
.wp-block-tainacan-carousel-terms-list .tainacan-carousel.has-arrows-left .swiper-button-next {
|
||||
left: 10px;
|
||||
right: auto;
|
||||
top: calc(50% + 12px) !important; }
|
||||
.wp-block-tainacan-carousel-terms-list .terms-list-edit-container.has-arrows-right .swiper-button-prev,
|
||||
.wp-block-tainacan-carousel-terms-list .tainacan-carousel.has-arrows-right .swiper-button-prev {
|
||||
right: 10px;
|
||||
left: auto; }
|
||||
.wp-block-tainacan-carousel-terms-list .terms-list-edit-container.has-arrows-right .swiper-button-next,
|
||||
.wp-block-tainacan-carousel-terms-list .tainacan-carousel.has-arrows-right .swiper-button-next {
|
||||
top: calc(50% + 12px) !important; }
|
||||
.wp-block-tainacan-carousel-terms-list ul.terms-list-edit {
|
||||
display: flex;
|
||||
align-items: flex-start;
|
||||
overflow-x: scroll;
|
||||
list-style: none;
|
||||
margin: 0 36px; }
|
||||
.wp-block-tainacan-carousel-terms-list ul.terms-list-edit li.term-list-item {
|
||||
position: relative;
|
||||
display: block;
|
||||
margin: 16px 32px 16px 0px;
|
||||
width: calc(16.666% - 32px);
|
||||
min-width: calc(16.666% - 32px); }
|
||||
.wp-block-tainacan-carousel-terms-list ul.terms-list-edit li.term-list-item.term-list-item-grid {
|
||||
margin: 16px;
|
||||
width: calc(25% - 16px);
|
||||
min-width: calc(25% - 16px); }
|
||||
.wp-block-tainacan-carousel-terms-list ul.terms-list-edit li.term-list-item a {
|
||||
color: #454647;
|
||||
font-weight: bold;
|
||||
line-height: normal; }
|
||||
.wp-block-tainacan-carousel-terms-list ul.terms-list-edit li.term-list-item img {
|
||||
height: auto;
|
||||
padding: 0px;
|
||||
margin-bottom: 0.5rem; }
|
||||
.wp-block-tainacan-carousel-terms-list ul.terms-list-edit li.term-list-item:hover a {
|
||||
color: #454647;
|
||||
text-decoration: none; }
|
||||
.wp-block-tainacan-carousel-terms-list ul.terms-list-edit li.term-list-item button {
|
||||
position: absolute !important;
|
||||
background-color: rgba(255, 255, 255, 0.75);
|
||||
color: #454647;
|
||||
padding: 2px;
|
||||
margin-left: 5px;
|
||||
min-width: 14px;
|
||||
visibility: hidden;
|
||||
position: relative;
|
||||
opacity: 0;
|
||||
right: -14px;
|
||||
top: 0px;
|
||||
justify-content: center;
|
||||
z-index: 999; }
|
||||
.wp-block-tainacan-carousel-terms-list ul.terms-list-edit li.term-list-item:hover button {
|
||||
visibility: visible;
|
||||
background-color: white !important;
|
||||
opacity: 1;
|
||||
right: -8px;
|
||||
top: -8px;
|
||||
border: 1px solid #cbcbcb;
|
||||
border-radius: 12px;
|
||||
transition: opacity linear 0.15s, right linear 0.15s; }
|
||||
.wp-block-tainacan-carousel-terms-list ul.terms-list-edit li.term-list-item:hover button:hover {
|
||||
background-color: white !important;
|
||||
border: 1px solid #cbcbcb !important; }
|
||||
.wp-block-tainacan-carousel-terms-list ul.terms-list-edit li.term-list-item .term-items-grid {
|
||||
flex-wrap: wrap;
|
||||
display: flex;
|
||||
display: -ms-grid;
|
||||
display: grid;
|
||||
grid-template-columns: 33% 33% 33%;
|
||||
grid-template-rows: 50% 50%; }
|
||||
.wp-block-tainacan-carousel-terms-list ul.terms-list-edit li.term-list-item .term-items-grid img:first-of-type {
|
||||
flex-basis: 100%;
|
||||
-ms-grid-column: 1;
|
||||
-ms-grid-column-span: 2;
|
||||
-ms-grid-row: 1;
|
||||
-ms-grid-row-span: 2;
|
||||
grid-column: 1/3;
|
||||
grid-row: 1/3; }
|
||||
.wp-block-tainacan-carousel-terms-list ul.terms-list-edit li.term-list-item .term-items-grid img {
|
||||
flex-basis: 50%;
|
||||
padding: 2px;
|
||||
margin-bottom: 0px; }
|
||||
@media only screen and (max-width: 1686px) {
|
||||
.wp-block-tainacan-carousel-terms-list ul.terms-list-edit li.term-list-item {
|
||||
width: calc(20% - 32px);
|
||||
min-width: calc(20% - 32px); } }
|
||||
@media only screen and (max-width: 1452px) {
|
||||
.wp-block-tainacan-carousel-terms-list ul.terms-list-edit li.term-list-item {
|
||||
width: calc(25% - 32px);
|
||||
min-width: calc(25% - 32px); } }
|
||||
@media only screen and (max-width: 1118px) {
|
||||
.wp-block-tainacan-carousel-terms-list ul.terms-edit li.term-list-item {
|
||||
width: calc(33.333% - 32px);
|
||||
min-width: calc(33.333% - 32px); } }
|
||||
@media only screen and (max-width: 854px) {
|
||||
.wp-block-tainacan-carousel-terms-list ul.terms-list-edit li.term-list-item {
|
||||
width: calc(50% - 32px);
|
||||
min-width: calc(50% - 32px); } }
|
||||
@media only screen and (max-width: 584px) {
|
||||
.wp-block-tainacan-carousel-terms-list ul.terms-list-edit li.term-list-item {
|
||||
width: calc(100% - 32px);
|
||||
min-width: calc(100% - 32px); } }
|
||||
|
||||
/*# sourceMappingURL=tainacan-gutenberg-block-carousel-terms-list.css.map */
|
File diff suppressed because one or more lines are too long
|
@ -95,8 +95,11 @@
|
|||
.wp-block-tainacan-modal .modal-checkbox-list,
|
||||
.wp-block-tainacan-modal .modal-radio-list .components-base-control__field {
|
||||
padding: 0;
|
||||
flex-wrap: wrap;
|
||||
display: flex;
|
||||
display: -ms-grid;
|
||||
display: grid;
|
||||
-ms-grid-columns: 250px 250px;
|
||||
grid-template-columns: repeat(auto-fill, 250px);
|
||||
grid-gap: 0px;
|
||||
justify-content: space-evenly;
|
||||
|
@ -178,8 +181,11 @@
|
|||
.wp-block-tainacan-collections-list ul.collections-list.collections-layout-grid,
|
||||
.wp-block-tainacan-collections-list ul.collections-list-edit.collections-layout-grid {
|
||||
padding: 0;
|
||||
flex-wrap: wrap;
|
||||
display: flex;
|
||||
display: -ms-grid;
|
||||
display: grid;
|
||||
-ms-grid-columns: 220px 220px 220px 220px 220px;
|
||||
grid-template-columns: repeat(auto-fill, 220px);
|
||||
grid-gap: 0px;
|
||||
justify-content: space-evenly;
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -95,8 +95,11 @@
|
|||
.wp-block-tainacan-modal .modal-checkbox-list,
|
||||
.wp-block-tainacan-modal .modal-radio-list .components-base-control__field {
|
||||
padding: 0;
|
||||
flex-wrap: wrap;
|
||||
display: flex;
|
||||
display: -ms-grid;
|
||||
display: grid;
|
||||
-ms-grid-columns: 250px 250px;
|
||||
grid-template-columns: repeat(auto-fill, 250px);
|
||||
grid-gap: 0px;
|
||||
justify-content: space-evenly;
|
||||
|
@ -353,8 +356,11 @@
|
|||
.wp-block-tainacan-dynamic-items-list ul.items-list.items-layout-grid,
|
||||
.wp-block-tainacan-dynamic-items-list ul.items-list-edit.items-layout-grid {
|
||||
padding: 0;
|
||||
flex-wrap: wrap;
|
||||
display: flex;
|
||||
display: -ms-grid;
|
||||
display: grid;
|
||||
-ms-grid-columns: 220px 220px 220px 220px 220px;
|
||||
grid-template-columns: repeat(auto-fill, 220px);
|
||||
grid-gap: 0px;
|
||||
justify-content: space-evenly;
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -95,8 +95,11 @@
|
|||
.wp-block-tainacan-modal .modal-checkbox-list,
|
||||
.wp-block-tainacan-modal .modal-radio-list .components-base-control__field {
|
||||
padding: 0;
|
||||
flex-wrap: wrap;
|
||||
display: flex;
|
||||
display: -ms-grid;
|
||||
display: grid;
|
||||
-ms-grid-columns: 250px 250px;
|
||||
grid-template-columns: repeat(auto-fill, 250px);
|
||||
grid-gap: 0px;
|
||||
justify-content: space-evenly;
|
||||
|
@ -337,8 +340,11 @@
|
|||
.wp-block-tainacan-facets-list ul.facets-list.facets-layout-grid,
|
||||
.wp-block-tainacan-facets-list ul.facets-list-edit.facets-layout-grid {
|
||||
padding: 0;
|
||||
flex-wrap: wrap;
|
||||
display: flex;
|
||||
display: -ms-grid;
|
||||
display: grid;
|
||||
-ms-grid-columns: 220px 220px 220px 220px 220px;
|
||||
grid-template-columns: repeat(auto-fill, 220px);
|
||||
grid-gap: 0px;
|
||||
justify-content: space-evenly;
|
||||
|
@ -493,9 +499,8 @@
|
|||
.wp-block-tainacan-facets-list ul.facets-list.facets-layout-cloud li.facet-list-item a,
|
||||
.wp-block-tainacan-facets-list ul.facets-list-edit.facets-layout-cloud li.facet-list-item a {
|
||||
color: #454647;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
height: 54px; }
|
||||
display: inline;
|
||||
min-height: 54px; }
|
||||
.wp-block-tainacan-facets-list ul.facets-list.facets-layout-cloud li.facet-list-item img,
|
||||
.wp-block-tainacan-facets-list ul.facets-list-edit.facets-layout-cloud li.facet-list-item img {
|
||||
height: auto;
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -95,8 +95,11 @@
|
|||
.wp-block-tainacan-modal .modal-checkbox-list,
|
||||
.wp-block-tainacan-modal .modal-radio-list .components-base-control__field {
|
||||
padding: 0;
|
||||
flex-wrap: wrap;
|
||||
display: flex;
|
||||
display: -ms-grid;
|
||||
display: grid;
|
||||
-ms-grid-columns: 250px 250px;
|
||||
grid-template-columns: repeat(auto-fill, 250px);
|
||||
grid-gap: 0px;
|
||||
justify-content: space-evenly;
|
||||
|
@ -178,8 +181,11 @@
|
|||
.wp-block-tainacan-items-list ul.items-list.items-layout-grid,
|
||||
.wp-block-tainacan-items-list ul.items-list-edit.items-layout-grid {
|
||||
padding: 0;
|
||||
flex-wrap: wrap;
|
||||
display: flex;
|
||||
display: -ms-grid;
|
||||
display: grid;
|
||||
-ms-grid-columns: 220px 220px 220px 220px 220px;
|
||||
grid-template-columns: repeat(auto-fill, 220px);
|
||||
grid-gap: 0px;
|
||||
justify-content: space-evenly;
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -95,8 +95,11 @@
|
|||
.wp-block-tainacan-modal .modal-checkbox-list,
|
||||
.wp-block-tainacan-modal .modal-radio-list .components-base-control__field {
|
||||
padding: 0;
|
||||
flex-wrap: wrap;
|
||||
display: flex;
|
||||
display: -ms-grid;
|
||||
display: grid;
|
||||
-ms-grid-columns: 250px 250px;
|
||||
grid-template-columns: repeat(auto-fill, 250px);
|
||||
grid-gap: 0px;
|
||||
justify-content: space-evenly;
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -95,8 +95,11 @@
|
|||
.wp-block-tainacan-modal .modal-checkbox-list,
|
||||
.wp-block-tainacan-modal .modal-radio-list .components-base-control__field {
|
||||
padding: 0;
|
||||
flex-wrap: wrap;
|
||||
display: flex;
|
||||
display: -ms-grid;
|
||||
display: grid;
|
||||
-ms-grid-columns: 250px 250px;
|
||||
grid-template-columns: repeat(auto-fill, 250px);
|
||||
grid-gap: 0px;
|
||||
justify-content: space-evenly;
|
||||
|
@ -163,8 +166,11 @@
|
|||
.wp-block-tainacan-terms-list ul.terms-list.terms-layout-grid,
|
||||
.wp-block-tainacan-terms-list ul.terms-list-edit.terms-layout-grid {
|
||||
padding: 0;
|
||||
flex-wrap: wrap;
|
||||
display: flex;
|
||||
display: -ms-grid;
|
||||
display: grid;
|
||||
-ms-grid-columns: 220px 220px 220px 220px 220px;
|
||||
grid-template-columns: repeat(auto-fill, 220px);
|
||||
grid-gap: 0px;
|
||||
justify-content: space-evenly;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"version": 3,
|
||||
"mappings": "AAEA,kCAAmC;EAC/B,KAAK,EAAE,iBAAiB;;AAE5B,cAAe;EACX,OAAO,EAAE,IAAI;EACb,cAAc,EAAE,GAAG;EACnB,eAAe,EAAE,MAAM;EACvB,WAAW,EAAE,MAAM;EACnB,OAAO,EAAE,GAAG;EACZ,QAAQ,EAAE,QAAQ;EAClB,GAAG,EAAE,KAAK;EACV,IAAI,EAAE,KAAK;EACX,KAAK,EAAE,iBAAiB;EACxB,UAAU,EAAE,OAAO;EAEnB,gBAAE;IACE,SAAS,EAAE,mBAAmB;IAC9B,MAAM,EAAE,kBAAkB;IAC1B,IAAI,EAAE,OAAO;IAEb,oBAAI;MACA,GAAG,EAAE,GAAG;MACR,YAAY,EAAE,OAAO;MACrB,QAAQ,EAAE,QAAQ;MAClB,IAAI,EAAE,OAAO;;AAIzB,mCAAoC;EAChC,SAAS,EAAE,mBAAmB;EAC9B,UAAU,EAAE,IAAI;EAChB,IAAI,EAAE,OAAO;EAEb,uCAAI;IACA,YAAY,EAAE,IAAI;IAClB,GAAG,EAAE,GAAG;IACR,QAAQ,EAAE,QAAQ;IAClB,IAAI,EAAE,OAAO;;AAKrB,wBAAyB;EACrB,KAAK,EAAE,GAAG;EAEV,0CAA2C;IAH/C,wBAAyB;MAGyB,KAAK,EAAE,GAAG;EACxD,yCAA0C;IAJ9C,wBAAyB;MAIuB,KAAK,EAAE,IAAI;EAGvD,sCAAgB;IACZ,KAAK,EAAE,GAAG;IACV,MAAM,EAAE,GAAG;IACX,KAAK,EAAE,IAAI;IACX,MAAM,EAAE,IAAI;IAEZ,6CAAO;MACH,KAAK,EAAE,iBAAiB;MACxB,MAAM,EAAE,kBAAkB;MAC1B,WAAW,EAAE,KAAK;IAGtB,yDAAmB;MACf,MAAM,EAAE,IAAI;MACZ,KAAK,EAAE,iBAAiB;MACxB,WAAW,EAAE,gBAAgB;MAC7B,OAAO,EAAE,wBAAwB;MACjC,UAAU,EAAE,iBAAiB;EAKrC,2CAAmB;IACf,UAAU,EAAE,IAAI;IAChB,OAAO,EAAE,IAAI;IACb,OAAO,EAAE,IAAI;IACb,eAAe,EAAE,MAAM;IACvB,WAAW,EAAE,MAAM;IACnB,KAAK,EAAE,OAAO;IACd,+DAAoB;MAAE,MAAM,EAAE,GAAG;EAGrC,0EAAkD;IAC9C,aAAa,EAAE,CAAC;EAGpB,2BAAG;IACC,MAAM,EAAE,WAAW;EAGvB,2CAAmB;IACf,OAAO,EAAE,IAAI;IACb,eAAe,EAAE,MAAM;IACvB,aAAa,EAAE,IAAI;IAEnB,oEAAyB;MACrB,KAAK,EAAE,GAAG;MAEV,0CAA2C;QAH/C,oEAAyB;UAGyB,KAAK,EAAE,GAAG;MACxD,iFAAe;QACX,WAAW,EAAE,CAAC;MAElB,oGAAgC;QAC5B,SAAS,EAAE,IAAI;MAEnB,yGAAqC;QACjC,WAAW,EAAE,GAAG;QAChB,KAAK,EAAE,OAAO;QACd,SAAS,EAAE,QAAQ;QACnB,UAAU,EAAE,MAAM;MAEtB,yGAAqC;QACjC,OAAO,EAAE,OAAO;QAChB,MAAM,EAAE,IAAI;EAKxB,gDAAwB;IACpB,WAAW,EAAE,GAAG;IAChB,WAAW,EAAE,OAAO;EAGxB;4EACkD;IAC9C,OAAO,EAAE,CAAC;IACV,OAAO,EAAE,QAAQ;IACjB,OAAO,EAAE,IAAI;IACb,qBAAqB,EAAE,wBAAwB;IAC/C,QAAQ,EAAE,GAAG;IACb,eAAe,EAAE,YAAY;IAC7B,eAAe,EAAE,IAAI;IACrB,MAAM,EAAE,IAAI;IACZ,UAAU,EAAE,IAAI;IAChB,UAAU,EAAE,IAAI;IAChB,UAAU,EAAE,MAAM;IAElB;uGAAyB;MACrB,QAAQ,EAAE,MAAM;IAGpB;;;gHACkC;MAC9B,OAAO,EAAE,IAAI;MACb,eAAe,EAAE,UAAU;MAE3B;;;sHAAI;QACA,KAAK,EAAE,IAAI;QACX,MAAM,EAAE,IAAI;QACZ,YAAY,EAAE,IAAI;MAEtB;;;wHAAM;QACF,WAAW,EAAE,MAAM;QACnB,aAAa,EAAE,QAAQ;QACvB,QAAQ,EAAE,MAAM;QAChB,OAAO,EAAE,YAAY;QACrB,SAAS,EAAE,GAAG;QAEd,yCAA0C;UAP9C;;;4HAAM;YAO0C,SAAS,EAAE,GAAG;EAItE,gDAAwB;IACpB,OAAO,EAAE,IAAI;IACb,WAAW,EAAE,QAAQ;IACrB,eAAe,EAAE,MAAM;IAEvB,kDAAE;MACE,KAAK,EAAE,OAAO;MACd,YAAY,EAAE,IAAI;MAClB,UAAU,EAAE,GAAG;EAGvB,2CAAmB;IACf,UAAU,EAAE,iBAAiB;IAC7B,OAAO,EAAE,IAAI;IACb,WAAW,EAAE,QAAQ;IACrB,eAAe,EAAE,aAAa;IAC9B,OAAO,EAAE,gBAAgB;IACzB,MAAM,EAAE,OAAO;IAEf,6CAAE;MACE,OAAO,EAAE,MAAM;MACf,KAAK,EAAE,OAAO;;ACtL1B,6BAA8B;EAC1B,MAAM,EAAE,QAAQ;EAGhB,iDAAoB;IAChB,QAAQ,EAAE,QAAQ;IAClB,KAAK,EAAE,CAAC;EAIZ;oEACqC;IACjC,OAAO,EAAE,CAAC;IACV,OAAO,EAAE,QAAQ;IACjB,OAAO,EAAE,IAAI;IACb,qBAAqB,EAAE,wBAAwB;IAC/C,QAAQ,EAAE,GAAG;IACb,eAAe,EAAE,YAAY;IAC7B,eAAe,EAAE,IAAI;IAErB;wFAAkB;MACd,QAAQ,EAAE,QAAQ;MAClB,OAAO,EAAE,KAAK;MACd,MAAM,EAAE,mBAAmB;MAC3B,aAAa,EAAE,IAAI;MACnB,KAAK,EAAE,KAAK;MAEZ;4FAAE;QACE,KAAK,EAAE,OAAO;QACd,WAAW,EAAE,IAAI;QACjB,WAAW,EAAE,MAAM;MAGvB;8FAAI;QACA,MAAM,EAAE,IAAI;QACZ,KAAK,EAAE,KAAK;QACZ,SAAS,EAAE,KAAK;QAChB,OAAO,EAAE,GAAG;QACZ,aAAa,EAAE,MAAM;MAGzB;mHAAyB;QACrB,OAAO,EAAE,IAAI;MAGjB;kGAAU;QACN,KAAK,EAAE,OAAO;QACd,eAAe,EAAE,IAAI;EAIjC,kEAAqC;IACjC,OAAO,EAAE,IAAI;IACb,WAAW,EAAE,UAAU;IAEvB,yEAAO;MACH,QAAQ,EAAE,mBAAmB;MAC7B,gBAAgB,EAAE,yBAAyB;MAC3C,KAAK,EAAE,OAAO;MACd,OAAO,EAAE,GAAG;MACZ,WAAW,EAAE,GAAG;MAChB,SAAS,EAAE,IAAI;MACf,UAAU,EAAE,MAAM;MAClB,QAAQ,EAAE,QAAQ;MAClB,OAAO,EAAE,CAAC;MACV,KAAK,EAAE,KAAK;MACZ,GAAG,EAAE,GAAG;MACR,eAAe,EAAE,MAAM;MACvB,OAAO,EAAE,GAAG;IAGhB,+EAAe;MACX,UAAU,EAAE,OAAO;MACnB,gBAAgB,EAAE,gBAAiC;MACnD,OAAO,EAAE,CAAC;MACV,KAAK,EAAE,IAAI;MACX,GAAG,EAAE,IAAI;MACT,MAAM,EAAE,iBAAiB;MACzB,aAAa,EAAE,IAAI;MACnB,UAAU,EAAE,wCAAwC;IAExD,qFAAqB;MACjB,gBAAgB,EAAE,gBAAiC;MACnD,MAAM,EAAE,4BAA4B;EAG5C,yCAA0C;IAEtC;sEACqC;MACjC,qBAAqB,EAAE,uBAAuB;MAE9C;0FAAkB;QACd,KAAK,EAAE,IAAI;QACX;gGAAI;UAAE,KAAK,EAAE,IAAI;EAM7B;oEACqC;IACjC,OAAO,EAAE,CAAC;IACV,OAAO,EAAE,IAAI;IACb,SAAS,EAAE,IAAI;IACf,WAAW,EAAE,MAAM;IACnB,eAAe,EAAE,IAAI;IAErB;wFAAkB;MACd,QAAQ,EAAE,QAAQ;MAClB,MAAM,EAAE,mBAAmB;MAC3B,aAAa,EAAE,IAAI;MACnB,UAAU,EAAE,IAAI;MAChB,SAAS,EAAE,gBAAgB;MAC3B,KAAK,EAAE,gBAAgB;MAEvB;4FAAE;QACE,KAAK,EAAE,OAAO;QACd,MAAM,EAAE,IAAI;QACZ,OAAO,EAAE,IAAI;QACb,WAAW,EAAE,MAAM;QACnB,UAAU,EAAE,SAAS;QACrB,UAAU,EAAE,UAAU;MAG1B;8FAAI;QACA,MAAM,EAAE,IAAI;QACZ,KAAK,EAAE,IAAI;QACX,SAAS,EAAE,IAAI;QACf,OAAO,EAAE,GAAG;QACZ,YAAY,EAAE,IAAI;MAGtB;mHAAyB;QACrB,OAAO,EAAE,IAAI;MAGjB;kGAAU;QACN,KAAK,EAAE,OAAO;QACd,eAAe,EAAE,IAAI;MAGzB,0CAA2C;QAlC/C;4FAAkB;UAmCV,SAAS,EAAE,gBAAgB;UAC3B,KAAK,EAAE,gBAAgB;MAG3B,0CAA2C;QAvC/C;4FAAkB;UAwCV,SAAS,EAAE,oBAAoB;UAC/B,KAAK,EAAE,oBAAoB;MAG/B,yCAA0C;QA5C9C;4FAAkB;UA6CV,SAAS,EAAE,gBAAgB;UAC3B,KAAK,EAAE,gBAAgB;MAG3B,yCAA0C;QAjD9C;4FAAkB;UAkDV,SAAS,EAAE,iBAAiB;UAC5B,KAAK,EAAE,iBAAiB",
|
||||
"mappings": "AAEA,kCAAmC;EAC/B,KAAK,EAAE,iBAAiB;;AAE5B,cAAe;EACX,OAAO,EAAE,IAAI;EACb,cAAc,EAAE,GAAG;EACnB,eAAe,EAAE,MAAM;EACvB,WAAW,EAAE,MAAM;EACnB,OAAO,EAAE,GAAG;EACZ,QAAQ,EAAE,QAAQ;EAClB,GAAG,EAAE,KAAK;EACV,IAAI,EAAE,KAAK;EACX,KAAK,EAAE,iBAAiB;EACxB,UAAU,EAAE,OAAO;EAEnB,gBAAE;IACE,SAAS,EAAE,mBAAmB;IAC9B,MAAM,EAAE,kBAAkB;IAC1B,IAAI,EAAE,OAAO;IAEb,oBAAI;MACA,GAAG,EAAE,GAAG;MACR,YAAY,EAAE,OAAO;MACrB,QAAQ,EAAE,QAAQ;MAClB,IAAI,EAAE,OAAO;;AAIzB,mCAAoC;EAChC,SAAS,EAAE,mBAAmB;EAC9B,UAAU,EAAE,IAAI;EAChB,IAAI,EAAE,OAAO;EAEb,uCAAI;IACA,YAAY,EAAE,IAAI;IAClB,GAAG,EAAE,GAAG;IACR,QAAQ,EAAE,QAAQ;IAClB,IAAI,EAAE,OAAO;;AAqBrB,wBAAyB;EACrB,KAAK,EAAE,GAAG;EAEV,0CAA2C;IAH/C,wBAAyB;MAGyB,KAAK,EAAE,GAAG;EACxD,yCAA0C;IAJ9C,wBAAyB;MAIuB,KAAK,EAAE,IAAI;EAGvD,sCAAgB;IACZ,KAAK,EAAE,GAAG;IACV,MAAM,EAAE,GAAG;IACX,KAAK,EAAE,IAAI;IACX,MAAM,EAAE,IAAI;IAEZ,6CAAO;MACH,KAAK,EAAE,iBAAiB;MACxB,MAAM,EAAE,kBAAkB;MAC1B,WAAW,EAAE,KAAK;IAGtB,yDAAmB;MACf,MAAM,EAAE,IAAI;MACZ,KAAK,EAAE,iBAAiB;MACxB,WAAW,EAAE,gBAAgB;MAC7B,OAAO,EAAE,wBAAwB;MACjC,UAAU,EAAE,iBAAiB;EAKrC,2CAAmB;IACf,UAAU,EAAE,IAAI;IAChB,OAAO,EAAE,IAAI;IACb,OAAO,EAAE,IAAI;IACb,eAAe,EAAE,MAAM;IACvB,WAAW,EAAE,MAAM;IACnB,KAAK,EAAE,OAAO;IACd,+DAAoB;MAAE,MAAM,EAAE,GAAG;EAGrC,0EAAkD;IAC9C,aAAa,EAAE,CAAC;EAGpB,2BAAG;IACC,MAAM,EAAE,WAAW;EAGvB,2CAAmB;IACf,OAAO,EAAE,IAAI;IACb,eAAe,EAAE,MAAM;IACvB,aAAa,EAAE,IAAI;IAEnB,oEAAyB;MACrB,KAAK,EAAE,GAAG;MAEV,0CAA2C;QAH/C,oEAAyB;UAGyB,KAAK,EAAE,GAAG;MACxD,iFAAe;QACX,WAAW,EAAE,CAAC;MAElB,oGAAgC;QAC5B,SAAS,EAAE,IAAI;MAEnB,yGAAqC;QACjC,WAAW,EAAE,GAAG;QAChB,KAAK,EAAE,OAAO;QACd,SAAS,EAAE,QAAQ;QACnB,UAAU,EAAE,MAAM;MAEtB,yGAAqC;QACjC,OAAO,EAAE,OAAO;QAChB,MAAM,EAAE,IAAI;EAKxB,gDAAwB;IACpB,WAAW,EAAE,GAAG;IAChB,WAAW,EAAE,OAAO;EAGxB;4EACkD;IAC9C,OAAO,EAAE,CAAC;IAjGd,SAAS,EAAE,IAAI;IACf,OAAO,EAAE,IAAI;IACb,OAAO,EAAE,QAAQ;IACjB,OAAO,EAAE,IAAI;IAgGT,gBAAgB,EAAE,WAAW;IAC7B,qBAAqB,EAAE,wBAAwB;IAC/C,QAAQ,EAAE,GAAG;IACb,eAAe,EAAE,YAAY;IAC7B,eAAe,EAAE,IAAI;IACrB,MAAM,EAAE,IAAI;IACZ,UAAU,EAAE,IAAI;IAChB,UAAU,EAAE,IAAI;IAChB,UAAU,EAAE,MAAM;IAElB;uGAAyB;MACrB,QAAQ,EAAE,MAAM;IAGpB;;;gHACkC;MAC9B,OAAO,EAAE,IAAI;MACb,eAAe,EAAE,UAAU;MAE3B;;;sHAAI;QACA,KAAK,EAAE,IAAI;QACX,MAAM,EAAE,IAAI;QACZ,YAAY,EAAE,IAAI;MAEtB;;;wHAAM;QACF,WAAW,EAAE,MAAM;QACnB,aAAa,EAAE,QAAQ;QACvB,QAAQ,EAAE,MAAM;QAChB,OAAO,EAAE,YAAY;QACrB,SAAS,EAAE,GAAG;QAEd,yCAA0C;UAP9C;;;4HAAM;YAO0C,SAAS,EAAE,GAAG;EAItE,gDAAwB;IACpB,OAAO,EAAE,IAAI;IACb,WAAW,EAAE,QAAQ;IACrB,eAAe,EAAE,MAAM;IAEvB,kDAAE;MACE,KAAK,EAAE,OAAO;MACd,YAAY,EAAE,IAAI;MAClB,UAAU,EAAE,GAAG;EAGvB,2CAAmB;IACf,UAAU,EAAE,iBAAiB;IAC7B,OAAO,EAAE,IAAI;IACb,WAAW,EAAE,QAAQ;IACrB,eAAe,EAAE,aAAa;IAC9B,OAAO,EAAE,gBAAgB;IACzB,MAAM,EAAE,OAAO;IAEf,6CAAE;MACE,OAAO,EAAE,MAAM;MACf,KAAK,EAAE,OAAO;;ACtM1B,6BAA8B;EAC1B,MAAM,EAAE,QAAQ;EAGhB,iDAAoB;IAChB,QAAQ,EAAE,QAAQ;IAClB,KAAK,EAAE,CAAC;EAIZ;oEACqC;IACjC,OAAO,EAAE,CAAC;ID+Bd,SAAS,EAAE,IAAI;IACf,OAAO,EAAE,IAAI;IACb,OAAO,EAAE,QAAQ;IACjB,OAAO,EAAE,IAAI;IChCT,gBAAgB,EAAE,6BAA6B;IAC/C,qBAAqB,EAAE,wBAAwB;IAC/C,QAAQ,EAAE,GAAG;IACb,eAAe,EAAE,YAAY;IAC7B,eAAe,EAAE,IAAI;IAErB;wFAAkB;MACd,QAAQ,EAAE,QAAQ;MAClB,OAAO,EAAE,KAAK;MACd,MAAM,EAAE,mBAAmB;MAC3B,aAAa,EAAE,IAAI;MACnB,KAAK,EAAE,KAAK;MAEZ;4FAAE;QACE,KAAK,EAAE,OAAO;QACd,WAAW,EAAE,IAAI;QACjB,WAAW,EAAE,MAAM;MAGvB;8FAAI;QACA,MAAM,EAAE,IAAI;QACZ,KAAK,EAAE,KAAK;QACZ,SAAS,EAAE,KAAK;QAChB,OAAO,EAAE,GAAG;QACZ,aAAa,EAAE,MAAM;MAGzB;mHAAyB;QACrB,OAAO,EAAE,IAAI;MAGjB;kGAAU;QACN,KAAK,EAAE,OAAO;QACd,eAAe,EAAE,IAAI;EAIjC,kEAAqC;IACjC,OAAO,EAAE,IAAI;IACb,WAAW,EAAE,UAAU;IAEvB,yEAAO;MACH,QAAQ,EAAE,mBAAmB;MAC7B,gBAAgB,EAAE,yBAAyB;MAC3C,KAAK,EAAE,OAAO;MACd,OAAO,EAAE,GAAG;MACZ,WAAW,EAAE,GAAG;MAChB,SAAS,EAAE,IAAI;MACf,UAAU,EAAE,MAAM;MAClB,QAAQ,EAAE,QAAQ;MAClB,OAAO,EAAE,CAAC;MACV,KAAK,EAAE,KAAK;MACZ,GAAG,EAAE,GAAG;MACR,eAAe,EAAE,MAAM;MACvB,OAAO,EAAE,GAAG;IAGhB,+EAAe;MACX,UAAU,EAAE,OAAO;MACnB,gBAAgB,EAAE,gBAAiC;MACnD,OAAO,EAAE,CAAC;MACV,KAAK,EAAE,IAAI;MACX,GAAG,EAAE,IAAI;MACT,MAAM,EAAE,iBAAiB;MACzB,aAAa,EAAE,IAAI;MACnB,UAAU,EAAE,wCAAwC;IAExD,qFAAqB;MACjB,gBAAgB,EAAE,gBAAiC;MACnD,MAAM,EAAE,4BAA4B;EAG5C,yCAA0C;IAEtC;sEACqC;MACjC,qBAAqB,EAAE,uBAAuB;MAE9C;0FAAkB;QACd,KAAK,EAAE,IAAI;QACX;gGAAI;UAAE,KAAK,EAAE,IAAI;EAM7B;oEACqC;IACjC,OAAO,EAAE,CAAC;IACV,OAAO,EAAE,IAAI;IACb,SAAS,EAAE,IAAI;IACf,WAAW,EAAE,MAAM;IACnB,eAAe,EAAE,IAAI;IAErB;wFAAkB;MACd,QAAQ,EAAE,QAAQ;MAClB,MAAM,EAAE,mBAAmB;MAC3B,aAAa,EAAE,IAAI;MACnB,UAAU,EAAE,IAAI;MAChB,SAAS,EAAE,gBAAgB;MAC3B,KAAK,EAAE,gBAAgB;MAEvB;4FAAE;QACE,KAAK,EAAE,OAAO;QACd,MAAM,EAAE,IAAI;QACZ,OAAO,EAAE,IAAI;QACb,WAAW,EAAE,MAAM;QACnB,UAAU,EAAE,SAAS;QACrB,UAAU,EAAE,UAAU;MAG1B;8FAAI;QACA,MAAM,EAAE,IAAI;QACZ,KAAK,EAAE,IAAI;QACX,SAAS,EAAE,IAAI;QACf,OAAO,EAAE,GAAG;QACZ,YAAY,EAAE,IAAI;MAGtB;mHAAyB;QACrB,OAAO,EAAE,IAAI;MAGjB;kGAAU;QACN,KAAK,EAAE,OAAO;QACd,eAAe,EAAE,IAAI;MAGzB,0CAA2C;QAlC/C;4FAAkB;UAmCV,SAAS,EAAE,gBAAgB;UAC3B,KAAK,EAAE,gBAAgB;MAG3B,0CAA2C;QAvC/C;4FAAkB;UAwCV,SAAS,EAAE,oBAAoB;UAC/B,KAAK,EAAE,oBAAoB;MAG/B,yCAA0C;QA5C9C;4FAAkB;UA6CV,SAAS,EAAE,gBAAgB;UAC3B,KAAK,EAAE,gBAAgB;MAG3B,yCAA0C;QAjD9C;4FAAkB;UAkDV,SAAS,EAAE,iBAAiB;UAC5B,KAAK,EAAE,iBAAiB",
|
||||
"sources": ["../../gutenberg-blocks/gutenberg-blocks-style.scss","../../gutenberg-blocks/tainacan-terms/terms-list/terms-list.scss"],
|
||||
"names": [],
|
||||
"file": "tainacan-gutenberg-block-terms-list.css"
|
||||
|
|
|
@ -12,18 +12,10 @@ namespace Tainacan;
|
|||
|
||||
defined( 'ABSPATH' ) || exit;
|
||||
|
||||
if ( ! class_exists( 'WP_Async_Request', false ) ) {
|
||||
include_once TAINACAN_CLASSES_DIR . '/lib/wp-async-request.php';
|
||||
}
|
||||
|
||||
if ( ! class_exists( 'WP_Background_Process', false ) ) {
|
||||
include_once TAINACAN_CLASSES_DIR . '/lib/wp-background-process.php';
|
||||
}
|
||||
|
||||
/**
|
||||
* Tainacan_Background_Process class.
|
||||
*/
|
||||
abstract class Background_Process extends \WP_Background_Process {
|
||||
abstract class Background_Process extends \Tainacan_WP_Background_Process {
|
||||
|
||||
/**
|
||||
* Table name where the queue is stored
|
||||
|
|
|
@ -81,9 +81,9 @@ class Elastic_Press {
|
|||
|
||||
if ($item instanceof Entities\Item) {
|
||||
$ids_meta = array_keys ($post_args['meta']);
|
||||
\array_filter(function($n) {
|
||||
$ids_meta = \array_filter($ids_meta, function($n) {
|
||||
if (is_numeric($n)) return intval($n);
|
||||
}, $ids_meta);
|
||||
});
|
||||
|
||||
$Tainacan_Metadata = \Tainacan\Repositories\Metadata::get_instance();
|
||||
$Tainacan_Item_Metadata = \Tainacan\Repositories\Item_Metadata::get_instance();
|
||||
|
@ -584,7 +584,7 @@ class Elastic_Press {
|
|||
}
|
||||
|
||||
if($search != '') {
|
||||
$formatted_args['query']['bool']['must'][] = ["wildcard"=>["$field.name.raw" => "*$search*"]];
|
||||
$formatted_args['query']['bool']['must'][] = ["wildcard"=>["$field.name.sortable" => "*$search*"]];
|
||||
}
|
||||
} else {
|
||||
$aggs[$id] = [
|
||||
|
@ -613,7 +613,7 @@ class Elastic_Press {
|
|||
$field_relationship_label = "$field_relationship_label[0].$field_relationship_label[1].relationship_label";
|
||||
//$formatted_args['query']['bool']['must'][] = ["wildcard"=>["$field" => "*$search*"]];
|
||||
$formatted_args['query']['bool']['must'][] = ["bool"=>["should"=>[
|
||||
["wildcard"=>["$field"=>"*$search*"]],
|
||||
["wildcard"=>["$id.value.sortable"=>"*$search*"]],
|
||||
["wildcard"=>["$field_relationship_label"=>"*$search*"]] //pega nome do metadado é melhor!
|
||||
]]];
|
||||
}
|
||||
|
|
|
@ -237,7 +237,7 @@ class Media {
|
|||
return;
|
||||
}
|
||||
|
||||
$content_index_meta = '_document_content_index';
|
||||
$content_index_meta = 'document_content_index';
|
||||
|
||||
if ($file == null) {
|
||||
$meta_id = update_post_meta( $item_id, $content_index_meta, null );
|
||||
|
@ -260,7 +260,7 @@ class Media {
|
|||
|
||||
try {
|
||||
$parser = new \Smalot\PdfParser\Parser();
|
||||
$content = $parser->parseFile($file)->getText();
|
||||
$content = $parser->parseFile($file)->getText();
|
||||
|
||||
$wp_charset = get_bloginfo('charset');
|
||||
$content_charset = mb_detect_encoding($content);
|
||||
|
|
|
@ -8,9 +8,11 @@ use Tainacan\Entities;
|
|||
* Class withe helpful methods to handle media in Tainacan
|
||||
*/
|
||||
class Private_Files {
|
||||
|
||||
|
||||
private static $instance = null;
|
||||
|
||||
public $dir_separator;
|
||||
|
||||
public static function get_instance() {
|
||||
if(!isset(self::$instance)) {
|
||||
self::$instance = new self();
|
||||
|
@ -18,26 +20,31 @@ class Private_Files {
|
|||
|
||||
return self::$instance;
|
||||
}
|
||||
|
||||
|
||||
protected function __construct() {
|
||||
|
||||
// Once upon a time I thought I had to worry about Windows and use DIRECTORY_SEPARATOR
|
||||
// but this only gave me frustration and bugs.
|
||||
$this->dir_separator = '/';
|
||||
|
||||
add_filter('wp_handle_upload_prefilter', [$this, 'pre_upload']);
|
||||
add_filter('wp_handle_sideload_prefilter', [$this, 'pre_upload']);
|
||||
add_filter('wp_handle_upload', [$this, 'post_upload']);
|
||||
|
||||
|
||||
add_action('tainacan-pre-insert-attachment', [$this, 'pre_tainacan_upload'], 10, 3);
|
||||
add_action('tainacan-post-insert-attachment', [$this, 'post_tainacan_upload'], 10, 3);
|
||||
|
||||
|
||||
add_action('template_redirect', [$this, 'template_redirect']);
|
||||
add_filter('image_get_intermediate_size', [$this, 'image_get_intermediate_size'], 10, 3);
|
||||
add_filter('wp_get_attachment_url', [$this, 'wp_get_attachment_url'], 10, 2);
|
||||
|
||||
|
||||
add_action('tainacan-insert', [$this, 'update_item_and_collection']);
|
||||
|
||||
|
||||
add_action('tainacan-bulk-edit-set-status', [$this, 'bulk_edit'], 10, 4);
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
function pre_tainacan_upload($blob, $filename, $post_id) {
|
||||
if (is_numeric($post_id)) {
|
||||
global $TAINACAN_UPLOADING_ATTACHMENT_TO_POST;
|
||||
|
@ -45,33 +52,33 @@ class Private_Files {
|
|||
add_filter('upload_dir', [$this, 'change_upload_dir']);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function post_tainacan_upload($attach_id, $attach_data, $post_id) {
|
||||
remove_filter('upload_dir', [$this, 'change_upload_dir']);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Adds a filter to the upload_dir hook when uploading a new file
|
||||
*
|
||||
* Adds a filter to the upload_dir hook when uploading a new file
|
||||
*
|
||||
*/
|
||||
function pre_upload($file){
|
||||
add_filter('upload_dir', [$this, 'change_upload_dir']);
|
||||
return $file;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Removes a filter to the upload_dir hook after uploading a new file
|
||||
*
|
||||
* Removes a filter to the upload_dir hook after uploading a new file
|
||||
*
|
||||
*/
|
||||
function post_upload($fileinfo){
|
||||
remove_filter('upload_dir', [$this, 'change_upload_dir']);
|
||||
return $fileinfo;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Gets the base directory inside the uploads folder where
|
||||
* attachments and documents for items will be uploaded
|
||||
*
|
||||
* Gets the base directory inside the uploads folder where
|
||||
* attachments and documents for items will be uploaded
|
||||
*
|
||||
* @return string The folder name
|
||||
*/
|
||||
function get_items_uploads_folder() {
|
||||
|
@ -80,11 +87,11 @@ class Private_Files {
|
|||
}
|
||||
return 'tainacan-items';
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Gets the directory prefix to be added to folders holding
|
||||
* attachments and documents for private items or collections
|
||||
*
|
||||
* attachments and documents for private items or collections
|
||||
*
|
||||
* @return string The folder prefix
|
||||
*/
|
||||
function get_private_folder_prefix() {
|
||||
|
@ -93,140 +100,140 @@ class Private_Files {
|
|||
}
|
||||
return '_x_';
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Change the upload directory for items attachments and documents
|
||||
* Change the upload directory for items attachments and documents
|
||||
*
|
||||
* It replaces the default WordPress strucutre, which is YYYY/MM/file
|
||||
* with a path containing the collection id and the item id inside the @see get_items_uploads_folder():
|
||||
* It replaces the default WordPress strucutre, which is YYYY/MM/file
|
||||
* with a path containing the collection id and the item id inside the @see get_items_uploads_folder():
|
||||
* ex: * tainacan-items/$collection_id/$item_id
|
||||
*
|
||||
* It also add a prefix in the folder name of private items or collections:
|
||||
* It also add a prefix in the folder name of private items or collections:
|
||||
* tainacan-items/$collection_id/_x_$item_id ($item_id is a private item)
|
||||
*
|
||||
*
|
||||
*/
|
||||
function change_upload_dir($path) {
|
||||
$post_id = false;
|
||||
|
||||
|
||||
// regular ajax uploads via Admin Panel will send post_id
|
||||
if ( isset($_REQUEST['post_id']) && $_REQUEST['post_id'] ) {
|
||||
$post_id = $_REQUEST['post_id'];
|
||||
}
|
||||
|
||||
|
||||
// API requests to media endpoint will send post
|
||||
if ( false === $post_id && isset($_REQUEST['post']) && is_numeric($_REQUEST['post']) ) {
|
||||
$post_id = $_REQUEST['post'];
|
||||
}
|
||||
|
||||
// tainacan internals, scripts and tests, will set this global
|
||||
|
||||
// tainacan internals, scripts and tests, will set this global
|
||||
if (false === $post_id) {
|
||||
global $TAINACAN_UPLOADING_ATTACHMENT_TO_POST;
|
||||
if ( isset($TAINACAN_UPLOADING_ATTACHMENT_TO_POST) && is_numeric($TAINACAN_UPLOADING_ATTACHMENT_TO_POST) ) {
|
||||
$post_id = $TAINACAN_UPLOADING_ATTACHMENT_TO_POST;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (false === $post_id) {
|
||||
return $path;
|
||||
}
|
||||
|
||||
|
||||
$theme_helper = \Tainacan\Theme_Helper::get_instance();
|
||||
|
||||
|
||||
$post = get_post($post_id);
|
||||
|
||||
|
||||
if ( !$theme_helper->is_post_an_item($post) ) {
|
||||
return $path;
|
||||
}
|
||||
|
||||
|
||||
$item = \Tainacan\Repositories\Items::get_instance()->fetch( (int) $post_id );
|
||||
|
||||
|
||||
if ($item instanceof \Tainacan\Entities\Item) {
|
||||
|
||||
|
||||
$tainacan_basepath = $this->get_items_uploads_folder();
|
||||
$col_id_url = $item->get_collection_id();
|
||||
$col_id = $item->get_collection_id();
|
||||
$item_id_url = $item->get_id();
|
||||
$item_id = $item->get_id();
|
||||
|
||||
|
||||
$col_status = get_post_status_object($item->get_collection()->get_status());
|
||||
$item_status = get_post_status_object($item->get_status());
|
||||
|
||||
|
||||
if ( ! $col_status->public ) {
|
||||
$col_id = $this->get_private_folder_prefix() . $col_id;
|
||||
}
|
||||
if ( ! $item_status->public ) {
|
||||
$item_id = $this->get_private_folder_prefix() . $item_id;
|
||||
}
|
||||
|
||||
|
||||
$path['path'] = str_replace($path['subdir'], '', $path['path']); //remove default subdir (year/month)
|
||||
$path['url'] = str_replace($path['subdir'], '/' . $tainacan_basepath . '/' . $col_id_url . '/' . $item_id_url, $path['url']);
|
||||
$path['path'] .= DIRECTORY_SEPARATOR . $tainacan_basepath . DIRECTORY_SEPARATOR . $col_id . '/' . $item_id;
|
||||
$path['subdir'] = DIRECTORY_SEPARATOR . $tainacan_basepath . DIRECTORY_SEPARATOR . $col_id . '/' . $item_id;
|
||||
|
||||
$path['url'] = str_replace($path['subdir'], '/' . $tainacan_basepath . '/' . $col_id_url . '/' . $item_id_url, $path['url']);
|
||||
$path['path'] .= $this->dir_separator . $tainacan_basepath . $this->dir_separator . $col_id . $this->dir_separator . $item_id;
|
||||
$path['subdir'] = $this->dir_separator . $tainacan_basepath . $this->dir_separator . $col_id . $this->dir_separator . $item_id;
|
||||
|
||||
}
|
||||
|
||||
|
||||
return $path;
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Handles 404 returns looking for attachments inside the tainacan items uploads folder
|
||||
* Handles 404 returns looking for attachments inside the tainacan items uploads folder
|
||||
*
|
||||
* When looking for a file that does not exists, it checks for relative prefixed folders.
|
||||
* When looking for a file that does not exists, it checks for relative prefixed folders.
|
||||
* If it finds the file, it then checks to see if current user have permission to see this file, based on
|
||||
* the permission he/she have to read the related item.
|
||||
*
|
||||
*
|
||||
*/
|
||||
function template_redirect() {
|
||||
|
||||
|
||||
if (is_404()) {
|
||||
|
||||
|
||||
$upload_dir = wp_get_upload_dir();
|
||||
$base_upload_url = preg_replace('/^https?:\/\//', '', $upload_dir['baseurl']);
|
||||
|
||||
|
||||
$requested_uri = $_SERVER['SERVER_NAME'] . $_SERVER['REQUEST_URI'];
|
||||
|
||||
|
||||
if ( strpos($requested_uri, $base_upload_url) === false ) {
|
||||
// Not uploads
|
||||
// Not uploads
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
$requested_uri = str_replace('/' . $this->get_private_folder_prefix(), '/', $requested_uri);
|
||||
|
||||
$file_path = \str_replace( '/', DIRECTORY_SEPARATOR, str_replace($base_upload_url, '', $requested_uri) );
|
||||
|
||||
|
||||
$file_path = \str_replace( '/', $this->dir_separator, str_replace($base_upload_url, '', $requested_uri) );
|
||||
|
||||
$file = $upload_dir['basedir'] . $file_path;
|
||||
|
||||
|
||||
$existing_file = false;
|
||||
|
||||
$file_dirs = explode(DIRECTORY_SEPARATOR, $file);
|
||||
|
||||
$file_dirs = explode($this->dir_separator, $file);
|
||||
$file_dirs_size = sizeof($file_dirs);
|
||||
|
||||
|
||||
$item_id = $file_dirs[$file_dirs_size-2];
|
||||
$collection_id = $file_dirs[$file_dirs_size-3];
|
||||
|
||||
// private item
|
||||
$prefixed_file = str_replace( DIRECTORY_SEPARATOR . $item_id . DIRECTORY_SEPARATOR, DIRECTORY_SEPARATOR . $this->get_private_folder_prefix() . $item_id . DIRECTORY_SEPARATOR, $file);
|
||||
|
||||
|
||||
// private item
|
||||
$prefixed_file = str_replace( $this->dir_separator . $item_id . $this->dir_separator, $this->dir_separator . $this->get_private_folder_prefix() . $item_id . $this->dir_separator, $file);
|
||||
|
||||
if ( \file_exists( $prefixed_file ) ) {
|
||||
$existing_file = $prefixed_file;
|
||||
}
|
||||
// private collection
|
||||
$prefixed_collection = str_replace( DIRECTORY_SEPARATOR . $collection_id . DIRECTORY_SEPARATOR, DIRECTORY_SEPARATOR . $this->get_private_folder_prefix() . $collection_id . DIRECTORY_SEPARATOR, $file);
|
||||
// private collection
|
||||
$prefixed_collection = str_replace( $this->dir_separator . $collection_id . $this->dir_separator, $this->dir_separator . $this->get_private_folder_prefix() . $collection_id . $this->dir_separator, $file);
|
||||
if ( !$existing_file && \file_exists( $prefixed_collection ) ) {
|
||||
$existing_file = $prefixed_collection;
|
||||
}
|
||||
// private both
|
||||
$prefixed_both = str_replace( DIRECTORY_SEPARATOR . $collection_id . DIRECTORY_SEPARATOR, DIRECTORY_SEPARATOR . $this->get_private_folder_prefix() . $collection_id . DIRECTORY_SEPARATOR, $prefixed_file);
|
||||
// private both
|
||||
$prefixed_both = str_replace( $this->dir_separator . $collection_id . $this->dir_separator, $this->dir_separator . $this->get_private_folder_prefix() . $collection_id . $this->dir_separator, $prefixed_file);
|
||||
if ( !$existing_file && \file_exists( $prefixed_both ) ) {
|
||||
$existing_file = $prefixed_both;
|
||||
}
|
||||
|
||||
|
||||
if ($existing_file) {
|
||||
|
||||
|
||||
$item = \Tainacan\Repositories\Items::get_instance()->fetch( (int) $item_id, (int) $collection_id );
|
||||
$mime_type = \Tainacan\Media::get_instance()->get_mime_content_type($existing_file);
|
||||
|
||||
|
||||
if ($item instanceof \Tainacan\Entities\Item && $item->can_read()) {
|
||||
//header('Content-Description: File Transfer');
|
||||
//header('Content-Type: application/octet-stream');
|
||||
|
@ -237,137 +244,137 @@ class Private_Files {
|
|||
// header('Pragma: public');
|
||||
// header('Content-Length: ' . filesize($file));
|
||||
\readfile($existing_file);
|
||||
|
||||
|
||||
die;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Filters the image_get_intermediate_size hook to strip out the
|
||||
* Filters the image_get_intermediate_size hook to strip out the
|
||||
* private uploads folder prefix from the attachments URLs
|
||||
*/
|
||||
function image_get_intermediate_size($data, $post_id, $size) {
|
||||
|
||||
$data['path'] = str_replace(DIRECTORY_SEPARATOR . $this->get_private_folder_prefix(), DIRECTORY_SEPARATOR, $data['path']);
|
||||
|
||||
$data['path'] = str_replace($this->dir_separator . $this->get_private_folder_prefix(), $this->dir_separator, $data['path']);
|
||||
$data['url'] = str_replace('/' . $this->get_private_folder_prefix(), '/', $data['url']);
|
||||
|
||||
|
||||
return $data;
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Filters the wp_get_attachment_url hook to strip out the
|
||||
* Filters the wp_get_attachment_url hook to strip out the
|
||||
* private uploads folder prefix from the attachments URLs
|
||||
*/
|
||||
function wp_get_attachment_url($url, $post_id) {
|
||||
$url = str_replace('/' . $this->get_private_folder_prefix(), '/', $url);
|
||||
return $url;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* When an item or collection is saved, it checks if the satus was changed and
|
||||
* if the items upload directory mus be renamed to add or remove the
|
||||
* private folder prefix
|
||||
* When an item or collection is saved, it checks if the satus was changed and
|
||||
* if the items upload directory mus be renamed to add or remove the
|
||||
* private folder prefix
|
||||
*/
|
||||
function update_item_and_collection($obj) {
|
||||
|
||||
$folder = DIRECTORY_SEPARATOR;
|
||||
$check_folder = DIRECTORY_SEPARATOR;
|
||||
|
||||
$folder = $this->dir_separator;
|
||||
$check_folder = $this->dir_separator;
|
||||
$check = false;
|
||||
|
||||
|
||||
if ( $obj instanceof \Tainacan\Entities\Collection ) {
|
||||
|
||||
|
||||
$status_obj = get_post_status_object($obj->get_status());
|
||||
|
||||
|
||||
$folder .= $status_obj->public ? $obj->get_id() : $this->get_private_folder_prefix() . $obj->get_id();
|
||||
$check_folder .= ! $status_obj->public ? $obj->get_id() : $this->get_private_folder_prefix() . $obj->get_id();
|
||||
|
||||
|
||||
$check = true;
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
if ( $obj instanceof \Tainacan\Entities\Item ) {
|
||||
|
||||
|
||||
$collection = $obj->get_collection();
|
||||
$col_status_object = get_post_status_object($collection->get_status());
|
||||
|
||||
$folder .= $col_status_object->public ? $collection->get_id() : $this->get_private_folder_prefix() . $collection->get_id() . DIRECTORY_SEPARATOR;
|
||||
$check_folder .= $col_status_object->public ? $collection->get_id() : $this->get_private_folder_prefix() . $collection->get_id() . DIRECTORY_SEPARATOR;
|
||||
|
||||
$folder .= DIRECTORY_SEPARATOR;
|
||||
$check_folder .= DIRECTORY_SEPARATOR;
|
||||
|
||||
|
||||
$folder .= $col_status_object->public ? $collection->get_id() : $this->get_private_folder_prefix() . $collection->get_id() . $this->dir_separator;
|
||||
$check_folder .= $col_status_object->public ? $collection->get_id() : $this->get_private_folder_prefix() . $collection->get_id() . $this->dir_separator;
|
||||
|
||||
$folder .= $this->dir_separator;
|
||||
$check_folder .= $this->dir_separator;
|
||||
|
||||
$status_obj = get_post_status_object($obj->get_status());
|
||||
|
||||
|
||||
$folder .= $status_obj->public ? $obj->get_id() : $this->get_private_folder_prefix() . $obj->get_id();
|
||||
$check_folder .= ! $status_obj->public ? $obj->get_id() : $this->get_private_folder_prefix() . $obj->get_id();
|
||||
|
||||
|
||||
$check = true;
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
if ($check) {
|
||||
|
||||
|
||||
$upload_dir = wp_get_upload_dir();
|
||||
$base_dir = $upload_dir['basedir'];
|
||||
$full_path = $base_dir . DIRECTORY_SEPARATOR . $this->get_items_uploads_folder() . $folder;
|
||||
$full_path_check = $base_dir . DIRECTORY_SEPARATOR . $this->get_items_uploads_folder() . $check_folder;
|
||||
|
||||
$full_path = $base_dir . $this->dir_separator . $this->get_items_uploads_folder() . $folder;
|
||||
$full_path_check = $base_dir . $this->dir_separator . $this->get_items_uploads_folder() . $check_folder;
|
||||
|
||||
if (\file_exists($full_path_check)) {
|
||||
rename($full_path_check, $full_path);
|
||||
do_action('tainacan-upload-folder-renamed', $full_path_check, $full_path);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Rename all folders from items after a bulk edit operation move their statuses
|
||||
* Rename all folders from items after a bulk edit operation move their statuses
|
||||
*
|
||||
* TODO: In the upcoming bulk edit refactor this must be handled as there are performance issues
|
||||
*
|
||||
*
|
||||
*/
|
||||
function bulk_edit($status, $group, $select_query, $query) {
|
||||
global $wpdb;
|
||||
|
||||
|
||||
$ids = $wpdb->get_col($select_query);
|
||||
|
||||
|
||||
$status_obj = get_post_status_object($status);
|
||||
$prefix = $status_obj->public ? $this->get_private_folder_prefix() : '';
|
||||
|
||||
|
||||
$upload_dir = wp_get_upload_dir();
|
||||
$base_dir = $upload_dir['basedir'];
|
||||
$full_path = $base_dir . DIRECTORY_SEPARATOR . $this->get_items_uploads_folder() . DIRECTORY_SEPARATOR . '*' . DIRECTORY_SEPARATOR . $prefix;
|
||||
|
||||
$full_path = $base_dir . $this->dir_separator . $this->get_items_uploads_folder() . $this->dir_separator . '*' . $this->dir_separator . $prefix;
|
||||
|
||||
foreach ($ids as $id) {
|
||||
$folder = $full_path . $id;
|
||||
$found = glob($folder);
|
||||
|
||||
|
||||
if (sizeof($found) == 1 && isset($found[0])) {
|
||||
|
||||
|
||||
if ($status_obj->public) {
|
||||
$target = str_replace(DIRECTORY_SEPARATOR . $this->get_private_folder_prefix() . $id, DIRECTORY_SEPARATOR . $id, $found[0]);
|
||||
$target = str_replace($this->dir_separator . $this->get_private_folder_prefix() . $id, $this->dir_separator . $id, $found[0]);
|
||||
} else {
|
||||
$target = str_replace(DIRECTORY_SEPARATOR . $id, DIRECTORY_SEPARATOR . $this->get_private_folder_prefix() . $id, $found[0]);
|
||||
$target = str_replace($this->dir_separator . $id, $this->dir_separator . $this->get_private_folder_prefix() . $id, $found[0]);
|
||||
}
|
||||
|
||||
|
||||
rename($found[0], $target);
|
||||
do_action('tainacan-upload-folder-renamed', $found[0], $target);
|
||||
|
||||
|
||||
}
|
||||
if (\file_exists($folder)) {
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -366,7 +366,7 @@ class Entity {
|
|||
|
||||
$attributes = [];
|
||||
foreach($map as $prop => $content) {
|
||||
$attributes[$prop] = $this->get_mapped_property($prop);
|
||||
$attributes[$prop] = $this->get($prop);
|
||||
}
|
||||
|
||||
$hook_prefix = self::get_post_type();
|
||||
|
|
|
@ -152,7 +152,7 @@ class Filter extends Entity {
|
|||
}
|
||||
|
||||
$object_type = new $class_name();
|
||||
$object_type->set_options( $this->get_filter_type_options() );
|
||||
$object_type->set_options( $this->get_mapped_property('filter_type_options') );
|
||||
return $object_type;
|
||||
}
|
||||
|
||||
|
@ -171,6 +171,10 @@ class Filter extends Entity {
|
|||
* @return array Configurations for the filter type object
|
||||
*/
|
||||
function get_filter_type_options(){
|
||||
$object = $this->get_filter_type_object();
|
||||
if ($object) {
|
||||
return $object->get_options(); // merge with dedault filter type options
|
||||
}
|
||||
return $this->get_mapped_property('filter_type_options');
|
||||
}
|
||||
|
||||
|
@ -275,6 +279,21 @@ class Filter extends Entity {
|
|||
if (false === $is_valid)
|
||||
return false;
|
||||
|
||||
|
||||
$status = $this->get_status();
|
||||
$status_obj = get_post_status_object($status);
|
||||
|
||||
if ($status_obj->public) {
|
||||
$metadatum = $this->get_metadatum();
|
||||
if ($metadatum) {
|
||||
$metadatum_status_obj = get_post_status_object($metadatum->get_status());
|
||||
if ( ! $metadatum_status_obj->public ) {
|
||||
$this->add_error('status', __('Filter can not be public because the related metadatum is private', 'tainacan'));
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$fto = $this->get_filter_type_object();
|
||||
if (is_object($fto)) {
|
||||
$is_valid = $fto->validate_options( $this );
|
||||
|
|
|
@ -444,25 +444,29 @@ class Item_Metadata_Entity extends Entity {
|
|||
}
|
||||
|
||||
if ($this->is_required() && !$one_filled) {
|
||||
$this->add_error('required', $metadatum->get_name() . ' is required');
|
||||
// translators: %s = metadatum name. ex: Title is required
|
||||
$this->add_error( 'required', sprintf( __('%s is required', 'tainacan'), $metadatum->get_name() ) );
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!$valid) {
|
||||
$this->add_error('invalid', $metadatum->get_name() . ' is invalid');
|
||||
// translators: %s = metadatum name. ex: Title is invalid
|
||||
$this->add_error( 'invalid', sprintf( __('%s is invalid', 'tainacan'), $metadatum->get_name() ) );
|
||||
return false;
|
||||
}
|
||||
|
||||
$this->set_as_valid();
|
||||
return true;
|
||||
} else {
|
||||
$this->add_error('invalid', $metadatum->get_name() . ' is invalid');
|
||||
// translators: %s = metadatum name. ex: Title is invalid
|
||||
$this->add_error( 'invalid', sprintf( __('%s is invalid', 'tainacan'), $metadatum->get_name() ) );
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
|
||||
if( is_array($value) ){
|
||||
$this->add_error('not_multiple', $metadatum->get_name() . ' do not accept array as value');
|
||||
// translators: %s = metadatum name. ex: Title accepts only one single value and not a list of values
|
||||
$this->add_error( 'not_multiple', sprintf( __('%s accepts only one single value and not a list of values', 'tainacan'), $metadatum->get_name() ) );
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -476,11 +480,12 @@ class Item_Metadata_Entity extends Entity {
|
|||
'value' => $value
|
||||
],
|
||||
],
|
||||
'post__not_in' => [$item->get_id()]
|
||||
'post__not_in' => [$item->get_id()]
|
||||
], $item->get_collection());
|
||||
|
||||
if ($test->have_posts()) {
|
||||
$this->add_error('key_exists', $metadatum->get_name() . ' is a collection key and there is another item with the same value');
|
||||
// translators: %s = metadatum name. ex: Register ID is a collection key and there is another item with the same value
|
||||
$this->add_error( 'key_exists', sprintf( __('%s is a collection key and there is another item with the same value', 'tainacan'), $metadatum->get_name() ) );
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -93,10 +93,10 @@ class Item extends Entity {
|
|||
}
|
||||
|
||||
$attachments_query = [
|
||||
'post_type' => 'attachment',
|
||||
'post_per_page' => -1,
|
||||
'post_parent' => $item_id,
|
||||
'exclude' => $to_exclude,
|
||||
'post_type' => 'attachment',
|
||||
'posts_per_page' => -1,
|
||||
'post_parent' => $item_id,
|
||||
'exclude' => $to_exclude,
|
||||
];
|
||||
|
||||
$attachments = get_posts( $attachments_query );
|
||||
|
|
|
@ -95,6 +95,14 @@ class Log extends Entity {
|
|||
return $this->get_mapped_property( 'date' );
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the log slug
|
||||
*
|
||||
* @return mixed|null
|
||||
*/
|
||||
function get_slug() {
|
||||
return $this->get_mapped_property( 'slug' );
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the Log description
|
||||
|
@ -125,7 +133,7 @@ class Log extends Entity {
|
|||
public function get_old_value() {
|
||||
return $this->get_mapped_property( 'old_value' );
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get new value of log entry object
|
||||
*
|
||||
|
@ -183,7 +191,7 @@ class Log extends Entity {
|
|||
public function set_old_value( $value ) {
|
||||
$this->set_mapped_property( 'old_value', $value );
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Set new value of log entry
|
||||
*
|
||||
|
@ -201,19 +209,19 @@ class Log extends Entity {
|
|||
public function get_log_diffs(){
|
||||
return $this->get_mapped_property('log_diffs');
|
||||
}
|
||||
|
||||
|
||||
public function get_object_type() {
|
||||
$this->get_mapped_property('object_type');
|
||||
return $this->get_mapped_property('object_type');
|
||||
}
|
||||
|
||||
|
||||
public function set_object_type($value) {
|
||||
$this->set_mapped_property('object_type', $value);
|
||||
}
|
||||
|
||||
|
||||
public function get_object_id() {
|
||||
$this->get_mapped_property('object_id');
|
||||
return $this->get_mapped_property('object_id');
|
||||
}
|
||||
|
||||
|
||||
public function set_object_id($value) {
|
||||
$this->set_mapped_property('object_id', $value);
|
||||
}
|
||||
|
@ -231,11 +239,11 @@ class Log extends Entity {
|
|||
public function get_item_id(){
|
||||
return $this->get_mapped_property('item_id');
|
||||
}
|
||||
|
||||
|
||||
public function get_action() {
|
||||
$this->get_mapped_property('action');
|
||||
return $this->get_mapped_property('action');
|
||||
}
|
||||
|
||||
|
||||
public function set_action($value) {
|
||||
$this->set_mapped_property('action', $value);
|
||||
}
|
||||
|
@ -249,4 +257,4 @@ class Log extends Entity {
|
|||
|
||||
return $repository->approve( $this );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -178,7 +178,7 @@ class Metadatum extends Entity {
|
|||
}
|
||||
|
||||
$object_type = new $class_name();
|
||||
$object_type->set_options( $this->get_metadata_type_options() );
|
||||
$object_type->set_options( $this->get_mapped_property('metadata_type_options') );
|
||||
return $object_type;
|
||||
}
|
||||
|
||||
|
@ -197,7 +197,11 @@ class Metadatum extends Entity {
|
|||
* @return array Configurations for the metadatum type object
|
||||
*/
|
||||
function get_metadata_type_options(){
|
||||
return $this->get_mapped_property('metadata_type_options');
|
||||
$object = $this->get_metadata_type_object();
|
||||
if ($object) {
|
||||
return $object->get_options(); // merge with dedault metadata type options
|
||||
}
|
||||
return $this->get_mapped_property('metadata_type_options');
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -22,28 +22,28 @@ class Taxonomy extends Entity {
|
|||
* @var string
|
||||
*/
|
||||
static $post_type = 'tainacan-taxonomy';
|
||||
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
* @see \Tainacan\Entities\Entity::capability_type
|
||||
* @var string
|
||||
*/
|
||||
protected static $capability_type = ['tainacan-taxonomy', 'tainacan-taxonomies'];
|
||||
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
* @see \Tainacan\Entities\Entity::repository
|
||||
* @var string
|
||||
*/
|
||||
protected $repository = 'Taxonomies';
|
||||
|
||||
|
||||
/**
|
||||
* Prefix used to create the db_identifier
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
static $db_identifier_prefix = 'tnc_tax_';
|
||||
|
||||
|
||||
public function __toString(){
|
||||
return apply_filters("tainacan-taxonomy-to-string", $this->get_name(), $this);
|
||||
}
|
||||
|
@ -67,7 +67,7 @@ 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;
|
||||
|
@ -80,21 +80,22 @@ class Taxonomy extends Entity {
|
|||
'show_admin_column' => false,
|
||||
'rewrite' => [
|
||||
'slug' => $this->get_slug()
|
||||
],
|
||||
],
|
||||
'update_count_callback' => '_update_generic_term_count'
|
||||
);
|
||||
|
||||
|
||||
if (taxonomy_exists($this->get_db_identifier())){
|
||||
unregister_taxonomy($this->get_db_identifier());
|
||||
}
|
||||
|
||||
|
||||
|
||||
register_taxonomy(
|
||||
$this->get_db_identifier(),
|
||||
$enabled_post_types,
|
||||
$args
|
||||
|
||||
|
||||
|
||||
register_taxonomy(
|
||||
$this->get_db_identifier(),
|
||||
$enabled_post_types,
|
||||
$args
|
||||
);
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -135,7 +136,7 @@ class Taxonomy extends Entity {
|
|||
function get_slug() {
|
||||
return $this->get_mapped_property('slug');
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Return the enabled post types
|
||||
*
|
||||
|
@ -144,7 +145,7 @@ class Taxonomy extends Entity {
|
|||
function get_enabled_post_types() {
|
||||
return $this->get_mapped_property('enabled_post_types');
|
||||
}
|
||||
|
||||
|
||||
// special Getters
|
||||
|
||||
/**
|
||||
|
@ -194,7 +195,7 @@ class Taxonomy extends Entity {
|
|||
function set_allow_insert($value) {
|
||||
$this->set_mapped_property('allow_insert', $value);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Sets enabled post types
|
||||
*
|
||||
|
@ -221,19 +222,19 @@ class Taxonomy extends Entity {
|
|||
return parent::validate();
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Check if a term already exists
|
||||
* Check if a term already exists
|
||||
*
|
||||
* @param string $term_name The term name
|
||||
* @param int|null $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
|
||||
* @param string $term_name The term name
|
||||
* @param int|null $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
|
||||
*/
|
||||
function term_exists($term_name, $parent = null, $return_term = false) {
|
||||
$repo = $this->get_repository();
|
||||
return $repo->term_exists($this, $term_name, $parent, $return_term);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -145,6 +145,16 @@ class Term extends Entity {
|
|||
return wp_get_attachment_url( $this->get_header_image_id() );
|
||||
}
|
||||
|
||||
/**
|
||||
* @return false|string
|
||||
*/
|
||||
function get_url(){
|
||||
$url = get_term_link( $this->get_id() );
|
||||
if (is_wp_error($url))
|
||||
return "";
|
||||
return $url;
|
||||
}
|
||||
|
||||
// Setters
|
||||
|
||||
/**
|
||||
|
|
|
@ -10,8 +10,8 @@
|
|||
:loading="isLoadingOptions"
|
||||
@input="search"
|
||||
field="label"
|
||||
@select="option => setResults(option) "
|
||||
:placeholder="(type == 'Tainacan\\Metadata_Types\\Relationship') ? $i18n.get('info_type_to_search_items') : $i18n.get('info_type_to_search_metadata')">
|
||||
@select="onSelect"
|
||||
:placeholder="(metadatumType === 'Tainacan\\Metadata_Types\\Relationship') ? $i18n.get('info_type_to_search_items') : $i18n.get('info_type_to_search_metadata')">
|
||||
<template slot-scope="props">
|
||||
<div class="media">
|
||||
<div
|
||||
|
@ -20,7 +20,7 @@
|
|||
<img
|
||||
:alt="$i18n.get('label_thumbnail')"
|
||||
width="24"
|
||||
:src="`${props.option.img}`">
|
||||
:src="props.option.img">
|
||||
</div>
|
||||
<div class="media-content">
|
||||
<span class="ellipsed-text">{{ props.option.label }}</span>
|
||||
|
@ -41,70 +41,51 @@
|
|||
|
||||
<script>
|
||||
import { tainacan as axios, isCancel } from '../../../js/axios/axios'
|
||||
import { filterTypeMixin } from '../filter-types-mixin';
|
||||
// import qs from 'qs';
|
||||
import { filterTypeMixin, dynamicFilterTypeMixin } from '../filter-types-mixin';
|
||||
|
||||
export default {
|
||||
created(){
|
||||
const vm = this;
|
||||
|
||||
let endpoint = '/collection/' + this.collectionId + '/metadata/' + this.metadatumId;
|
||||
|
||||
if (this.isRepositoryLevel || this.collectionId == 'default'){
|
||||
endpoint = '/metadata/'+ this.metadatumId;
|
||||
}
|
||||
|
||||
axios.get(endpoint)
|
||||
.then( res => {
|
||||
let result = res.data;
|
||||
if( result && result.metadata_type ){
|
||||
vm.metadatum_object = result;
|
||||
vm.type = result.metadata_type;
|
||||
vm.selectedValues();
|
||||
}
|
||||
})
|
||||
.catch(error => {
|
||||
this.$console.log(error);
|
||||
});
|
||||
},
|
||||
mixins: [filterTypeMixin, dynamicFilterTypeMixin],
|
||||
data(){
|
||||
return {
|
||||
results:'',
|
||||
selected:'',
|
||||
options: [],
|
||||
type: '',
|
||||
metadatum_object: {},
|
||||
label: ''
|
||||
}
|
||||
},
|
||||
mixins: [filterTypeMixin],
|
||||
watch: {
|
||||
'query.metaquery'() {
|
||||
this.updateSelectedValues();
|
||||
},
|
||||
},
|
||||
mounted() {
|
||||
this.updateSelectedValues();
|
||||
},
|
||||
methods: {
|
||||
setResults(option){
|
||||
onSelect(option){
|
||||
|
||||
if(!option)
|
||||
return;
|
||||
this.results = option.value;
|
||||
this.selected = option.value;
|
||||
this.label = option.label;
|
||||
this.onSelect()
|
||||
},
|
||||
onSelect(){
|
||||
|
||||
this.$emit('input', {
|
||||
filter: 'autocomplete',
|
||||
metadatum_id: this.metadatumId,
|
||||
collection_id: this.collectionId,
|
||||
value: this.results
|
||||
value: this.selected
|
||||
});
|
||||
this.selectedValues();
|
||||
this.updateSelectedValues();
|
||||
},
|
||||
search: _.debounce( function(query) {
|
||||
|
||||
if (query != '') {
|
||||
let promise = null;
|
||||
this.options = [];
|
||||
|
||||
// Cancels previous Request
|
||||
if (this.getOptionsValuesCancel != undefined)
|
||||
this.getOptionsValuesCancel.cancel('Facet search Canceled.');
|
||||
|
||||
if ( this.type === 'Tainacan\\Metadata_Types\\Relationship' )
|
||||
if ( this.metadatumType === 'Tainacan\\Metadata_Types\\Relationship' )
|
||||
promise = this.getValuesRelationship( query, this.isRepositoryLevel );
|
||||
else
|
||||
promise = this.getValuesPlainText( this.metadatumId, query, this.isRepositoryLevel );
|
||||
|
@ -120,73 +101,51 @@
|
|||
this.getOptionsValuesCancel = promise.source;
|
||||
|
||||
} else {
|
||||
this.clearSearch();
|
||||
this.label = '';
|
||||
this.selected = '';
|
||||
this.$emit('input', {
|
||||
filter: 'autocomplete',
|
||||
metadatum_id: this.metadatumId,
|
||||
collection_id: this.collectionId,
|
||||
value: this.selected
|
||||
});
|
||||
}
|
||||
}, 500),
|
||||
selectedValues(){
|
||||
const instance = this;
|
||||
if ( !this.query || !this.query.metaquery || !Array.isArray( this.query.metaquery ) )
|
||||
updateSelectedValues(){
|
||||
|
||||
if (!this.query || !this.query.metaquery || !Array.isArray( this.query.metaquery ))
|
||||
return false;
|
||||
|
||||
let index = this.query.metaquery.findIndex(newMetadatum => newMetadatum.key == this.metadatumId );
|
||||
if ( index >= 0){
|
||||
let index = this.query.metaquery.findIndex(newMetadatum => newMetadatum.key == this.metadatumId);
|
||||
if (index >= 0) {
|
||||
let metadata = this.query.metaquery[ index ];
|
||||
// let collectionTarget = ( this.metadatum_object && this.metadatum_object.metadata_type_options.collection_id ) ?
|
||||
// this.metadatum_object.metadata_type_options.collection_id : this.collection_id;
|
||||
|
||||
if ( this.type === 'Tainacan\\Metadata_Types\\Relationship' ) {
|
||||
// let query = qs.stringify({ postin: metadata.value });
|
||||
|
||||
axios.get('/items/' + metadata.value)
|
||||
if (this.metadatumType === 'Tainacan\\Metadata_Types\\Relationship') {
|
||||
|
||||
let endpoint = '/items/' + metadata.value + '?fetch_only=title,thumbnail';
|
||||
|
||||
axios.get(endpoint)
|
||||
.then( res => {
|
||||
|
||||
|
||||
let item = res.data;
|
||||
instance.results = item.title;
|
||||
instance.label = item.title;
|
||||
instance.selected = item.title;
|
||||
this.label = item.title;
|
||||
this.selected = item.title;
|
||||
|
||||
this.$emit( 'sendValuesToTags', instance.label);
|
||||
this.$emit( 'sendValuesToTags', { label: this.label, value: this.selected });
|
||||
})
|
||||
.catch(error => {
|
||||
this.$console.log(error);
|
||||
});
|
||||
} else {
|
||||
instance.results = metadata.value;
|
||||
instance.label = metadata.value;
|
||||
instance.selected = metadata.value;
|
||||
|
||||
this.$emit( 'sendValuesToTags', metadata.value);
|
||||
this.label = metadata.value;
|
||||
this.selected = metadata.value;
|
||||
this.$emit( 'sendValuesToTags', { label: this.label, value: this.selected });
|
||||
}
|
||||
} else {
|
||||
return false;
|
||||
this.label = '';
|
||||
this.selected = '';
|
||||
}
|
||||
},
|
||||
clearSearchFromTags(filterTag) {
|
||||
if (filterTag.filterId == this.filter.id)
|
||||
this.clearSearch();
|
||||
},
|
||||
clearSearch(){
|
||||
this.results = '';
|
||||
this.label = '';
|
||||
this.selected = '';
|
||||
this.$emit('input', {
|
||||
filter: 'autocomplete',
|
||||
metadatum_id: this.metadatumId,
|
||||
collection_id: this.collectionId,
|
||||
value: ''
|
||||
});
|
||||
},
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
<style scoped>
|
||||
#profileImage {
|
||||
width: 32px;
|
||||
height: 32px;
|
||||
font-size: 2.1875rem;
|
||||
color: #fff;
|
||||
text-align: center;
|
||||
line-height: 9.375rem;
|
||||
margin: 20px 0;
|
||||
}
|
||||
</style>
|
||||
</script>
|
|
@ -9,7 +9,7 @@ defined( 'ABSPATH' ) or die( 'No script kiddies please!' );
|
|||
class Autocomplete extends Filter_Type {
|
||||
|
||||
function __construct(){
|
||||
$this->set_name('Autocomplete');
|
||||
$this->set_name( __('Autocomplete', 'tainacan') );
|
||||
$this->set_supported_types(['string','long_string','item']);
|
||||
$this->set_component('tainacan-filter-autocomplete');
|
||||
$this->set_use_max_options(false);
|
||||
|
|
|
@ -39,86 +39,61 @@
|
|||
</template>
|
||||
|
||||
<script>
|
||||
import { tainacan as axios, isCancel } from '../../../js/axios/axios';
|
||||
import { filterTypeMixin } from '../filter-types-mixin';
|
||||
import { isCancel } from '../../../js/axios/axios';
|
||||
import { filterTypeMixin, dynamicFilterTypeMixin } from '../filter-types-mixin';
|
||||
import CheckboxRadioModal from '../../../admin/components/other/checkbox-radio-modal.vue';
|
||||
|
||||
export default {
|
||||
created(){
|
||||
let route = '/collection/' + this.collectionId + '/metadata/' + this.metadatumId +'?nopaging=1';
|
||||
|
||||
if (this.isRepositoryLevel || this.collectionId == 'default')
|
||||
route = '/metadata?nopaging=1';
|
||||
|
||||
axios.get(route)
|
||||
.then( res => {
|
||||
let result = res.data;
|
||||
if ( result && result.metadata_type ){
|
||||
this.metadatum_object = result;
|
||||
this.type = result.metadata_type;
|
||||
|
||||
if (!this.isUsingElasticSearch)
|
||||
this.loadOptions();
|
||||
|
||||
}
|
||||
})
|
||||
.catch(error => {
|
||||
this.$console.log(error);
|
||||
});
|
||||
|
||||
if (this.isUsingElasticSearch) {
|
||||
this.isLoadingOptions = false;
|
||||
this.$eventBusSearch.$on('isLoadingItems', this.updatesIsLoading);
|
||||
}
|
||||
},
|
||||
mixins: [filterTypeMixin, dynamicFilterTypeMixin],
|
||||
data(){
|
||||
return {
|
||||
options: [],
|
||||
type: '',
|
||||
selected: [],
|
||||
metadatum_object: {}
|
||||
selected: []
|
||||
}
|
||||
},
|
||||
mixins: [filterTypeMixin],
|
||||
watch: {
|
||||
selected: function(){
|
||||
//this.selected = val;
|
||||
this.onSelect();
|
||||
selected(newVal, oldVal) {
|
||||
const isEqual = (newVal.length == oldVal.length) && newVal.every((element, index) => {
|
||||
return element === oldVal[index];
|
||||
});
|
||||
|
||||
if (!isEqual)
|
||||
this.onSelect();
|
||||
},
|
||||
'query.metaquery'() {
|
||||
if (!this.isUsingElasticSearch)
|
||||
this.loadOptions();
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
if (!this.isUsingElasticSearch)
|
||||
this.loadOptions();
|
||||
},
|
||||
methods: {
|
||||
loadOptions(skipSelected) {
|
||||
loadOptions() {
|
||||
let promise = null;
|
||||
|
||||
// Cancels previous Request
|
||||
if (this.getOptionsValuesCancel != undefined)
|
||||
this.getOptionsValuesCancel.cancel('Facet search Canceled.');
|
||||
|
||||
if ( this.type === 'Tainacan\\Metadata_Types\\Relationship' )
|
||||
if ( this.metadatumType === 'Tainacan\\Metadata_Types\\Relationship' )
|
||||
promise = this.getValuesRelationship( null, this.isRepositoryLevel, [], 0, this.filter.max_options, false, '1');
|
||||
else
|
||||
promise = this.getValuesPlainText( this.metadatumId, null, this.isRepositoryLevel, [], 0, this.filter.max_options, false, '1' );
|
||||
|
||||
promise.request
|
||||
.then(() => {
|
||||
this.updateSelectedValues();
|
||||
})
|
||||
.catch( (error) => {
|
||||
if (isCancel(error)) {
|
||||
this.$console.log('Request canceled: ' + error.message);
|
||||
this.updateSelectedValues();
|
||||
} else
|
||||
this.$console.error( error );
|
||||
});
|
||||
|
||||
if (skipSelected != undefined && skipSelected == true) {
|
||||
promise.request
|
||||
.then(() => {
|
||||
if (this.options.length > this.filter.max_options)
|
||||
this.options.splice(this.filter.max_options);
|
||||
}).catch((error) => {
|
||||
this.$console.error(error);
|
||||
});
|
||||
} else {
|
||||
promise.request
|
||||
.then(() => {
|
||||
this.selectedValues();
|
||||
})
|
||||
.catch( (error) => {
|
||||
if (isCancel(error)) {
|
||||
this.$console.log('Request canceled: ' + error.message);
|
||||
}else
|
||||
this.$console.error( error );
|
||||
});
|
||||
}
|
||||
// Search Request Token for cancelling
|
||||
this.getOptionsValuesCancel = promise.source;
|
||||
},
|
||||
|
@ -130,34 +105,32 @@
|
|||
collection_id: this.collectionId,
|
||||
value: this.selected
|
||||
});
|
||||
},
|
||||
updateSelectedValues() {
|
||||
if ( !this.query || !this.query.metaquery || !Array.isArray( this.query.metaquery ) )
|
||||
return false;
|
||||
|
||||
let index = this.query.metaquery.findIndex(newMetadatum => newMetadatum.key == this.metadatumId );
|
||||
|
||||
if ( index >= 0){
|
||||
let query = this.query.metaquery.slice();
|
||||
this.selected = query[ index ].value;
|
||||
} else {
|
||||
this.selected = [];
|
||||
}
|
||||
|
||||
let onlyLabels = [];
|
||||
|
||||
if(!isNaN(this.selected[0])){
|
||||
if (!isNaN(this.selected[0])){
|
||||
for (let aSelected of this.selected) {
|
||||
let valueIndex = this.options.findIndex(option => option.value == aSelected);
|
||||
|
||||
|
||||
if (valueIndex >= 0) {
|
||||
onlyLabels.push(this.options[valueIndex].label);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
this.$emit( 'sendValuesToTags', onlyLabels.length ? onlyLabels : this.selected);
|
||||
},
|
||||
selectedValues() {
|
||||
if ( !this.query || !this.query.metaquery || !Array.isArray( this.query.metaquery ) )
|
||||
return false;
|
||||
|
||||
let index = this.query.metaquery.findIndex(newMetadatum => newMetadatum.key == this.metadatumId );
|
||||
if ( index >= 0){
|
||||
let query = this.query.metaquery.slice();
|
||||
this.selected = query[ index ].value;
|
||||
|
||||
} else {
|
||||
this.selected = [];
|
||||
return false;
|
||||
}
|
||||
this.$emit( 'sendValuesToTags', { label: onlyLabels.length ? onlyLabels : this.selected, value: this.selected });
|
||||
},
|
||||
openCheckboxModal() {
|
||||
this.$buefy.modal.open({
|
||||
|
@ -171,8 +144,7 @@
|
|||
metadatumId: this.metadatumId,
|
||||
//taxonomy: this.taxonomy,
|
||||
collectionId: this.collectionId,
|
||||
metadatum_type: this.type,
|
||||
metadatum_object: this.metadatum_object,
|
||||
metadatum_type: this.metadatumType,
|
||||
isRepositoryLevel: this.isRepositoryLevel,
|
||||
query: this.query
|
||||
},
|
||||
|
@ -184,44 +156,9 @@
|
|||
trapFocus: true
|
||||
});
|
||||
},
|
||||
cleanSearchFromTags(filterTag) {
|
||||
|
||||
if (filterTag.filterId == this.filter.id) {
|
||||
|
||||
let selectedIndex = this.selected.findIndex(option => option == filterTag.singleValue);
|
||||
let optionIndex = this.options.findIndex(option => option.label == filterTag.singleValue);
|
||||
let alternativeIndex;
|
||||
|
||||
if (optionIndex >= 0) {
|
||||
alternativeIndex = this.selected.findIndex(option => this.options[optionIndex].value == option);
|
||||
}
|
||||
|
||||
if (selectedIndex >= 0 || alternativeIndex >= 0) {
|
||||
|
||||
selectedIndex >= 0 ? this.selected.splice(selectedIndex, 1) : this.selected.splice(alternativeIndex, 1);
|
||||
|
||||
this.$emit('input', {
|
||||
filter: 'checkbox',
|
||||
compare: 'IN',
|
||||
metadatum_id: this.metadatumId,
|
||||
collection_id: this.collectionId,
|
||||
value: this.selected
|
||||
});
|
||||
|
||||
this.$emit( 'sendValuesToTags', this.selected);
|
||||
|
||||
this.selectedValues();
|
||||
}
|
||||
}
|
||||
},
|
||||
updatesIsLoading(isLoading) {
|
||||
this.isLoadingOptions = isLoading;
|
||||
updatesIsLoading(isLoadingOptions) {
|
||||
this.isLoadingOptions = isLoadingOptions;
|
||||
}
|
||||
},
|
||||
beforeDestroy() {
|
||||
|
||||
if (this.isUsingElasticSearch)
|
||||
this.$eventBusSearch.$off('isLoadingItems', this.updatesIsLoading);
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
|
|
@ -9,7 +9,7 @@ defined( 'ABSPATH' ) or die( 'No script kiddies please!' );
|
|||
class Checkbox extends Filter_Type {
|
||||
|
||||
function __construct(){
|
||||
$this->set_name('Checkbox List');
|
||||
$this->set_name( __('Checkbox List', 'tainacan') );
|
||||
$this->set_supported_types(['string','long_string','item']);
|
||||
$this->set_component('tainacan-filter-checkbox');
|
||||
$this->set_preview_template('
|
||||
|
|
|
@ -1,307 +0,0 @@
|
|||
<template>
|
||||
<div>
|
||||
<!-- Date -->
|
||||
<div v-if="type === 'date'">
|
||||
<b-datepicker
|
||||
:aria-labelledby="'filter-label-id-' + filter.id"
|
||||
:placeholder="$i18n.get('label_selectbox_init')"
|
||||
v-model="date_init"
|
||||
size="is-small"
|
||||
@focus="isTouched = true"
|
||||
@input="validate_values()"
|
||||
editable
|
||||
:date-formatter="(date) => dateFormatter(date)"
|
||||
:date-parser="(date) => dateParser(date)"
|
||||
icon="calendar-today"
|
||||
:day-names="[
|
||||
$i18n.get('datepicker_short_sunday'),
|
||||
$i18n.get('datepicker_short_monday'),
|
||||
$i18n.get('datepicker_short_tuesday'),
|
||||
$i18n.get('datepicker_short_wednesday'),
|
||||
$i18n.get('datepicker_short_thursday'),
|
||||
$i18n.get('datepicker_short_friday'),
|
||||
$i18n.get('datepicker_short_saturday'),
|
||||
]"/>
|
||||
<p class="is-size-7 has-text-centered is-marginless">{{ $i18n.get('label_until') }}</p>
|
||||
<b-datepicker
|
||||
:aria-labelledby="'filter-label-id-' + filter.id"
|
||||
:placeholder="$i18n.get('label_selectbox_init')"
|
||||
v-model="date_end"
|
||||
size="is-small"
|
||||
@input="validate_values()"
|
||||
@focus="isTouched = true"
|
||||
editable
|
||||
:date-formatter="(date) => dateFormatter(date)"
|
||||
:date-parser="(date) => dateParser(date)"
|
||||
icon="calendar-today"
|
||||
:day-names="[
|
||||
$i18n.get('datepicker_short_sunday'),
|
||||
$i18n.get('datepicker_short_monday'),
|
||||
$i18n.get('datepicker_short_tuesday'),
|
||||
$i18n.get('datepicker_short_wednesday'),
|
||||
$i18n.get('datepicker_short_thursday'),
|
||||
$i18n.get('datepicker_short_friday'),
|
||||
$i18n.get('datepicker_short_saturday'),
|
||||
]"/>
|
||||
</div>
|
||||
|
||||
<!-- Numeric -->
|
||||
<div v-else>
|
||||
<b-numberinput
|
||||
:aria-labelledby="'filter-label-id-' + filter.id"
|
||||
size="is-small"
|
||||
step="any"
|
||||
@input="validate_values()"
|
||||
v-model="value_init"/>
|
||||
<p class="is-size-7 has-text-centered is-marginless">{{ $i18n.get('label_until') }}</p>
|
||||
<b-numberinput
|
||||
:aria-labelledby="'filter-label-id-' + filter.id"
|
||||
size="is-small"
|
||||
step="any"
|
||||
@input="validate_values()"
|
||||
@focus="isTouched = true"
|
||||
v-model="value_end"/>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { tainacan as axios } from '../../../js/axios/axios';
|
||||
import { wpAjax, dateInter } from "../../../admin/js/mixins";
|
||||
import { filterTypeMixin } from '../filter-types-mixin';
|
||||
import moment from 'moment';
|
||||
|
||||
export default {
|
||||
mixins: [
|
||||
wpAjax,
|
||||
dateInter,
|
||||
filterTypeMixin
|
||||
],
|
||||
created() {
|
||||
let endpoint = '/collection/' + this.collectionId + '/metadata/' + this.metadatumId;
|
||||
|
||||
if (this.isRepositoryLevel || this.collectionId == 'default'){
|
||||
endpoint = '/metadata/'+ this.metadatumId;
|
||||
}
|
||||
|
||||
axios.get(endpoint)
|
||||
.then( res => {
|
||||
let result = res.data;
|
||||
if( result && result.metadata_type ){
|
||||
this.metadatum_object = result;
|
||||
this.type = ( result.metadata_type === 'Tainacan\\Metadata_Types\\Date') ? 'date' : 'numeric';
|
||||
this.selectedValues();
|
||||
}
|
||||
})
|
||||
.catch(error => {
|
||||
this.$console.log(error);
|
||||
});
|
||||
},
|
||||
data(){
|
||||
return {
|
||||
value_init: null,
|
||||
value_end: null,
|
||||
date_init: undefined,
|
||||
date_end: undefined,
|
||||
isTouched: false,
|
||||
isValid: false,
|
||||
clear: false,
|
||||
type: 'numeric',
|
||||
metadatum_object: {}
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
isTouched( val ){
|
||||
if ( val && this.date_init === null)
|
||||
this.date_init = new Date();
|
||||
|
||||
if ( val && this.date_end === null)
|
||||
this.date_end = new Date();
|
||||
|
||||
this.isTouched = val;
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
// only validate if the first value is higher than first
|
||||
validate_values: _.debounce( function (){
|
||||
if( this.type === 'date' ){
|
||||
if (this.date_init === undefined)
|
||||
this.date_init = new Date();
|
||||
|
||||
if (this.date_end === undefined)
|
||||
this.date_end = new Date();
|
||||
|
||||
if ( this.date_init > this.date_end ) {
|
||||
let result = this.date_init;
|
||||
result.setDate(result.getDate() + 1);
|
||||
this.date_end = result;
|
||||
|
||||
result.setDate(result.getDate() - 1);
|
||||
this.date_init = result;
|
||||
//this.error_message();
|
||||
}
|
||||
|
||||
} else {
|
||||
if ( parseFloat( this.value_init ) > parseFloat( this.value_end )) {
|
||||
//this.value_end = parseFloat( this.value_init ) + 1;
|
||||
//this.error_message();
|
||||
return;
|
||||
}
|
||||
}
|
||||
this.emit();
|
||||
}, 1000),
|
||||
// message for error
|
||||
error_message(){
|
||||
if ( !this.isTouched ) return false;
|
||||
|
||||
this.$buefy.toast.open({
|
||||
duration: 3000,
|
||||
message: this.$i18n.get('info_error_first_value_greater'),
|
||||
position: 'is-bottom',
|
||||
type: 'is-danger'
|
||||
})
|
||||
},
|
||||
dateFormatter(dateObject) {
|
||||
return moment(dateObject, moment.ISO_8601).format(this.dateFormat);
|
||||
},
|
||||
dateParser(dateString) {
|
||||
return moment(dateString, this.dateFormat).toDate();
|
||||
},
|
||||
selectedValues(){
|
||||
if ( !this.query || !this.query.metaquery || !Array.isArray( this.query.metaquery ) )
|
||||
return false;
|
||||
|
||||
let index = this.query.metaquery.findIndex(newMetadatum => newMetadatum.key == this.metadatumId );
|
||||
if ( index >= 0){
|
||||
let metadata = this.query.metaquery[ index ];
|
||||
if( metadata.value && metadata.value.length > 0 && this.type === 'numeric'){
|
||||
this.value_init = metadata.value[0];
|
||||
this.value_end = metadata.value[1];
|
||||
this.isValid = true;
|
||||
} else if( metadata.value && metadata.value.length > 0 ){
|
||||
this.date_init = new Date( metadata.value[0] );
|
||||
this.date_end = new Date( metadata.value[1] );
|
||||
|
||||
this.isValid = true;
|
||||
}
|
||||
|
||||
if (metadata.value[0] != undefined && metadata.value[1] != undefined)
|
||||
this.$emit( 'sendValuesToTags', this.parseDateToNavigatorLanguage(metadata.value[0]) + ' - ' + this.parseDateToNavigatorLanguage(metadata.value[1]));
|
||||
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
},
|
||||
showSearch(){
|
||||
if( this.type === 'date' ){
|
||||
|
||||
if( this.date_init === null || this.date_end === null ){
|
||||
this.clear = true;
|
||||
return '';
|
||||
}
|
||||
|
||||
return this.date_init.toLocaleString().split(' ')[0] + ' - ' + this.date_end.toLocaleString().split(' ')[0];
|
||||
}
|
||||
// else {
|
||||
// return this.value_init + ' - ' +this.value_end;
|
||||
// }
|
||||
},
|
||||
cleanSearchFromTags(filterTag) {
|
||||
if (filterTag.filterId == this.filter.id)
|
||||
this.clearSearch();
|
||||
},
|
||||
clearSearch(){
|
||||
|
||||
this.clear = true;
|
||||
|
||||
this.$emit('input', {
|
||||
filter: 'range',
|
||||
compare: 'BETWEEN',
|
||||
metadatum_id: this.metadatumId,
|
||||
collection_id: this.collectionId,
|
||||
value: ''
|
||||
});
|
||||
|
||||
if( this.type === 'date' ){
|
||||
this.date_init = null;
|
||||
this.date_end = null;
|
||||
this.isTouched = false;
|
||||
} else {
|
||||
this.value_end = null;
|
||||
this.value_init = null;
|
||||
this.isTouched = false;
|
||||
}
|
||||
},
|
||||
// emit the operation for listeners
|
||||
emit() {
|
||||
let values = [];
|
||||
let type = '';
|
||||
|
||||
if( this.type === 'date' ){
|
||||
|
||||
if( this.date_init === null && this.date_end === null ){
|
||||
values = [];
|
||||
type = 'DATE';
|
||||
this.isValid = false;
|
||||
this.clear = true;
|
||||
} else {
|
||||
let date_init = this.date_init.getUTCFullYear() + '-' +
|
||||
('00' + (this.date_init.getUTCMonth() + 1)).slice(-2) + '-' +
|
||||
('00' + this.date_init.getUTCDate()).slice(-2);
|
||||
let date_end = this.date_end.getUTCFullYear() + '-' +
|
||||
('00' + (this.date_end.getUTCMonth() + 1)).slice(-2) + '-' +
|
||||
('00' + this.date_end.getUTCDate()).slice(-2);
|
||||
values = [ date_init, date_end ];
|
||||
type = 'DATE';
|
||||
this.isValid = true;
|
||||
this.clear = false;
|
||||
}
|
||||
} else {
|
||||
if( this.value_init === null || this.value_end === null
|
||||
|| this.value_init === '' || this.value_end === ''){
|
||||
return;
|
||||
} else {
|
||||
values = [ this.value_init, this.value_end ];
|
||||
|
||||
if(this.value_init !== this.value_end && (this.value_init % 1 !== 0 && this.value_end % 1 == 0)) {
|
||||
type = 'DECIMAL';
|
||||
} else if(this.value_init !== this.value_end &&
|
||||
this.value_init % 1 !== 0 &&
|
||||
this.value_end % 1 !== 0) {
|
||||
|
||||
type = '';
|
||||
} else if(this.value_init !== this.value_end &&
|
||||
!(this.value_init % 1 == 0 && this.value_end % 1 !== 0)){
|
||||
type = 'DECIMAL';
|
||||
} else {
|
||||
type = '';
|
||||
}
|
||||
//this.isValid = true;
|
||||
//this.clear = false;
|
||||
}
|
||||
}
|
||||
|
||||
this.$emit('input', {
|
||||
filter: 'range',
|
||||
type: type,
|
||||
compare: 'BETWEEN',
|
||||
metadatum_id: this.metadatumId,
|
||||
collection_id: this.collectionId,
|
||||
value: values
|
||||
});
|
||||
|
||||
if (values[0] != undefined && values[1] != undefined)
|
||||
this.$emit( 'sendValuesToTags', this.parseDateToNavigatorLanguage(values[0]) + ' - ' + this.parseDateToNavigatorLanguage(values[1]));
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.field {
|
||||
margin-bottom: 0.125rem !important;
|
||||
}
|
||||
p.is-size-7 {
|
||||
margin-bottom: 0.125rem !important;
|
||||
}
|
||||
</style>
|
|
@ -1,74 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace Tainacan\Filter_Types;
|
||||
|
||||
defined( 'ABSPATH' ) or die( 'No script kiddies please!' );
|
||||
|
||||
/**
|
||||
* Class TainacanMetadatumType
|
||||
*/
|
||||
class Custom_Interval extends Filter_Type {
|
||||
|
||||
function __construct(){
|
||||
$this->set_name('Custom Interval');
|
||||
$this->set_supported_types(['float','date']);
|
||||
$this->set_component('tainacan-filter-custom-interval');
|
||||
$this->set_use_max_options(false);
|
||||
$this->set_preview_template('
|
||||
<div>
|
||||
<div class="b-numberinput field is-grouped">
|
||||
<p class="control">
|
||||
<button type="button" class="button is-primary is-small">
|
||||
<span class="icon is-small">
|
||||
<i class="mdi mdi-minus"></i>
|
||||
</span>
|
||||
</button>
|
||||
</p>
|
||||
<div class="control is-small is-clearfix">
|
||||
<input type="number" step="0.01" class="input is-small" value="6">
|
||||
</div>
|
||||
<p class="control">
|
||||
<button type="button" class="button is-primary is-small">
|
||||
<span class="icon is-small">
|
||||
<i class="mdi mdi-plus"></i>
|
||||
</span>
|
||||
</button>
|
||||
</p>
|
||||
</div>
|
||||
<p class="is-size-7 has-text-centered is-marginless">until</p>
|
||||
<div class="b-numberinput field is-grouped">
|
||||
<p class="control">
|
||||
<button type="button" class="button is-primary is-small">
|
||||
<span class="icon is-small">
|
||||
<i class="mdi mdi-minus"></i>
|
||||
</span>
|
||||
</button>
|
||||
</p>
|
||||
<div class="control is-small is-clearfix">
|
||||
<input type="number" step="0.01" class="input is-small" value="10">
|
||||
</div>
|
||||
<p class="control">
|
||||
<button type="button" class="button is-primary is-small">
|
||||
<span class="icon is-small">
|
||||
<i class="mdi mdi-plus"></i>
|
||||
</span>
|
||||
</button>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
');
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $filter
|
||||
* @return string
|
||||
* @internal param $metadatum
|
||||
*/
|
||||
public function render( $filter ){
|
||||
$type = ( $filter->get_metadatum()->get_metadata_type() === 'Tainacan\Metadata_Types\Date' ) ? 'date' : 'numeric';
|
||||
return '<tainacan-filter-custom-interval
|
||||
name="'.$filter->get_name().'"
|
||||
collection_id="'.$filter->get_collection_id().'"
|
||||
metadatum_id="'.$filter->get_metadatum()->get_id().'"></tainacan-filter-custom-interval>';
|
||||
}
|
||||
}
|
|
@ -0,0 +1,181 @@
|
|||
<template>
|
||||
<div>
|
||||
<b-datepicker
|
||||
:aria-labelledby="'filter-label-id-' + filter.id"
|
||||
:placeholder="$i18n.get('label_selectbox_init')"
|
||||
v-model="dateInit"
|
||||
size="is-small"
|
||||
@focus="isTouched = true"
|
||||
@input="validadeValues()"
|
||||
editable
|
||||
:date-formatter="(date) => dateFormatter(date)"
|
||||
:date-parser="(date) => dateParser(date)"
|
||||
icon="calendar-today"
|
||||
:years-range="[-200, 100]"
|
||||
:day-names="[
|
||||
$i18n.get('datepicker_short_sunday'),
|
||||
$i18n.get('datepicker_short_monday'),
|
||||
$i18n.get('datepicker_short_tuesday'),
|
||||
$i18n.get('datepicker_short_wednesday'),
|
||||
$i18n.get('datepicker_short_thursday'),
|
||||
$i18n.get('datepicker_short_friday'),
|
||||
$i18n.get('datepicker_short_saturday'),
|
||||
]"/>
|
||||
<p class="is-size-7 has-text-centered is-marginless">{{ $i18n.get('label_until') }}</p>
|
||||
<b-datepicker
|
||||
:aria-labelledby="'filter-label-id-' + filter.id"
|
||||
:placeholder="$i18n.get('label_selectbox_init')"
|
||||
v-model="dateEnd"
|
||||
size="is-small"
|
||||
@input="validadeValues()"
|
||||
@focus="isTouched = true"
|
||||
editable
|
||||
:date-formatter="(date) => dateFormatter(date)"
|
||||
:date-parser="(date) => dateParser(date)"
|
||||
icon="calendar-today"
|
||||
:years-range="[-200, 50]"
|
||||
:day-names="[
|
||||
$i18n.get('datepicker_short_sunday'),
|
||||
$i18n.get('datepicker_short_monday'),
|
||||
$i18n.get('datepicker_short_tuesday'),
|
||||
$i18n.get('datepicker_short_wednesday'),
|
||||
$i18n.get('datepicker_short_thursday'),
|
||||
$i18n.get('datepicker_short_friday'),
|
||||
$i18n.get('datepicker_short_saturday'),
|
||||
]"/>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { wpAjax, dateInter } from "../../../admin/js/mixins";
|
||||
import { filterTypeMixin } from '../filter-types-mixin';
|
||||
import moment from 'moment';
|
||||
|
||||
export default {
|
||||
mixins: [
|
||||
wpAjax,
|
||||
dateInter,
|
||||
filterTypeMixin
|
||||
],
|
||||
data(){
|
||||
return {
|
||||
dateInit: undefined,
|
||||
dateEnd: undefined,
|
||||
isTouched: false
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
isTouched( val ){
|
||||
if ( val && this.dateInit === null)
|
||||
this.dateInit = new Date();
|
||||
|
||||
if ( val && this.dateEnd === null)
|
||||
this.dateEnd = new Date();
|
||||
},
|
||||
'query.metaquery'() {
|
||||
this.updateSelectedValues();
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
this.updateSelectedValues();
|
||||
},
|
||||
methods: {
|
||||
// only validate if the first value is higher than first
|
||||
validadeValues: _.debounce( function (){
|
||||
|
||||
if (this.dateInit === undefined)
|
||||
this.dateInit = new Date();
|
||||
|
||||
if (this.dateEnd === undefined)
|
||||
this.dateEnd = new Date();
|
||||
|
||||
if (this.dateInit > this.dateEnd) {
|
||||
this.showErrorMessage();
|
||||
return
|
||||
}
|
||||
|
||||
this.emit();
|
||||
}, 800),
|
||||
showErrorMessage(){
|
||||
if ( !this.isTouched ) return false;
|
||||
|
||||
this.$buefy.toast.open({
|
||||
duration: 3000,
|
||||
message: this.$i18n.get('info_error_first_value_greater'),
|
||||
position: 'is-bottom',
|
||||
type: 'is-danger'
|
||||
})
|
||||
},
|
||||
dateFormatter(dateObject){
|
||||
return moment(dateObject, moment.ISO_8601).format(this.dateFormat);
|
||||
},
|
||||
dateParser(dateString){
|
||||
return moment(dateString, this.dateFormat).toDate();
|
||||
},
|
||||
updateSelectedValues(){
|
||||
if ( !this.query || !this.query.metaquery || !Array.isArray( this.query.metaquery ) )
|
||||
return false;
|
||||
|
||||
let index = this.query.metaquery.findIndex(newMetadatum => newMetadatum.key == this.metadatumId);
|
||||
|
||||
if (index >= 0) {
|
||||
let metadata = this.query.metaquery[ index ];
|
||||
|
||||
if (metadata.value && metadata.value.length > 0){
|
||||
this.dateInit = new Date(metadata.value[0]);
|
||||
this.dateEnd = new Date(metadata.value[1]);
|
||||
}
|
||||
|
||||
if (metadata.value[0] != undefined && metadata.value[1] != undefined)
|
||||
this.$emit('sendValuesToTags', {
|
||||
label: this.parseDateToNavigatorLanguage(metadata.value[0]) + ' - ' + this.parseDateToNavigatorLanguage(metadata.value[1]),
|
||||
value: [metadata.value[0], metadata.value[1]]
|
||||
});
|
||||
} else {
|
||||
this.dateInit = null;
|
||||
this.dateEnd = null;
|
||||
}
|
||||
},
|
||||
// emit the operation for listeners
|
||||
emit() {
|
||||
let values = [];
|
||||
|
||||
if (this.dateInit === null && this.dateEnd === null) {
|
||||
values = [];
|
||||
} else {
|
||||
let dateInit = this.dateInit.getUTCFullYear() + '-' +
|
||||
('00' + (this.dateInit.getUTCMonth() + 1)).slice(-2) + '-' +
|
||||
('00' + this.dateInit.getUTCDate()).slice(-2);
|
||||
let dateEnd = this.dateEnd.getUTCFullYear() + '-' +
|
||||
('00' + (this.dateEnd.getUTCMonth() + 1)).slice(-2) + '-' +
|
||||
('00' + this.dateEnd.getUTCDate()).slice(-2);
|
||||
values = [ dateInit, dateEnd ];
|
||||
}
|
||||
|
||||
this.$emit('input', {
|
||||
filter: 'range',
|
||||
type: 'DATE',
|
||||
compare: 'BETWEEN',
|
||||
metadatum_id: this.metadatumId,
|
||||
collection_id: this.collectionId,
|
||||
value: values
|
||||
});
|
||||
|
||||
if (values[0] != undefined && values[1] != undefined)
|
||||
this.$emit( 'sendValuesToTags', {
|
||||
label: this.parseDateToNavigatorLanguage(values[0]) + ' - ' + this.parseDateToNavigatorLanguage(values[1]),
|
||||
value: [ values[0], values[1] ]
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.field {
|
||||
margin-bottom: 0.125rem !important;
|
||||
}
|
||||
p.is-size-7 {
|
||||
margin-bottom: 0.125rem !important;
|
||||
}
|
||||
</style>
|
|
@ -0,0 +1,55 @@
|
|||
<?php
|
||||
|
||||
namespace Tainacan\Filter_Types;
|
||||
|
||||
defined( 'ABSPATH' ) or die( 'No script kiddies please!' );
|
||||
|
||||
/**
|
||||
* Class TainacanMetadatumType
|
||||
*/
|
||||
class Date_Interval extends Filter_Type {
|
||||
|
||||
function __construct(){
|
||||
$this->set_name( __('Date Interval', 'tainacan') );
|
||||
$this->set_supported_types(['date']);
|
||||
$this->set_component('tainacan-filter-date-interval');
|
||||
$this->set_use_max_options(false);
|
||||
$this->set_preview_template('
|
||||
<div>
|
||||
<div class="datepicker control is-small">
|
||||
<div class="dropdown is-bottom-left is-mobile-modal">
|
||||
<div role="button" class="dropdown-trigger">
|
||||
<div class="control has-icons-left is-small is-clearfix">
|
||||
<input type="text" autocomplete="off" placeholder=" '. __('Select a date', 'tainacan') .'" class="input is-small">
|
||||
<span class="icon is-left is-small"><i class="mdi mdi-calendar-today"></i></span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<p class="is-size-7 has-text-centered is-marginless">until</p>
|
||||
<div class="datepicker control is-small">
|
||||
<div class="dropdown is-bottom-left is-mobile-modal">
|
||||
<div role="button" class="dropdown-trigger">
|
||||
<div class="control has-icons-left is-small is-clearfix">
|
||||
<input type="text" autocomplete="off" placeholder=" '. __('Select a date', 'tainacan') .'" class="input is-small">
|
||||
<span class="icon is-left is-small"><i class="mdi mdi-calendar-today"></i></span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
');
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $filter
|
||||
* @return string
|
||||
* @internal param $metadatum
|
||||
*/
|
||||
public function render( $filter ){
|
||||
return '<tainacan-filter-date-interval
|
||||
name="'.$filter->get_name().'"
|
||||
collection_id="'.$filter->get_collection_id().'"
|
||||
metadatum_id="'.$filter->get_metadatum()->get_id().'"></tainacan-filter-date-interval>';
|
||||
}
|
||||
}
|
|
@ -78,6 +78,7 @@
|
|||
:date-parser="(date) => dateParser(date)"
|
||||
size="is-small"
|
||||
icon="calendar-today"
|
||||
:years-range="[-200, 50]"
|
||||
:day-names="[
|
||||
$i18n.get('datepicker_short_sunday'),
|
||||
$i18n.get('datepicker_short_monday'),
|
||||
|
@ -110,7 +111,6 @@
|
|||
</template>
|
||||
|
||||
<script>
|
||||
import { tainacan as axios } from '../../../js/axios/axios';
|
||||
import { wpAjax, dateInter } from "../../../admin/js/mixins";
|
||||
import { filterTypeMixin } from '../filter-types-mixin';
|
||||
import moment from 'moment';
|
||||
|
@ -121,38 +121,20 @@
|
|||
dateInter,
|
||||
filterTypeMixin
|
||||
],
|
||||
created() {
|
||||
this.filterTypeOptions = this.filter.filter_type_options;
|
||||
|
||||
let endpoint = '/collection/' + this.collectionId + '/metadata/' + this.metadatumId;
|
||||
|
||||
if (this.isRepositoryLevel || this.collectionId == 'default')
|
||||
endpoint = '/metadata/'+ this.metadatumId;
|
||||
|
||||
axios.get(endpoint)
|
||||
.then( res => {
|
||||
let result = res.data;
|
||||
if ( result && result.metadata_type ){
|
||||
this.metadatum_object = result;
|
||||
this.selectedValues();
|
||||
}
|
||||
})
|
||||
.catch(error => {
|
||||
this.$console.log(error);
|
||||
});
|
||||
},
|
||||
mounted() {
|
||||
this.selectedValues();
|
||||
this.updateSelectedValues();
|
||||
},
|
||||
data(){
|
||||
return {
|
||||
value: null,
|
||||
clear: false,
|
||||
filterTypeOptions: [],
|
||||
metadatum_object: {},
|
||||
comparator: '=', // =, !=, >, >=, <, <=
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
'query.metaquery'() {
|
||||
this.updateSelectedValues();
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
yearsOnlyValue() {
|
||||
return this.value && typeof this.value.getUTCFullYear === 'function' ? this.value.getUTCFullYear() : null
|
||||
|
@ -170,12 +152,12 @@
|
|||
}
|
||||
},
|
||||
methods: {
|
||||
selectedValues(){
|
||||
updateSelectedValues(){
|
||||
if ( !this.query || !this.query.metaquery || !Array.isArray( this.query.metaquery ) )
|
||||
return false;
|
||||
|
||||
let index = this.query.metaquery.findIndex(newMetadatum => newMetadatum.key == this.metadatumId );
|
||||
|
||||
|
||||
if ( index >= 0){
|
||||
let metadata = this.query.metaquery[ index ];
|
||||
|
||||
|
@ -190,32 +172,15 @@
|
|||
|
||||
this.value = new Date(textValue);
|
||||
|
||||
this.$emit('sendValuesToTags', this.comparator + ' ' + moment(this.value, moment.ISO_8601).format(this.dateFormat));
|
||||
this.$emit('sendValuesToTags', {
|
||||
label: this.comparator + ' ' + moment(this.value, moment.ISO_8601).format(this.dateFormat),
|
||||
value: textValue
|
||||
});
|
||||
}
|
||||
|
||||
} else {
|
||||
return false;
|
||||
this.value = null;
|
||||
}
|
||||
|
||||
},
|
||||
cleanSearchFromTags(filterTag) {
|
||||
if (filterTag.filterId == this.filter.id)
|
||||
this.clearSearch();
|
||||
},
|
||||
clearSearch(){
|
||||
|
||||
this.clear = true;
|
||||
|
||||
this.$emit('input', {
|
||||
filter: 'date',
|
||||
type: 'DATE',
|
||||
compare: this.comparator,
|
||||
metadatum_id: this.metadatumId,
|
||||
collection_id: this.collectionId,
|
||||
value: ''
|
||||
});
|
||||
|
||||
this.value = null;
|
||||
},
|
||||
dateFormatter(dateObject) {
|
||||
return moment(dateObject, moment.ISO_8601).format(this.dateFormat);
|
||||
|
@ -252,7 +217,10 @@
|
|||
collection_id: this.collectionId,
|
||||
value: valueQuery
|
||||
});
|
||||
this.$emit('sendValuesToTags', this.comparator + ' ' + moment(this.value, moment.ISO_8601).format(this.dateFormat));
|
||||
this.$emit('sendValuesToTags', {
|
||||
label: this.comparator + ' ' + moment(this.value, moment.ISO_8601).format(this.dateFormat),
|
||||
value: valueQuery
|
||||
});
|
||||
|
||||
},
|
||||
onChangeComparator(newComparator) {
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue