Sets to false max count option on filters that don't need it. Removes unecessary imports from theme items list. Begins implementation of form component for numeric filter Ref. #242.

This commit is contained in:
Mateus Machado Luna 2019-05-23 12:37:36 -03:00
parent dca53f1238
commit 7a9e720777
9 changed files with 69 additions and 35 deletions

View File

@ -33,6 +33,8 @@ import FilterTaginput from '../../classes/filter-types/taginput/Taginput.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 TainacanFormItem from '../../classes/metadata-types/tainacan-form-item.vue';
import TainacanFiltersList from '../../classes/filter-types/tainacan-filter-item.vue';
@ -65,7 +67,7 @@ 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);
@ -81,6 +83,8 @@ Vue.component('tainacan-filter-checkbox', FilterCheckbox);
Vue.component('tainacan-filter-taginput', FilterTaginput);
Vue.component('tainacan-filter-taxonomy-checkbox', FilterTaxonomyCheckbox);
Vue.component('tainacan-filter-taxonomy-taginput', FilterTaxonomyTaginput);
/* Filter Metadata Option forms */
Vue.component('tainacan-filter-form-numeric', FormNumeric);
/* Others */
Vue.component('help-button', HelpButton);

View File

@ -5,18 +5,6 @@ import VTooltip from 'v-tooltip';
import VueMasonry from 'vue-masonry-css';
// Custom elements
import Text from '../../classes/metadata-types/text/Text.vue';
import Textarea from '../../classes/metadata-types/textarea/Textarea.vue';
import Selectbox from '../../classes/metadata-types/selectbox/Selectbox.vue';
import Numeric from '../../classes/metadata-types/numeric/Numeric.vue';
import Date from '../../classes/metadata-types/date/Date.vue';
import Relationship from '../../classes/metadata-types/relationship/Relationship.vue';
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 FilterCustomInterval from '../../classes/filter-types/custom-interval/CustomInterval.vue';
import FilterNumeric from '../../classes/filter-types/numeric/Numeric.vue';
import FilterSelectbox from '../../classes/filter-types/selectbox/Selectbox.vue';
@ -27,7 +15,6 @@ import FilterTaginput from '../../classes/filter-types/taginput/Taginput.vue';
import FilterTaxonomyCheckbox from '../../classes/filter-types/taxonomy/Checkbox.vue';
import FilterTaxonomyTaginput from '../../classes/filter-types/taxonomy/Taginput.vue';
import TaincanFormItem from '../../classes/metadata-types/tainacan-form-item.vue';
import TaincanFiltersList from '../../classes/filter-types/tainacan-filter-item.vue';
import ItemsPage from '../pages/lists/items-page.vue';
import TermItemsPage from '../pages/lists/term-items-page.vue';
@ -38,8 +25,6 @@ import ViewModeMasonry from '../../theme-helper/view-mode-masonry.vue';
import ViewModeSlideshow from '../../theme-helper/view-mode-slideshow.vue';
// Remaining imports
import HelpButton from '../components/other/help-button.vue';
import draggable from 'vuedraggable'
import store from '../../js/store/store'
import routerTheme from './theme-router.js'
import eventBusSearch from '../../js/event-bus-search';
@ -54,19 +39,7 @@ Vue.use(UserPrefsPlugin);
Vue.use(RouterHelperPlugin);
Vue.use(ConsolePlugin, {visual: false});
/* Metadata */
Vue.component('tainacan-text', Text);
Vue.component('tainacan-textarea', Textarea);
Vue.component('tainacan-selectbox', Selectbox);
Vue.component('tainacan-numeric', Numeric);
Vue.component('tainacan-date', Date);
Vue.component('tainacan-relationship', Relationship);
Vue.component('tainacan-taxonomy', Taxonomy);
Vue.component('tainacan-form-relationship', FormRelationship);
Vue.component('tainacan-form-taxonomy', FormTaxonomy);
Vue.component('tainacan-form-selectbox', FormSelectbox);
Vue.component('tainacan-form-item', TaincanFormItem);
Vue.component('tainacan-filter-item', TaincanFiltersList);
/* Filters */
@ -80,8 +53,6 @@ Vue.component('tainacan-filter-taxonomy-checkbox', FilterTaxonomyCheckbox);
Vue.component('tainacan-filter-taxonomy-taginput', FilterTaxonomyTaginput);
/* Others */
Vue.component('help-button', HelpButton);
Vue.component('draggable', draggable);
Vue.component('items-page', ItemsPage);
Vue.component('term-items-page', TermItemsPage);

View File

@ -8,12 +8,10 @@ defined( 'ABSPATH' ) or die( 'No script kiddies please!' );
*/
class Autocomplete extends Filter_Type {
//protected $default_max_options = -1;
protected $use_max_options = false;
function __construct(){
$this->set_supported_types(['string','long_string','item']);
$this->set_component('tainacan-filter-autocomplete');
$this->set_use_max_options(false);
$this->set_preview_template('
<div>
<div class="taginput control is-expanded has-selected">

View File

@ -12,6 +12,7 @@ class Custom_Interval extends Filter_Type {
function __construct(){
$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="control is-small is-clearfix">

View File

@ -0,0 +1,54 @@
<template>
<div>
<!-- <b-select
expanded
:disabled="disabled"
:id = "id"
:placeholder="$i18n.get('label_selectbox_init')"
:value="value"
:class="{'is-empty': value == undefined || value == ''}"
@blur="$emit('blur')"
@input="onChecked($event)">
<option
v-for="(option, index) in getOptions"
:key="index"
:label="option"
:value="option"
border>{{ option }}</option>
</b-select> -->
</div>
</template>
<script>
export default {
// props: {
// filter: {
// type: Object
// },
// options: {
// type: String
// },
// value: [String, Number, Array],
// id: '',
// disabled: false,
// },
// computed: {
// getOptions(){
// if ( this.options && this.options !== '' ){
// return this.options.split("\n");
// }
// else if ( this.filter && this.filter.filter.metadata_type_options.options ) {
// const metadata = this.filter.filter.metadata_type_options.options;
// return ( metadata ) ? metadata.split("\n") : [];
// }
// return [];
// }
// },
// methods: {
// onChecked(value) {
// this.$emit('input', value);
// },
// }
}
</script>

View File

@ -12,6 +12,8 @@ class Numeric extends Filter_Type {
function __construct(){
$this->set_supported_types(['float']);
$this->set_component('tainacan-filter-numeric');
// $this->set_form_component('tainacan-filter-form-numeric');
$this->set_use_max_options(false);
$this->set_preview_template('
<div>
<div>
@ -70,7 +72,9 @@ class Numeric extends Filter_Type {
* @internal param $metadatum
*/
public function render( $filter ){
return '<tainacan-filter-custom-interval
$options = $this->get_option('options');
return '<tainacan-filter-custom-interval
options="' . $options . '"
name="'.$filter->get_name().'"
typeRange="numeric"
collection_id="'.$filter->get_collection_id().'"

View File

@ -8,10 +8,10 @@ defined( 'ABSPATH' ) or die( 'No script kiddies please!' );
*/
class Selectbox extends Filter_Type {
protected $use_max_options = false;
function __construct(){
$this->set_supported_types(['string', 'long_string']);
$this->set_component('tainacan-filter-selectbox');
$this->set_use_max_options(false);
$this->set_preview_template('
<div>
<div class="control is-expanded">

View File

@ -11,6 +11,7 @@ class Taginput extends Filter_Type {
function __construct(){
$this->set_supported_types(['string','long_string','item']);
$this->set_component('tainacan-filter-taginput');
$this->set_use_max_options(false);
$this->set_preview_template('
<div>
<p class="has-text-gray">'. __('Selected values') . ': </p>

View File

@ -11,6 +11,7 @@ class TaxonomyTaginput extends Filter_Type {
function __construct(){
$this->set_supported_types(['term']);
$this->set_component('tainacan-filter-taxonomy-taginput');
$this->set_use_max_options(false);
$this->set_preview_template('
<div>
<p class="has-text-gray">'. __('Selected values') . ': </p>