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

Unified Diff: appengine/chromium_rietveld/new_static/components/cr-app.html

Issue 904273002: Add the ability to logout. (Closed) Base URL: https://chromium.googlesource.com/infra/infra.git@master
Patch Set: Created 5 years, 10 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 | « no previous file | appengine/chromium_rietveld/new_static/model/user.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: appengine/chromium_rietveld/new_static/components/cr-app.html
diff --git a/appengine/chromium_rietveld/new_static/components/cr-app.html b/appengine/chromium_rietveld/new_static/components/cr-app.html
index 1198444a950fae2c00848e4b9a733a4496976b85..f0adb35feee5d1c34ad0f73ee39af440d9aec958 100644
--- a/appengine/chromium_rietveld/new_static/components/cr-app.html
+++ b/appengine/chromium_rietveld/new_static/components/cr-app.html
@@ -107,19 +107,6 @@ found in the LICENSE file. -->
app-route {
display: none;
}
-
- .view-links .login-link,
- .view-links .settings-link {
- display: none;
- }
-
- :host-context(.login) .settings-link {
- display: block;
- }
-
- :host-context(.no-login) .login-link {
- display: block;
- }
</style>
<header>
<div class="title">
@@ -133,8 +120,17 @@ found in the LICENSE file. -->
href="https://code.google.com/p/chromium/issues/entry?labels=Type-Bug,Pri-2,Infra-Area-Rietveld"
target="_blank">Report a bug</a>
<a href="/search" class="search-link">Search</a>
- <a href="/settings" class="settings-link">Settings</a>
- <cr-action on-tap="{{ handleLogin }}" class="login-link" white>Login</cr-action>
+ <template if="{{ user }}">
+ <a href="/settings">Settings</a>
+ </template>
+ <cr-action on-tap="{{ handleLogin }}" white>
+ <template if="{{ user }}">
+ Logout
+ </template>
+ <template if="{{ !user }}">
+ Login
+ </template>
+ </cr-action>
</div>
</header>
<app-router id="router" trailingSlash="ignore">
@@ -147,6 +143,9 @@ found in the LICENSE file. -->
</template>
<script>
Polymer({
+ created: function() {
+ this.user = User.current;
+ },
attached: function() {
var self = this;
User.loadCurrentUser({cached:true}).then(function() {
@@ -162,7 +161,10 @@ found in the LICENSE file. -->
this.$.router.go();
},
handleLogin: function() {
- window.location.href = User.getLoginUrl();
+ if (this.user)
+ location.href = User.getLogoutUrl();
ojan 2015/02/08 05:49:08 It's kinda funny to recreate links here. I would j
+ else
+ location.href = User.getLoginUrl();
},
});
</script>
« no previous file with comments | « no previous file | appengine/chromium_rietveld/new_static/model/user.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698