diff options
Diffstat (limited to 'templates/web/base')
-rw-r--r-- | templates/web/base/report/_main.html | 14 | ||||
-rw-r--r-- | templates/web/base/report/display.html | 3 | ||||
-rw-r--r-- | templates/web/base/report/update.html | 8 | ||||
-rw-r--r-- | templates/web/base/reports/_list-filters.html | 16 | ||||
-rw-r--r-- | templates/web/base/reports/_status_filter_options.html | 3 |
5 files changed, 24 insertions, 20 deletions
diff --git a/templates/web/base/report/_main.html b/templates/web/base/report/_main.html index 405cb2118..25bbd4c33 100644 --- a/templates/web/base/report/_main.html +++ b/templates/web/base/report/_main.html @@ -1,13 +1,9 @@ -[% IF c.user_exists %] - [% DEFAULT permissions = c.user.permissions(c, problem.bodies_str) %] -[%- END %] - <a href="[% c.uri_for( '/around', { lat => latitude, lon => longitude } ) %]" class="problem-back js-back-to-report-list">[% loc('Back to all reports') %]</a> <div class="problem-header clearfix" data-lastupdate="[% problem.lastupdate %]"> -[% IF c.user.has_permission_to('planned_reports', problem.bodies_str_ids) %] +[% IF permissions.planned_reports %] <form method="post" action="/my/planned/change" id="planned_form" class="hidden-label-target"> <input type="hidden" name="id" value="[% problem.id %]"> <input type="hidden" name="token" value="[% csrf_token %]"> @@ -124,16 +120,12 @@ </form> [% END %] - [% IF - (permissions.moderate) - OR - (c.user.has_permission_to('planned_reports', problem.bodies_str_ids)) - %] + [% IF permissions.moderate OR permissions.planned_reports %] <div class="moderate-display segmented-control" role="menu"> [% IF permissions.moderate %] <a class="js-moderate btn" role="menuitem" aria-label="[% loc('Moderate this report') %]">[% loc('Moderate') %]</a> [% END %] - [% IF c.user.has_permission_to('planned_reports', problem.bodies_str_ids) %] + [% IF permissions.planned_reports %] [%~ IF c.user.is_planned_report(problem) ~%] <label class="btn btn--shortlisted" for="shortlist-report" role="menuitem" aria-label="[% loc('Remove from shortlist') %]">[% loc('Shortlisted') %]</label> [%~ ELSE ~%] diff --git a/templates/web/base/report/display.html b/templates/web/base/report/display.html index 7c26c4938..d5e3bdcfa 100644 --- a/templates/web/base/report/display.html +++ b/templates/web/base/report/display.html @@ -39,6 +39,9 @@ [% END %] [% INCLUDE 'report/banner.html' %] +[% IF c.user_exists %] + [% DEFAULT permissions = c.user.permissions(c, problem.bodies_str) %] +[%- END %] [% INCLUDE 'report/_main.html' %] [% IF problem.duplicate_of %] diff --git a/templates/web/base/report/update.html b/templates/web/base/report/update.html index 5691376e6..6dca226fe 100644 --- a/templates/web/base/report/update.html +++ b/templates/web/base/report/update.html @@ -1,12 +1,10 @@ -[% moderating = c.user && c.user.has_permission_to('moderate', problem.bodies_str_ids) %] - [% IF loop.first %] <section class="full-width"> <h4 class="static-with-rule">[% loc('Updates') %]</h4> <ul class="item-list item-list--updates"> [% END %] <li class="item-list__item item-list__item--updates"> - [% IF moderating; original_update = update.moderation_original_data %] + [% IF permissions.moderate; original_update = update.moderation_original_data %] <form method="post" action="/moderate/report/[% problem.id %]/update/[% update.id %]"> <input type="hidden" name="token" value="[% csrf_token %]"> <input type="button" class="btn js-moderate moderate-display" value="[% loc('Moderate this update') %]"> @@ -33,7 +31,7 @@ <div class="moderate-display"> [% update.text | add_links | markup(update.user) | html_para %] </div> - [% IF moderating %] + [% IF permissions.moderate %] <div class="moderate-edit"> [% IF update.text != original.detail %] <label><input type="checkbox" name="update_revert_detail" class="revert-textarea"> @@ -66,7 +64,7 @@ </div> [% END %] </div> - [% IF moderating %] + [% IF permissions.moderate %] <div class="moderate-edit"> <label for="moderation_reason">[% loc('Moderation reason:') %]</label> <input type="text" class="form-control" name="moderation_reason" diff --git a/templates/web/base/reports/_list-filters.html b/templates/web/base/reports/_list-filters.html index 50e88857d..ab8ac06f7 100644 --- a/templates/web/base/reports/_list-filters.html +++ b/templates/web/base/reports/_list-filters.html @@ -1,10 +1,18 @@ [% select_status = BLOCK %] <select class="form-control js-multiple" name="status" id="statuses" multiple - data-all="[% loc('All') %]" data-all-options='["open","closed","fixed"]' - [%~ IF c.cobrand.on_map_default_status == 'open' %] - data-none="[% loc('Unfixed reports') %]" + data-all="[% loc('All') %]" + [% IF c.user_exists AND c.user.is_superuser OR c.user.belongs_to_body(body.id) %] + [% options = []; FOR group IN filter_states; FOR state IN group.1; NEXT IF state == 'hidden'; options.push(state); END; END %] + data-all-options='["[% options.join('", "') %]"]' + [%~ ELSE ~%] + [%~ IF has_fixed_state ~%] + data-all-options='["open","closed","fixed"]' + [%~ ELSE ~%] + data-all-options='["open","closed"]' + [%~ END ~%] [%~ END ~%] - > + [% INCLUDE 'reports/_status_filter_options.html' %] + > [% IF c.user_exists AND c.user.has_body_permission_to('planned_reports') AND !shortlist %] <option value="shortlisted"[% ' selected' IF filter_status.shortlisted %]>[% loc('Shortlisted') %]</option> <option value="unshortlisted"[% ' selected' IF filter_status.unshortlisted %]>[% loc('Unshortlisted') %]</option> diff --git a/templates/web/base/reports/_status_filter_options.html b/templates/web/base/reports/_status_filter_options.html new file mode 100644 index 000000000..b761222e0 --- /dev/null +++ b/templates/web/base/reports/_status_filter_options.html @@ -0,0 +1,3 @@ + [%~ IF c.cobrand.on_map_default_status == 'open' %] + data-none="[% prettify_state('confirmed') %]" + [%~ END ~%] |