Permalink
Browse files

Adds list notes page

Creates basic structure for page handling and templates for the application
  • Loading branch information...
Dominik Guzei
Dominik Guzei committed Jan 31, 2012
1 parent 6a45b98 commit 61a571341a7d4bba9c45b82c01c0caa6aed6e870
@@ -0,0 +1,8 @@
+
+App = @App
+
+App.mediators.pagesMediator = SC.Object.create {
+
+ currentPage: null
+
+}
@@ -4,16 +4,26 @@
#= require app/controllers/statechartController
#= require app/states/BrowsingState
#= require app/states/AuthenticationState
+#= require app/views/AppView
App = @App
App.statechart = SC.Statechart.create {
- statesAreConcurrent: YES
trace: YES
delegate: App.controllers.statechartController
- Browsing: App.states.BrowsingState
- Authentication: App.states.AuthenticationState
+ rootState: SC.State.extend {
+
+ substatesAreConcurrent: YES
+
+ Browsing: App.states.BrowsingState
+ Authentication: App.states.AuthenticationState
+
+ enterState: ->
+ App.views.appView = App.views.AppView.create()
+ App.views.appView.append()
+ }
+
}
@@ -1,6 +1,11 @@
#= require app/mediators/authenticationMediator
+#= require app/mediators/pagesMediator
+#= require app/views/PagesView
+#= require app/views/pages/ListNotesView
App = @App
+pagesMediator = App.mediators.pagesMediator
+pages = App.views.pages
App.states.BrowsingState = SC.State.extend {
@@ -14,6 +19,9 @@ App.states.BrowsingState = SC.State.extend {
representRoute: 'notes'
+ enterState: ->
+ pagesMediator.set 'currentPage', pages.ListNotesView
+
createNote: ->
@gotoState 'Browsing.Restricted.CreateNote'
}
@@ -0,0 +1,2 @@
+
+{{view App.views.PagesView}}
@@ -0,0 +1,4 @@
+
+<div id="current-page">
+ {{view currentPage}}
+</div>
@@ -0,0 +1,8 @@
+
+<h2>Notes:</h2>
+<ul>
+ <li>First Note</li>
+ <li>Second Note</li>
+ <li>Third Note</li>
+ <li>Fourth Note</li>
+</ul>
@@ -0,0 +1,11 @@
+
+#= require app/templates/app
+
+App = @App
+
+App.views.AppView = SC.View.extend {
+
+ templateName: 'app_templates_app'
+ elementId: 'app'
+
+}
@@ -0,0 +1,16 @@
+
+#= require app/templates/pages
+
+App = @App
+
+App.views.PagesView = SC.View.extend {
+
+ templateName: 'app_templates_pages'
+ elementId: 'pages'
+
+ currentPageBinding: 'App.mediators.pagesMediator.currentPage'
+
+}
+
+# provides namespace for pages
+App.views.pages = {}
@@ -0,0 +1,11 @@
+
+#= require app/templates/pages/list_notes
+
+App = @App
+
+App.views.pages.ListNotesView = SC.View.extend {
+
+ templateName: 'app_templates_pages_list_notes'
+ elementId: 'list-notes-page'
+
+}
@@ -1,2 +0,0 @@
-<h1>Notes#index</h1>
-<p>Find me in app/views/notes/index.html.erb</p>

0 comments on commit 61a5713

Please sign in to comment.