-
-
Notifications
You must be signed in to change notification settings - Fork 115
/
Copy pathapplication.js
52 lines (46 loc) · 1.34 KB
/
application.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
import { inject as service } from '@ember/service';
import Route from '@ember/routing/route';
import { set } from '@ember/object';
import ENV from 'ember-api-docs/config/environment';
import getCompactVersion from 'ember-api-docs/utils/get-compact-version';
export default class ApplicationRoute extends Route {
@service
headData;
@service
legacyModuleMappings;
title() {
let entity = this.headData.modelName;
let version = this.headData.modelVersion;
if (!entity) {
entity = 'Ember';
}
if (version) {
const compactVersion = getCompactVersion(version);
const title = `${[entity, compactVersion].join(
' - '
)} - Ember API Documentation`;
set(this, 'headData.title', title);
return title;
}
return '';
}
async afterModel() {
set(this, 'headData.cdnDomain', ENV.API_HOST);
await this.legacyModuleMappings.initMappings();
let entity = this.headData.modelName;
let version = this.headData.modelVersion;
if (!entity) {
entity = 'Ember';
}
if (version) {
const compactVersion = getCompactVersion(version);
const title = `${[entity, compactVersion].join(
' - '
)} - Ember API Documentation`;
set(this, 'headData.title', title);
return title;
}
return '';
return super.afterModel(...arguments);
}
}