2014-12-20 14:26:46 +08:00
|
|
|
import Ember from 'ember';
|
|
|
|
|
|
|
|
export default Ember.Controller.extend({
|
|
|
|
|
|
|
|
// The title of the forum.
|
|
|
|
// TODO: Preload this value in the index.html payload from Laravel config.
|
2015-01-26 09:36:54 +08:00
|
|
|
forumTitle: 'Flarum Demo Forum',
|
2015-01-16 14:56:10 +08:00
|
|
|
|
|
|
|
// The title of the current page. This should be set as appropriate in
|
|
|
|
// controllers/views.
|
2014-12-20 14:26:46 +08:00
|
|
|
pageTitle: '',
|
|
|
|
|
2015-01-16 14:56:10 +08:00
|
|
|
// When either the forum title or the page title changes, we want to
|
|
|
|
// refresh the document's title.
|
|
|
|
updateTitle: function() {
|
2014-12-20 14:26:46 +08:00
|
|
|
var parts = [this.get('forumTitle')];
|
|
|
|
var pageTitle = this.get('pageTitle');
|
2015-01-16 14:56:10 +08:00
|
|
|
if (pageTitle) {
|
|
|
|
parts.unshift(pageTitle);
|
|
|
|
}
|
2014-12-20 14:26:46 +08:00
|
|
|
document.title = parts.join(' - ');
|
|
|
|
}.observes('pageTitle', 'forumTitle'),
|
|
|
|
|
2015-01-16 14:56:10 +08:00
|
|
|
// Whether or not a pane is currently pinned to the side of the interface.
|
|
|
|
panePinned: false,
|
|
|
|
|
2014-12-20 14:26:46 +08:00
|
|
|
searchQuery: '',
|
|
|
|
searchActive: false,
|
|
|
|
|
|
|
|
actions: {
|
|
|
|
search: function(query) {
|
2015-01-16 14:56:10 +08:00
|
|
|
this.transitionToRoute('index', {queryParams: {searchQuery: query, sort: query ? 'relevance' : 'recent'}});
|
|
|
|
}
|
2014-12-20 14:26:46 +08:00
|
|
|
}
|
|
|
|
});
|