mirror of
https://github.com/flarum/framework.git
synced 2024-12-04 00:03:37 +08:00
Set document.title on every page
This commit is contained in:
parent
39dd2f9b9b
commit
d7facbd90a
|
@ -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();
|
||||
|
|
|
@ -91,6 +91,8 @@ export default class DiscussionPage extends Component {
|
|||
// }
|
||||
|
||||
this.streamContent.goToNumber(this.currentNear, true);
|
||||
|
||||
app.setTitle(discussion.title());
|
||||
}
|
||||
|
||||
onload(element, isInitialized, context) {
|
||||
|
|
|
@ -142,6 +142,8 @@ export default class IndexPage extends Component {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
app.setTitle('');
|
||||
}
|
||||
|
||||
newDiscussion() {
|
||||
|
|
|
@ -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() {
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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];
|
||||
|
|
Loading…
Reference in New Issue
Block a user