mirror of
https://github.com/discourse/discourse.git
synced 2025-02-19 17:54:59 +08:00
31 lines
805 B
JavaScript
31 lines
805 B
JavaScript
/**
|
|
This view renders a link within a post
|
|
|
|
@class PostLinkView
|
|
@extends Discourse.View
|
|
@namespace Discourse
|
|
@module Discourse
|
|
**/
|
|
Discourse.PostLinkView = Discourse.View.extend({
|
|
tagName: 'li',
|
|
classNameBindings: ['direction'],
|
|
|
|
direction: (function() {
|
|
if (this.get('content.reflection')) return 'incoming';
|
|
return null;
|
|
}).property('content.reflection'),
|
|
|
|
render: function(buffer) {
|
|
var clicks;
|
|
buffer.push("<a href='" + (this.get('content.url')) + "' class='track-link'>\n");
|
|
buffer.push("<i class='icon icon-arrow-right'></i>");
|
|
buffer.push(this.get('content.title'));
|
|
if (clicks = this.get('content.clicks')) {
|
|
buffer.push("\n<span class='badge badge-notification clicks'>" + clicks + "</span>");
|
|
}
|
|
return buffer.push("</a>");
|
|
}
|
|
});
|
|
|
|
|