settings: Streamline how we launch settings.

We can eliminate the janky `setup_page` methods
and just pass in section from `hashchanged`.

This sets us up to handle browser history more
nicely when you load '#settings' and we could essentially
redirect you to '#settings/your-account' (or similar
things).  A future commit will address that.

We also use `launch` as the new entry point, which
is more consistent with other modules.
This commit is contained in:
Steve Howell
2018-12-06 19:18:56 +00:00
committed by Tim Abbott
parent 5a4a357afc
commit 2a1a55af8a
4 changed files with 26 additions and 45 deletions

View File

@@ -179,9 +179,21 @@ function do_hashchange_overlay(old_hash) {
return;
}
if (/settings|organization/.test(base)) {
settings.setup_page();
admin.setup_page();
if (base === 'settings') {
if (!section) {
section = settings_panel_menu.normal_settings.current_tab();
}
settings.launch(section);
return;
}
if (base === 'organization') {
if (!section) {
section = settings_panel_menu.org_settings.current_tab();
}
admin.launch(section);
return;
}