mirror of https://github.com/zulip/zulip.git
settings: Extract gear_menu.update_org_settings_menu_item().
The prior name of this was a bit inaccurate, as we no longer ever hide the menu item for non-admins. Also, it belongs more naturally in `gear_menu.js` at this point. Also, we remove one call to this, which was in a place where it was no longer necessary.
This commit is contained in:
parent
1d07d0a532
commit
fcf31cedbc
|
@ -12,8 +12,8 @@ set_global('settings_users', {
|
|||
set_global('admin_sections', {
|
||||
maybe_disable_widgets: function () {},
|
||||
});
|
||||
set_global('admin', {
|
||||
show_or_hide_menu_item: function () {},
|
||||
set_global('gear_menu', {
|
||||
update_org_settings_menu_item: function () {},
|
||||
});
|
||||
set_global('page_params', {
|
||||
is_admin: true,
|
||||
|
|
|
@ -2,15 +2,6 @@ var admin = (function () {
|
|||
|
||||
var exports = {};
|
||||
|
||||
exports.show_or_hide_menu_item = function () {
|
||||
var item = $('.admin-menu-item').expectOne();
|
||||
if (page_params.is_admin) {
|
||||
item.find("span").text(i18n.t("Manage organization"));
|
||||
} else {
|
||||
item.find("span").text(i18n.t("Organization settings"));
|
||||
}
|
||||
};
|
||||
|
||||
var admin_settings_label = {
|
||||
// Organization settings
|
||||
realm_allow_community_topic_editing: i18n.t("Users can edit the topic of any message"),
|
||||
|
@ -97,11 +88,6 @@ exports.setup_page = function () {
|
|||
exports.launch_page(tab);
|
||||
settings_toggle.highlight_toggle('organization');
|
||||
}
|
||||
|
||||
|
||||
// Do this after calling the setup_up methods, so that we can
|
||||
// disable any dynamically rendered elements.
|
||||
exports.show_or_hide_menu_item();
|
||||
};
|
||||
|
||||
exports.launch_page = function (section) {
|
||||
|
|
|
@ -78,8 +78,17 @@ the selector and then calls info_overlay.show.
|
|||
// when we switch back.)
|
||||
var scroll_positions = {};
|
||||
|
||||
exports.update_org_settings_menu_item = function () {
|
||||
var item = $('.admin-menu-item').expectOne();
|
||||
if (page_params.is_admin) {
|
||||
item.find("span").text(i18n.t("Manage organization"));
|
||||
} else {
|
||||
item.find("span").text(i18n.t("Organization settings"));
|
||||
}
|
||||
};
|
||||
|
||||
exports.initialize = function () {
|
||||
admin.show_or_hide_menu_item();
|
||||
exports.update_org_settings_menu_item();
|
||||
|
||||
$('#gear-menu a[data-toggle="tab"]').on('show', function (e) {
|
||||
// Save the position of our old tab away, before we switch
|
||||
|
|
|
@ -57,7 +57,7 @@ exports.update_person = function update(person) {
|
|||
|
||||
if (people.is_my_user_id(person.user_id)) {
|
||||
page_params.is_admin = person.is_admin;
|
||||
admin.show_or_hide_menu_item();
|
||||
gear_menu.update_org_settings_menu_item();
|
||||
admin_sections.maybe_disable_widgets();
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue