| <!-- |
| Copyright (C) 2016 The Android Open Source Project |
| |
| Licensed under the Apache License, Version 2.0 (the "License"); |
| you may not use this file except in compliance with the License. |
| You may obtain a copy of the License at |
| |
| http://www.apache.org/licenses/LICENSE-2.0 |
| |
| Unless required by applicable law or agreed to in writing, software |
| distributed under the License is distributed on an "AS IS" BASIS, |
| WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| See the License for the specific language governing permissions and |
| limitations under the License. |
| --> |
| |
| <link rel="import" href="../../../bower_components/polymer/polymer.html"> |
| <link rel="import" href="../gr-menu-editor/gr-menu-editor.html"> |
| <link rel="import" href="../gr-watched-projects-editor/gr-watched-projects-editor.html"> |
| <link rel="import" href="../../shared/gr-button/gr-button.html"> |
| <link rel="import" href="../../shared/gr-date-formatter/gr-date-formatter.html"> |
| <link rel="import" href="../../shared/gr-rest-api-interface/gr-rest-api-interface.html"> |
| <link rel="import" href="../../shared/gr-select/gr-select.html"> |
| |
| <dom-module id="gr-settings-view"> |
| <template> |
| <style> |
| :host { |
| background-color: var(--view-background-color); |
| display: block; |
| } |
| main { |
| margin: 2em auto; |
| max-width: 46em; |
| } |
| h1 { |
| margin-bottom: .1em; |
| } |
| h2.edited:after { |
| color: #444; |
| content: ' *'; |
| } |
| fieldset { |
| border: none; |
| margin: 0 0 2em 2em; |
| } |
| section { |
| margin-bottom: .5em; |
| } |
| .title, |
| .value { |
| display: inline-block; |
| vertical-align: top; |
| } |
| .title { |
| color: #666; |
| font-weight: bold; |
| padding-right: .5em; |
| width: 11em; |
| } |
| .loading { |
| color: #666; |
| padding: 1em var(--default-horizontal-margin); |
| } |
| @media only screen and (max-width: 40em) { |
| .loading { |
| padding: 0 var(--default-horizontal-margin); |
| } |
| main { |
| margin: 2em 1em; |
| } |
| section { |
| margin-bottom: 1em; |
| } |
| .title, |
| .value { |
| display: block; |
| } |
| } |
| </style> |
| <div class="loading" hidden$="[[!_loading]]">Loading...</div> |
| <div hidden$="[[_loading]]" hidden> |
| <main> |
| <h1>User Settings</h1> |
| <h2>Profile</h2> |
| <fieldset id="profile"> |
| <section> |
| <span class="title">ID</span> |
| <span class="value">[[account._account_id]]</span> |
| </section> |
| <section> |
| <span class="title">Name</span> |
| <span class="value">[[account.name]]</span> |
| </section> |
| <section> |
| <span class="title">Email</span> |
| <span class="value">[[account.email]]</span> |
| </section> |
| <section hidden$="[[!account.username]]"> |
| <span class="title">Username</span> |
| <span class="value">[[account.username]]</span> |
| </section> |
| <section> |
| <span class="title">Registered</span> |
| <span class="value"> |
| <gr-date-formatter |
| date-str="[[account.registered_on]]"></gr-date-formatter> |
| </span> |
| </section> |
| </fieldset> |
| <h2 class$="[[_computeHeaderClass(_prefsChanged)]]">Preferences</h2> |
| <fieldset id="preferences"> |
| <section> |
| <span class="title">Changes Per Page</span> |
| <span class="value"> |
| <select |
| is="gr-select" |
| bind-value="{{_localPrefs.changes_per_page}}"> |
| <option value="10">10 rows per page</option> |
| <option value="25">25 rows per page</option> |
| <option value="50">50 rows per page</option> |
| <option value="100">100 rows per page</option> |
| </select> |
| </span> |
| </section> |
| <section> |
| <span class="title">Date/Time Format</span> |
| <span class="value"> |
| <select |
| is="gr-select" |
| bind-value="{{_localPrefs.date_format}}"> |
| <option value="STD">Jun 3 ; Jun 3, 2016</option> |
| <option value="US">06/03 ; 06/03/16</option> |
| <option value="ISO">06-03 ; 2016-06-03</option> |
| <option value="EURO">3. Jun ; 03.06.2016</option> |
| <option value="UK">03/06 ; 03/06/2016</option> |
| </select> |
| <select |
| is="gr-select" |
| bind-value="{{_localPrefs.time_format}}"> |
| <option value="HHMM_12">4:10 PM</option> |
| <option value="HHMM_24">16:10</option> |
| </select> |
| </span> |
| </section> |
| <section> |
| <span class="title">Email Notifications</span> |
| <span class="value"> |
| <select |
| is="gr-select" |
| bind-value="{{_localPrefs.email_strategy}}"> |
| <option value="ENABLED">Enabled</option> |
| <option |
| value="CC_ON_OWN_COMMENTS">CC Me On Comments I Write</option> |
| <option value="DISABLED">Disabled</option> |
| </select> |
| </span> |
| </section> |
| <section> |
| <span class="title">Diff View</span> |
| <span class="value"> |
| <select |
| is="gr-select" |
| bind-value="{{_localPrefs.diff_view}}"> |
| <option value="SIDE_BY_SIDE">Side by Side</option> |
| <option value="UNIFIED_DIFF">Unified Diff</option> |
| </select> |
| </span> |
| </section> |
| <gr-button |
| id="savePrefs" |
| on-tap="_handleSavePreferences" |
| disabled="[[!_prefsChanged]]">Save Changes</gr-button> |
| </fieldset> |
| <h2 class$="[[_computeHeaderClass(_diffPrefsChanged)]]"> |
| Diff Preferences |
| </h2> |
| <fieldset id="diffPreferences"> |
| <section> |
| <span class="title">Context</span> |
| <span class="value"> |
| <select |
| is="gr-select" |
| bind-value="{{_diffPrefs.context}}"> |
| <option value="3">3 lines</option> |
| <option value="10">10 lines</option> |
| <option value="25">25 lines</option> |
| <option value="50">50 lines</option> |
| <option value="75">75 lines</option> |
| <option value="100">100 lines</option> |
| <option value="-1">Whole file</option> |
| </select> |
| </span> |
| </section> |
| <section> |
| <span class="title">Columns</span> |
| <span class="value"> |
| <input |
| is="iron-input" |
| type="number" |
| prevent-invalid-input |
| allowed-pattern="[0-9]" |
| bind-value="{{_diffPrefs.line_length}}"> |
| </span> |
| </section> |
| <section> |
| <span class="title">Tab Width</span> |
| <span class="value"> |
| <input |
| is="iron-input" |
| type="number" |
| prevent-invalid-input |
| allowed-pattern="[0-9]" |
| bind-value="{{_diffPrefs.tab_size}}"> |
| </span> |
| </section> |
| <section> |
| <span class="title">Show Tabs</span> |
| <span class="value"> |
| <input |
| id="showTabs" |
| type="checkbox" |
| checked$="[[_diffPrefs.show_tabs]]" |
| on-change="_handleShowTabsChanged"> |
| </span> |
| </section> |
| <gr-button |
| id="saveDiffPrefs" |
| on-tap="_handleSaveDiffPreferences" |
| disabled$="[[!_diffPrefsChanged]]">Save Changes</gr-button> |
| </fieldset> |
| <h2 class$="[[_computeHeaderClass(_menuChanged)]]">Menu</h2> |
| <fieldset id="menu"> |
| <gr-menu-editor menu-items="{{_localMenu}}"></gr-menu-editor> |
| <gr-button |
| id="saveMenu" |
| on-tap="_handleSaveMenu" |
| disabled="[[!_menuChanged]]">Save Changes</gr-button> |
| </fieldset> |
| <h2 class$="[[_computeHeaderClass(_watchedProjectsChanged)]]"> |
| Notifications |
| </h2> |
| <fieldset id="watchedProjects"> |
| <gr-watched-projects-editor |
| on-project-removed="_handleWatchedProjectRemoved" |
| projects="{{_watchedProjects}}"></gr-watched-projects-editor> |
| <gr-button |
| on-tap="_handleSaveWatchedProjects" |
| disabled$="[[!_watchedProjectsChanged]]" |
| id="_handleSaveWatchedProjects">Save Changes</gr-button> |
| </fieldset> |
| </main> |
| </div> |
| <gr-rest-api-interface id="restAPI"></gr-rest-api-interface> |
| </template> |
| <script src="../../../scripts/util.js"></script> |
| <script src="gr-settings-view.js"></script> |
| </dom-module> |