This repository has been archived on 2023-03-18. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
osr-discourse-src/app/assets/javascripts/discourse/views/buttons/favorite_button.js
T
2013-06-06 16:45:25 -04:00

28 lines
644 B
JavaScript

/**
A button for favoriting a topic
@class FavoriteButton
@extends Discourse.ButtonView
@namespace Discourse
@module Discourse
**/
Discourse.FavoriteButton = Discourse.ButtonView.extend({
textKey: 'favorite.title',
helpKeyBinding: 'controller.content.favoriteTooltipKey',
favoriteChanged: function() {
this.rerender();
}.observes('controller.content.starred'),
click: function() {
this.get('controller').toggleStar();
},
renderIcon: function(buffer) {
buffer.push("<i class='icon-star " +
(this.get('controller.content.starred') ? ' starred' : '') +
"'></i>");
}
});