fix: expose default grid pagesize in appinfo config
This commit is contained in:
parent
7cfe6e15f4
commit
cc52c708db
3 changed files with 29 additions and 0 deletions
|
|
@ -158,6 +158,24 @@
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<h3 class="block is-size-3">Grids</h3>
|
||||||
|
<div class="block" style="padding-left: 2rem; width: 50%;">
|
||||||
|
|
||||||
|
<b-field label="Default Page Size"
|
||||||
|
:message="simpleSettings['wuttaweb.grids.default_pagesize'] ? '' : 'Current default page size is: ${grid_pagesize_default}'">
|
||||||
|
<b-select name="wuttaweb.grids.default_pagesize"
|
||||||
|
v-model="simpleSettings['wuttaweb.grids.default_pagesize']"
|
||||||
|
@input="settingsNeedSaved = true">
|
||||||
|
<option :value="null">(use default)</option>
|
||||||
|
<option v-for="option in gridPagesizeOptions"
|
||||||
|
:value="option">
|
||||||
|
{{ option }}
|
||||||
|
</option>
|
||||||
|
</b-select>
|
||||||
|
</b-field>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
<h3 class="block is-size-3">Web Libraries</h3>
|
<h3 class="block is-size-3">Web Libraries</h3>
|
||||||
<div class="block" style="padding-left: 2rem;">
|
<div class="block" style="padding-left: 2rem;">
|
||||||
|
|
||||||
|
|
@ -348,6 +366,8 @@
|
||||||
|
|
||||||
ThisPageData.validators.push(ThisPage.methods.timezoneValidate)
|
ThisPageData.validators.push(ThisPage.methods.timezoneValidate)
|
||||||
|
|
||||||
|
ThisPageData.gridPagesizeOptions = ${json.dumps(grid_pagesize_options)|n}
|
||||||
|
|
||||||
ThisPageData.weblibs = ${json.dumps(weblibs or [])|n}
|
ThisPageData.weblibs = ${json.dumps(weblibs or [])|n}
|
||||||
|
|
||||||
ThisPageData.editWebLibraryShowDialog = false
|
ThisPageData.editWebLibraryShowDialog = false
|
||||||
|
|
|
||||||
|
|
@ -228,6 +228,8 @@ class AppInfoView(MasterView): # pylint: disable=abstract-method
|
||||||
{"name": f"{self.config.appname}.email.default.to"},
|
{"name": f"{self.config.appname}.email.default.to"},
|
||||||
{"name": f"{self.config.appname}.email.feedback.subject"},
|
{"name": f"{self.config.appname}.email.feedback.subject"},
|
||||||
{"name": f"{self.config.appname}.email.feedback.to"},
|
{"name": f"{self.config.appname}.email.feedback.to"},
|
||||||
|
# grids
|
||||||
|
{"name": "wuttaweb.grids.default_pagesize", "type": int},
|
||||||
]
|
]
|
||||||
|
|
||||||
def getval(key):
|
def getval(key):
|
||||||
|
|
@ -282,6 +284,11 @@ class AppInfoView(MasterView): # pylint: disable=abstract-method
|
||||||
handlers = [{"spec": spec} for spec in handlers]
|
handlers = [{"spec": spec} for spec in handlers]
|
||||||
context["menu_handlers"] = handlers
|
context["menu_handlers"] = handlers
|
||||||
|
|
||||||
|
# add pagesize options
|
||||||
|
g = self.make_grid()
|
||||||
|
context["grid_pagesize_options"] = g.get_pagesize_options()
|
||||||
|
context["grid_pagesize_default"] = g.get_pagesize()
|
||||||
|
|
||||||
# add `weblibs` to context, based on config values
|
# add `weblibs` to context, based on config values
|
||||||
weblibs = self.get_weblibs()
|
weblibs = self.get_weblibs()
|
||||||
for key in weblibs:
|
for key in weblibs:
|
||||||
|
|
|
||||||
|
|
@ -1785,6 +1785,8 @@ class TestMasterView(WebTestCase):
|
||||||
kw = original_context(**kw)
|
kw = original_context(**kw)
|
||||||
kw["menu_handlers"] = []
|
kw["menu_handlers"] = []
|
||||||
kw["default_timezone"] = "UTC"
|
kw["default_timezone"] = "UTC"
|
||||||
|
kw["grid_pagesize_options"] = [10, 20, 50]
|
||||||
|
kw["grid_pagesize_default"] = 20
|
||||||
return kw
|
return kw
|
||||||
|
|
||||||
with patch.object(view, "configure_get_context", new=get_context):
|
with patch.object(view, "configure_get_context", new=get_context):
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue