2 name: "blerg.Controls",
5 classes: "blerg-controls",
15 {name: "loggedOutControls", components: [
16 {tag: "form", onsubmit: "loginClicked", classes: "login", components: [
17 {kind: "onyx.Groupbox", components: [
18 {kind: "onyx.InputDecorator", components: [
19 {name: "username", kind: "onyx.Input", placeholder: "Username"}
21 {kind: "onyx.InputDecorator", components: [
22 {name: "password", kind: "onyx.Input", placeholder: "Password", type: "password"}
25 {kind: "onyx.Button", content: "Login", onclick: "loginClicked"}
28 {name: "loggedInControls", showing: false, components: [
29 {name: "greeting", components: [
30 {noDom: true, content: "Hello, "},
31 {name: "userlink", tag: "a"},
32 {noDom: true, content: "."}
34 {classes: "onyx-toolbar-inline", components: [
35 {kind: "onyx.Button", content: "Write", onclick: "writeClicked"},
36 {kind: "onyx.Button", content: "Hearsay", onclick: "chatterClicked"},
37 {kind: "onyx.Button", content: "Stalking", onclick: "feedClicked"},
38 {kind: "onyx.Button", content: "Logout", onclick: "logoutClicked"}
41 {name: "rssButton", showing: false, kind: "blerg.Link", components: [
42 {kind: "Image", src: "/images/rss.png", width: 16, height: 16},
43 {noDom: true, content: " RSS"}
48 showRSS: function(url) {
49 this.$.rssButton.show();
51 this.$.rssButton.setAttribute('href', url);
54 this.$.rssButton.hide();
56 loggedInChanged: function() {
58 this.$.loggedOutControls.hide();
59 this.$.loggedInControls.show();
61 this.$.loggedOutControls.show();
62 this.$.loggedInControls.hide();
65 loginClicked: function(inSender, inEvent) {
66 this.bubble('onTryLogin', {
67 username: this.$.username.getValue(),
68 password: this.$.password.getValue()
70 inEvent.preventDefault();
73 logoutClicked: function() {
74 this.bubble('onTryLogout');
76 login: function(inSender, inEvent) {
77 this.$.password.setValue('');
78 this.setLoggedIn(true);
79 this.$.userlink.setAttribute('href', '/#' + inEvent.username);
80 this.$.userlink.setContent('@' + inEvent.username);
81 this.username = inEvent.username;
83 logout: function(inSender, inEvent) {
84 this.setLoggedIn(false);