This project contains sample apps that I've written as I'm learning Sproutcore and testing out concepts.
As of 17/10/2010, the code has been built to work with Sproutcore 1.4.2.
-
Install sproutcore gem.
sudo gem install sproutcore
-
Get this project source code
git clone git://github.com/veebs/veebs-sproutcore-samples.git cd veebs-sproutcore-samples
-
Install sproutcore source code into our project to help with debugging and fixing known bugs in the framework. Sproutcore build tools is smart enough to use this copy rather than the copy in the installed gem from step #1.
cd veebs-sproutcore-samples mkdir -p frameworks cd frameworks git clone git://github.com/sproutcore/sproutcore.git cd sproutcore git branch -r git checkout origin/1-4-stable
I found the standard Sproutcore route sample too complex for a newbie like me. It uses responders, states and other advance features.
This sample demonstrates
- registering routes (in main.js) using SC.routes.add().
- moving between 2 pages (one_page and two_page) using routes using SC.routes.set().
- how to read and use URL parameters in the route handler (route.js)
Check out the tutorial on my blog.
See it in action here.
This demonstrates
- moving from one page to another
- binding between view and controller
- using 'view-model' data stored in the controller
- async HTTP call to retrieve login details
- error handling
This does NOT handle cookies, session id or logout. This is will addressed in an the login-logout-sample (todo).
Check out the tutorial on my blog.
See it in action here.
This demonstrates
- using cookies to store authentication token upon login
- storage of login permanently, for browser session or for 3 seconds
- logout clearing authentication token
Check out the tutorial on my blog.
See it in action here.
Allows the user to Create, Read, Update and Delete user records.
This demonstrates
- Use of SC.TableView
- Use of a modal details pane
- Use of a modal error pane
- Field level validation - username must be [a-z]
- Page level validation - username is required
- Nested stores so that local changes can be discarded before commit.
- Simulated server response with 1 second latency
- Simulated server error - check for duplicate keys (username)
- SC.DataSource error handling
- Display errors to users
Check out the tutorial on my blog.
See it in action here.
Displays a list of items and allows the user to re-order them.
This demonstrates
- How to implement a custom SC.ListView row.
- How to hi-light an item when hovering with a mouse.
- How to implement drag-and-drop re ordering.
Check out the tutorial on my blog.
See it in action here.
This is the table view tutorial as documented in the sproutcore wiki.
I've just renamed table-example to table-sample to fit in with my app naming convention.