This repository has been archived on 2023-03-18. You can view files and clone it, but cannot push or open issues or pull requests.
osr-discourse-src/app/assets/javascripts/discourse/views/buttons/star_button.js
2014-01-10 14:54:19 -05:00

28 lines
654 B
JavaScript

/**
A button for starring a topic
@class StarButton
@extends Discourse.ButtonView
@namespace Discourse
@module Discourse
**/
Discourse.StarButton = Discourse.ButtonView.extend({
classNames: ['star'],
textKey: 'starred.title',
helpKeyBinding: 'controller.starTooltipKey',
attributeBindings: ['disabled'],
shouldRerender: Discourse.View.renderIfChanged('controller.starred'),
click: function() {
this.get('controller').send('toggleStar');
},
renderIcon: function(buffer) {
buffer.push("<i class='fa fa-star " +
(this.get('controller.starred') ? ' starred' : '') +
"'></i>");
}
});