From 60ea95fac7b74c5f340637485d873e6b0b02a8f6 Mon Sep 17 00:00:00 2001 From: Wyatt Allen Date: Fri, 3 Jun 2016 09:35:07 -0700 Subject: [PATCH] Adds user settings/preferences page Adds a home for viewing and editing user preferences at a new client route: /settings/. This is first in a series of changes to bring preferences editing to PolyGerrit. At this point the settings page is read-only and mostly un-styled. Introduces the gr-settings-view element which is added to gr-app in the same manner as the other main PolyGerrit views. Introduces the /settings route which will display the new view, or redirect to login if the user is not authenticated. Adds a link to user settings in the gr-account-dropdown. Bug: Issue 3911 Change-Id: Ib164502d586518876737c6d333c8940f2898dad4 --- .../gr-account-dropdown.html | 1 + .../app/elements/core/gr-router/gr-router.js | 10 ++ polygerrit-ui/app/elements/gr-app.html | 4 + polygerrit-ui/app/elements/gr-app.js | 3 + .../gr-settings-view/gr-settings-view.html | 96 +++++++++++++++++++ .../gr-settings-view/gr-settings-view.js | 56 +++++++++++ .../gr-settings-view_test.html | 83 ++++++++++++++++ polygerrit-ui/app/test/index.html | 1 + 8 files changed, 254 insertions(+) create mode 100644 polygerrit-ui/app/elements/settings/gr-settings-view/gr-settings-view.html create mode 100644 polygerrit-ui/app/elements/settings/gr-settings-view/gr-settings-view.js create mode 100644 polygerrit-ui/app/elements/settings/gr-settings-view/gr-settings-view_test.html diff --git a/polygerrit-ui/app/elements/core/gr-account-dropdown/gr-account-dropdown.html b/polygerrit-ui/app/elements/core/gr-account-dropdown/gr-account-dropdown.html index 6880a39369..1d31c12159 100644 --- a/polygerrit-ui/app/elements/core/gr-account-dropdown/gr-account-dropdown.html +++ b/polygerrit-ui/app/elements/core/gr-account-dropdown/gr-account-dropdown.html @@ -82,6 +82,7 @@ limitations under the License.
[[account.email]]
+
  • Settings
  • Switch account
  • Sign out
  • diff --git a/polygerrit-ui/app/elements/core/gr-router/gr-router.js b/polygerrit-ui/app/elements/core/gr-router/gr-router.js index dea0d1d3c4..32246caf66 100644 --- a/polygerrit-ui/app/elements/core/gr-router/gr-router.js +++ b/polygerrit-ui/app/elements/core/gr-router/gr-router.js @@ -132,6 +132,16 @@ } } + page(/^\/settings\/?/, function(data) { + restAPI.getLoggedIn().then(function(loggedIn) { + if (loggedIn) { + app.params = {view: 'gr-settings-view'}; + } else { + page.show('/login/' + encodeURIComponent(data.canonicalPath)); + } + }); + }); + page.start(); }); })(); diff --git a/polygerrit-ui/app/elements/gr-app.html b/polygerrit-ui/app/elements/gr-app.html index 0d6eaa8fe7..b15672104b 100644 --- a/polygerrit-ui/app/elements/gr-app.html +++ b/polygerrit-ui/app/elements/gr-app.html @@ -27,6 +27,7 @@ limitations under the License. + @@ -109,6 +110,9 @@ limitations under the License. params="[[params]]" change-view-state="{{_viewState.changeView}}"> +