2
0
Fork 0
mirror of https://github.com/discourse/discourse.git synced 2025-09-06 10:50:21 +08:00
discourse/app/assets/javascripts/discourse/controllers/notification_controller.js
2014-04-17 01:58:01 +05:30

20 lines
832 B
JavaScript

Discourse.NotificationController = Discourse.ObjectController.extend({
scope: function() {
return "notifications." + Discourse.Site.currentProp("notificationLookup")[this.get("notification_type")];
}.property(),
username: function() {
return this.get("data.display_username");
}.property(),
link: function() {
if (this.get('data.badge_id')) {
return '<a href="/badges/' + this.get('data.badge_id') + '/' + this.get('data.badge_name').replace(/[^A-Za-z0-9_]+/g, '-').toLowerCase() + '">' + this.get('data.badge_name') + '</a>';
}
if (this.blank("data.topic_title")) {
return "";
}
var url = Discourse.Utilities.postUrl(this.get("slug"), this.get("topic_id"), this.get("post_number"));
return '<a href="' + url + '">' + this.get("data.topic_title") + '</a>';
}.property()
});