X-Git-Url: http://git.bytex64.net/?a=blobdiff_plain;f=www%2Fjssrc%2Fblerg%2FRecord.js;h=5d4cf23d91eb03b8a24055f224824ebc85051a61;hb=f4fcda2f29d7c2efe91d9afabf7d5fcd4bd04b5a;hp=7601de9972bbcf13b71a34b7923f846396722ca9;hpb=9818631aecddd827374a0c01b3ec287e7b018bb1;p=blerg.git diff --git a/www/jssrc/blerg/Record.js b/www/jssrc/blerg/Record.js index 7601de9..5d4cf23 100644 --- a/www/jssrc/blerg/Record.js +++ b/www/jssrc/blerg/Record.js @@ -1,74 +1,92 @@ enyo.kind({ - name: "blerg.Record", - kind: "Control", - classes: "record", - published: { - data: "", - timestamp: 0, - author: "", - record: null - }, - components: [ - {name: "data", noDom: true, allowHtml: true}, - {classes: "info", components: [ - {noDom: true, content: "Posted "}, - {name: "date", noDom: true}, - {noDom: true, content: ". "}, - {name: "permalink", kind: "blerg.Link", content: "[permalink]"}, - {noDom: true, content: " "}, - {name: "reply", kind: "blerg.Link", content: "[reply]", onclick: "postPopup"} - ]} - ], - create: function() { - this.inherited(arguments); - this.dataChanged(); - this.timestampChanged(); - this.updateLinks(); - }, - dataChanged: function() { - this.$.data.setContent(blerg.Util.blergFormat(this.data)); - }, - timestampChanged: function() { - this.$.date.setContent(new Date(this.timestamp * 1000).toString()); - }, - authorChanged: function() { - this.updateLinks(); - }, - recordChanged: function() { - this.updateLinks(); - }, - updateLinks: function() { - this.$.permalink.setHref(baseURL + enyo.macroize("/#{$author}/{$record}", this)); - }, - postPopup: function() { - this.bubble('onPostVisibility', { - showing: true, - data: enyo.macroize("@{$author}/{$record}", this) - }); - return true; - } + name: "blerg.Record", + kind: "Control", + classes: "record", + published: { + data: "", + timestamp: 0, + author: "", + record: null + }, + components: [ + {name: "data", noDom: true, allowHtml: true}, + {classes: "info", components: [ + {noDom: true, content: "Posted "}, + {name: "date", noDom: true}, + {noDom: true, content: ". "}, + {name: "permalink", kind: "blerg.Link", content: "[permalink]"}, + {noDom: true, content: " "}, + {name: "reply", kind: "blerg.Link", content: "[reply]", onNavigate: "postPopup"} + ]} + ], + create: function() { + this.inherited(arguments); + this.dataChanged(); + this.timestampChanged(); + this.updateLinks(); + }, + dataChanged: function() { + this.$.data.setContent(blerg.Util.blergFormat(this.data)); + }, + timestampChanged: function() { + this.$.date.setContent(new Date(this.timestamp * 1000).toString()); + }, + authorChanged: function() { + this.updateLinks(); + }, + recordChanged: function() { + this.updateLinks(); + }, + updateLinks: function() { + this.$.permalink.setHref(baseURL + enyo.macroize("/#{$author}/{$record}", this)); + }, + postPopup: function() { + this.bubble('onPostVisibility', { + showing: true, + data: enyo.macroize("@{$author}/{$record}: ", this) + }); + return true; + } }); enyo.kind({ - name: "blerg.TagRecord", - kind: "blerg.Record" + name: "blerg.TagRecord", + kind: "blerg.Record", + components: [ + {name: "data", noDom: true, allowHtml: true}, + {classes: "info", components: [ + {noDom: true, content: "Posted by "}, + {name: "author", kind: "blerg.Link", classes: "author ref"}, + {noDom: true, content: " at "}, + {name: "date", noDom: true}, + {noDom: true, content: ". "}, + {name: "permalink", kind: "blerg.Link", content: "[permalink]"}, + {noDom: true, content: " "}, + {name: "reply", kind: "blerg.Link", content: "[reply]", onNavigate: "postPopup"} + ]} + ], + updateLinks: function() { + this.inherited(arguments); + this.$.author.setContent('@' + this.author); + this.$.author.setHref('/#' + this.author); + } }); enyo.kind({ - name: "blerg.BriefRecord", - kind: "blerg.Record", - components: [ - {name: "authorlink", kind: "blerg.Link", classes: "author ref"}, - {noDom: true, content: " "}, - {name: "data", noDom: true} - ], - dataChanged: function() { - var d = this.data.replace(/&/g, '&').replace(//g, '>'); - this.$.data.setContent(d); - }, - timestampChanged: function() { }, - updateLinks: function() { - this.$.authorlink.setHref(baseURL + '/#' + this.author); - this.$.authorlink.setContent('@' + this.author); - }, + name: "blerg.BriefRecord", + kind: "blerg.Record", + components: [ + {name: "authorlink", kind: "blerg.Link", classes: "author ref"}, + {noDom: true, content: " "}, + {name: "data", noDom: true} + ], + dataChanged: function() { + var d = this.data.replace(/&/g, '&').replace(//g, '>'); + this.$.data.setContent(d); + }, + timestampChanged: function() { }, + updateLinks: function() { + this.$.authorlink.setHref(baseURL + '/#' + this.author); + this.$.authorlink.setContent('@' + this.author); + }, });