backoffice: update to new appbar markup (#25983)

This commit is contained in:
Frédéric Péters 2018-08-16 09:29:49 +02:00
parent 12a413ab34
commit b76eee459b
8 changed files with 34 additions and 2 deletions

View File

@ -74,8 +74,10 @@ class CategoryPage(Directory):
r += htmltext('<div id="appbar">')
r += htmltext('<h2>%s</h2>') % self.category.name
r += htmltext('<span class="actions">')
r += htmltext('<a href="delete" rel="popup">%s</a>') % _('Delete')
r += htmltext('<a href="edit">%s</a>') % _('Edit')
r += htmltext('</span>')
r += htmltext('</div>')
if self.category.description:
@ -175,7 +177,9 @@ class CategoriesDirectory(Directory):
r += htmltext('<div id="appbar">')
r += htmltext('<h2>%s</h2>') % _('Categories')
r += htmltext('<span class="actions">')
r += htmltext('<a class="new-item" href="new" rel="popup">%s</a>') % _('New Category')
r += htmltext('</span>')
r += htmltext('</div>')
r += htmltext('<div class="explanation bo-block"><p>%s</p></div>') % \
_('Categories are used to sort the different forms.')

View File

@ -95,8 +95,10 @@ class NamedDataSourcePage(Directory):
r += htmltext('<h2>%s - ') % _('Data Source')
r += self.datasource.name
r += htmltext('</h2>')
r += htmltext('<span class="actions">')
r += htmltext('<a href="delete" rel="popup">%s</a>') % _('Delete')
r += htmltext('<a href="edit">%s</a>') % _('Edit')
r += htmltext('</span>')
r += htmltext('</div>')
if self.datasource.description:
@ -213,7 +215,9 @@ class NamedDataSourcesDirectory(Directory):
r += htmltext('<div id="appbar">')
r += htmltext('<h2>%s</h2>') % _('Data Sources')
r += htmltext('<span class="actions">')
r += htmltext('<a class="new-item" href="new">%s</a>') % _('New Data Source')
r += htmltext('</span>')
r += htmltext('</div>')
r += htmltext('<ul class="biglist" id="datasource-list">')
datasources = NamedDataSource.select(order_by='name')

View File

@ -1458,9 +1458,11 @@ class FormsDirectory(AccessControlled, Directory):
r += htmltext('<div id="appbar">')
r += htmltext('<h2>%s</h2>') % _('Forms')
if has_roles:
r += htmltext('<span class="actions">')
r += htmltext('<a href="data-sources/">%s</a>') % _('Data sources')
r += htmltext('<a href="import" rel="popup">%s</a>') % _('Import')
r += htmltext('<a class="new-item" href="new" rel="popup">%s</a>') % _('New Form')
r += htmltext('</span>')
r += htmltext('</div>')
if not has_roles:

View File

@ -88,8 +88,10 @@ class RolePage(Directory):
r = TemplateIO(html=True)
r += htmltext('<div id="appbar">')
r += htmltext('<h2>%s</h2>') % self.role.name
r += htmltext('<span class="actions">')
r += htmltext('<a href="delete" rel="popup">%s</a>') % _('Delete')
r += htmltext('<a href="edit">%s</a>') % _('Edit')
r += htmltext('</span>')
r += htmltext('</div>')
if self.role.details or self.role.emails:
@ -204,7 +206,9 @@ class RolesDirectory(Directory):
r += htmltext('<div id="appbar">')
r += htmltext('<h2>%s</h2>') % _('Roles')
r += htmltext('<span class="actions">')
r += htmltext('<a class="new-item" rel="popup" href="new">%s</a>') % _('New Role')
r += htmltext('</span>')
r += htmltext('</div>')
r += htmltext('<div class="explanation bo-block">')

View File

@ -118,7 +118,9 @@ class UserPage(Directory):
r = TemplateIO(html=True)
r += htmltext('<div id="appbar">')
r += htmltext('<h2>%s</h2>') % self.user.display_name
r += htmltext('<span class="actions">')
r += self.get_actions()
r += htmltext('</span>')
r += htmltext('</div>')
users_cfg = get_cfg('users', {})
@ -397,7 +399,9 @@ class UsersDirectory(Directory):
# the possibility to create users, as only the roles field would
# be shown, and the creation would fail on missing fields.
if not is_idp_managing_user_attributes():
r2 += htmltext('<span class="actions">')
r2 += htmltext('<a class="new-item" href="new">%s</a>') % _('New User')
r2 += htmltext('</span>')
get_response().filter['sidebar'] = self.get_sidebar(offset, limit)
r2 += htmltext('</div>')

View File

@ -1781,9 +1781,11 @@ class WorkflowsDirectory(Directory):
r += htmltext('<div id="appbar">')
r += htmltext('<h2>%s</h2>') % _('Workflows')
r += htmltext('<span class="actions">')
r += htmltext('<a href="data-sources/">%s</a>') % _('Data sources')
r += htmltext('<a href="import" rel="popup">%s</a>') % _('Import')
r += htmltext('<a class="new-item" rel="popup" href="new">%s</a>') % _('New Workflow')
r += htmltext('</span>')
r += htmltext('</div>')
r += htmltext('<ul class="biglist">')
workflows_in_use = set(['_default'])

View File

@ -97,8 +97,10 @@ class NamedWsCallPage(Directory):
r += htmltext('<h2>%s - ') % _('Webservice Call')
r += self.wscall.name
r += htmltext('</h2>')
r += htmltext('<span class="actions">')
r += htmltext('<a href="delete" rel="popup">%s</a>') % _('Delete')
r += htmltext('<a href="edit">%s</a>') % _('Edit')
r += htmltext('</span>')
r += htmltext('</div>')
if self.wscall.description:
@ -192,7 +194,9 @@ class NamedWsCallsDirectory(Directory):
r += htmltext('<div id="appbar">')
r += htmltext('<h2>%s</h2>') % _('Webservice Calls')
r += htmltext('<span class="actions">')
r += htmltext('<a class="new-item" href="new">%s</a>') % _('New webservice call')
r += htmltext('</span>')
r += htmltext('</div>')
r += htmltext('<ul class="biglist" id="wscall-list">')
wscalls = NamedWsCall.select(order_by='name')

View File

@ -495,14 +495,18 @@ class ManagementDirectory(Directory):
append_form_entry(formdef)
if forms_with_pending_stuff:
r += htmltext('<div class="bo-block" id="forms-in-your-care">')
r += htmltext('<div id="appbar">')
r += htmltext('<h2>%s</h2>') % _('Forms in your care')
r += htmltext('</div>')
r += htmltext('<div class="bo-block" id="forms-in-your-care">')
r += self.display_forms(forms_with_pending_stuff)
r += htmltext('</div>')
if forms_without_pending_stuff:
r += htmltext('<div class="bo-block" id="other-forms">')
r += htmltext('<div id="appbar">')
r += htmltext('<h2>%s</h2>') % _('Other Forms')
r += htmltext('</div>')
r += htmltext('<div class="bo-block" id="other-forms">')
r += self.display_forms(forms_without_pending_stuff)
r += htmltext('</div>')
@ -910,11 +914,13 @@ class ManagementDirectory(Directory):
rt = TemplateIO(html=True)
rt += htmltext('<div id="appbar">')
rt += htmltext('<h2>%s</h2>') % _('Global View')
rt += htmltext('<span class="actions">')
rt += htmltext('<a href="forms">%s</a>') % _('Forms View')
for formdef in FormDef.select(lightweight=True):
if formdef.geolocations:
rt += htmltext(' <a href="map">%s</a>') % _('Map View')
break
rt += htmltext('</span>')
rt += htmltext('</div>')
rt += get_session().display_message()
rt += r.getvalue()
@ -2198,12 +2204,14 @@ class FormBackOfficeStatusPage(FormStatusPage):
r = TemplateIO(html=True)
r += htmltext('<div id="appbar">')
r += htmltext('<h2>%s</h2>') % _('Form Inspector')
r += htmltext('<span class="actions">')
if get_publisher().get_backoffice_root().is_accessible('forms'):
r += htmltext(' <a href="../../../forms/%s/">%s</a>') % (
self.formdef.id, _('Form Definition'))
if get_publisher().get_backoffice_root().is_accessible('workflows'):
r += htmltext(' <a href="../../../workflows/%s/">%s</a>') % (
self.formdef.workflow.id, _('Workflow Definition'))
r += htmltext('</span>')
r += htmltext('</div>')
r += htmltext('<ul class="biglist form-inspector">')
r += htmltext(' <li><h3>%s</h3></li>') % _('Substitution variables')