From 6ec7f11a9b5a067875adbf718ead7a04d55aedf0 Mon Sep 17 00:00:00 2001 From: Steven Day Date: Tue, 28 Jul 2015 16:53:23 +0100 Subject: Drop show-admin-notes class and show notes everywhere .show-admin-notes was a class that could be applied on a cobrand basis to turn on or off the showing of admin notes and error messages. This was introduced when the concept of admin notes was added, so that existing cobrands could opt-in to the functionality. Now, every cobrand uses it, so there's no need to make it optional. This commit removes the CSS styles based on it, so that errors and notes always display; removes the addition of the class to admin pages, and removes the conditional javascript that enabled admin tooltips based on the class. Closes #1161 --- web/js/fixmystreet-admin.js | 48 ++++++++++++++++++++++----------------------- 1 file changed, 23 insertions(+), 25 deletions(-) (limited to 'web/js') diff --git a/web/js/fixmystreet-admin.js b/web/js/fixmystreet-admin.js index 1663dda7b..e49516a5c 100644 --- a/web/js/fixmystreet-admin.js +++ b/web/js/fixmystreet-admin.js @@ -3,7 +3,7 @@ $(function(){ // hide the open311_only section and reveal it only when send_method is relevant var $open311_only = $('.admin-open311-only'); - + function hide_or_show_open311(hide_fast) { var send_method = $('#send_method').val(); var show_open311 = false; @@ -28,34 +28,32 @@ $(function(){ hide_or_show_open311(true); } - if ($('body').hasClass("show-admin-notes")) { - // admin hints: maybe better implemented as tooltips? - $(".admin-hint").on('click', function(){ - if ($(this).hasClass('admin-hint-show')) { - $(this).removeClass('admin-hint-show'); + // 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'); + } + }); + + // 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 = $(""); + $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 { - $(this).addClass('admin-hint-show'); + $cols.show(); + $(this).prop("value", 'Hide deleted contacts'); } }); - - // 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 = $(""); - $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'); - } - }); - } } $( "#start_date" ).datepicker({ -- cgit v1.2.3