Make the Administration menu item be show/hide-driven.

Always render the Administration menu item from the back end, but
make it be hidden by default until the page is loaded.  Then, the
client can un-hide it as needed.

(imported from commit 66e607eec430d7179b4d5ac3f5416f5be8ac26c9)
This commit is contained in:
Steve Howell
2014-01-21 19:43:11 -05:00
parent 90ba39d02e
commit 887c2059b1
4 changed files with 16 additions and 3 deletions

View File

@@ -2,6 +2,15 @@ var admin = (function () {
var exports = {}; 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) { function failed_listing_users(xhr, error) {
util.destroy_loading_indicator($('#subs_page_loading_indicator')); util.destroy_loading_indicator($('#subs_page_loading_indicator'));
ui.report_error("Error listing users or bots", xhr, $("#administration-status")); ui.report_error("Error listing users or bots", xhr, $("#administration-status"));

View File

@@ -966,6 +966,8 @@ $(function () {
$('#old_password, #new_password, #confirm_password').val(''); $('#old_password, #new_password, #confirm_password').val('');
} }
admin.show_or_hide_menu_item();
$('#gear-menu a[data-toggle="tab"]').on('show', function (e) { $('#gear-menu a[data-toggle="tab"]').on('show', function (e) {
// Save the position of our old tab away, before we switch // Save the position of our old tab away, before we switch
var old_tab = $(e.relatedTarget).attr('href'); var old_tab = $(e.relatedTarget).attr('href');

View File

@@ -3699,6 +3699,10 @@ div.edit_bot {
text-decoration: line-through; text-decoration: line-through;
} }
.admin-menu-item {
display: none;
}
.administration { .administration {
margin-top: 55px; margin-top: 55px;
padding-left: 15px; padding-left: 15px;

View File

@@ -82,13 +82,11 @@
</a> </a>
</li> </li>
<li class="divider"></li> <li class="divider"></li>
{% if is_admin %} <li title="Administration" class="admin-menu-item">
<li title="Administration">
<a href="#administration" role="button" data-toggle="tab"> <a href="#administration" role="button" data-toggle="tab">
<i class="icon-vector-bolt"></i> Administration <i class="icon-vector-bolt"></i> Administration
</a> </a>
</li> </li>
{% endif %}
{% if show_invites %} {% if show_invites %}
<li title="Invite coworkers to Zulip"> <li title="Invite coworkers to Zulip">
<a href="#invite-user" role="button" data-toggle="modal"> <a href="#invite-user" role="button" data-toggle="modal">