refactored batches.list route a bit
This commit is contained in:
parent
675c4deb63
commit
6bf3fd5886
|
@ -4,7 +4,7 @@
|
||||||
<%def name="crud_name()">Batch</%def>
|
<%def name="crud_name()">Batch</%def>
|
||||||
|
|
||||||
<%def name="menu()">
|
<%def name="menu()">
|
||||||
<p>${h.link_to("Back to Batches", url('batch.list'))}</p>
|
<p>${h.link_to("Back to Batches", url('batches.list'))}</p>
|
||||||
% if fieldset.edit:
|
% if fieldset.edit:
|
||||||
<p>${h.link_to("View Batch Details", url('batch.details', uuid=fieldset.model.uuid))}</p>
|
<p>${h.link_to("View Batch Details", url('batch.details', uuid=fieldset.model.uuid))}</p>
|
||||||
<p>${h.link_to("Execute this Batch", url('batch.execute', uuid=fieldset.model.uuid))}</p>
|
<p>${h.link_to("Execute this Batch", url('batch.execute', uuid=fieldset.model.uuid))}</p>
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
<%def name="title()">Batch : ${batch.name}</%def>
|
<%def name="title()">Batch : ${batch.name}</%def>
|
||||||
|
|
||||||
<%def name="menu()">
|
<%def name="menu()">
|
||||||
<p>${h.link_to("Back to Batches", url('batch.list'))}</p>
|
<p>${h.link_to("Back to Batches", url('batches.list'))}</p>
|
||||||
<p>${h.link_to("View Batch Properties", url('batch.edit', uuid=batch.uuid))}</p>
|
<p>${h.link_to("View Batch Properties", url('batch.edit', uuid=batch.uuid))}</p>
|
||||||
<p>${h.link_to("Execute this Batch", url('batch.execute', uuid=batch.uuid))}</p>
|
<p>${h.link_to("Execute this Batch", url('batch.execute', uuid=batch.uuid))}</p>
|
||||||
</%def>
|
</%def>
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
<%def name="title()">Batch Dictionaries</%def>
|
<%def name="title()">Batch Dictionaries</%def>
|
||||||
|
|
||||||
<%def name="menu()">
|
<%def name="menu()">
|
||||||
<p>${h.link_to("Back to Batches", url('batch.list'))}</p>
|
<p>${h.link_to("Back to Batches", url('batches.list'))}</p>
|
||||||
## <p>${h.link_to("Create a New Dictionary", url('batch_dictionary'))}</p>
|
## <p>${h.link_to("Create a New Dictionary", url('batch_dictionary'))}</p>
|
||||||
</%def>
|
</%def>
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
<%inherit file="/crud.mako" />
|
<%inherit file="/crud.mako" />
|
||||||
|
|
||||||
<%def name="menu()">
|
<%def name="menu()">
|
||||||
<p>${h.link_to("Back to Batches", url('batch.list'))}</p>
|
<p>${h.link_to("Back to Batches", url('batches.list'))}</p>
|
||||||
<p>${h.link_to("Back to Dictionaries", url('batch_dictionaries'))}</p>
|
<p>${h.link_to("Back to Dictionaries", url('batch_dictionaries'))}</p>
|
||||||
</%def>
|
</%def>
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
<%inherit file="/crud.mako" />
|
<%inherit file="/crud.mako" />
|
||||||
|
|
||||||
<%def name="menu()">
|
<%def name="menu()">
|
||||||
<p>${h.link_to("Back to Batches", url('batch.list'))}</p>
|
<p>${h.link_to("Back to Batches", url('batches.list'))}</p>
|
||||||
<p>${h.link_to("Back to SIL Columns", url('sil_columns'))}</p>
|
<p>${h.link_to("Back to SIL Columns", url('sil_columns'))}</p>
|
||||||
</%def>
|
</%def>
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
<%def name="title()">SIL Columns</%def>
|
<%def name="title()">SIL Columns</%def>
|
||||||
|
|
||||||
<%def name="menu()">
|
<%def name="menu()">
|
||||||
<p>${h.link_to("Back to Batches", url('batch.list'))}</p>
|
<p>${h.link_to("Back to Batches", url('batches.list'))}</p>
|
||||||
</%def>
|
</%def>
|
||||||
|
|
||||||
${parent.body()}
|
${parent.body()}
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
<%inherit file="/crud.mako" />
|
<%inherit file="/crud.mako" />
|
||||||
|
|
||||||
<%def name="menu()">
|
<%def name="menu()">
|
||||||
<p>${h.link_to("Back to Batches", url('batch.list'))}</p>
|
<p>${h.link_to("Back to Batches", url('batches.list'))}</p>
|
||||||
<p>${h.link_to("Back to Batch Terminals", url('batch_terminals'))}</p>
|
<p>${h.link_to("Back to Batch Terminals", url('batch_terminals'))}</p>
|
||||||
</%def>
|
</%def>
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
<%def name="title()">Batch Terminals</%def>
|
<%def name="title()">Batch Terminals</%def>
|
||||||
|
|
||||||
<%def name="menu()">
|
<%def name="menu()">
|
||||||
<p>${h.link_to("Back to Batches", url('batch.list'))}</p>
|
<p>${h.link_to("Back to Batches", url('batches.list'))}</p>
|
||||||
<p>${h.link_to("Create a New Terminal", url('batch_terminal.new'))}</p>
|
<p>${h.link_to("Create a New Terminal", url('batch_terminal.new'))}</p>
|
||||||
</%def>
|
</%def>
|
||||||
|
|
||||||
|
|
|
@ -592,8 +592,10 @@ def terminals(context, request):
|
||||||
return grids.render_grid(request, grid, search)
|
return grids.render_grid(request, grid, search)
|
||||||
|
|
||||||
|
|
||||||
@view_config(route_name='batch.list', renderer='/batches/index.mako')
|
def batches(request):
|
||||||
def batches(context, request):
|
"""
|
||||||
|
Batch list/index view.
|
||||||
|
"""
|
||||||
|
|
||||||
fmap = filters.get_filter_map(
|
fmap = filters.get_filter_map(
|
||||||
rattail.Batch,
|
rattail.Batch,
|
||||||
|
@ -601,7 +603,7 @@ def batches(context, request):
|
||||||
target=filters.filter_ilike(rattail.BatchTerminal.description))
|
target=filters.filter_ilike(rattail.BatchTerminal.description))
|
||||||
|
|
||||||
config = filters.get_search_config(
|
config = filters.get_search_config(
|
||||||
'batches', request, fmap,
|
'batches.list', request, fmap,
|
||||||
include_filter_description=True,
|
include_filter_description=True,
|
||||||
filter_type_description='lk',
|
filter_type_description='lk',
|
||||||
include_filter_source_description=True,
|
include_filter_source_description=True,
|
||||||
|
@ -613,7 +615,7 @@ def batches(context, request):
|
||||||
config, source_description="Source")
|
config, source_description="Source")
|
||||||
|
|
||||||
config = grids.get_grid_config(
|
config = grids.get_grid_config(
|
||||||
'batches', request, search,
|
'batches.list', request, search,
|
||||||
filter_map=fmap, deletable=True, sort='target',
|
filter_map=fmap, deletable=True, sort='target',
|
||||||
actions=['Execute'])
|
actions=['Execute'])
|
||||||
|
|
||||||
|
@ -642,7 +644,7 @@ def batches(context, request):
|
||||||
batches = grids.get_pager(query, config)
|
batches = grids.get_pager(query, config)
|
||||||
g = forms.AlchemyGrid(
|
g = forms.AlchemyGrid(
|
||||||
rattail.Batch, batches, config,
|
rattail.Batch, batches, config,
|
||||||
gridurl=request.route_url('batch.list'),
|
gridurl=request.route_url('batches.list'),
|
||||||
# url_object=request.route_url('batch'),
|
# url_object=request.route_url('batch'),
|
||||||
# url_delete=request.route_url('batch'))
|
# url_delete=request.route_url('batch'))
|
||||||
objurl='batch.edit', delurl='batch.delete')
|
objurl='batch.edit', delurl='batch.delete')
|
||||||
|
@ -720,7 +722,7 @@ def batch_columns(context, request):
|
||||||
def batch_fieldset(batch, request):
|
def batch_fieldset(batch, request):
|
||||||
fs = forms.make_fieldset(batch, url=request.route_url,
|
fs = forms.make_fieldset(batch, url=request.route_url,
|
||||||
url_action=request.current_route_url(),
|
url_action=request.current_route_url(),
|
||||||
route_name='batch.list')
|
route_name='batches.list')
|
||||||
|
|
||||||
# Remove unsupported action types...for now.
|
# Remove unsupported action types...for now.
|
||||||
enum = rattail.BATCH_ACTION_TYPE.copy()
|
enum = rattail.BATCH_ACTION_TYPE.copy()
|
||||||
|
@ -753,8 +755,8 @@ def batch_fieldset(batch, request):
|
||||||
return fs
|
return fs
|
||||||
|
|
||||||
|
|
||||||
@view_config(route_name='batch.edit', renderer='/batches/batch.mako')
|
@view_config(route_name='batch.edit', renderer='/batches/batch.mako', permission='batches.edit')
|
||||||
def edit_batch(context, request):
|
def edit_batch(request):
|
||||||
uuid = request.matchdict['uuid']
|
uuid = request.matchdict['uuid']
|
||||||
batch = Session.query(rattail.Batch).get(uuid) if uuid else None
|
batch = Session.query(rattail.Batch).get(uuid) if uuid else None
|
||||||
assert batch
|
assert batch
|
||||||
|
@ -786,7 +788,7 @@ def delete_batch(context, request):
|
||||||
assert batch
|
assert batch
|
||||||
with transaction.manager:
|
with transaction.manager:
|
||||||
Session.delete(batch)
|
Session.delete(batch)
|
||||||
return HTTPFound(location=request.route_url('batch.list'))
|
return HTTPFound(location=request.route_url('batches.list'))
|
||||||
|
|
||||||
|
|
||||||
# @view_config(route_name='batch', renderer='/batches/batch.mako')
|
# @view_config(route_name='batch', renderer='/batches/batch.mako')
|
||||||
|
@ -977,7 +979,7 @@ def execute(context, request):
|
||||||
"""
|
"""
|
||||||
|
|
||||||
uuid = request.matchdict['uuid']
|
uuid = request.matchdict['uuid']
|
||||||
home = HTTPFound(location=request.route_url('batch.list'))
|
home = HTTPFound(location=request.route_url('batches.list'))
|
||||||
|
|
||||||
with transaction.manager:
|
with transaction.manager:
|
||||||
batch = Session.query(rattail.Batch).get(uuid) if uuid else None
|
batch = Session.query(rattail.Batch).get(uuid) if uuid else None
|
||||||
|
@ -1016,7 +1018,10 @@ def includeme(config):
|
||||||
config.add_route('batch_terminal.columns', '/batches/terminal/{uuid}/columns')
|
config.add_route('batch_terminal.columns', '/batches/terminal/{uuid}/columns')
|
||||||
# config.add_route('batch_terminal', '/batches/terminal/{uuid}')
|
# config.add_route('batch_terminal', '/batches/terminal/{uuid}')
|
||||||
|
|
||||||
config.add_route('batch.list', '/batches')
|
config.add_route('batches.list', '/batches')
|
||||||
|
config.add_view(batches, route_name='batches.list', renderer='/batches/index.mako',
|
||||||
|
permission='batches.list')
|
||||||
|
|
||||||
# config.add_route('batch', '/batch')
|
# config.add_route('batch', '/batch')
|
||||||
# config.add_route('batch.new', '/batches/new')
|
# config.add_route('batch.new', '/batches/new')
|
||||||
config.add_route('batch.edit', '/batches/{uuid}/edit')
|
config.add_route('batch.edit', '/batches/{uuid}/edit')
|
||||||
|
|
Loading…
Reference in a new issue