X-Git-Url: http://git.bytex64.net/?a=blobdiff_plain;f=www%2Fjssrc%2Fblerg%2FRecord.js;h=2dc57398383ec781c5b7143bd35822a835e0df60;hb=626be60457401042854cab447a01ed4120b78886;hp=2751042e0cae22c7a3dba9188f453b37aaca16f2;hpb=13ce437d1c9120ac0813abbbf7602097e7ac14dc;p=blerg.git diff --git a/www/jssrc/blerg/Record.js b/www/jssrc/blerg/Record.js index 2751042..2dc5739 100644 --- a/www/jssrc/blerg/Record.js +++ b/www/jssrc/blerg/Record.js @@ -1,74 +1,93 @@ enyo.kind({ - name: "blerg.Record", - kind: "Control", - classes: "record", - published: { - data: "", - timestamp: 0, - author: "", - record: null - }, - components: [ - {name: "data", noDom: 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(postMangle(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", tag: null, allowHtml: true}, + {classes: "info", components: [ + {tag: null, content: "Posted "}, + {name: "date", tag: null}, + {tag: null, content: ". "}, + {name: "permalink", kind: "blerg.Link", content: "[permalink]"}, + {tag: null, 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), + replyto: this.$.data.getContent() + }); + return true; + } }); enyo.kind({ - name: "blerg.TagRecord", - kind: "blerg.Record" + name: "blerg.TagRecord", + kind: "blerg.Record", + components: [ + {name: "data", tag: null, allowHtml: true}, + {classes: "info", components: [ + {tag: null, content: "Posted by "}, + {name: "author", kind: "blerg.Link", classes: "author ref"}, + {tag: null, content: " at "}, + {name: "date", tag: null}, + {tag: null, content: ". "}, + {name: "permalink", kind: "blerg.Link", content: "[permalink]"}, + {tag: null, 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"}, + {tag: null, content: " "}, + {name: "data", tag: null} + ], + 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); + }, });