First stab at enyo rewrite
[blerg.git] / www / jssrc / blerg / Title.js
1 enyo.kind({
2         name: "blerg.Title",
3         kind: "Control",
4         style: "float: left; width: 40%",
5         published: {
6                 subscribed: null,
7                 section: ""
8         },
9         components: [
10                 {kind: "Image", classes: "logo", src: "images/blerglogo.png", attributes: {width: 125, height: 122}},
11                 {tag: "h1", components: [
12                         {kind: "blerg.Link", content: "BlĂ«rg!"}
13                 ]},
14                 {tag: "h2", components: [
15                         {name: "section", tag: "span"}
16                 ]},
17                 {name: "userControls", showing: false, components: [
18                         {kind: "blerg.Link", onclick: "clickChatter", content: "[chatter]"},
19                         {name: "subscribeLink", kind: "blerg.Link", onclick: "clickSubscribe", showing: false, content: "[stalk]"},
20                         {name: "unsubscribeLink", kind: "blerg.Link", onclick: "clickUnsubscribe", showing: false, content: "[stop stalking]"}
21                 ]}
22         ],
23         create: function() {
24                 this.inherited(arguments);
25                 this.subscribedChanged();
26         },
27         clickChatter: function() {
28                 this.bubble("onChatter");
29         },
30         clickSubscribe: function() {
31                 this.bubble("onSubscribe");
32         },
33         clickUnsubscribe: function() {
34                 this.bubble("onUnsubscribe");
35         },
36         subscribedChanged: function() {
37                 if (this.subscribed == null) {
38                         this.$.subscribeLink.hide();
39                         this.$.unsubscribeLink.hide();
40                 } else if (this.subscribed) {
41                         this.$.subscribeLink.hide();
42                         this.$.unsubscribeLink.show();
43                 } else {
44                         this.$.subscribeLink.show();
45                         this.$.unsubscribeLink.hide();
46                 }
47         },
48         sectionChanged: function() {
49                 this.$.section.setContent(this.section);
50         },
51         showControls: function() {
52                 this.$.userControls.hide();
53         },
54         hideControls: function() {
55                 this.$.userControls.hide();
56         }
57 });