diff --git a/framework/core/js/forum/src/components/activity-page.js b/framework/core/js/forum/src/components/activity-page.js index e1a40d5f1..d45bc40e7 100644 --- a/framework/core/js/forum/src/components/activity-page.js +++ b/framework/core/js/forum/src/components/activity-page.js @@ -9,7 +9,6 @@ export default class ActivityPage extends UserPage { constructor(props) { super(props); - this.user = m.prop(); this.loading = m.prop(true); this.moreResults = m.prop(false); this.activity = m.prop([]); @@ -30,7 +29,7 @@ export default class ActivityPage extends UserPage { setupUser(user) { m.startComputation(); - this.user(user); + super.setupUser(user); m.endComputation(); this.refresh(); diff --git a/framework/core/js/forum/src/components/discussion-page.js b/framework/core/js/forum/src/components/discussion-page.js index 607d2eae3..cceaa54ab 100644 --- a/framework/core/js/forum/src/components/discussion-page.js +++ b/framework/core/js/forum/src/components/discussion-page.js @@ -91,6 +91,8 @@ export default class DiscussionPage extends Component { // } this.streamContent.goToNumber(this.currentNear, true); + + app.setTitle(discussion.title()); } onload(element, isInitialized, context) { diff --git a/framework/core/js/forum/src/components/index-page.js b/framework/core/js/forum/src/components/index-page.js index 2d87b12f1..c19234e8f 100644 --- a/framework/core/js/forum/src/components/index-page.js +++ b/framework/core/js/forum/src/components/index-page.js @@ -142,6 +142,8 @@ export default class IndexPage extends Component { } } } + + app.setTitle(''); } newDiscussion() { diff --git a/framework/core/js/forum/src/components/settings-page.js b/framework/core/js/forum/src/components/settings-page.js index 6116ea717..3245c2f40 100644 --- a/framework/core/js/forum/src/components/settings-page.js +++ b/framework/core/js/forum/src/components/settings-page.js @@ -14,7 +14,8 @@ export default class SettingsPage extends UserPage { constructor(props) { super(props); - this.user = app.session.user; + this.setupUser(app.session.user()); + app.setTitle('Settings'); } content() { diff --git a/framework/core/js/forum/src/components/user-page.js b/framework/core/js/forum/src/components/user-page.js index d05694113..bc4ba6c8f 100644 --- a/framework/core/js/forum/src/components/user-page.js +++ b/framework/core/js/forum/src/components/user-page.js @@ -21,6 +21,8 @@ export default class UserPage extends Component { constructor(props) { super(props); + this.user = m.prop(); + app.history.push('user'); app.current = this; } @@ -30,6 +32,8 @@ export default class UserPage extends Component { */ setupUser(user) { this.user(user); + + app.setTitle(user.username()); } onload(element, isInitialized, context) { diff --git a/framework/core/js/lib/utils/app.js b/framework/core/js/lib/utils/app.js index e51ed4a18..b4b2f0856 100644 --- a/framework/core/js/lib/utils/app.js +++ b/framework/core/js/lib/utils/app.js @@ -10,6 +10,10 @@ class App { this.initializers.toArray().forEach((initializer) => initializer(this)); } + setTitle(title) { + document.title = (title ? title+' - ' : '')+this.config['forum_title']; + } + route(name, params) { var url = this.routes[name][0].replace(/:([^\/]+)/g, function(m, t) { var value = params[t];