Commit Graph

13 Commits

Author SHA1 Message Date
Steve Howell 3697add70c settings: Reset scroll when switching sections. 2019-02-26 14:26:15 -08:00
Steve Howell 7a44d99b96 settings: Eliminate admin_sections module.
We move all of its logic into settings_sections.

Note that this is slightly more than a refactor.
We are slightly more aggressive about resetting
sections.  For example, if you go into Settings,
then exit the overlay, then go into Manage
Organization, we will now reset sections for both
groups.
2018-12-17 10:13:20 -08:00
Steve Howell 779ed37cfa hashchange: Fix update_browser_history() call for settings.
Even prior to my recent change in settings_panel_menu.js,
we were assigning window.location.hash a value that doesn't
have a '#' prefix.  This probably doesn't matter too much
for the browser, but it does confuse our own checks about
whether we're redundantly updating browser history.

Now we prefix the settings hash with '#' and we encorce
this convention with a blueslip error.
2018-12-03 10:09:35 -08:00
Steve Howell c4d3578de3 Move more code into activate_section().
This code was added to the click handler, but it can
really go into activate_section().  This way the code
also runs when we first launch settings.
2018-12-02 19:07:24 -08:00
Steve Howell 473f2650fd refactor: Change settings_panel_menu.activate_section().
We now have activate_section take a section, rather than
an li, so it will be easier to call directly.
2018-12-02 19:07:24 -08:00
Steve Howell 636e54389b settings: Streamline code for navigating panels.
We call hashchanged.update_browser_history() when
we switch panels.  This API short circuits the
hashchanged callback and avoids code churn.

(We weren't actually double rendering, as the downstream
code does nothing at this point, so this is more
just preventig a pitfall and moving to a consistent
API.)
2018-12-02 19:07:15 -08:00
Armaan Ahluwalia 6d255efe4c app: Prepare JS files for consumption by webpack.
This commit prepares the frontend code to be consumed by webpack.

It is a hack: In theory, modules should be declaring and importing the
modules they depend on and the globals they expose directly.

However, that requires significant per-module work, which we don't
really want to block moving our toolchain to webpack on.

So we expose the modules by setting window.varName = varName; as
needed in the js files.
2018-07-05 10:53:36 +02:00
Akash Nimare d5e3ab761b settings: Unify code for setting-panel. 2018-06-27 11:48:50 -04:00
Steve Howell 3065bf0c58 settings: Make the enter key go to panels.
This is less than perfect, but for most settings hitting
the enter key will now take you to the first element in
the right panel.

The two exceptions are below.  They have checkboxes with
kind of strange markup:

    Notifications
    Authentication methods
2018-06-06 09:42:33 -07:00
Steve Howell e7e38253ec settings: Add better keyboard navigation for panel menus.
You can now use all four arrow keys intuitively in the
Settings/Organization panel menus.
2018-06-06 09:42:33 -07:00
Steve Howell a5f0163a67 Keep track of which settings sections are open.
If you toggle between Settings and Organization now, it
will remember where you were the last time (not counting
reload).  Likewise if you go in and out of settings.

The old code always put you in the first section, which I
think was an accident of implementation.  Of course, we'll
continue to default to the first row if you haven't gone
anywhere else.
2018-06-06 09:42:33 -07:00
Steve Howell beecee4b8c Move panel click handler into settings_panel_menu.js.
This is mostly a code move, but because things are more
modular now, we don't need the two conditionals to find
out what kind of panel menu we're inside of, and our
selectors are less brittle.
2018-06-06 09:42:33 -07:00
Steve Howell 8ce8e93645 refactor: Extract settings_panel_menu.js. 2018-06-06 09:42:33 -07:00