diff options
author | Dave Arter <davea@mysociety.org> | 2018-08-20 15:22:37 +0100 |
---|---|---|
committer | Matthew Somerville <matthew-github@dracos.co.uk> | 2018-09-13 14:24:58 +0100 |
commit | 9e5595755c912dfa8ae020253668b29f48494e23 (patch) | |
tree | 3d5e950232df8418088fcf9a713b02e1b30e9fc2 /templates | |
parent | 847ea6f773ddb5ba921ee1d9f1a0db4799687b1d (diff) |
Add cobrand hook for disallowing updates.
Provides a template override for cobrands to show if updates aren't
allowed on the problem.
Diffstat (limited to 'templates')
-rw-r--r-- | templates/web/base/report/display.html | 20 | ||||
-rw-r--r-- | templates/web/base/report/update-form.html | 2 |
2 files changed, 13 insertions, 9 deletions
diff --git a/templates/web/base/report/display.html b/templates/web/base/report/display.html index eedbc4f85..cb5bf327c 100644 --- a/templates/web/base/report/display.html +++ b/templates/web/base/report/display.html @@ -61,14 +61,18 @@ c.uri_for( '/report/new', { longitude => longitude, latitude => latitude } ) ) %] </p> -[% ELSIF NOT shown_form %] - [% IF two_column_sidebar %] - <button class="btn btn--provide-update js-provide-update hidden-nojs">[% loc('Provide an update') %]</button> - <div class="hidden-js"> - [% END %] - [% INCLUDE 'report/update-form.html' %] - [% IF two_column_sidebar %] - </div> +[% ELSIF NOT shown_form %] + [% UNLESS c.cobrand.updates_disallowed(problem) %] + [% IF two_column_sidebar %] + <button class="btn btn--provide-update js-provide-update hidden-nojs">[% loc('Provide an update') %]</button> + <div class="hidden-js"> + [% END %] + [% INCLUDE 'report/update-form.html' %] + [% IF two_column_sidebar %] + </div> + [% END %] + [% ELSE %] + [% TRY %][% INCLUDE 'report/_updates_disallowed_message.html' %][% CATCH file %][% END %] [% END %] [% END %] diff --git a/templates/web/base/report/update-form.html b/templates/web/base/report/update-form.html index 9276acde9..a68ce117f 100644 --- a/templates/web/base/report/update-form.html +++ b/templates/web/base/report/update-form.html @@ -1,4 +1,4 @@ -[% allow_creation = !c.cobrand.only_authed_can_create || (c.user && c.user.from_body) %] +[% allow_creation = (!c.cobrand.only_authed_can_create || (c.user && c.user.from_body)) AND NOT c.cobrand.updates_disallowed(problem) %] [% RETURN IF NOT allow_creation OR problem.extra.closed_updates %] <div id="update_form"> |