Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3291)

Unified Diff: appengine/sheriff_o_matic/ui/ct-user-prefs.html

Issue 1315693002: SoM: upgrade Polymer from 0.5 to 1.0 Base URL: https://chromium.googlesource.com/infra/infra.git@master
Patch Set: get bower_components from polymer_1.0.4 Created 5 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « appengine/sheriff_o_matic/ui/ct-unexpected-failures.html ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: appengine/sheriff_o_matic/ui/ct-user-prefs.html
diff --git a/appengine/sheriff_o_matic/ui/ct-user-prefs.html b/appengine/sheriff_o_matic/ui/ct-user-prefs.html
index 2e6036e54777fa6de5e01385b5df03994c664042..43814d70af79b52c54384c4c13363a749353d7ad 100644
--- a/appengine/sheriff_o_matic/ui/ct-user-prefs.html
+++ b/appengine/sheriff_o_matic/ui/ct-user-prefs.html
@@ -2,61 +2,58 @@
Copyright 2015 The Chromium Authors. All rights reserved.
Use of this source code is governed by a BSD-style license that can be
found in the LICENSE file.
--->
-
-<link href="../bower_components/polymer/polymer.html" rel="import">
+--><html><head><link href="../bower_components/polymer/polymer.html" rel="import">
<link rel="import" href="../appengine_module/components/net.html">
-<polymer-element name="ct-user-prefs" attributes="user linkTarget values">
+<dom-module id="ct-user-prefs">
<script>
-(function() {
- // Folloing the "MonoState" pattern suggested in
- // https://www.polymer-project.org/0.5/docs/polymer/polymer.html#global
- // Instantiate as many ct-user-prefs elements as you'd like, they'll always
- // bind to the same shared set of values.
- var values = {};
-
- Polymer({
- ready: function() {
- this.values = values;
- },
-
- attached: function() {
- if (!this.values.loaded && !this.values.loading) {
- this.values.loading = true;
- this.load();
- }
- },
-
- load: function() {
- net.json('/api/v1/prefs').then(function(data) {
- this.values.user = data.user;
- this.values.xsrfToken = data.xsrf_token;
- this.values.loginUrl = data.login_url;
- this.values.logoutUrl = data.logout_url;
-
- if (data.prefs) {
- this.values.useUberchromegw = data.prefs.use_uberchromegw;
- this.values.useNewWindows = data.prefs.use_new_windows;
- this.values.linkTarget = data.prefs.use_new_windows ? '_blank' : '_self';
+ (function () {
+ // Folloing the "MonoState" pattern suggested in
+ // https://www.polymer-project.org/0.5/docs/polymer/polymer.html#global
+ // Instantiate as many ct-user-prefs elements as you'd like, they'll always
+ // bind to the same shared set of values.
+ var values = {};
+ Polymer({
+ is: 'ct-user-prefs',
+ properties: {
+ linkTarget: { notify: true },
+ user: { notify: true },
+ values: { notify: true }
+ },
+ ready: function () {
+ this.values = values;
+ },
+ attached: function () {
+ if (!this.values.loaded && !this.values.loading) {
+ this.values.loading = true;
+ this.load();
+ }
+ },
+ load: function () {
+ net.json('/api/v1/prefs').then(function (data) {
+ this.values.user = data.user;
+ this.values.xsrfToken = data.xsrf_token;
+ this.values.loginUrl = data.login_url;
+ this.values.logoutUrl = data.logout_url;
+ if (data.prefs) {
+ this.values.useUberchromegw = data.prefs.use_uberchromegw;
+ this.values.useNewWindows = data.prefs.use_new_windows;
+ this.values.linkTarget = data.prefs.use_new_windows ? '_blank' : '_self';
+ }
+ this.values.loaded = true;
+ this.values.loading = false;
+ }.bind(this), function (err) {
+ window.console.log('could not load user prefs: ' + err);
+ this.values.loading = false;
+ }.bind(this));
+ },
+ rewriteUrl: function (url) {
+ if (this.values.useUberchromegw) {
+ url = url.replace('//build.chromium.org/p/', '//uberchromegw.corp.google.com/i/');
+ }
+ return url;
}
- this.values.loaded = true;
- this.values.loading = false;
- }.bind(this), function(err) {
- window.console.log('could not load user prefs: ' + err);
- this.values.loading = false;
- }.bind(this));
- },
-
- rewriteUrl: function(url) {
- if (this.values.useUberchromegw) {
- url = url.replace(
- '//build.chromium.org/p/',
- '//uberchromegw.corp.google.com/i/');
- }
- return url;
- },
- });
-})();
+ });
+ }());
</script>
-</polymer-element>
+</dom-module>
« no previous file with comments | « appengine/sheriff_o_matic/ui/ct-unexpected-failures.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698