Convert label profiles to use master view.

Plus some more minor tweaks to the framework.
This commit is contained in:
Lance Edgar 2015-08-12 00:46:39 -05:00
parent af07f477dc
commit d4210844ac
11 changed files with 145 additions and 184 deletions

View file

@ -0,0 +1,17 @@
## -*- coding: utf-8 -*-
<%inherit file="/master/create.mako" />
<%def name="head_tags()">
${parent.head_tags()}
<style type="text/css">
div.form div.field-wrapper.format textarea {
font-size: 120%;
font-family: monospace;
width: auto;
}
</style>
</%def>
${parent.body()}

View file

@ -1,29 +0,0 @@
## -*- coding: utf-8 -*-
<%inherit file="/crud.mako" />
<%def name="head_tags()">
${parent.head_tags()}
<style type="text/css">
div.form div.field-wrapper.format textarea {
font-size: 120%;
font-family: monospace;
width: auto;
}
</style>
</%def>
<%def name="context_menu_items()">
<li>${h.link_to("Back to Label Profiles", url('label_profiles'))}</li>
% if form.updating:
<% profile = form.fieldset.model %>
<% printer = profile.get_printer(request.rattail_config) %>
% if printer and printer.required_settings:
<li>${h.link_to("Edit Printer Settings", url('label_profile.printer_settings', uuid=profile.uuid))}</li>
% endif
<li>${h.link_to("View this Label Profile", url('label_profile.read', uuid=profile.uuid))}</li>
% endif
</%def>
${parent.body()}

View file

@ -0,0 +1,25 @@
## -*- coding: utf-8 -*-
<%inherit file="/master/edit.mako" />
<%def name="head_tags()">
${parent.head_tags()}
<style type="text/css">
div.form div.field-wrapper.format textarea {
font-size: 120%;
font-family: monospace;
width: auto;
}
</style>
</%def>
<%def name="context_menu_items()">
${parent.context_menu_items()}
<% printer = instance.get_printer(request.rattail_config) %>
% if printer and printer.required_settings:
<li>${h.link_to("Edit Printer Settings", url('labelprofiles.printer_settings', uuid=instance.uuid))}</li>
% endif
</%def>
${parent.body()}

View file

@ -1,12 +0,0 @@
## -*- coding: utf-8 -*-
<%inherit file="/grid.mako" />
<%def name="title()">Label Profiles</%def>
<%def name="context_menu_items()">
% if request.has_perm('label_profiles.create'):
<li>${h.link_to("Create a new Label Profile", url('label_profile.create'))}</li>
% endif
</%def>
${parent.body()}

View file

@ -4,9 +4,9 @@
<%def name="title()">Printer Settings</%def>
<%def name="context_menu_items()">
<li>${h.link_to("Back to Label Profiles", url('label_profiles'))}</li>
<li>${h.link_to("View this Label Profile", url('label_profile.read', uuid=profile.uuid))}</li>
<li>${h.link_to("Edit this Label Profile", url('label_profile.update', uuid=profile.uuid))}</li>
<li>${h.link_to("Back to Label Profiles", url('labelprofiles'))}</li>
<li>${h.link_to("View this Label Profile", url('labelprofiles.view', uuid=profile.uuid))}</li>
<li>${h.link_to("Edit this Label Profile", url('labelprofiles.edit', uuid=profile.uuid))}</li>
</%def>
<div class="form-wrapper">
@ -40,7 +40,7 @@
<div class="buttons">
${h.submit('update', "Update")}
<button type="button" onclick="location.href = '${url('label_profile.read', uuid=profile.uuid)}';">Cancel</button>
<button type="button" onclick="location.href = '${url('labelprofiles.view', uuid=profile.uuid)}';">Cancel</button>
</div>
${h.end_form()}

View file

@ -1,36 +0,0 @@
## -*- coding: utf-8 -*-
<%inherit file="/labels/profiles/crud.mako" />
<%def name="context_menu_items()">
<li>${h.link_to("Back to Label Profiles", url('label_profiles'))}</li>
% if form.readonly and request.has_perm('label_profiles.update'):
<% profile = form.fieldset.model %>
<% printer = profile.get_printer(request.rattail_config) %>
<li>${h.link_to("Edit this Label Profile", url('label_profile.update', uuid=form.fieldset.model.uuid))}</li>
% if printer and printer.required_settings:
<li>${h.link_to("Edit Printer Settings", url('label_profile.printer_settings', uuid=profile.uuid))}</li>
% endif
% endif
% if version_count is not Undefined and request.has_perm('labelprofile.versions.view'):
<li>${h.link_to("View Change History ({0})".format(version_count), url('labelprofile.versions', uuid=form.fieldset.model.uuid))}</li>
% endif
</%def>
${parent.body()}
<% profile = form.fieldset.model %>
<% printer = profile.get_printer(request.rattail_config) %>
% if printer and printer.required_settings:
<h2>Printer Settings</h2>
<div class="form">
% for name, display in printer.required_settings.iteritems():
<div class="field-wrapper">
<label>${display}</label>
<div class="field">${profile.get_printer_setting(name) or ''}</div>
</div>
% endfor
</div>
% endif

View file

@ -0,0 +1,45 @@
## -*- coding: utf-8 -*-
<%inherit file="/master/view.mako" />
<%def name="head_tags()">
${parent.head_tags()}
<style type="text/css">
div.form div.field-wrapper.format textarea {
font-size: 120%;
font-family: monospace;
width: auto;
}
</style>
</%def>
<%def name="context_menu_items()">
${parent.context_menu_items()}
% if request.has_perm('labelprofiles.edit'):
<% printer = instance.get_printer(request.rattail_config) %>
% if printer and printer.required_settings:
<li>${h.link_to("Edit Printer Settings", url('labelprofiles.printer_settings', uuid=instance.uuid))}</li>
% endif
% endif
% if version_count is not Undefined and request.has_perm('labelprofile.versions.view'):
<li>${h.link_to("View Change History ({0})".format(version_count), url('labelprofile.versions', uuid=instance.uuid))}</li>
% endif
</%def>
${parent.body()}
<% printer = instance.get_printer(request.rattail_config) %>
% if printer and printer.required_settings:
<h2>Printer Settings</h2>
<div class="form">
% for name, display in printer.required_settings.iteritems():
<div class="field-wrapper">
<label>${display}</label>
<div class="field">${instance.get_printer_setting(name) or ''}</div>
</div>
% endfor
</div>
% endif