3
0
Fork 0

Compare commits

...

4 commits

Author SHA1 Message Date
Lance Edgar e9d59062ca fix: add form padding, validators for /configure pages 2024-08-20 19:02:00 -05:00
Lance Edgar cadd63e3e8 fix: add padding around main form, via wrapper css 2024-08-20 17:03:15 -05:00
Lance Edgar bdc57abd5a fix: show CRUD buttons in header only if relevant and user has access 2024-08-20 17:02:38 -05:00
Lance Edgar f502bf1ba3 fix: tweak style config for home link app title in main menu
putting the gap/margin in base css so another template can override
2024-08-20 16:48:33 -05:00
3 changed files with 66 additions and 38 deletions

View file

@ -124,9 +124,11 @@
}
% endif
## nb. this refers to the "menu-sized" app title in far left of main menu
## nb. this refers to the "home link" app title, next to small
## header logo in top left of screen
#navbar-brand-title {
font-weight: bold;
margin-left: 0.3rem;
}
#header-index-title {
@ -149,6 +151,12 @@
white-space: nowrap;
}
.wutta-form-wrapper {
margin-left: 5rem;
margin-top: 2rem;
width: 50%;
}
</style>
</%def>
@ -299,7 +307,7 @@
<%def name="render_navbar_brand()">
<div class="navbar-brand">
<a class="navbar-item" href="${url('home')}">
<div style="display: flex; gap: 0.3rem; align-items: center;">
<div style="display: flex; align-items: center;">
${base_meta.header_logo()}
<div id="navbar-brand-title">
${base_meta.global_title()}
@ -480,36 +488,44 @@
<%def name="render_crud_header_buttons()">
% if master:
% if master.viewing:
<wutta-button once
tag="a" href="${master.get_action_url('edit', instance)}"
icon-left="edit"
label="Edit This" />
% if instance_deletable:
<wutta-button once type="is-danger"
tag="a" href="${master.get_action_url('delete', instance)}"
icon-left="trash"
label="Delete This" />
% endif
% elif master.editing:
<wutta-button once
tag="a" href="${master.get_action_url('view', instance)}"
icon-left="eye"
label="View This" />
% if instance_deletable:
<wutta-button once type="is-danger"
tag="a" href="${master.get_action_url('delete', instance)}"
icon-left="trash"
label="Delete This" />
% endif
% elif master.deleting:
<wutta-button once
tag="a" href="${master.get_action_url('view', instance)}"
icon-left="eye"
label="View This" />
<wutta-button once
tag="a" href="${master.get_action_url('edit', instance)}"
icon-left="edit"
label="Edit This" />
% if instance_editable and master.has_perm('edit'):
<wutta-button once
tag="a" href="${master.get_action_url('edit', instance)}"
icon-left="edit"
label="Edit This" />
% endif
% if instance_deletable and master.has_perm('delete'):
<wutta-button once type="is-danger"
tag="a" href="${master.get_action_url('delete', instance)}"
icon-left="trash"
label="Delete This" />
% endif
% elif master.editing:
% if instance_viewable and master.has_perm('view'):
<wutta-button once
tag="a" href="${master.get_action_url('view', instance)}"
icon-left="eye"
label="View This" />
% endif
% if instance_deletable and master.has_perm('delete'):
<wutta-button once type="is-danger"
tag="a" href="${master.get_action_url('delete', instance)}"
icon-left="trash"
label="Delete This" />
% endif
% elif master.deleting:
% if instance_viewable and master.has_perm('view'):
<wutta-button once
tag="a" href="${master.get_action_url('view', instance)}"
icon-left="eye"
label="View This" />
% endif
% if instance_editable and master.has_perm('edit'):
<wutta-button once
tag="a" href="${master.get_action_url('edit', instance)}"
icon-left="edit"
label="Edit This" />
% endif
% endif
% endif
</%def>

View file

@ -8,8 +8,10 @@
${self.buttons_content()}
${h.form(request.current_route_url(), enctype='multipart/form-data', ref='saveSettingsForm', **{'@submit': 'saveSettingsFormSubmit'})}
${h.csrf_token(request)}
${self.form_content()}
${h.csrf_token(request)}
<div class="wutta-form-wrapper">
${self.form_content()}
</div>
${h.end_form()}
<b-modal has-modal-card
@ -148,8 +150,18 @@
ThisPageData.settingsNeedSaved = false
ThisPageData.undoChanges = false
ThisPageData.savingSettings = false
ThisPageData.validators = []
ThisPage.methods.saveSettings = function() {
for (let validator of this.validators) {
let msg = validator.call(this)
if (msg) {
alert(msg)
return
}
}
this.savingSettings = true
this.$refs.saveSettingsForm.submit()
}

View file

@ -2,11 +2,11 @@
<%inherit file="/page.mako" />
<%def name="page_content()">
<div style="margin-top: 2rem; width: 50%;">
% if form is not Undefined:
% if form is not Undefined:
<div class="wutta-form-wrapper">
${form.render_vue_tag()}
% endif
</div>
</div>
% endif
</%def>
<%def name="render_vue_templates()">