Make Account Center only usable when logged in
[blerg.git] / www / jssrc / blerg / Feed.js
1 enyo.kind({
2     name: "blerg.Feed",
3     kind: "blerg.Pager",
4     listKind: "blerg.TagRecord",
5     published: {
6     },
7     components: [
8         {classes: "blerg-user-controls", components: [
9             {name: "rssLink", href: "/rss/feed", kind: "blerg.Link", components: [
10                 {tag: null, content: "["},
11                 {kind: "Image", src: "/images/rss.png", attributes: {width: 16, height: 16}},
12                 {tag: null, content: "RSS]"}
13             ]}
14         ]},
15         {name: "records"},
16         {name: "spinner", kind: "OldSchoolSpinner", showing: false},
17         {name: "api", kind: "blerg.API",
18          onItemsLoaded: "itemsLoaded",
19          onClearStatus: "clearStatus"}
20     ],
21     statics: {
22         locationDetect: function(l) {
23             var m = l.hash.match(/^#\/feed$/);
24             if (m) {
25                 return {kind: "blerg.Feed"};
26             }
27         }
28     },
29     create: function() {
30         this.inherited(arguments);
31         this.loadMore();
32     },
33     loadItems: function(from, to) {
34         this.inherited(arguments);
35         this.$.api.loadFeed();
36     },
37     itemsLoaded: function(inSender, inEvent) {
38         this.addItems(inEvent.entries);
39         this.$.api.clearStatus('feed');
40     },
41     clearStatus: function(inSender, inEvent) {
42         if (inEvent.type == 'feed' && inEvent.status == 'success') {
43             enyo.Signals.send('onClearNotification', {type: inEvent.type});
44         }
45     }
46 });