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/controllers/header_controller.js

42 lines
890 B
JavaScript

/**
This controller supports actions on the site header
@class HeaderController
@extends Discourse.Controller
@namespace Discourse
@module Discourse
**/
Discourse.HeaderController = Discourse.Controller.extend({
topic: null,
showExtraInfo: null,
toggleStar: function() {
var topic = this.get('topic');
if (topic) topic.toggleStar();
return false;
},
categories: function() {
return Discourse.Category.list();
}.property(),
showFavoriteButton: function() {
return this.get('currentUser') && !this.get('topic.isPrivateMessage');
}.property('currentUser', 'topic.isPrivateMessage'),
mobileDevice: function() {
return Discourse.Mobile.isMobileDevice;
}.property(),
mobileView: function() {
return Discourse.Mobile.mobileView;
}.property(),
toggleMobileView: function() {
Discourse.Mobile.toggleMobileView();
}
});