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/bookmark-button.js.es6
Sam b041b3f67f FIX: bookmark topic was not working intuitively
- explicitly call out "clear bookmarks"
- correct keyboard shortcuts
- properly remove bookmarks when toggeling
2015-02-19 10:58:57 +11:00

26 lines
793 B
JavaScript

import ButtonView from 'discourse/views/button';
export default ButtonView.extend({
classNames: ['bookmark'],
attributeBindings: ['disabled'],
textKey: function() {
return this.get('controller.bookmarked') ? 'bookmarked.clear_bookmarks' : 'bookmarked.title';
}.property('controller.bookmarked'),
rerenderTriggers: ['controller.bookmarked'],
helpKey: function() {
return this.get("controller.bookmarked") ? "bookmarked.help.unbookmark" : "bookmarked.help.bookmark";
}.property("controller.bookmarked"),
click: function() {
this.get('controller').send('toggleBookmark');
},
renderIcon: function(buffer) {
var className = this.get("controller.bookmarked") ? "bookmarked" : "";
buffer.push("<i class='fa fa-bookmark " + className + "'></i>");
}
});