Skip to content

Commit

Permalink
Add {{page-title}} to route templates
Browse files Browse the repository at this point in the history
  • Loading branch information
raido committed Oct 23, 2020
1 parent 7c226cc commit 578f450
Show file tree
Hide file tree
Showing 4 changed files with 42 additions and 38 deletions.
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
{{page-title "<%= routeName %>"}}
{{outlet}}
4 changes: 3 additions & 1 deletion blueprints/route/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,13 +73,15 @@ module.exports = useEditionDetector({

locals: function (options) {
let moduleName = options.entity.name;
let rawRouteName = moduleName.split('/').pop();

if (options.resetNamespace) {
moduleName = moduleName.split('/').pop();
moduleName = rawRouteName;
}

return {
moduleName: stringUtil.dasherize(moduleName),
routeName: stringUtil.classify(rawRouteName)
};
},

Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
{{page-title "<%= routeName %>"}}
{{outlet}}
74 changes: 37 additions & 37 deletions node-tests/blueprints/route-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ describe('Blueprint: route', function () {
return emberGenerateDestroy(['route', 'foo'], (_file) => {
expect(_file('app/routes/foo.js')).to.equal(fixture('route/route.js'));

expect(_file('app/templates/foo.hbs')).to.equal('{{outlet}}');
expect(_file('app/templates/foo.hbs')).to.equal('{{page-title "Foo"}}\n{{outlet}}');

expect(_file('tests/unit/routes/foo-test.js')).to.equal(fixture('route-test/default.js'));

Expand All @@ -57,7 +57,7 @@ describe('Blueprint: route', function () {

expect(_file('app/routes/foo.js')).to.equal(fixture('route/route.js'));

expect(_file('app/templates/foo.hbs')).to.equal('{{outlet}}');
expect(_file('app/templates/foo.hbs')).to.equal('{{page-title "Foo"}}\n{{outlet}}');

expect(_file('tests/unit/routes/foo-test.js')).to.equal(fixture('route-test/default.js'));

Expand All @@ -83,7 +83,7 @@ describe('Blueprint: route', function () {
return emberGenerateDestroy(['route', 'foo', '--path=:foo_id/show'], (_file) => {
expect(_file('app/routes/foo.js')).to.equal(fixture('route/route.js'));

expect(_file('app/templates/foo.hbs')).to.equal('{{outlet}}');
expect(_file('app/templates/foo.hbs')).to.equal('{{page-title "Foo"}}\n{{outlet}}');

expect(_file('tests/unit/routes/foo-test.js')).to.equal(fixture('route-test/default.js'));

Expand All @@ -102,7 +102,7 @@ describe('Blueprint: route', function () {
return emberGenerateDestroy(['route', 'parent/child', '--reset-namespace'], (_file) => {
expect(_file('app/routes/child.js')).to.equal(fixture('route/route-child.js'));

expect(_file('app/templates/child.hbs')).to.equal('{{outlet}}');
expect(_file('app/templates/child.hbs')).to.equal('{{page-title "Child"}}\n{{outlet}}');

expect(_file('tests/unit/routes/child-test.js')).to.equal(
fixture('route-test/default-child.js')
Expand All @@ -122,7 +122,7 @@ describe('Blueprint: route', function () {
(_file) => {
expect(_file('app/child/route.js')).to.equal(fixture('route/route-child.js'));

expect(_file('app/child/template.hbs')).to.equal('{{outlet}}');
expect(_file('app/child/template.hbs')).to.equal('{{page-title "Child"}}\n{{outlet}}');

expect(_file('tests/unit/child/route-test.js')).to.equal(
fixture('route-test/default-child.js')
Expand Down Expand Up @@ -172,7 +172,7 @@ describe('Blueprint: route', function () {

expect(_file('app/foo/route.js')).to.equal(fixture('route/route.js'));

expect(_file('app/foo/template.hbs')).to.equal('{{outlet}}');
expect(_file('app/foo/template.hbs')).to.equal('{{page-title "Foo"}}\n{{outlet}}');

expect(_file('tests/unit/foo/route-test.js')).to.equal(fixture('route-test/default.js'));

Expand All @@ -187,7 +187,7 @@ describe('Blueprint: route', function () {
return emberGenerateDestroy(['route', 'foo.js', '--pod'], (_file) => {
expect(_file('app/foo/route.js')).to.equal(fixture('route/route.js'));

expect(_file('app/foo/template.hbs')).to.equal('{{outlet}}');
expect(_file('app/foo/template.hbs')).to.equal('{{page-title "Foo"}}\n{{outlet}}');

expect(_file('tests/unit/foo/route-test.js')).to.equal(fixture('route-test/default.js'));

Expand Down Expand Up @@ -243,7 +243,7 @@ describe('Blueprint: route', function () {
return emberGenerateDestroy(['route', 'foo', '--pod'], (_file) => {
expect(_file('app/pods/foo/route.js')).to.equal(fixture('route/route.js'));

expect(_file('app/pods/foo/template.hbs')).to.equal('{{outlet}}');
expect(_file('app/pods/foo/template.hbs')).to.equal('{{page-title "Foo"}}\n{{outlet}}');

expect(_file('tests/unit/pods/foo/route-test.js')).to.equal(
fixture('route-test/default.js')
Expand All @@ -263,7 +263,7 @@ describe('Blueprint: route', function () {

expect(_file('app/pods/foo/route.js')).to.equal(fixture('route/route.js'));

expect(_file('app/pods/foo/template.hbs')).to.equal('{{outlet}}');
expect(_file('app/pods/foo/template.hbs')).to.equal('{{page-title "Foo"}}\n{{outlet}}');

expect(_file('tests/unit/pods/foo/route-test.js')).to.equal(
fixture('route-test/default.js')
Expand Down Expand Up @@ -294,7 +294,7 @@ describe('Blueprint: route', function () {
return emberGenerateDestroy(['route', 'foo'], (_file) => {
expect(_file('addon/routes/foo.js')).to.equal(fixture('route/route.js'));

expect(_file('addon/templates/foo.hbs')).to.equal('{{outlet}}');
expect(_file('addon/templates/foo.hbs')).to.equal('{{page-title "Foo"}}\n{{outlet}}');

expect(_file('app/routes/foo.js')).to.contain(
"export { default } from 'my-addon/routes/foo';"
Expand Down Expand Up @@ -322,7 +322,7 @@ describe('Blueprint: route', function () {

expect(_file('addon/routes/foo.js')).to.equal(fixture('route/route.js'));

expect(_file('addon/templates/foo.hbs')).to.equal('{{outlet}}');
expect(_file('addon/templates/foo.hbs')).to.equal('{{page-title "Foo"}}\n{{outlet}}');

expect(_file('app/routes/foo.js')).to.contain(
"export { default } from 'my-addon/routes/foo';"
Expand All @@ -345,7 +345,7 @@ describe('Blueprint: route', function () {
return emberGenerateDestroy(['route', 'foo/bar'], (_file) => {
expect(_file('addon/routes/foo/bar.js')).to.equal(fixture('route/route-nested.js'));

expect(_file('addon/templates/foo/bar.hbs')).to.equal('{{outlet}}');
expect(_file('addon/templates/foo/bar.hbs')).to.equal('{{page-title "Bar"}}\n{{outlet}}');

expect(_file('app/routes/foo/bar.js')).to.contain(
"export { default } from 'my-addon/routes/foo/bar';"
Expand All @@ -369,7 +369,7 @@ describe('Blueprint: route', function () {
return emberGenerateDestroy(['route', 'foo', '--dummy'], (_file) => {
expect(_file('tests/dummy/app/routes/foo.js')).to.equal(fixture('route/route.js'));

expect(_file('tests/dummy/app/templates/foo.hbs')).to.equal('{{outlet}}');
expect(_file('tests/dummy/app/templates/foo.hbs')).to.equal('{{page-title "Foo"}}\n{{outlet}}');

expect(_file('app/routes/foo.js')).to.not.exist;
expect(_file('app/templates/foo.hbs')).to.not.exist;
Expand All @@ -388,7 +388,7 @@ describe('Blueprint: route', function () {

expect(_file('tests/dummy/app/routes/foo.js')).to.equal(fixture('route/route.js'));

expect(_file('tests/dummy/app/templates/foo.hbs')).to.equal('{{outlet}}');
expect(_file('tests/dummy/app/templates/foo.hbs')).to.equal('{{page-title "Foo"}}\n{{outlet}}');

expect(_file('app/routes/foo.js')).to.not.exist;
expect(_file('app/templates/foo.hbs')).to.not.exist;
Expand All @@ -407,7 +407,7 @@ describe('Blueprint: route', function () {
fixture('route/route-nested.js')
);

expect(_file('tests/dummy/app/templates/foo/bar.hbs')).to.equal('{{outlet}}');
expect(_file('tests/dummy/app/templates/foo/bar.hbs')).to.equal('{{page-title "Bar"}}\n{{outlet}}');

expect(_file('app/routes/foo/bar.js')).to.not.exist;
expect(_file('app/templates/foo/bar.hbs')).to.not.exist;
Expand All @@ -425,7 +425,7 @@ describe('Blueprint: route', function () {
return emberGenerateDestroy(['route', 'foo', '--pod'], (_file) => {
expect(_file('addon/foo/route.js')).to.equal(fixture('route/route.js'));

expect(_file('addon/foo/template.hbs')).to.equal('{{outlet}}');
expect(_file('addon/foo/template.hbs')).to.equal('{{page-title "Foo"}}\n{{outlet}}');

expect(_file('app/foo/route.js')).to.contain(
"export { default } from 'my-addon/foo/route';"
Expand All @@ -449,7 +449,7 @@ describe('Blueprint: route', function () {

expect(_file('addon/foo/route.js')).to.equal(fixture('route/route.js'));

expect(_file('addon/foo/template.hbs')).to.equal('{{outlet}}');
expect(_file('addon/foo/template.hbs')).to.equal('{{page-title "Foo"}}\n{{outlet}}');

expect(_file('app/foo/route.js')).to.contain(
"export { default } from 'my-addon/foo/route';"
Expand Down Expand Up @@ -482,7 +482,7 @@ describe('Blueprint: route', function () {
return emberGenerateDestroy(['route', 'foo'], (_file) => {
expect(_file('app/routes/foo.js')).to.equal(fixture('route/native-route.js'));

expect(_file('app/templates/foo.hbs')).to.equal('{{outlet}}');
expect(_file('app/templates/foo.hbs')).to.equal('{{page-title "Foo"}}\n{{outlet}}');

expect(_file('tests/unit/routes/foo-test.js')).to.equal(fixture('route-test/default.js'));

Expand All @@ -500,7 +500,7 @@ describe('Blueprint: route', function () {

expect(_file('app/routes/foo.js')).to.equal(fixture('route/native-route.js'));

expect(_file('app/templates/foo.hbs')).to.equal('{{outlet}}');
expect(_file('app/templates/foo.hbs')).to.equal('{{page-title "Foo"}}\n{{outlet}}');

expect(_file('tests/unit/routes/foo-test.js')).to.equal(fixture('route-test/default.js'));

Expand All @@ -526,7 +526,7 @@ describe('Blueprint: route', function () {
return emberGenerateDestroy(['route', 'foo', '--path=:foo_id/show'], (_file) => {
expect(_file('app/routes/foo.js')).to.equal(fixture('route/native-route.js'));

expect(_file('app/templates/foo.hbs')).to.equal('{{outlet}}');
expect(_file('app/templates/foo.hbs')).to.equal('{{page-title "Foo"}}\n{{outlet}}');

expect(_file('tests/unit/routes/foo-test.js')).to.equal(fixture('route-test/default.js'));

Expand All @@ -545,7 +545,7 @@ describe('Blueprint: route', function () {
return emberGenerateDestroy(['route', 'parent/child', '--reset-namespace'], (_file) => {
expect(_file('app/routes/child.js')).to.equal(fixture('route/native-route-child.js'));

expect(_file('app/templates/child.hbs')).to.equal('{{outlet}}');
expect(_file('app/templates/child.hbs')).to.equal('{{page-title "Child"}}\n{{outlet}}');

expect(_file('tests/unit/routes/child-test.js')).to.equal(
fixture('route-test/default-child.js')
Expand All @@ -565,7 +565,7 @@ describe('Blueprint: route', function () {
(_file) => {
expect(_file('app/child/route.js')).to.equal(fixture('route/native-route-child.js'));

expect(_file('app/child/template.hbs')).to.equal('{{outlet}}');
expect(_file('app/child/template.hbs')).to.equal('{{page-title "Child"}}\n{{outlet}}');

expect(_file('tests/unit/child/route-test.js')).to.equal(
fixture('route-test/default-child.js')
Expand Down Expand Up @@ -611,7 +611,7 @@ describe('Blueprint: route', function () {
return emberGenerateDestroy(['route', 'foo', '--pod'], (_file) => {
expect(_file('app/foo/route.js')).to.equal(fixture('route/native-route.js'));

expect(_file('app/foo/template.hbs')).to.equal('{{outlet}}');
expect(_file('app/foo/template.hbs')).to.equal('{{page-title "Foo"}}\n{{outlet}}');

expect(_file('tests/unit/foo/route-test.js')).to.equal(fixture('route-test/default.js'));

Expand All @@ -629,7 +629,7 @@ describe('Blueprint: route', function () {

expect(_file('app/foo/route.js')).to.equal(fixture('route/native-route.js'));

expect(_file('app/foo/template.hbs')).to.equal('{{outlet}}');
expect(_file('app/foo/template.hbs')).to.equal('{{page-title "Foo"}}\n{{outlet}}');

expect(_file('tests/unit/foo/route-test.js')).to.equal(fixture('route-test/default.js'));

Expand Down Expand Up @@ -686,7 +686,7 @@ describe('Blueprint: route', function () {
return emberGenerateDestroy(['route', 'foo', '--pod'], (_file) => {
expect(_file('app/pods/foo/route.js')).to.equal(fixture('route/native-route.js'));

expect(_file('app/pods/foo/template.hbs')).to.equal('{{outlet}}');
expect(_file('app/pods/foo/template.hbs')).to.equal('{{page-title "Foo"}}\n{{outlet}}');

expect(_file('tests/unit/pods/foo/route-test.js')).to.equal(
fixture('route-test/default.js')
Expand All @@ -706,7 +706,7 @@ describe('Blueprint: route', function () {

expect(_file('app/pods/foo/route.js')).to.equal(fixture('route/native-route.js'));

expect(_file('app/pods/foo/template.hbs')).to.equal('{{outlet}}');
expect(_file('app/pods/foo/template.hbs')).to.equal('{{page-title "Foo"}}\n{{outlet}}');

expect(_file('tests/unit/pods/foo/route-test.js')).to.equal(
fixture('route-test/default.js')
Expand Down Expand Up @@ -739,7 +739,7 @@ describe('Blueprint: route', function () {
return emberGenerateDestroy(['route', 'foo'], (_file) => {
expect(_file('addon/routes/foo.js')).to.equal(fixture('route/native-route.js'));

expect(_file('addon/templates/foo.hbs')).to.equal('{{outlet}}');
expect(_file('addon/templates/foo.hbs')).to.equal('{{page-title "Foo"}}\n{{outlet}}');

expect(_file('app/routes/foo.js')).to.contain(
"export { default } from 'my-addon/routes/foo';"
Expand Down Expand Up @@ -767,7 +767,7 @@ describe('Blueprint: route', function () {

expect(_file('addon/routes/foo.js')).to.equal(fixture('route/native-route.js'));

expect(_file('addon/templates/foo.hbs')).to.equal('{{outlet}}');
expect(_file('addon/templates/foo.hbs')).to.equal('{{page-title "Foo"}}\n{{outlet}}');

expect(_file('app/routes/foo.js')).to.contain(
"export { default } from 'my-addon/routes/foo';"
Expand All @@ -790,7 +790,7 @@ describe('Blueprint: route', function () {
return emberGenerateDestroy(['route', 'foo/bar'], (_file) => {
expect(_file('addon/routes/foo/bar.js')).to.equal(fixture('route/native-route-nested.js'));

expect(_file('addon/templates/foo/bar.hbs')).to.equal('{{outlet}}');
expect(_file('addon/templates/foo/bar.hbs')).to.equal('{{page-title "Bar"}}\n{{outlet}}');

expect(_file('app/routes/foo/bar.js')).to.contain(
"export { default } from 'my-addon/routes/foo/bar';"
Expand All @@ -814,7 +814,7 @@ describe('Blueprint: route', function () {
return emberGenerateDestroy(['route', 'foo', '--dummy'], (_file) => {
expect(_file('tests/dummy/app/routes/foo.js')).to.equal(fixture('route/native-route.js'));

expect(_file('tests/dummy/app/templates/foo.hbs')).to.equal('{{outlet}}');
expect(_file('tests/dummy/app/templates/foo.hbs')).to.equal('{{page-title "Foo"}}\n{{outlet}}');

expect(_file('app/routes/foo.js')).to.not.exist;
expect(_file('app/templates/foo.hbs')).to.not.exist;
Expand All @@ -833,7 +833,7 @@ describe('Blueprint: route', function () {

expect(_file('tests/dummy/app/routes/foo.js')).to.equal(fixture('route/native-route.js'));

expect(_file('tests/dummy/app/templates/foo.hbs')).to.equal('{{outlet}}');
expect(_file('tests/dummy/app/templates/foo.hbs')).to.equal('{{page-title "Foo"}}\n{{outlet}}');

expect(_file('app/routes/foo.js')).to.not.exist;
expect(_file('app/templates/foo.hbs')).to.not.exist;
Expand All @@ -852,7 +852,7 @@ describe('Blueprint: route', function () {
fixture('route/native-route-nested.js')
);

expect(_file('tests/dummy/app/templates/foo/bar.hbs')).to.equal('{{outlet}}');
expect(_file('tests/dummy/app/templates/foo/bar.hbs')).to.equal('{{page-title "Bar"}}\n{{outlet}}');

expect(_file('app/routes/foo/bar.js')).to.not.exist;
expect(_file('app/templates/foo/bar.hbs')).to.not.exist;
Expand All @@ -870,7 +870,7 @@ describe('Blueprint: route', function () {
return emberGenerateDestroy(['route', 'foo', '--pod'], (_file) => {
expect(_file('addon/foo/route.js')).to.equal(fixture('route/native-route.js'));

expect(_file('addon/foo/template.hbs')).to.equal('{{outlet}}');
expect(_file('addon/foo/template.hbs')).to.equal('{{page-title "Foo"}}\n{{outlet}}');

expect(_file('app/foo/route.js')).to.contain(
"export { default } from 'my-addon/foo/route';"
Expand All @@ -894,7 +894,7 @@ describe('Blueprint: route', function () {

expect(_file('addon/foo/route.js')).to.equal(fixture('route/native-route.js'));

expect(_file('addon/foo/template.hbs')).to.equal('{{outlet}}');
expect(_file('addon/foo/template.hbs')).to.equal('{{page-title "Foo"}}\n{{outlet}}');

expect(_file('app/foo/route.js')).to.contain(
"export { default } from 'my-addon/foo/route';"
Expand Down Expand Up @@ -925,7 +925,7 @@ describe('Blueprint: route', function () {
return emberGenerateDestroy(['route', 'foo', '--in-repo-addon=my-addon'], (_file) => {
expect(_file('lib/my-addon/addon/routes/foo.js')).to.equal(fixture('route/route.js'));

expect(_file('lib/my-addon/addon/templates/foo.hbs')).to.equal('{{outlet}}');
expect(_file('lib/my-addon/addon/templates/foo.hbs')).to.equal('{{page-title "Foo"}}\n{{outlet}}');

expect(_file('lib/my-addon/app/routes/foo.js')).to.contain(
"export { default } from 'my-addon/routes/foo';"
Expand All @@ -949,7 +949,7 @@ describe('Blueprint: route', function () {

expect(_file('lib/my-addon/addon/routes/foo.js')).to.equal(fixture('route/route.js'));

expect(_file('lib/my-addon/addon/templates/foo.hbs')).to.equal('{{outlet}}');
expect(_file('lib/my-addon/addon/templates/foo.hbs')).to.equal('{{page-title "Foo"}}\n{{outlet}}');

expect(_file('lib/my-addon/app/routes/foo.js')).to.contain(
"export { default } from 'my-addon/routes/foo';"
Expand All @@ -969,7 +969,7 @@ describe('Blueprint: route', function () {
fixture('route/route-nested.js')
);

expect(_file('lib/my-addon/addon/templates/foo/bar.hbs')).to.equal('{{outlet}}');
expect(_file('lib/my-addon/addon/templates/foo/bar.hbs')).to.equal('{{page-title "Bar"}}\n{{outlet}}');

expect(_file('lib/my-addon/app/routes/foo/bar.js')).to.contain(
"export { default } from 'my-addon/routes/foo/bar';"
Expand Down

0 comments on commit 578f450

Please sign in to comment.