Refactor template content_title()
and prev/next buttons feature
those were intertwined but now are a bit more separate, much better
This commit is contained in:
parent
9f743daf07
commit
eafe3737dc
8 changed files with 72 additions and 45 deletions
|
@ -1041,6 +1041,7 @@ class MasterView(View):
|
|||
"""
|
||||
instance = self.get_instance()
|
||||
model_class = self.get_model_class()
|
||||
route_prefix = self.get_route_prefix()
|
||||
Transaction = continuum.transaction_class(model_class)
|
||||
transactions = model_transaction_query(self.Session(), instance, model_class,
|
||||
child_classes=self.normalize_version_child_classes())
|
||||
|
@ -1058,6 +1059,13 @@ class MasterView(View):
|
|||
.first()
|
||||
|
||||
instance_title = self.get_instance_title(instance)
|
||||
|
||||
prev_url = next_url = None
|
||||
if older:
|
||||
prev_url = self.request.route_url('{}.version'.format(route_prefix), uuid=instance.uuid, txnid=older.id)
|
||||
if newer:
|
||||
next_url = self.request.route_url('{}.version'.format(route_prefix), uuid=instance.uuid, txnid=newer.id)
|
||||
|
||||
return self.render_to_response('view_version', {
|
||||
'instance': instance,
|
||||
'instance_title': "{} (history)".format(instance_title),
|
||||
|
@ -1066,6 +1074,9 @@ class MasterView(View):
|
|||
'transaction': transaction,
|
||||
'changed': localtime(self.rattail_config, transaction.issued_at, from_utc=True),
|
||||
'versions': self.get_relevant_versions(transaction, instance),
|
||||
'show_prev_next': True,
|
||||
'prev_url': prev_url,
|
||||
'next_url': next_url,
|
||||
'previous_transaction': older,
|
||||
'next_transaction': newer,
|
||||
'title_for_version': self.title_for_version,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue