2017-04-17 16:51:27 +02:00
|
|
|
var admin_sections = (function () {
|
|
|
|
|
|
|
|
var exports = {};
|
|
|
|
|
|
|
|
var is_loaded = new Dict(); // section -> bool
|
|
|
|
|
|
|
|
exports.load_admin_section = function (name) {
|
|
|
|
var section;
|
|
|
|
|
|
|
|
switch (name) {
|
2018-05-07 01:38:14 +02:00
|
|
|
case 'organization-profile':
|
|
|
|
case 'organization-settings':
|
|
|
|
case 'organization-permissions':
|
|
|
|
case 'auth-methods':
|
|
|
|
section = 'org';
|
|
|
|
break;
|
|
|
|
case 'emoji-settings':
|
|
|
|
section = 'emoji';
|
|
|
|
break;
|
|
|
|
case 'bot-list-admin':
|
|
|
|
case 'user-list-admin':
|
|
|
|
case 'deactivated-users-admin':
|
|
|
|
section = 'users';
|
|
|
|
break;
|
|
|
|
case 'default-streams-list':
|
|
|
|
section = 'streams';
|
|
|
|
break;
|
|
|
|
case 'filter-settings':
|
|
|
|
section = 'filters';
|
|
|
|
break;
|
|
|
|
case 'invites-list-admin':
|
|
|
|
section = 'invites';
|
|
|
|
break;
|
|
|
|
case 'user-groups-admin':
|
|
|
|
section = 'user-groups';
|
|
|
|
break;
|
|
|
|
case 'profile-field-settings':
|
|
|
|
section = 'profile-fields';
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
blueslip.error('Unknown admin id ' + name);
|
|
|
|
return;
|
2017-04-17 16:51:27 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
if (is_loaded.get(section)) {
|
|
|
|
// We only load sections once (unless somebody calls
|
|
|
|
// reset_sections).
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
switch (section) {
|
2018-05-07 01:38:14 +02:00
|
|
|
case 'org':
|
|
|
|
settings_org.set_up();
|
|
|
|
break;
|
|
|
|
case 'emoji':
|
|
|
|
settings_emoji.set_up();
|
|
|
|
break;
|
|
|
|
case 'users':
|
|
|
|
settings_users.set_up();
|
|
|
|
break;
|
|
|
|
case 'streams':
|
|
|
|
settings_streams.set_up();
|
|
|
|
break;
|
|
|
|
case 'filters':
|
|
|
|
settings_filters.set_up();
|
|
|
|
break;
|
|
|
|
case 'invites':
|
|
|
|
settings_invites.set_up();
|
|
|
|
break;
|
|
|
|
case 'user-groups':
|
|
|
|
settings_user_groups.set_up();
|
|
|
|
break;
|
|
|
|
case 'profile-fields':
|
|
|
|
settings_profile_fields.set_up();
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
blueslip.error('programming error for section ' + section);
|
|
|
|
return;
|
2017-04-17 16:51:27 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
is_loaded.set(section, true);
|
|
|
|
};
|
|
|
|
|
|
|
|
exports.reset_sections = function () {
|
|
|
|
is_loaded.clear();
|
|
|
|
settings_org.reset();
|
|
|
|
settings_emoji.reset();
|
|
|
|
settings_users.reset();
|
|
|
|
settings_streams.reset();
|
|
|
|
settings_filters.reset();
|
2017-10-21 03:15:12 +02:00
|
|
|
settings_invites.reset();
|
2017-11-13 05:20:42 +01:00
|
|
|
settings_user_groups.reset();
|
2017-12-14 05:51:45 +01:00
|
|
|
settings_profile_fields.reset();
|
2017-04-17 16:51:27 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
return exports;
|
|
|
|
}());
|
|
|
|
|
|
|
|
if (typeof module !== 'undefined') {
|
|
|
|
module.exports = admin_sections;
|
|
|
|
}
|
2018-05-28 08:04:36 +02:00
|
|
|
window.admin_sections = admin_sections;
|