Skip to content

Commit 084aa6a

Browse files
author
Kevin Schaaf
committed
Refactor bookplate skeleton per best-practice structure.
DCO-1.1-Signed-Off-By: Kevin Schaaf <[email protected]>
1 parent 3052a4e commit 084aa6a

File tree

15 files changed

+120
-28
lines changed

15 files changed

+120
-28
lines changed

debug.html

-3
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,5 @@
1616
<script src="source/package.js" charset="utf-8"></script>
1717
</head>
1818
<body class="enyo-unselectable">
19-
<script>
20-
new App().renderInto(document.body);
21-
</script>
2219
</body>
2320
</html>

index.html

+1-7
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,6 @@
1616
<script src="build/app.js" charset="utf-8"></script>
1717
</head>
1818
<body class="enyo-unselectable">
19-
<script>
20-
if (!window.App) {
21-
alert('No application build found, redirecting to debug.html.');
22-
location = 'debug.html';
23-
}
24-
new App().renderInto(document.body);
25-
</script>
19+
<script type="text/javascript">if (undefined === window.enyo) location = "debug.html";</script>
2620
</body>
2721
</html>
File renamed without changes.

source-old/App.js

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
enyo.kind({
2+
name: "App",
3+
kind: "FittableRows",
4+
fit: true,
5+
components:[
6+
{kind: "onyx.Toolbar", content: "Hello World"},
7+
{kind: "enyo.Scroller", fit: true, components: [
8+
{name: "main", classes: "nice-padding", allowHtml: true}
9+
]},
10+
{kind: "onyx.Toolbar", components: [
11+
{kind: "onyx.Button", content: "Tap me", ontap: "helloWorldTap"}
12+
]}
13+
],
14+
helloWorldTap: function(inSender, inEvent) {
15+
this.$.main.addContent("The button was tapped.<br/>");
16+
}
17+
});
File renamed without changes.

source-old/package.js

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
enyo.depends(
2+
"$lib/layout",
3+
"$lib/onyx", // To theme Onyx using Theme.less, change this line to $lib/onyx/source,
4+
//"Theme.less", // uncomment this line, and follow the steps described in Theme.less
5+
"App.css",
6+
"App.js"
7+
);

source/App.js

+13-15
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,15 @@
1+
/**
2+
Define and instantiate your enyo.Application kind in this file. Note,
3+
application rendering should be deferred until DOM is ready by wrapping
4+
it in a call to enyo.ready().
5+
*/
6+
17
enyo.kind({
2-
name: "App",
3-
kind: "FittableRows",
4-
fit: true,
5-
components:[
6-
{kind: "onyx.Toolbar", content: "Hello World"},
7-
{kind: "enyo.Scroller", fit: true, components: [
8-
{name: "main", classes: "nice-padding", allowHtml: true}
9-
]},
10-
{kind: "onyx.Toolbar", components: [
11-
{kind: "onyx.Button", content: "Tap me", ontap: "helloWorldTap"}
12-
]}
13-
],
14-
helloWorldTap: function(inSender, inEvent) {
15-
this.$.main.addContent("The button was tapped.<br/>");
16-
}
8+
name: "myapp.Application",
9+
kind: "enyo.Application",
10+
view: "myapp.MainView"
1711
});
12+
13+
enyo.ready(function () {
14+
new myapp.Application({name: "app"});
15+
});

source/data/data.js

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
/**
2+
For simple applications, you might define all of your models, collections,
3+
and sources in this file. For more complex applications, you might choose to separate
4+
these kind definitions into multiple files under this folder.
5+
*/

source/data/package.js

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
enyo.depends(
2+
"data.js"
3+
);

source/package.js

+11-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,15 @@
11
enyo.depends(
2+
// Layout library
23
"$lib/layout",
4+
// Onyx UI library
35
"$lib/onyx", // To theme Onyx using Theme.less, change this line to $lib/onyx/source,
46
//"Theme.less", // uncomment this line, and follow the steps described in Theme.less
5-
"App.css",
6-
"App.js"
7-
);
7+
// CSS/LESS style files
8+
"style",
9+
// Model and data definitions
10+
"data",
11+
// View kind definitions
12+
"views",
13+
// Include our default entry point
14+
"app.js"
15+
);

source/style/Theme.less

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
/*
2+
You can modify the Moonraker theme by adding variable and rule overrides to this
3+
file. To enable theming, follow these steps:
4+
5+
1. In source/package.js, change "$lib/moonraker" to "$lib/moonraker/source".
6+
2. In source/style/package.js, add "Theme.less" (this file).
7+
3. Add variable and rule overrides below.
8+
9+
See [https://github.com/enyojs/enyo/wiki/UI-Theming] for more information.
10+
*/
11+
12+
13+
/* Moonstone default variable definitions: */
14+
@import "../../lib/moonstone/css/moonstone-variables.less";
15+
16+
/* Place your Moonstone variable overrides here --------------- */
17+
18+
/* ------------------------------------- end variable overrides */
19+
20+
/* Moonstone rule definitions: */
21+
@import "../../lib/moonstone/css/moonstone-rules.less";
22+
23+
/* Place your Moonstone rule overrides here ------------------- */
24+
25+
/* ----------------------------------------- end rule overrides */

source/style/main.less

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
/*
2+
+ App-specific LESS/CSS would go here, but to make your
3+
+ application easier to maintain, you should try to
4+
+ minimize the use of custom CSS.
5+
+*/
6+
7+
.main-view {
8+
}

source/style/package.js

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
enyo.depends(
2+
//"Theme.less", // To theme Moonstone, uncomment this line, and follow the steps described in Theme.less
3+
"main.less"
4+
);

source/views/package.js

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
enyo.depends(
2+
"views.js"
3+
);

source/views/views.js

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
/**
2+
For simple applications, you might define all of your views in this file.
3+
For more complex applications, you might choose to separate these kind definitions
4+
into multiple files under this folder.
5+
*/
6+
7+
enyo.kind({
8+
name: "myapp.MainView",
9+
kind: "FittableRows",
10+
fit: true,
11+
components:[
12+
{kind: "onyx.Toolbar", content: "Hello World"},
13+
{kind: "enyo.Scroller", fit: true, components: [
14+
{name: "main", classes: "nice-padding", allowHtml: true}
15+
]},
16+
{kind: "onyx.Toolbar", components: [
17+
{kind: "onyx.Button", content: "Tap me", ontap: "helloWorldTap"}
18+
]}
19+
],
20+
helloWorldTap: function(inSender, inEvent) {
21+
this.$.main.addContent("The button was tapped.<br/>");
22+
}
23+
});

0 commit comments

Comments
 (0)