Created
February 29, 2012 17:37
-
-
Save tim-evans/1942816 to your computer and use it in GitHub Desktop.
Separating views
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| commit b9dc87d66c0606908b3199e08ce261e2425d1ef6 | |
| Author: Tim Evans <[email protected]> | |
| Date: Wed Feb 29 12:36:06 2012 -0500 | |
| separated views into their own files for reuse | |
| diff --git a/apps/todos_two/resources/main_page.js b/apps/todos_two/resources/main_page.js | |
| index e5d620b..c17be8d 100644 | |
| --- a/apps/todos_two/resources/main_page.js | |
| +++ b/apps/todos_two/resources/main_page.js | |
| @@ -3,6 +3,8 @@ | |
| // Copyright: @2012 My Company, Inc. | |
| // ========================================================================== | |
| /*globals TodosTwo */ | |
| +sc_require('views/welcome'); | |
| +sc_require('views/rolling'); | |
| // This page describes the main user interface for your application. | |
| TodosTwo.mainPage = SC.Page.design({ | |
| @@ -11,21 +13,10 @@ TodosTwo.mainPage = SC.Page.design({ | |
| // Add childViews to this pane for views to display immediately on page | |
| // load. | |
| mainPane: SC.MainPane.design({ | |
| - childViews: 'labelView labelView2'.w(), | |
| + childViews: 'welcomeView rollingView'.w(), | |
| - labelView: SC.LabelView.design({ | |
| - layout: { centerX: 0, centerY: 0, width: 200, height: 18 }, | |
| - textAlign: SC.ALIGN_CENTER, | |
| - tagName: "h1", | |
| - value: "Welcome to SproutCore!" | |
| - }), | |
| - | |
| - labelView2: SC.LabelView.design({ | |
| - layout: { centerX: 0, centerY: 15, width: 200, height: 18 }, | |
| - textAlign: SC.ALIGN_CENTER, | |
| - tagName: "h1", | |
| - value: "Now we're rolling!" | |
| - }) | |
| + welcomeView: TodosTwo.WelcomeView.design(), | |
| + rollingView: TodosTwo.RollingView.design() | |
| }) | |
| }); | |
| diff --git a/apps/todos_two/views/rolling.js b/apps/todos_two/views/rolling.js | |
| new file mode 100644 | |
| index 0000000..d17a7aa | |
| --- /dev/null | |
| +++ b/apps/todos_two/views/rolling.js | |
| @@ -0,0 +1,6 @@ | |
| +TodosTwo.RollingView = SC.LabelView.extend({ | |
| + layout: { centerX: 0, centerY: 15, width: 200, height: 18 }, | |
| + textAlign: SC.ALIGN_CENTER, | |
| + tagName: "h1", | |
| + value: "Now we're rolling!" | |
| +}); | |
| diff --git a/apps/todos_two/views/welcome.js b/apps/todos_two/views/welcome.js | |
| new file mode 100644 | |
| index 0000000..cb4146d | |
| --- /dev/null | |
| +++ b/apps/todos_two/views/welcome.js | |
| @@ -0,0 +1,6 @@ | |
| +TodosTwo.WelcomeView = SC.LabelView.extend({ | |
| + layout: { centerX: 0, centerY: 0, width: 200, height: 18 }, | |
| + textAlign: SC.ALIGN_CENTER, | |
| + tagName: "h1", | |
| + value: "Welcome to SproutCore!" | |
| +}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment