backoffice: use absolute links to forms/cards/workflows in inspect (#43351)

This commit is contained in:
Frédéric Péters 2020-05-29 07:44:37 +02:00
parent cc6e87c793
commit 66de9cdd5c
2 changed files with 10 additions and 6 deletions

View File

@ -2894,15 +2894,15 @@ class FormBackOfficeStatusPage(FormStatusPage):
r += htmltext('<span class="actions">')
if self.formdef._names == 'formdefs':
if get_publisher().get_backoffice_root().is_accessible('forms'):
r += htmltext(' <a href="../../../forms/%s/">%s</a>') % (
self.formdef.id, _('View Form'))
r += htmltext(' <a href="%s">%s</a>') % (
self.formdef.get_admin_url(), _('View Form'))
elif self.formdef._names == 'carddefs':
if get_publisher().get_backoffice_root().is_accessible('cards'):
r += htmltext(' <a href="../../../cards/%s/">%s</a>') % (
self.formdef.id, _('View Card'))
r += htmltext(' <a href="%s">%s</a>') % (
self.formdef.get_admin_url(), _('View Card'))
if get_publisher().get_backoffice_root().is_accessible('workflows'):
r += htmltext(' <a href="../../../workflows/%s/">%s</a>') % (
self.formdef.workflow.id, _('View Workflow'))
r += htmltext(' <a href="%s">%s</a>') % (
self.formdef.workflow.get_admin_url(), _('View Workflow'))
r += htmltext('</span>')
r += htmltext('</div>')

View File

@ -391,6 +391,10 @@ class Workflow(StorableObject):
else:
update()
def get_admin_url(self):
base_url = get_publisher().get_backoffice_url()
return '%s/workflows/%s/' % (base_url, self.id)
@classmethod
def get(cls, id, ignore_errors=False, ignore_migration=False):
if id == '_default':