diff --git a/frontend_tests/node_tests/user_events.js b/frontend_tests/node_tests/user_events.js index d42230d418..2963f5ba8b 100644 --- a/frontend_tests/node_tests/user_events.js +++ b/frontend_tests/node_tests/user_events.js @@ -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, diff --git a/static/js/admin.js b/static/js/admin.js index b2c8782985..6861f93105 100644 --- a/static/js/admin.js +++ b/static/js/admin.js @@ -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) { diff --git a/static/js/gear_menu.js b/static/js/gear_menu.js index 58abfe318a..4435045812 100644 --- a/static/js/gear_menu.js +++ b/static/js/gear_menu.js @@ -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 diff --git a/static/js/user_events.js b/static/js/user_events.js index f351702569..2cbadc1f44 100644 --- a/static/js/user_events.js +++ b/static/js/user_events.js @@ -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(); } }