From 7454e611c507b299e2c7cddc18e51becc2fd5733 Mon Sep 17 00:00:00 2001 From: Lance Edgar Date: Tue, 8 Nov 2016 12:56:12 -0600 Subject: [PATCH] Refactor how batch editing is done; don't include rows for that sometimes Various other fixes also..for sake of new purchase batches --- tailbone/templates/master/edit.mako | 17 +++++++ tailbone/templates/master/view_row.mako | 2 +- tailbone/templates/newbatch/edit.mako | 12 +++-- .../templates/purchases/batches/view.mako | 6 ++- tailbone/views/batch.py | 46 ++++++++++++------- tailbone/views/master.py | 8 ++++ tailbone/views/purchases/batch.py | 20 ++++++-- 7 files changed, 85 insertions(+), 26 deletions(-) diff --git a/tailbone/templates/master/edit.mako b/tailbone/templates/master/edit.mako index 79bc533f..9599a2c2 100644 --- a/tailbone/templates/master/edit.mako +++ b/tailbone/templates/master/edit.mako @@ -3,6 +3,23 @@ <%def name="title()">Edit ${model_title}: ${instance_title} +<%def name="head_tags()"> + ${parent.head_tags()} + + + <%def name="context_menu_items()">
  • ${h.link_to("Back to {}".format(model_title_plural), url(route_prefix))}
  • % if master.viewable and request.has_perm('{}.view'.format(permission_prefix)): diff --git a/tailbone/templates/master/view_row.mako b/tailbone/templates/master/view_row.mako index dc5fd532..b03ae6e0 100644 --- a/tailbone/templates/master/view_row.mako +++ b/tailbone/templates/master/view_row.mako @@ -11,7 +11,7 @@ % if master.rows_deletable and instance_deletable and request.has_perm('{}.delete'.format(permission_prefix)):
  • ${h.link_to("Delete this {}".format(model_title), action_url('delete', instance))}
  • % endif - % if master.rows_creatable and request.has_perm('{}.create'.format(permission_prefix)): + % if rows_creatable and request.has_perm('{}.create'.format(permission_prefix)):
  • ${h.link_to("Create a new {}".format(model_title), url('{}.create'.format(route_prefix)))}
  • % endif diff --git a/tailbone/templates/newbatch/edit.mako b/tailbone/templates/newbatch/edit.mako index 91ea1dc9..120ec8fa 100644 --- a/tailbone/templates/newbatch/edit.mako +++ b/tailbone/templates/newbatch/edit.mako @@ -50,10 +50,16 @@
    - ${form.render(buttons=capture(buttons))|n} -
    + % if master.edit_with_rows: + ${form.render(buttons=capture(buttons))|n} + % else: + ${form.render()|n} + % endif + -${rows_grid.render_complete(allow_save_defaults=False, tools=capture(self.grid_tools))|n} +% if master.edit_with_rows: + ${rows_grid.render_complete(allow_save_defaults=False, tools=capture(self.grid_tools))|n} +% endif