Fix record [reply] links
[blerg.git] / www / jssrc / blerg / Record.js
index 7601de9..5d4cf23 100644 (file)
@@ -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, '&amp;').replace(/</g, '&lt;').replace(/>/g, '&gt;');
-               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, '&amp;').replace(/</g, '&lt;').replace(/>/g, '&gt;');
+        this.$.data.setContent(d);
+    },
+    timestampChanged: function() { },
+    updateLinks: function() {
+        this.$.authorlink.setHref(baseURL + '/#' + this.author);
+        this.$.authorlink.setContent('@' + this.author);
+    },
 });