Removes proposal of type option from date filter for now.

This commit is contained in:
Mateus Machado Luna 2019-09-04 10:03:54 -03:00
parent ebdfc64a25
commit ce211e5130
3 changed files with 27 additions and 24 deletions

View File

@ -35,7 +35,7 @@ import FilterTaxonomyCheckbox from '../../classes/filter-types/taxonomy/Checkbox
import FilterTaxonomyTaginput from '../../classes/filter-types/taxonomy/Taginput.vue'; import FilterTaxonomyTaginput from '../../classes/filter-types/taxonomy/Taginput.vue';
import FormNumeric from '../../classes/filter-types/numeric/FormNumeric.vue'; import FormNumeric from '../../classes/filter-types/numeric/FormNumeric.vue';
import FormDate from '../../classes/filter-types/date/FormDate.vue'; // import FormDate from '../../classes/filter-types/date/FormDate.vue';
import TainacanFormItem from '../../classes/metadata-types/tainacan-form-item.vue'; import TainacanFormItem from '../../classes/metadata-types/tainacan-form-item.vue';
import TainacanFiltersList from '../../classes/filter-types/tainacan-filter-item.vue'; import TainacanFiltersList from '../../classes/filter-types/tainacan-filter-item.vue';
@ -91,7 +91,7 @@ Vue.component('tainacan-filter-taxonomy-checkbox', FilterTaxonomyCheckbox);
Vue.component('tainacan-filter-taxonomy-taginput', FilterTaxonomyTaginput); Vue.component('tainacan-filter-taxonomy-taginput', FilterTaxonomyTaginput);
/* Filter Metadata Option forms */ /* Filter Metadata Option forms */
Vue.component('tainacan-filter-form-numeric', FormNumeric); Vue.component('tainacan-filter-form-numeric', FormNumeric);
Vue.component('tainacan-filter-form-date', FormDate); // Vue.component('tainacan-filter-form-date', FormDate);
/* Others */ /* Others */
Vue.component('help-button', HelpButton); Vue.component('help-button', HelpButton);

View File

@ -58,20 +58,18 @@
≤  {{ $i18n.get('before_or_on_day') }} ≤  {{ $i18n.get('before_or_on_day') }}
</b-dropdown-item> </b-dropdown-item>
</b-dropdown> </b-dropdown>
<b-numberinput <!-- <b-numberinput
v-if="options.type == 'year'" v-if="options.type == 'year'"
:placeholder="$i18n.get('instruction_type_value_year')" :placeholder="$i18n.get('instruction_type_value_year')"
:aria-labelledby="labelId" :aria-labelledby="labelId"
size="is-small" size="is-small"
step="1" step="1"
@input="emitOnlyYear($event)" @input="emitOnlyYear($event)"
v-model="yearsOnlyValue"/> v-model="yearsOnlyValue"/> -->
<b-datepicker <b-datepicker
v-else
:type="options.type == 'month' ? 'month' : null"
position="is-bottom-left" position="is-bottom-left"
:aria-labelledby="labelId" :aria-labelledby="labelId"
:placeholder="options.type == 'month' ? $i18n.get('instruction_select_a_date') : $i18n.get('instruction_select_a_month')" :placeholder="$i18n.get('instruction_select_a_date')"
v-model="value" v-model="value"
@input="emit()" @input="emit()"
editable editable
@ -102,6 +100,11 @@
$i18n.get('datepicker_month_november'), $i18n.get('datepicker_month_november'),
$i18n.get('datepicker_month_december') $i18n.get('datepicker_month_december')
]"/> ]"/>
<!-- OPTIONS FOR TYPE
v-else
:type="options.type == 'month' ? 'month' : null"
:placeholder="options.type == 'month' ? $i18n.get('instruction_select_a_date') : $i18n.get('instruction_select_a_month')"
-->
</div> </div>
</template> </template>

View File

@ -12,11 +12,11 @@ class Date extends Filter_Type {
function __construct(){ function __construct(){
$this->set_supported_types(['date']); $this->set_supported_types(['date']);
$this->set_component('tainacan-filter-date'); $this->set_component('tainacan-filter-date');
$this->set_form_component('tainacan-filter-form-date'); // $this->set_form_component('tainacan-filter-form-date');
$this->set_use_max_options(false); $this->set_use_max_options(false);
$this->set_default_options([ // $this->set_default_options([
'type' => 'day' // 'type' => 'day'
]); // ]);
$this->set_preview_template(' $this->set_preview_template('
<div> <div>
<div> <div>
@ -60,17 +60,17 @@ class Date extends Filter_Type {
'); ');
} }
/** // /**
* @inheritdoc // * @inheritdoc
*/ // */
public function get_form_labels(){ // public function get_form_labels(){
return [ // return [
'type' => [ // 'type' => [
'title' => __( 'Type', 'tainacan' ), // 'title' => __( 'Type', 'tainacan' ),
'description' => __( 'The type of the date picker, may be for day, month or year.', 'tainacan' ), // 'description' => __( 'The type of the date picker, may be for day, month or year.', 'tainacan' ),
] // ]
]; // ];
} // }
/** /**
* @param $filter * @param $filter
@ -78,11 +78,11 @@ class Date extends Filter_Type {
* @internal param $metadatum * @internal param $metadatum
*/ */
public function render( $filter ){ public function render( $filter ){
return '<tainacan-filter-date return '<tainacan-filter-date
type="' . $this->get_option('type') . '"
name="'.$filter->get_name().'" name="'.$filter->get_name().'"
collection_id="'.$filter->get_collection_id().'" collection_id="'.$filter->get_collection_id().'"
metadatum_id="'.$filter->get_metadatum_id().'"></tainacan-filter-date>'; metadatum_id="'.$filter->get_metadatum_id().'"></tainacan-filter-date>';
// type="' . $this->get_option('type') . '"
} }
} }