diff --git a/static/js/admin.js b/static/js/admin.js index b4321cfb43..bea168b79d 100644 --- a/static/js/admin.js +++ b/static/js/admin.js @@ -2,6 +2,15 @@ var admin = (function () { var exports = {}; +exports.show_or_hide_menu_item = function () { + var item = $('.admin-menu-item').expectOne(); + if (page_params.is_admin) { + item.show(); + } else { + item.hide(); + } +}; + function failed_listing_users(xhr, error) { util.destroy_loading_indicator($('#subs_page_loading_indicator')); ui.report_error("Error listing users or bots", xhr, $("#administration-status")); diff --git a/static/js/ui.js b/static/js/ui.js index e38b477cd0..20b1272e00 100644 --- a/static/js/ui.js +++ b/static/js/ui.js @@ -966,6 +966,8 @@ $(function () { $('#old_password, #new_password, #confirm_password').val(''); } + admin.show_or_hide_menu_item(); + $('#gear-menu a[data-toggle="tab"]').on('show', function (e) { // Save the position of our old tab away, before we switch var old_tab = $(e.relatedTarget).attr('href'); diff --git a/static/styles/zulip.css b/static/styles/zulip.css index 54c513a30c..1d19b91ff1 100644 --- a/static/styles/zulip.css +++ b/static/styles/zulip.css @@ -3699,6 +3699,10 @@ div.edit_bot { text-decoration: line-through; } +.admin-menu-item { + display: none; +} + .administration { margin-top: 55px; padding-left: 15px; diff --git a/templates/zerver/navbar.html b/templates/zerver/navbar.html index ca4ae2e3ec..cd1717a292 100644 --- a/templates/zerver/navbar.html +++ b/templates/zerver/navbar.html @@ -82,13 +82,11 @@
- {% if is_admin %} -