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/topic_footer_buttons_view.js
2013-07-11 16:39:35 -04:00

46 lines
1.3 KiB
JavaScript

/**
This view is used for rendering the buttons at the footer of the topic
@class TopicFooterButtonsView
@extends Discourse.ContainerView
@namespace Discourse
@module Discourse
**/
Discourse.TopicFooterButtonsView = Discourse.ContainerView.extend({
elementId: 'topic-footer-buttons',
topicBinding: 'controller.content',
init: function() {
this._super();
this.createButtons();
},
// Add the buttons below a topic
createButtons: function() {
var topic = this.get('topic');
if (Discourse.User.current()) {
if (!topic.get('isPrivateMessage')) {
// We hide some controls from private messages
if (this.get('topic.details.can_invite_to')) {
this.attachViewClass(Discourse.InviteReplyButton);
}
this.attachViewClass(Discourse.FavoriteButton);
this.attachViewClass(Discourse.ShareButton);
this.attachViewClass(Discourse.ClearPinButton);
}
this.attachViewClass(Discourse.ReplyButton);
if (!topic.get('isPrivateMessage')) {
this.attachViewClass(Discourse.NotificationsButton);
}
this.trigger('additionalButtons', this);
} else {
// If not logged in give them a login control
this.attachViewClass(Discourse.LoginReplyButton);
}
}
});