First stab at enyo rewrite
[blerg.git] / www / jssrc / blerg / Welcome.js
1 enyo.kind({
2         name: "blerg.Welcome",
3         statics: {
4                 locationDetect: function(l) {
5                         if (l.hash.match(/^(#\/?)?$/))
6                                 return {kind: "blerg.Welcome"}
7                         else
8                                 return false;
9                 }
10         },
11         components: [
12                 {components: [
13                         {style: "float: right; text-align: center; margin: 0 0 1em 1em", components: [
14                                 {style: "font-size: 14pt; margin-bottom: 4pt", content: "Curious? Click this unbelievably obnoxious button!"},
15                                 {kind: "onyx.Button", content: "I want to Blërg!", style: "font-size: 40pt; padding: 1em; background-color: #C0F; color: #F88", onclick: "startSignup"}
16                         ]}
17                 ]},
18                 {allowHtml: true, content: '<h2>I am 12 and what is this</h2> <p>Blërg is a microblogging platform.  Or maybe a miniblogging platform.  Blërg is not sure.  Blërg is a lot like <a href="http://twitter.com/">Twitter</a>, but aims to fix some of its idiosyncracies.  Blërg does not want to be a full blogging platform like <a href="http://wordpress.com/">Wordpress</a> or <a href="http://livejournal.com/">Livejournal</a>.  Blërg is also an <a href="/doc/">open source tagged text database engine</a> written in C that does the back-end work. Blërg\'s author finds it entertaining to anthropomorphize Blërg in the third person.</p>'},
19                 {name: "moreLink", kind: "blerg.Link", onclick: "loadMore", content: "Tell me more..."},
20                 {style: "clear: both"},
21                 {name: "contentBox", allowHtml: true},
22                 {tag: "h2", content: "Latest posts"},
23                 {name: "latestPosts"},
24                 {tag: "h2", content: "Latest tags"},
25                 {name: "latestTags"}
26         ],
27         rendered: function() {
28                 this.inherited(arguments);
29
30                 this.bubble("onSetTitle", {section: "Welcome!"});
31         },
32         loadMore: function() {
33                 var req = new enyo.Ajax({
34                         url: "/welcome.html",
35                         handleAs: "text"
36                 });
37                 req.response(function(inSender, inResponse) {
38                         this.$.contentBox.setContent(inResponse);
39                         this.$.moreLink.hide();
40                 }.bind(this));
41                 req.go();
42         },
43         startSignup: function() {
44                 this.bubble('onStartSignup');
45         }
46 });