From 472d2cfd7b40e1370898b7b7c4371ac9321b268e Mon Sep 17 00:00:00 2001 From: Lance Edgar Date: Mon, 26 Nov 2012 14:24:10 -0800 Subject: [PATCH] cleanup main batch route --- rattail/pyramid/templates/batches/crud.mako | 3 +++ rattail/pyramid/templates/batches/rows/index.mako | 2 +- rattail/pyramid/views/batches/core.py | 9 +++++---- rattail/pyramid/views/products.py | 2 +- 4 files changed, 10 insertions(+), 6 deletions(-) diff --git a/rattail/pyramid/templates/batches/crud.mako b/rattail/pyramid/templates/batches/crud.mako index 165b02be..f2875e56 100644 --- a/rattail/pyramid/templates/batches/crud.mako +++ b/rattail/pyramid/templates/batches/crud.mako @@ -3,6 +3,9 @@ <%def name="context_menu_items()">
  • ${h.link_to("Back to Batches", url('batches'))}
  • ${h.link_to("View Batch Rows", url('batch.rows', uuid=form.fieldset.model.uuid))}
  • + % if not form.readonly: +
  • ${h.link_to("View this Batch", url('batch.read', uuid=form.fieldset.model.uuid))}
  • + % endif ${parent.body()} diff --git a/rattail/pyramid/templates/batches/rows/index.mako b/rattail/pyramid/templates/batches/rows/index.mako index 17c72786..d362918d 100644 --- a/rattail/pyramid/templates/batches/rows/index.mako +++ b/rattail/pyramid/templates/batches/rows/index.mako @@ -33,7 +33,7 @@ <%def name="context_menu_items()">
  • ${h.link_to("Back to Batches", url('batches'))}
  • -
  • ${h.link_to("Back to Batch", url('batch', uuid=batch.uuid))}
  • +
  • ${h.link_to("Back to Batch", url('batch.read', uuid=batch.uuid))}
  • <%def name="tools()"> diff --git a/rattail/pyramid/views/batches/core.py b/rattail/pyramid/views/batches/core.py index c1fa0bf5..8a0f5a96 100644 --- a/rattail/pyramid/views/batches/core.py +++ b/rattail/pyramid/views/batches/core.py @@ -101,7 +101,7 @@ class BatchesGrid(SearchableAlchemyGridView): 'batch.rows', uuid=row.uuid)) g.add_column('rows', "", rows) g.clickable = True - g.click_route_name = 'batch' + g.click_route_name = 'batch.read' if self.request.has_perm('batches.update'): g.editable = True g.edit_route_name = 'batch.update' @@ -127,7 +127,7 @@ class BatchCrud(CrudView): fs.action_type, fs.description, fs.rowcount.label("Row Count").readonly(), - fs.executed, + fs.executed.readonly(), ]) return fs @@ -180,8 +180,9 @@ def includeme(config): renderer='/batches/index.mako', permission='batches.list') - config.add_route('batch', '/batches/{uuid}') - config.add_view(BatchCrud, attr='read', route_name='batch', + config.add_route('batch.read', '/batches/{uuid}') + config.add_view(BatchCrud, attr='read', + route_name='batch.read', renderer='/batches/read.mako', permission='batches.read') diff --git a/rattail/pyramid/views/products.py b/rattail/pyramid/views/products.py index 92f70d4a..16c1a613 100644 --- a/rattail/pyramid/views/products.py +++ b/rattail/pyramid/views/products.py @@ -268,7 +268,7 @@ class CreateProductsBatch(ProductsGrid): progress.session.load() progress.session['complete'] = True - progress.session['success_url'] = self.request.route_url('batch', uuid=batch.uuid) + progress.session['success_url'] = self.request.route_url('batch.read', uuid=batch.uuid) progress.session['success_msg'] = "Batch \"%s\" has been created." % batch.description progress.session.save()