aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--templates/web/base/auth/change_password.html21
-rw-r--r--templates/web/base/common_footer_tags.html5
-rw-r--r--templates/web/base/report/_main.html4
-rw-r--r--templates/web/base/report/new/form_user_loggedin.html2
-rw-r--r--web/cobrands/fixmystreet/fixmystreet.js54
-rw-r--r--web/js/moderate.js51
6 files changed, 71 insertions, 66 deletions
diff --git a/templates/web/base/auth/change_password.html b/templates/web/base/auth/change_password.html
index 44b695e0d..80708abb1 100644
--- a/templates/web/base/auth/change_password.html
+++ b/templates/web/base/auth/change_password.html
@@ -1,11 +1,19 @@
-[% INCLUDE 'header.html', title = loc('Change password'), bodyclass = 'authpage' %]
-
-<h1>[% loc('Change password') %]</h1>
+[%
+SET bclass = 'authpage';
+SET bclass = 'fullwidthpage' IF password_changed;
+INCLUDE 'header.html', title = loc('Change password'), bodyclass = bclass
+%]
[% IF password_changed %]
- <p class="form-success">[% loc('Your password has been changed') %]</p>
-[% END %]
+ <div class="confirmation-header">
+ <h1>[% loc('Your password has been changed') %]</h1>
+ <p><a href="/my">[% loc('Your account') %]</a></p>
+ </div>
+
+[% ELSE %]
+
+<h1>[% loc('Change password') %]</h1>
<form action="[% c.uri_for('change_password') %]" method="post" name="change_password" class="fieldset">
<input type="hidden" name="token" value="[% csrf_token %]">
@@ -24,7 +32,7 @@
[% END %]
<div class="form-field">
- <label for="new_password">[% loc('Password:') %]</label>
+ <label for="new_password">[% loc('New password:') %]</label>
<input type="password" name="new_password" value="[% new_password | html %]">
</div>
<div class="form-field">
@@ -38,5 +46,6 @@
</fieldset>
</form>
+[% END %]
[% INCLUDE 'footer.html' %]
diff --git a/templates/web/base/common_footer_tags.html b/templates/web/base/common_footer_tags.html
index debcde402..bed344f8b 100644
--- a/templates/web/base/common_footer_tags.html
+++ b/templates/web/base/common_footer_tags.html
@@ -22,11 +22,6 @@
<script type="text/javascript" src="[% version('/js/fixmystreet-admin.js') %]"></script>
[% END %]
-[% moderating = c.user && c.user.has_permission_to('moderate', problem.bodies_str) %]
-[% IF moderating %]
- <script type="text/javascript" src="[% version('/js/moderate.js') %]"></script>
-[% END %]
-
[% extra_js %]
[% TRY %][% PROCESS 'footer_extra_js.html' %][% CATCH file %][% END %]
diff --git a/templates/web/base/report/_main.html b/templates/web/base/report/_main.html
index ffda48074..585200ac3 100644
--- a/templates/web/base/report/_main.html
+++ b/templates/web/base/report/_main.html
@@ -47,8 +47,8 @@
<div class="moderate-edit">
<label>
- <input type="checkbox" name="problem_show_name" [% problem.anonymous ? 'checked' : '' %]>
- Hide reporter&rsquo;s name
+ <input type="checkbox" name="problem_show_name" [% 'checked' UNLESS problem.anonymous %]>
+ Show reporter&rsquo;s name
</label>
</div>
<p class="report_meta_info">
diff --git a/templates/web/base/report/new/form_user_loggedin.html b/templates/web/base/report/new/form_user_loggedin.html
index 49ead784c..1f941a6d1 100644
--- a/templates/web/base/report/new/form_user_loggedin.html
+++ b/templates/web/base/report/new/form_user_loggedin.html
@@ -27,7 +27,7 @@
<label for="form_email">[% loc('Email address') %]</label>
<input id="form_email"
- [%- IF can_contribute_as_another_user OR can_contribute_as_body -%]
+ [%- IF js OR can_contribute_as_another_user OR can_contribute_as_body -%]
name="email"
[%- ELSE -%]
disabled
diff --git a/web/cobrands/fixmystreet/fixmystreet.js b/web/cobrands/fixmystreet/fixmystreet.js
index 4302ed8ff..914b8e7eb 100644
--- a/web/cobrands/fixmystreet/fixmystreet.js
+++ b/web/cobrands/fixmystreet/fixmystreet.js
@@ -425,7 +425,8 @@ $.extend(fixmystreet.set_up, {
$showNameCheckbox.prop('checked', true).prop('disabled', true);
$addAlertCheckbox.prop('checked', false).prop('disabled', true);
}
- }).change();
+ });
+ $('.js-contribute-as').change();
},
on_resize: function() {
@@ -784,6 +785,56 @@ $.extend(fixmystreet.set_up, {
}
});
});
+ },
+
+ moderation: function() {
+ function toggle_original ($input, revert) {
+ $input.prop('disabled', revert);
+ if (revert) {
+ $input.data('currentValue', $input.val());
+ }
+ $input.val($input.data(revert ? 'originalValue' : 'currentValue'));
+ }
+
+ function add_handlers (elem, word) {
+ elem.each( function () {
+ var $elem = $(this);
+ $elem.find('.moderate').click( function () {
+ $elem.find('.moderate-display').hide();
+ $elem.find('.moderate-edit').show();
+ });
+
+ $elem.find('.revert-title').change( function () {
+ toggle_original($elem.find('input[name=problem_title]'), $(this).prop('checked'));
+ });
+
+ $elem.find('.revert-textarea').change( function () {
+ toggle_original($elem.find('textarea'), $(this).prop('checked'));
+ });
+
+ var hide_document = $elem.find('.hide-document');
+ hide_document.change( function () {
+ $elem.find('input[name=problem_title]').prop('disabled', $(this).prop('checked'));
+ $elem.find('textarea').prop('disabled', $(this).prop('checked'));
+ $elem.find('input[type=checkbox]').prop('disabled', $(this).prop('checked'));
+ $(this).prop('disabled', false); // in case disabled above
+ });
+
+ $elem.find('.cancel').click( function () {
+ $elem.find('.moderate-display').show();
+ $elem.find('.moderate-edit').hide();
+ });
+
+ $elem.find('form').submit( function () {
+ if (hide_document.prop('checked')) {
+ return confirm('This will hide the ' + word + ' completely! (You will not be able to undo this without contacting support.)');
+ }
+ return true;
+ });
+ });
+ }
+ add_handlers( $('.problem-header'), 'problem' );
+ add_handlers( $('.item-list__item--updates'), 'update' );
}
});
@@ -1006,6 +1057,7 @@ fixmystreet.display = {
fixmystreet.set_up.fancybox_images();
fixmystreet.set_up.dropzone($sideReport);
fixmystreet.set_up.form_focus_triggers();
+ fixmystreet.set_up.moderation();
window.selected_problem_id = reportId;
var marker = fixmystreet.maps.get_marker_by_id(reportId);
diff --git a/web/js/moderate.js b/web/js/moderate.js
deleted file mode 100644
index 53277d9d9..000000000
--- a/web/js/moderate.js
+++ /dev/null
@@ -1,51 +0,0 @@
-function toggle_original ($input, revert) {
- $input.prop('disabled', revert);
- if (revert) {
- $input.data('currentValue', $input.val());
- }
- $input.val($input.data(revert ? 'originalValue' : 'currentValue'));
-}
-
-function setup_moderation (elem, word) {
-
- elem.each( function () {
- var $elem = $(this);
- $elem.find('.moderate').click( function () {
- $elem.find('.moderate-display').hide();
- $elem.find('.moderate-edit').show();
- });
-
- $elem.find('.revert-title').change( function () {
- toggle_original($elem.find('input[name=problem_title]'), $(this).prop('checked'));
- });
-
- $elem.find('.revert-textarea').change( function () {
- toggle_original($elem.find('textarea'), $(this).prop('checked'));
- });
-
- var hide_document = $elem.find('.hide-document');
- hide_document.change( function () {
- $elem.find('input[name=problem_title]').prop('disabled', $(this).prop('checked'));
- $elem.find('textarea').prop('disabled', $(this).prop('checked'));
- $elem.find('input[type=checkbox]').prop('disabled', $(this).prop('checked'));
- $(this).prop('disabled', false); // in case disabled above
- });
-
- $elem.find('.cancel').click( function () {
- $elem.find('.moderate-display').show();
- $elem.find('.moderate-edit').hide();
- });
-
- $elem.find('form').submit( function () {
- if (hide_document.prop('checked')) {
- return confirm('This will hide the ' + word + ' completely! (You will not be able to undo this without contacting support.)');
- }
- return true;
- });
- });
-}
-
-$(function () {
- setup_moderation( $('.problem-header'), 'problem' );
- setup_moderation( $('.item-list__item--updates'), 'update' );
-});