/www/jssrc/blerg/Feed.js
enyo.kind({
    name: "blerg.Feed",
    kind: "blerg.Pager",
    listKind: "blerg.TagRecord",
    published: {
    },
    components: [
        {classes: "blerg-user-controls", components: [
            {name: "rssLink", href: "/rss/feed", kind: "blerg.Link", components: [
                {tag: null, content: "["},
                {kind: "Image", src: "/images/rss.png", attributes: {width: 16, height: 16}},
                {tag: null, content: "RSS]"}
            ]}
        ]},
        {name: "records"},
        {name: "spinner", kind: "OldSchoolSpinner", showing: false},
        {name: "api", kind: "blerg.API",
         onItemsLoaded: "itemsLoaded",
         onClearStatus: "clearStatus"}
    ],
    statics: {
        locationDetect: function(l) {
            var m = l.hash.match(/^#\/feed$/);
            if (m) {
                return {kind: "blerg.Feed"};
            }
        }
    },
    create: function() {
        this.inherited(arguments);
        this.loadMore();
    },
    loadItems: function(from, to) {
        this.inherited(arguments);
        this.$.api.loadFeed();
    },
    itemsLoaded: function(inSender, inEvent) {
        this.addItems(inEvent.entries);
        this.$.api.clearStatus('feed');
    },
    clearStatus: function(inSender, inEvent) {
        if (inEvent.type == 'feed' && inEvent.status == 'success') {
            enyo.Signals.send('onClearNotification', {type: inEvent.type});
        }
    }
});