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 # Rattail -- Retail Software Framework
# Copyright © 2010-2023 Lance Edgar # Copyright © 2010-2024 Lance Edgar
# #
# This file is part of Rattail. # 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') 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): def global_help_url(config):
return config.get('tailbone', 'global_help_url') return config.get('tailbone', 'global_help_url')

View file

@ -136,7 +136,7 @@
<div class="filters"> <div class="filters">
% if grid.filterable: % if grid.filterable:
## TODO: stop using |n filter ## 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 % endif
</div> </div>
</div> </div>

View file

@ -1,38 +1,70 @@
## -*- coding: utf-8; -*- ## -*- coding: utf-8; -*-
<div class="newfilters">
${h.form(form.action_url, method='get')} <form action="${form.action_url}" method="GET" @submit.prevent="applyFilters()">
${h.hidden('reset-to-default-filters', value='false')}
${h.hidden('save-current-filters-as-defaults', value='false')}
<fieldset> <grid-filter v-for="key in filtersSequence"
<legend>Filters</legend> :key="key"
% for filtr in form.iter_filters(): :filter="filters[key]"
<div class="filter" id="filter-${filtr.key}" data-key="${filtr.key}"${' style="display: none;"' if not filtr.active else ''|n}> ref="gridFilters">
${h.checkbox('{}-active'.format(filtr.key), class_='active', id='filter-active-{}'.format(filtr.key), checked=filtr.active)} </grid-filter>
<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>
<div class="buttons"> <b-field grouped>
<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>
% endif
</div>
${h.end_form()} <b-button type="is-primary"
</div><!-- newfilters --> 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>

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>