Rename template for grid filters (drop buefy suffix)

also remove some deprecated functions
This commit is contained in:
Lance Edgar 2024-04-13 09:21:48 -05:00
parent 1973614840
commit cd7c1bba21
4 changed files with 67 additions and 124 deletions

View file

@ -2,7 +2,7 @@
################################################################################
#
# Rattail -- Retail Software Framework
# Copyright © 2010-2023 Lance Edgar
# Copyright © 2010-2024 Lance Edgar
#
# This file is part of Rattail.
#
@ -61,25 +61,6 @@ def csrf_header_name(config):
return config.get('tailbone', 'csrf_header_name', default='X-CSRF-TOKEN')
def get_buefy_version(config):
warnings.warn("get_buefy_version() is deprecated; please use "
"tailbone.util.get_libver() instead",
DeprecationWarning, stacklevel=2)
version = config.get('tailbone', 'libver.buefy')
if version:
return version
return config.get('tailbone', 'buefy_version',
default='latest')
def get_buefy_0_8(config, version=None):
warnings.warn("get_buefy_0_8() is no longer supported",
DeprecationWarning, stacklevel=2)
return False
def global_help_url(config):
return config.get('tailbone', 'global_help_url')

View file

@ -136,7 +136,7 @@
<div class="filters">
% if grid.filterable:
## TODO: stop using |n filter
${grid.render_filters(template='/grids/filters_buefy.mako', allow_save_defaults=allow_save_defaults)|n}
${grid.render_filters(allow_save_defaults=allow_save_defaults)|n}
% endif
</div>
</div>

View file

@ -1,38 +1,70 @@
## -*- coding: utf-8; -*-
<div class="newfilters">
${h.form(form.action_url, method='get')}
${h.hidden('reset-to-default-filters', value='false')}
${h.hidden('save-current-filters-as-defaults', value='false')}
<form action="${form.action_url}" method="GET" @submit.prevent="applyFilters()">
<fieldset>
<legend>Filters</legend>
% for filtr in form.iter_filters():
<div class="filter" id="filter-${filtr.key}" data-key="${filtr.key}"${' style="display: none;"' if not filtr.active else ''|n}>
${h.checkbox('{}-active'.format(filtr.key), class_='active', id='filter-active-{}'.format(filtr.key), checked=filtr.active)}
<label for="filter-active-${filtr.key}">${filtr.label}</label>
<div class="inputs" style="display: inline-block;">
${form.filter_verb(filtr)}
${form.filter_value(filtr)}
</div>
</div>
% endfor
</fieldset>
<grid-filter v-for="key in filtersSequence"
:key="key"
:filter="filters[key]"
ref="gridFilters">
</grid-filter>
<b-field grouped>
<b-button type="is-primary"
native-type="submit"
icon-pack="fas"
icon-left="check"
class="control">
Apply Filters
</b-button>
<b-button v-if="!addFilterShow"
icon-pack="fas"
icon-left="plus"
class="control"
@click="addFilterButton">
Add Filter
</b-button>
<b-autocomplete v-if="addFilterShow"
ref="addFilterAutocomplete"
:data="addFilterChoices"
v-model="addFilterTerm"
placeholder="Add Filter"
field="key"
:custom-formatter="filtr => filtr.label"
open-on-focus
keep-first
icon-pack="fas"
clearable
clear-on-select
@select="addFilterSelect"
@keydown.native="addFilterKeydown">
</b-autocomplete>
<b-button @click="resetView()"
icon-pack="fas"
icon-left="home"
class="control">
Default View
</b-button>
<b-button @click="clearFilters()"
icon-pack="fas"
icon-left="trash"
class="control">
No Filters
</b-button>
<div class="buttons">
<button type="submit" id="apply-filters">Apply Filters</button>
<select id="add-filter">
<option value="">Add a Filter</option>
% for filtr in form.iter_filters():
<option value="${filtr.key}"${' disabled="disabled"' if filtr.active else ''|n}>${filtr.label}</option>
% endfor
</select>
<button type="button" id="default-filters">Default View</button>
<button type="button" id="clear-filters">No Filters</button>
% if allow_save_defaults and request.user:
<button type="button" id="save-defaults">Save Defaults</button>
<b-button @click="saveDefaults()"
icon-pack="fas"
icon-left="save"
class="control">
Save Defaults
</b-button>
% endif
</div>
${h.end_form()}
</div><!-- newfilters -->
</b-field>
</form>

View file

@ -1,70 +0,0 @@
## -*- coding: utf-8; -*-
<form action="${form.action_url}" method="GET" @submit.prevent="applyFilters()">
<grid-filter v-for="key in filtersSequence"
:key="key"
:filter="filters[key]"
ref="gridFilters">
</grid-filter>
<b-field grouped>
<b-button type="is-primary"
native-type="submit"
icon-pack="fas"
icon-left="check"
class="control">
Apply Filters
</b-button>
<b-button v-if="!addFilterShow"
icon-pack="fas"
icon-left="plus"
class="control"
@click="addFilterButton">
Add Filter
</b-button>
<b-autocomplete v-if="addFilterShow"
ref="addFilterAutocomplete"
:data="addFilterChoices"
v-model="addFilterTerm"
placeholder="Add Filter"
field="key"
:custom-formatter="filtr => filtr.label"
open-on-focus
keep-first
icon-pack="fas"
clearable
clear-on-select
@select="addFilterSelect"
@keydown.native="addFilterKeydown">
</b-autocomplete>
<b-button @click="resetView()"
icon-pack="fas"
icon-left="home"
class="control">
Default View
</b-button>
<b-button @click="clearFilters()"
icon-pack="fas"
icon-left="trash"
class="control">
No Filters
</b-button>
% if allow_save_defaults and request.user:
<b-button @click="saveDefaults()"
icon-pack="fas"
icon-left="save"
class="control">
Save Defaults
</b-button>
% endif
</b-field>
</form>