aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDave Whiteland <dave@mysociety.org>2013-09-06 10:56:49 +0100
committerDave Whiteland <dave@mysociety.org>2013-09-06 10:56:49 +0100
commit04b187d5347dd2d26874a83902e51c2532ef8a2f (patch)
treed5500ed47e478064319b0843c59f48c3d0f0549f
parentcadf212ed4dcace68dff5dc724785b0ecfeffc66 (diff)
add show-admin-notes class to body
making the admin-notes functionality easier to suppress on installations that don't want it; it's in the default header, i.e., on for new installations
-rw-r--r--templates/web/default/admin/header.html2
-rw-r--r--web/cobrands/sass/_layout.scss21
-rw-r--r--web/js/fixmystreet-admin.js46
3 files changed, 40 insertions, 29 deletions
diff --git a/templates/web/default/admin/header.html b/templates/web/default/admin/header.html
index 6282bf383..9f3503e20 100644
--- a/templates/web/default/admin/header.html
+++ b/templates/web/default/admin/header.html
@@ -1,4 +1,4 @@
-[% INCLUDE 'header.html' admin = 1, bodyclass = 'fullwidthpage admin' %]
+[% INCLUDE 'header.html' admin = 1, bodyclass = 'fullwidthpage admin show-admin-notes' %]
<style type="text/css">
dt { clear: left; float: left; font-weight: bold; }
dd { margin-left: 8em; }
diff --git a/web/cobrands/sass/_layout.scss b/web/cobrands/sass/_layout.scss
index 4d32f6062..126e44685 100644
--- a/web/cobrands/sass/_layout.scss
+++ b/web/cobrands/sass/_layout.scss
@@ -1039,6 +1039,19 @@ $button_bg_col: #a1a1a1; // also search bar (tables)
}
}
}
+ .no-bullets {
+ margin-left: 0;
+ > li {
+ list-style: none;
+ }
+ }
+ .fms-admin-warning, .fms-admin-info, .admin-hint {
+ display: none; // don't display admin-notes unless .show-admin-notes class is present
+ }
+ &.show-admin-notes {
+ .fms-admin-warning, .fms-admin-info, .admin-hint {
+ display: block;
+ }
.fms-admin-warning, .fms-admin-info {
padding: 1em;
font-size: 90%;
@@ -1101,14 +1114,10 @@ $button_bg_col: #a1a1a1; // also search bar (tables)
}
}
}
- .no-bullets {
- margin-left: 0;
- > li {
- list-style: none;
- }
- }
+ }
}
+
/* MEDIA QUERIES */
@media only screen and (min-width: 48em) and (max-width: 61em) {
.container {
diff --git a/web/js/fixmystreet-admin.js b/web/js/fixmystreet-admin.js
index 76c02128c..1aabf8349 100644
--- a/web/js/fixmystreet-admin.js
+++ b/web/js/fixmystreet-admin.js
@@ -28,32 +28,34 @@ $(function(){
hide_or_show_open311(true);
}
- // admin hints: maybe better implemented as tooltips?
- $(".admin-hint").on('click', function(){
- if ($(this).hasClass('admin-hint-show')) {
- $(this).removeClass('admin-hint-show');
- } else {
- $(this).addClass('admin-hint-show');
- }
- });
+ if ($('body').hasClass("show-admin-notes")) {
- // on a body's page, hide/show deleted contact categories
- var $table_with_deleted_contacts = $('table tr.is-deleted td.contact-category').closest('table');
- if ($table_with_deleted_contacts.length == 1) {
- var $toggle_deleted_btn = $("<input type='submit' class='btn' value='Hide deleted contacts' id='toggle-deleted-contacts-btn' style='margin:1em 0;'/>");
- $table_with_deleted_contacts.before($toggle_deleted_btn);
- $toggle_deleted_btn.on('click', function(e){
- e.preventDefault();
- var $cols = $table_with_deleted_contacts.find('tr.is-deleted');
- if ($cols.first().is(':visible')) {
- $cols.hide();
- $(this).prop("value", 'Show deleted contacts');
+ // admin hints: maybe better implemented as tooltips?
+ $(".admin-hint").on('click', function(){
+ if ($(this).hasClass('admin-hint-show')) {
+ $(this).removeClass('admin-hint-show');
} else {
- $cols.show();
- $(this).prop("value", 'Hide deleted contacts');
+ $(this).addClass('admin-hint-show');
}
});
- }
+ // on a body's page, hide/show deleted contact categories
+ var $table_with_deleted_contacts = $('table tr.is-deleted td.contact-category').closest('table');
+ if ($table_with_deleted_contacts.length == 1) {
+ var $toggle_deleted_btn = $("<input type='submit' class='btn' value='Hide deleted contacts' id='toggle-deleted-contacts-btn' style='margin:1em 0;'/>");
+ $table_with_deleted_contacts.before($toggle_deleted_btn);
+ $toggle_deleted_btn.on('click', function(e){
+ e.preventDefault();
+ var $cols = $table_with_deleted_contacts.find('tr.is-deleted');
+ if ($cols.first().is(':visible')) {
+ $cols.hide();
+ $(this).prop("value", 'Show deleted contacts');
+ } else {
+ $cols.show();
+ $(this).prop("value", 'Hide deleted contacts');
+ }
+ });
+ }
+ }
});