fix: allow auto-collapse of header when viewing trainwreck txn
This commit is contained in:
parent
af0f84762c
commit
3aafe578f0
|
@ -16,10 +16,53 @@
|
|||
</%def>
|
||||
|
||||
<%def name="page_content()">
|
||||
% if main_form_collapsible:
|
||||
<${b}-collapse class="panel"
|
||||
% if request.use_oruga:
|
||||
v-model:open="mainFormPanelOpen"
|
||||
% else:
|
||||
:open.sync="mainFormPanelOpen"
|
||||
% endif
|
||||
>
|
||||
<template #trigger="props">
|
||||
<div class="panel-heading"
|
||||
role="button"
|
||||
style="cursor: pointer;">
|
||||
|
||||
## TODO: for some reason buefy will "reuse" the icon
|
||||
## element in such a way that its display does not
|
||||
## refresh. so to work around that, we use different
|
||||
## structure for the two icons, so buefy is forced to
|
||||
## re-draw
|
||||
|
||||
<b-icon v-if="props.open"
|
||||
pack="fas"
|
||||
icon="caret-down">
|
||||
</b-icon>
|
||||
|
||||
<span v-if="!props.open">
|
||||
<b-icon pack="fas"
|
||||
icon="caret-right">
|
||||
</b-icon>
|
||||
</span>
|
||||
|
||||
|
||||
<strong>Transaction Header</strong>
|
||||
</div>
|
||||
</template>
|
||||
<div class="panel-block">
|
||||
<div class="form-wrapper">
|
||||
<br />
|
||||
${self.render_form()}
|
||||
</div>
|
||||
</div>
|
||||
</${b}-collapse>
|
||||
% else:
|
||||
<div class="form-wrapper">
|
||||
<br />
|
||||
${self.render_form()}
|
||||
</div>
|
||||
% endif
|
||||
</%def>
|
||||
|
||||
<%def name="render_this_page()">
|
||||
|
@ -54,6 +97,15 @@
|
|||
${parent.render_this_page_template()}
|
||||
</%def>
|
||||
|
||||
<%def name="modify_this_page_vars()">
|
||||
${parent.modify_this_page_vars()}
|
||||
% if main_form_collapsible:
|
||||
<script>
|
||||
ThisPageData.mainFormPanelOpen = ${'false' if main_form_autocollapse else 'true'}
|
||||
</script>
|
||||
% endif
|
||||
</%def>
|
||||
|
||||
<%def name="finalize_this_page_vars()">
|
||||
${parent.finalize_this_page_vars()}
|
||||
% if form is not Undefined:
|
||||
|
|
|
@ -3,6 +3,19 @@
|
|||
|
||||
<%def name="form_content()">
|
||||
|
||||
<h3 class="block is-size-3">Display</h3>
|
||||
<div class="block" style="padding-left: 2rem;">
|
||||
|
||||
<b-field>
|
||||
<b-checkbox name="tailbone.trainwreck.view_txn.autocollapse_header"
|
||||
v-model="simpleSettings['tailbone.trainwreck.view_txn.autocollapse_header']"
|
||||
native-value="true"
|
||||
@input="settingsNeedSaved = true">
|
||||
Auto-collapse header when viewing transaction
|
||||
</b-checkbox>
|
||||
</b-field>
|
||||
</div>
|
||||
|
||||
<h3 class="block is-size-3">Rotation</h3>
|
||||
<div class="block" style="padding-left: 2rem;">
|
||||
|
||||
|
|
|
@ -256,6 +256,7 @@ class TransactionView(MasterView):
|
|||
|
||||
def template_kwargs_view(self, **kwargs):
|
||||
kwargs = super().template_kwargs_view(**kwargs)
|
||||
config = self.rattail_config
|
||||
|
||||
form = kwargs['form']
|
||||
if 'custorder_xref_markers' in form:
|
||||
|
@ -268,6 +269,12 @@ class TransactionView(MasterView):
|
|||
})
|
||||
kwargs['custorder_xref_markers_data'] = markers
|
||||
|
||||
# collapse header
|
||||
kwargs['main_form_collapsible'] = True
|
||||
kwargs['main_form_autocollapse'] = config.get_bool(
|
||||
'tailbone.trainwreck.view_txn.autocollapse_header',
|
||||
default=False)
|
||||
|
||||
return kwargs
|
||||
|
||||
def get_xref_buttons(self, txn):
|
||||
|
@ -419,6 +426,11 @@ class TransactionView(MasterView):
|
|||
def configure_get_simple_settings(self):
|
||||
return [
|
||||
|
||||
# display
|
||||
{'section': 'tailbone',
|
||||
'option': 'trainwreck.view_txn.autocollapse_header',
|
||||
'type': bool},
|
||||
|
||||
# rotation
|
||||
{'section': 'trainwreck',
|
||||
'option': 'use_rotation',
|
||||
|
|
Loading…
Reference in a new issue