mirror of
https://github.com/flarum/framework.git
synced 2024-12-04 08:13:39 +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) {
|
constructor(props) {
|
||||||
super(props);
|
super(props);
|
||||||
|
|
||||||
this.user = m.prop();
|
|
||||||
this.loading = m.prop(true);
|
this.loading = m.prop(true);
|
||||||
this.moreResults = m.prop(false);
|
this.moreResults = m.prop(false);
|
||||||
this.activity = m.prop([]);
|
this.activity = m.prop([]);
|
||||||
|
@ -30,7 +29,7 @@ export default class ActivityPage extends UserPage {
|
||||||
|
|
||||||
setupUser(user) {
|
setupUser(user) {
|
||||||
m.startComputation();
|
m.startComputation();
|
||||||
this.user(user);
|
super.setupUser(user);
|
||||||
m.endComputation();
|
m.endComputation();
|
||||||
|
|
||||||
this.refresh();
|
this.refresh();
|
||||||
|
|
|
@ -91,6 +91,8 @@ export default class DiscussionPage extends Component {
|
||||||
// }
|
// }
|
||||||
|
|
||||||
this.streamContent.goToNumber(this.currentNear, true);
|
this.streamContent.goToNumber(this.currentNear, true);
|
||||||
|
|
||||||
|
app.setTitle(discussion.title());
|
||||||
}
|
}
|
||||||
|
|
||||||
onload(element, isInitialized, context) {
|
onload(element, isInitialized, context) {
|
||||||
|
|
|
@ -142,6 +142,8 @@ export default class IndexPage extends Component {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
app.setTitle('');
|
||||||
}
|
}
|
||||||
|
|
||||||
newDiscussion() {
|
newDiscussion() {
|
||||||
|
|
|
@ -14,7 +14,8 @@ export default class SettingsPage extends UserPage {
|
||||||
constructor(props) {
|
constructor(props) {
|
||||||
super(props);
|
super(props);
|
||||||
|
|
||||||
this.user = app.session.user;
|
this.setupUser(app.session.user());
|
||||||
|
app.setTitle('Settings');
|
||||||
}
|
}
|
||||||
|
|
||||||
content() {
|
content() {
|
||||||
|
|
|
@ -21,6 +21,8 @@ export default class UserPage extends Component {
|
||||||
constructor(props) {
|
constructor(props) {
|
||||||
super(props);
|
super(props);
|
||||||
|
|
||||||
|
this.user = m.prop();
|
||||||
|
|
||||||
app.history.push('user');
|
app.history.push('user');
|
||||||
app.current = this;
|
app.current = this;
|
||||||
}
|
}
|
||||||
|
@ -30,6 +32,8 @@ export default class UserPage extends Component {
|
||||||
*/
|
*/
|
||||||
setupUser(user) {
|
setupUser(user) {
|
||||||
this.user(user);
|
this.user(user);
|
||||||
|
|
||||||
|
app.setTitle(user.username());
|
||||||
}
|
}
|
||||||
|
|
||||||
onload(element, isInitialized, context) {
|
onload(element, isInitialized, context) {
|
||||||
|
|
|
@ -10,6 +10,10 @@ class App {
|
||||||
this.initializers.toArray().forEach((initializer) => initializer(this));
|
this.initializers.toArray().forEach((initializer) => initializer(this));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
setTitle(title) {
|
||||||
|
document.title = (title ? title+' - ' : '')+this.config['forum_title'];
|
||||||
|
}
|
||||||
|
|
||||||
route(name, params) {
|
route(name, params) {
|
||||||
var url = this.routes[name][0].replace(/:([^\/]+)/g, function(m, t) {
|
var url = this.routes[name][0].replace(/:([^\/]+)/g, function(m, t) {
|
||||||
var value = params[t];
|
var value = params[t];
|
||||||
|
|
Loading…
Reference in New Issue
Block a user