diff options
author | Dave Whiteland <dave@mysociety.org> | 2013-09-06 10:56:49 +0100 |
---|---|---|
committer | Dave Whiteland <dave@mysociety.org> | 2013-09-06 10:56:49 +0100 |
commit | 04b187d5347dd2d26874a83902e51c2532ef8a2f (patch) | |
tree | d5500ed47e478064319b0843c59f48c3d0f0549f /web/js | |
parent | cadf212ed4dcace68dff5dc724785b0ecfeffc66 (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
Diffstat (limited to 'web/js')
-rw-r--r-- | web/js/fixmystreet-admin.js | 46 |
1 files changed, 24 insertions, 22 deletions
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'); + } + }); + } + } }); |