From 779083de56aa8ef199fc861a93626ea9904976e8 Mon Sep 17 00:00:00 2001 From: Praveen Gandhi Date: Sat, 28 Mar 2020 17:28:02 +0530 Subject: [PATCH 1/4] feat: add option for app-with-router --- app-with-router/src/about.html | 1 + app-with-router/src/missing.ext | 8 ++++++++ app-with-router/src/missing.html | 1 + app-with-router/src/my-app.css__if_css | 17 +++++++++++++++++ app-with-router/src/my-app.html | 14 ++++++++++++++ app-with-router/src/my-app.less__if_less | 18 ++++++++++++++++++ app-with-router/src/my-app.scss__if_sass | 18 ++++++++++++++++++ app-with-router/src/welcome.ext | 3 +++ app-with-router/src/welcome.html | 1 + {app-min => common}/src/main.ext | 5 ++++- {app-min => common}/src/my-app.ext | 0 .../src/resource.d.ts__if_typescript | 0 questions.js | 5 ++--- 13 files changed, 87 insertions(+), 4 deletions(-) create mode 100644 app-with-router/src/about.html create mode 100644 app-with-router/src/missing.ext create mode 100644 app-with-router/src/missing.html create mode 100644 app-with-router/src/my-app.css__if_css create mode 100644 app-with-router/src/my-app.html create mode 100644 app-with-router/src/my-app.less__if_less create mode 100644 app-with-router/src/my-app.scss__if_sass create mode 100644 app-with-router/src/welcome.ext create mode 100644 app-with-router/src/welcome.html rename {app-min => common}/src/main.ext (69%) rename {app-min => common}/src/my-app.ext (100%) rename {app-min => common}/src/resource.d.ts__if_typescript (100%) diff --git a/app-with-router/src/about.html b/app-with-router/src/about.html new file mode 100644 index 0000000..23d7a8a --- /dev/null +++ b/app-with-router/src/about.html @@ -0,0 +1 @@ +

This is the page about the app.

diff --git a/app-with-router/src/missing.ext b/app-with-router/src/missing.ext new file mode 100644 index 0000000..ad8ebfa --- /dev/null +++ b/app-with-router/src/missing.ext @@ -0,0 +1,8 @@ +export class Missing { + /* @if typescript */public /* @endif */static parameters = ['id']; + /* @if typescript */public /* @endif */missingComponent/* @if typescript */: string /* @endif */; + + /* @if typescript */public /* @endif */enter(parameters) { + this.missingComponent = parameters.id; + } +} diff --git a/app-with-router/src/missing.html b/app-with-router/src/missing.html new file mode 100644 index 0000000..a367118 --- /dev/null +++ b/app-with-router/src/missing.html @@ -0,0 +1 @@ +

Ouch! Couldn't find '${missingComponent}'!

diff --git a/app-with-router/src/my-app.css__if_css b/app-with-router/src/my-app.css__if_css new file mode 100644 index 0000000..8d81831 --- /dev/null +++ b/app-with-router/src/my-app.css__if_css @@ -0,0 +1,17 @@ +nav { + background: #eee; + display: flex; +} + +a { + padding: 10px; + text-decoration: none; + color: black; +} +a:hover { + background-color: darkgray; +} + +.goto-active { + background-color: lightgray; +} diff --git a/app-with-router/src/my-app.html b/app-with-router/src/my-app.html new file mode 100644 index 0000000..8c7756a --- /dev/null +++ b/app-with-router/src/my-app.html @@ -0,0 +1,14 @@ + + + + + + + + +
+ THIS IS THE FOOTER +
diff --git a/app-with-router/src/my-app.less__if_less b/app-with-router/src/my-app.less__if_less new file mode 100644 index 0000000..86b1dff --- /dev/null +++ b/app-with-router/src/my-app.less__if_less @@ -0,0 +1,18 @@ +nav { + background: #eee; + display: flex; +} + +a { + padding: 10px; + text-decoration: none; + color: black; + + &:hover { + background-color: darkgray; + } +} + +.goto-active { + background-color: lightgray; +} diff --git a/app-with-router/src/my-app.scss__if_sass b/app-with-router/src/my-app.scss__if_sass new file mode 100644 index 0000000..a883c25 --- /dev/null +++ b/app-with-router/src/my-app.scss__if_sass @@ -0,0 +1,18 @@ +nav { + background: #eee; + display: flex; +} + +a { + padding: 10px; + text-decoration: none; + color: black; + + &:hover { + background-color: darkgray; + } +} + +.goto-active { + background-color: lightgray; +} diff --git a/app-with-router/src/welcome.ext b/app-with-router/src/welcome.ext new file mode 100644 index 0000000..fbe7641 --- /dev/null +++ b/app-with-router/src/welcome.ext @@ -0,0 +1,3 @@ +export class Welcome { + /* @if typescript */public /* @endif */message = 'Welcome to the Aurelia 2 app with routing!'; +} diff --git a/app-with-router/src/welcome.html b/app-with-router/src/welcome.html new file mode 100644 index 0000000..5a2728e --- /dev/null +++ b/app-with-router/src/welcome.html @@ -0,0 +1 @@ +

${message}

diff --git a/app-min/src/main.ext b/common/src/main.ext similarity index 69% rename from app-min/src/main.ext rename to common/src/main.ext index 2fc2553..d3822fb 100644 --- a/app-min/src/main.ext +++ b/common/src/main.ext @@ -2,7 +2,7 @@ // Promise polyfill for old browsers import 'promise-polyfill/lib/polyfill'; // @endif -import Aurelia/* @if shadow-dom *//*, { StyleConfiguration }*//* @endif */ from 'aurelia'; +import Aurelia/* @if shadow-dom || app-with-router */, { /* @endif *//* @if app-with-router */RouterConfiguration/* @endif *//* @if shadow-dom *//*, StyleConfiguration*//* @endif *//* @if shadow-dom || app-with-router */ }/* @endif */ from 'aurelia'; import { MyApp } from './my-app'; // @if shadow-dom // @if webpack @@ -22,5 +22,8 @@ Aurelia })) */ // @endif + // @if app-with-router + .register(RouterConfiguration) + // @endif .app(MyApp) .start(); diff --git a/app-min/src/my-app.ext b/common/src/my-app.ext similarity index 100% rename from app-min/src/my-app.ext rename to common/src/my-app.ext diff --git a/app-min/src/resource.d.ts__if_typescript b/common/src/resource.d.ts__if_typescript similarity index 100% rename from app-min/src/resource.d.ts__if_typescript rename to common/src/resource.d.ts__if_typescript diff --git a/questions.js b/questions.js index 1471cfc..c349a37 100644 --- a/questions.js +++ b/questions.js @@ -72,12 +72,11 @@ module.exports = [ {value: 'cypress', title: 'Yes (Cypress)', hint: 'Cypress offers fast, easy and reliable testing for anything that runs in a browser.'} ] }, - // This question is not raised to end user, since there is only one choice, it will be selected automatically. - // We will add more sample code in future. { message: 'What kind of sample code do you want in this project?', choices: [ - {value: 'app-min', title: 'Bare minimum'} + {value: 'app-min', title: 'Bare minimum'}, + {value: 'app-with-router', title: 'App With Router', hint: 'Application with navigation setup using conventional routing'} ] }, // Currently this question is not visible to end user because there is only one option. From 019e62ea5702505e4a597d38f4b9c8b9c58f7a78 Mon Sep 17 00:00:00 2001 From: Praveen Gandhi Date: Sun, 29 Mar 2020 12:13:07 +0530 Subject: [PATCH 2/4] fix: review comments addressed --- app-with-router/src/my-app.html | 4 ---- app-with-router/src/my-app.scss__if_sass | 4 ++-- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/app-with-router/src/my-app.html b/app-with-router/src/my-app.html index 8c7756a..142a679 100644 --- a/app-with-router/src/my-app.html +++ b/app-with-router/src/my-app.html @@ -8,7 +8,3 @@ - -
- THIS IS THE FOOTER -
diff --git a/app-with-router/src/my-app.scss__if_sass b/app-with-router/src/my-app.scss__if_sass index a883c25..902c57e 100644 --- a/app-with-router/src/my-app.scss__if_sass +++ b/app-with-router/src/my-app.scss__if_sass @@ -7,8 +7,8 @@ a { padding: 10px; text-decoration: none; color: black; - - &:hover { + + &:hover { background-color: darkgray; } } From 0011c9e94c13931a5c229acdb3f8bbb019bbd83a Mon Sep 17 00:00:00 2001 From: Praveen Gandhi Date: Sun, 29 Mar 2020 12:19:10 +0530 Subject: [PATCH 3/4] fix: review comments addressed (intendation) --- app-with-router/src/my-app.scss__if_sass | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/app-with-router/src/my-app.scss__if_sass b/app-with-router/src/my-app.scss__if_sass index 902c57e..673068c 100644 --- a/app-with-router/src/my-app.scss__if_sass +++ b/app-with-router/src/my-app.scss__if_sass @@ -1,18 +1,19 @@ nav { - background: #eee; - display: flex; + background: #eee; + display: flex; } a { - padding: 10px; - text-decoration: none; - color: black; + padding: 10px; + text-decoration: none; + color: black; + + &:hover { + background-color: darkgray; + } - &:hover { - background-color: darkgray; - } } .goto-active { - background-color: lightgray; -} + background-color: lightgray; +} \ No newline at end of file From 1cf596cc8058acbf41e64befc36d64404f4b05c6 Mon Sep 17 00:00:00 2001 From: Praveen Gandhi Date: Sun, 29 Mar 2020 12:25:19 +0530 Subject: [PATCH 4/4] fix: added the missing new line at end of file --- app-with-router/src/my-app.scss__if_sass | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app-with-router/src/my-app.scss__if_sass b/app-with-router/src/my-app.scss__if_sass index 673068c..7738ac9 100644 --- a/app-with-router/src/my-app.scss__if_sass +++ b/app-with-router/src/my-app.scss__if_sass @@ -16,4 +16,4 @@ a { .goto-active { background-color: lightgray; -} \ No newline at end of file +}