mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-07-12 17:34:16 -04:00
Move branding info from model
This was an awkward property to have in a model class because - it’s presentation not data about the object - it munged together data from a different object, so it wasn’t well encapsulated This commit moves the logic to the template, where it can reference the `Organisation` and `User` models directly.
This commit is contained in:
@@ -101,9 +101,6 @@ class Organisation(JSONModel):
|
||||
self.request_to_go_live_notes = None
|
||||
self.email_branding_id = None
|
||||
|
||||
def as_info_for_branding_request(self, fallback_domain):
|
||||
return self.name or 'Can’t tell (domain is {})'.format(fallback_domain)
|
||||
|
||||
@property
|
||||
def organisation_type_label(self):
|
||||
return dict(self.TYPES).get(self.organisation_type)
|
||||
|
||||
@@ -1,4 +1,8 @@
|
||||
Organisation: {{ current_service.organisation.as_info_for_branding_request(current_user.email_domain) }}
|
||||
Organisation: {% if current_service.organisation -%}
|
||||
{{ current_service.organisation.name }}
|
||||
{%- else -%}
|
||||
Can’t tell (domain is {{ current_user.email_domain }})
|
||||
{%- endif %}
|
||||
Service: {{ current_service.name }}
|
||||
{{ url_for('main.service_dashboard', service_id=current_service.id, _external=True) }}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user