2015-06-19 11:52:57 +09:00
|
|
|
//////////////////
|
|
|
|
// Link Helpers //
|
|
|
|
//////////////////
|
|
|
|
|
|
|
|
/**
|
2016-04-09 09:41:20 +09:00
|
|
|
* @summary Get URL of a comment page.
|
2015-06-19 11:52:57 +09:00
|
|
|
* @param {Object} comment
|
|
|
|
*/
|
|
|
|
Comments.getPageUrl = function(comment, isAbsolute){
|
|
|
|
var isAbsolute = typeof isAbsolute === "undefined" ? false : isAbsolute; // default to false
|
|
|
|
var prefix = isAbsolute ? Telescope.utils.getSiteUrl().slice(0,-1) : "";
|
2016-06-11 16:37:03 +09:00
|
|
|
return prefix + "foo" + "#"+comment._id;
|
2015-06-19 11:52:57 +09:00
|
|
|
};
|
|
|
|
Comments.helpers({getPageUrl: function () {return Comments.getPageUrl(this);}});
|
|
|
|
|
|
|
|
///////////////////
|
|
|
|
// Other Helpers //
|
|
|
|
///////////////////
|
|
|
|
|
|
|
|
/**
|
2016-04-09 09:41:20 +09:00
|
|
|
* @summary Get a comment author's name
|
2015-06-19 11:52:57 +09:00
|
|
|
* @param {Object} comment
|
|
|
|
*/
|
|
|
|
Comments.getAuthorName = function (comment) {
|
|
|
|
var user = Meteor.users.findOne(comment.userId);
|
|
|
|
if (user) {
|
2015-10-01 16:38:10 +01:00
|
|
|
return user.getDisplayName();
|
2015-06-19 11:52:57 +09:00
|
|
|
} else {
|
|
|
|
return comment.author;
|
|
|
|
}
|
|
|
|
};
|
2015-10-01 16:56:50 +01:00
|
|
|
Comments.helpers({getAuthorName: function () {return Comments.getAuthorName(this);}});
|
2016-02-17 21:57:07 +09:00
|
|
|
|