aboutsummaryrefslogtreecommitdiffstats
path: root/web/js/moderate.js
diff options
context:
space:
mode:
authorHakim Cassimally <hakim@mysociety.org>2014-05-27 16:08:50 +0000
committerHakim Cassimally <hakim@mysociety.org>2014-08-13 15:11:29 +0000
commit382a782c16a998776176de37037dd029fab4e3fe (patch)
treec425b24e3ce2c396214fd463e0fc0bde21f792be /web/js/moderate.js
parent68a486f190aa5054b3bcf1be2a63ad0c7c6aef26 (diff)
Report moderation
- redaction marked with [...] - of report and comments - stores original data - uses a single form, on the report/_main view - requires additional permissions (user_body_permissions) - Hide report functionality - Moderation notification/contact form - Moderation writes to admin_log
Diffstat (limited to 'web/js/moderate.js')
-rw-r--r--web/js/moderate.js42
1 files changed, 42 insertions, 0 deletions
diff --git a/web/js/moderate.js b/web/js/moderate.js
new file mode 100644
index 000000000..075766d0b
--- /dev/null
+++ b/web/js/moderate.js
@@ -0,0 +1,42 @@
+$(function () {
+ setup_moderation( $('.problem-header'), 'problem' );
+ setup_moderation( $('.issue-list .issue'), 'update' );
+});
+
+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 () {
+ $elem.find('input[name=problem_title]').prop('disabled', $(this).prop('checked'));
+ });
+ $elem.find('.revert-textarea').change( function () {
+ $elem.find('textarea').prop('disabled', $(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;
+ });
+ });
+}