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-main-buttons.js.es6
2016-02-18 12:19:00 -05:00

45 lines
1.3 KiB
JavaScript

import ContainerView from 'discourse/views/container';
import { on } from 'ember-addons/ember-computed-decorators';
export default ContainerView.extend({
elementId: 'topic-footer-main-buttons',
@on('init')
createButtons() {
const mobileView = this.site.mobileView;
if (!mobileView && this.currentUser.get('staff')) {
const viewArgs = {action: 'showTopicAdminMenu', title: 'topic_admin_menu', icon: 'wrench', position: 'absolute'};
this.attachViewWithArgs(viewArgs, 'show-popup-button');
}
const topic = this.get('topic');
if (!topic.get('isPrivateMessage')) {
if (mobileView) {
this.attachViewWithArgs({ topic }, 'topic-footer-mobile-dropdown');
} else {
// We hide some controls from private messages
if (this.get('topic.details.can_invite_to')) {
this.attachViewClass('invite-reply-button');
}
this.attachViewClass('bookmark-button');
this.attachViewClass('share-button');
if (this.get('topic.details.can_flag_topic')) {
this.attachViewClass('flag-topic-button');
}
}
}
if (topic.get('isPrivateMessage')) {
this.attachViewClass('archive-button');
}
if (this.get('topic.details.can_create_post')) {
this.attachViewClass('reply-button');
}
this.trigger('additionalButtons', this);
}
});