2 name: "blerg.Controls",
4 classes: "blerg-controls",
13 onPostVisibility: "postVisibilityUpdate"
16 {name: "loggedOutControls", components: [
17 {tag: "form", onsubmit: "loginClicked", classes: "login", components: [
18 {kind: "onyx.Groupbox", components: [
19 {kind: "onyx.InputDecorator", components: [
20 {name: "username", kind: "onyx.Input", placeholder: "Username"}
22 {kind: "onyx.InputDecorator", components: [
23 {name: "password", kind: "onyx.Input", placeholder: "Password", type: "password"}
26 {kind: "onyx.Button", content: "Login", onclick: "loginClicked"}
29 {name: "loggedInControls", showing: false, components: [
30 {name: "greeting", components: [
31 {noDom: true, content: "Hello, "},
32 {name: "userlink", tag: "a"},
33 {noDom: true, content: ". "},
34 {kind: "blerg.Link", content: "Logout", onNavigate: "logoutClicked"},
35 {noDom: true, content: "."}
38 {name: "rssButton", kind: "blerg.Link", showing: false, components: [
39 {kind: "Image", src: "/images/rss.png", width: 16, height: 16},
40 {noDom: true, content: " RSS"}
43 {classes: "blerg-controls-toolbar", components: [
44 {kind: "onyx.Button", content: "Feed Your Vanity", onclick: "chatterClicked"},
45 {kind: "onyx.Button", content: "Stalk Your Victims", onclick: "feedClicked"},
46 {name: "spewButton", kind: "onyx.Button", classes: "spew-button", content: "Spew It!", onclick: "spewToggle"}
50 showRSS: function(url) {
51 this.$.rssButton.show();
53 this.$.rssButton.setAttribute('href', url);
56 this.$.rssButton.hide();
58 loggedInChanged: function() {
60 this.$.loggedOutControls.hide();
61 this.$.loggedInControls.show();
63 this.$.loggedOutControls.show();
64 this.$.loggedInControls.hide();
67 loginClicked: function(inSender, inEvent) {
68 this.bubble('onTryLogin', {
69 username: this.$.username.getValue(),
70 password: this.$.password.getValue()
72 inEvent.preventDefault();
75 logoutClicked: function() {
76 this.bubble('onTryLogout');
79 login: function(inSender, inEvent) {
80 this.$.password.setValue('');
81 this.setLoggedIn(true);
82 this.$.userlink.setAttribute('href', '/#' + inEvent.username);
83 this.$.userlink.setContent('@' + inEvent.username);
84 this.username = inEvent.username;
86 logout: function(inSender, inEvent) {
87 this.setLoggedIn(false);
89 spewToggle: function(inSender, inEvent) {
90 this.postShowing = !this.postShowing;
91 this.bubble('onPostVisibility', {showing: this.postShowing});
93 postVisibilityUpdate: function(inSender, inEvent) {
94 this.postShowing = inEvent.showing;
95 this.$.spewButton.addRemoveClass('active', inEvent.showing);