diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..a9a5aec --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +tmp diff --git a/Buildfile b/Buildfile new file mode 100644 index 0000000..24a4a5d --- /dev/null +++ b/Buildfile @@ -0,0 +1,12 @@ +# ========================================================================== +# Project: Teams +# Copyright: @2011 My Company, Inc. +# ========================================================================== + +# This is your Buildfile, which sets build settings for your project. +# For example, this tells SproutCore's build tools that your requires +# the SproutCore framework. +config :all, :required => :sproutcore + +# In addition to this Buildfile, which gives settings for your entire project, +# each of your apps has its own Buildfile with settings specific to that app. diff --git a/Gemfile b/Gemfile new file mode 100644 index 0000000..875173e --- /dev/null +++ b/Gemfile @@ -0,0 +1,4 @@ +gem 'sproutcore', '1.6.0.rc.2' +gem 'chunky_png', '1.1.0' + +source :rubygems diff --git a/Gemfile.lock b/Gemfile.lock new file mode 100644 index 0000000..a701342 --- /dev/null +++ b/Gemfile.lock @@ -0,0 +1,38 @@ +GEM + remote: http://rubygems.org/ + specs: + chunky_png (1.1.0) + compass (0.11.1) + chunky_png (~> 1.1) + fssm (>= 0.2.7) + sass (~> 3.1) + daemons (1.1.3) + erubis (2.7.0) + eventmachine (0.12.10) + extlib (0.9.15) + fssm (0.2.7) + haml (3.1.1) + json_pure (1.4.6) + rack (1.3.0) + sass (3.1.1) + sproutcore (1.6.0.rc.2) + compass (~> 0.11.1) + erubis (~> 2.6) + extlib (~> 0.9.15) + haml (~> 3.1.1) + json_pure (~> 1.4.6) + rack (~> 1.2) + thin (~> 1.2.11) + thor (~> 0.14.3) + thin (1.2.11) + daemons (>= 1.0.9) + eventmachine (>= 0.12.6) + rack (>= 1.0.0) + thor (0.14.6) + +PLATFORMS + ruby + +DEPENDENCIES + chunky_png (= 1.1.0) + sproutcore (= 1.6.0.rc.2) diff --git a/README b/README new file mode 100644 index 0000000..0249e27 --- /dev/null +++ b/README @@ -0,0 +1,6 @@ +========================================================================== +Project: Teams +Copyright: @2011 My Company, Inc. +========================================================================== + +TODO: Describe Your Project diff --git a/apps/teams/.core.js.swp b/apps/teams/.core.js.swp new file mode 100644 index 0000000..883efa7 Binary files /dev/null and b/apps/teams/.core.js.swp differ diff --git a/apps/teams/.main.js.swp b/apps/teams/.main.js.swp new file mode 100644 index 0000000..fc6afde Binary files /dev/null and b/apps/teams/.main.js.swp differ diff --git a/apps/teams/Buildfile b/apps/teams/Buildfile new file mode 100644 index 0000000..71acb4d --- /dev/null +++ b/apps/teams/Buildfile @@ -0,0 +1,14 @@ +# ========================================================================== +# Project: Teams +# Copyright: @2011 My Company, Inc. +# ========================================================================== + +# This is your Buildfile for your app, Teams. This tells SproutCore +# how to build your app. These settings override those in your project +# Buildfile, which contains default settings for all apps in your project. +# +# This line tells SproutCore's CSS preprocessor what class names to target. +# Since your app has a theme named 'teams', and it is based on SproutCore's +# Ace theme (named 'ace'), it is set to 'ace.teams'. +config :teams, :css_theme => 'ace.teams' + diff --git a/apps/teams/controllers/.teams_controller.js.swp b/apps/teams/controllers/.teams_controller.js.swp new file mode 100644 index 0000000..4bd3450 Binary files /dev/null and b/apps/teams/controllers/.teams_controller.js.swp differ diff --git a/apps/teams/controllers/teams_controller.js b/apps/teams/controllers/teams_controller.js new file mode 100644 index 0000000..90c8aa1 --- /dev/null +++ b/apps/teams/controllers/teams_controller.js @@ -0,0 +1,17 @@ +// ========================================================================== +// Project: Teams.teamsController +// Copyright: @2011 My Company, Inc. +// ========================================================================== +/*globals Teams */ + +/** @class + + (Document Your Controller Here) + + @extends SC.Object +*/ +Teams.teamsController = SC.ObjectController.create( +/** @scope Teams.teamsController.prototype */ { + + +}) ; diff --git a/apps/teams/core.js b/apps/teams/core.js new file mode 100644 index 0000000..3e0e401 --- /dev/null +++ b/apps/teams/core.js @@ -0,0 +1,27 @@ +// ========================================================================== +// Project: Teams +// Copyright: @2011 My Company, Inc. +// ========================================================================== +/*globals Teams */ + +/** @namespace + + My cool new app. Describe your application. + + @extends SC.Object +*/ +Teams = SC.Application.create( + /** @scope Teams.prototype */ { + + NAMESPACE: 'Teams', + VERSION: '0.1.0', + + // This is your application store. You will use this store to access all + // of your model data. You can also set a data source on this store to + // connect to a backend server. The default setup below connects the store + // to any fixtures you define. + store: SC.Store.create().from(SC.Record.fixtures) + + // TODO: Add global constants or singleton objects needed by your app here. + +}) ; diff --git a/apps/teams/fixtures/.player_fixtures.js.swp b/apps/teams/fixtures/.player_fixtures.js.swp new file mode 100644 index 0000000..fbc1f1c Binary files /dev/null and b/apps/teams/fixtures/.player_fixtures.js.swp differ diff --git a/apps/teams/fixtures/.team_fixtures.js.swp b/apps/teams/fixtures/.team_fixtures.js.swp new file mode 100644 index 0000000..7b57971 Binary files /dev/null and b/apps/teams/fixtures/.team_fixtures.js.swp differ diff --git a/apps/teams/fixtures/player_fixtures.js b/apps/teams/fixtures/player_fixtures.js new file mode 100644 index 0000000..73a4261 --- /dev/null +++ b/apps/teams/fixtures/player_fixtures.js @@ -0,0 +1,16 @@ +// ========================================================================== +// Project: Teams.Player Fixtures +// Copyright: @2011 My Company, Inc. +// ========================================================================== +/*globals Teams */ + +sc_require('models/player_model'); + +Teams.Player.FIXTURES = [ + + {guid: 1, name: 'One', team: 1}, + {guid: 2, name: 'Two', team: 1}, + {guid: 3, name: 'Three', team: 2}, + {guid: 4, name: 'Four', team: 2}, + +]; diff --git a/apps/teams/fixtures/team_fixtures.js b/apps/teams/fixtures/team_fixtures.js new file mode 100644 index 0000000..e67de82 --- /dev/null +++ b/apps/teams/fixtures/team_fixtures.js @@ -0,0 +1,14 @@ +// ========================================================================== +// Project: Teams.Team Fixtures +// Copyright: @2011 My Company, Inc. +// ========================================================================== +/*globals Teams */ + +sc_require('models/team_model'); + +Teams.Team.FIXTURES = [ + + {guid: 1, name: 'Team Red', players: [1,2]}, + {guid: 2, name: 'Team Blue', players: [3,4]} + +]; diff --git a/apps/teams/main.js b/apps/teams/main.js new file mode 100644 index 0000000..7c5edec --- /dev/null +++ b/apps/teams/main.js @@ -0,0 +1,30 @@ +// ========================================================================== +// Project: Teams +// Copyright: @2011 My Company, Inc. +// ========================================================================== +/*globals Teams */ + +// This is the function that will start your app running. The default +// implementation will load any fixtures you have created then instantiate +// your controllers and awake the elements on your page. +// +// As you develop your application you will probably want to override this. +// See comments for some pointers on what to do next. +// +Teams.main = function main() { + + // Step 1: Instantiate Your Views + // The default code here will make the mainPane for your application visible + // on screen. If you app gets any level of complexity, you will probably + // create multiple pages and panes. + Teams.getPath('mainPage.mainPane').append() ; + + // Step 2. Set the content property on your primary controller. + // This will make your app come alive! + + Teams.teams = Teams.store.find(Teams.Team); + Teams.teamsController.set('content', Teams.teams); + +} ; + +function main() { Teams.main(); } diff --git a/apps/teams/models/.player_model.js.swp b/apps/teams/models/.player_model.js.swp new file mode 100644 index 0000000..639f06c Binary files /dev/null and b/apps/teams/models/.player_model.js.swp differ diff --git a/apps/teams/models/.team_model.js.swp b/apps/teams/models/.team_model.js.swp new file mode 100644 index 0000000..933ac29 Binary files /dev/null and b/apps/teams/models/.team_model.js.swp differ diff --git a/apps/teams/models/player_model.js b/apps/teams/models/player_model.js new file mode 100644 index 0000000..d2fd654 --- /dev/null +++ b/apps/teams/models/player_model.js @@ -0,0 +1,22 @@ +// ========================================================================== +// Project: Teams.Player +// Copyright: @2011 My Company, Inc. +// ========================================================================== +/*globals Teams */ + +/** @class + + (Document your Model here) + + @extends SC.Record + @version 0.1 +*/ +Teams.Player = SC.Record.extend( +/** @scope Teams.Player.prototype */ { + name: SC.Record.attr(String), + team: SC.Record.toOne( + 'Teams.Team', + { isMaster: NO } + ) + +}) ; diff --git a/apps/teams/models/team_model.js b/apps/teams/models/team_model.js new file mode 100644 index 0000000..1f06233 --- /dev/null +++ b/apps/teams/models/team_model.js @@ -0,0 +1,22 @@ +// ========================================================================== +// Project: Teams.Team +// Copyright: @2011 My Company, Inc. +// ========================================================================== +/*globals Teams */ + +/** @class + + (Document your Model here) + + @extends SC.Record + @version 0.1 +*/ +Teams.Team = SC.Record.extend( +/** @scope Teams.Team.prototype */ { + name: SC.Record.attr(String), + players: SC.Record.toMany( + 'Teams.Player', + { isMaster: YES, inverse: 'team' } + ) + +}) ; diff --git a/apps/teams/resources/.main_page.js.swp b/apps/teams/resources/.main_page.js.swp new file mode 100644 index 0000000..6535804 Binary files /dev/null and b/apps/teams/resources/.main_page.js.swp differ diff --git a/apps/teams/resources/loading.rhtml b/apps/teams/resources/loading.rhtml new file mode 100644 index 0000000..e5fd662 --- /dev/null +++ b/apps/teams/resources/loading.rhtml @@ -0,0 +1,9 @@ +<% content_for :loading do %> +<% # Any HTML in this file will be visible on screen while your page loads + # its application JavaScript. SproutCore applications are optimized for + # caching and startup very fast, so your users will often only see this + # content for a brief moment on their first app load, if at all. +%> +

Loading...

+ +<% end %> diff --git a/apps/teams/resources/main_page.js b/apps/teams/resources/main_page.js new file mode 100644 index 0000000..17c366e --- /dev/null +++ b/apps/teams/resources/main_page.js @@ -0,0 +1,21 @@ +// ========================================================================== +// Project: Teams - mainPage +// Copyright: @2011 My Company, Inc. +// ========================================================================== +/*globals Teams */ + +// This page describes the main user interface for your application. +Teams.mainPage = SC.Page.design({ + + // The main pane is made visible on screen as soon as your app is loaded. + // Add childViews to this pane for views to display immediately on page + // load. + mainPane: SC.MainPane.design({ + childViews: 'teamsView'.w(), + + teamsView: SC.TemplateView.design({ + templateName: 'teams' + }) + }) + +}); diff --git a/apps/teams/templates/.teams.handlebars.swp b/apps/teams/templates/.teams.handlebars.swp new file mode 100644 index 0000000..dc39b98 Binary files /dev/null and b/apps/teams/templates/.teams.handlebars.swp differ diff --git a/apps/teams/templates/teams.handlebars b/apps/teams/templates/teams.handlebars new file mode 100644 index 0000000..315da3a --- /dev/null +++ b/apps/teams/templates/teams.handlebars @@ -0,0 +1,6 @@ +{{#collection SC.TemplateCollectionView contentBinding="Teams.teamsController.content"}} + Team: {{content.name}} + {{#collection SC.TemplateCollectionView contentBinding=".parentView.content.players"}} + Player: {{content.name}} + {{/collection}} +{{/collection}} diff --git a/apps/teams/tests/controllers/teams_test.js b/apps/teams/tests/controllers/teams_test.js new file mode 100644 index 0000000..d90bc7a --- /dev/null +++ b/apps/teams/tests/controllers/teams_test.js @@ -0,0 +1,15 @@ +// ========================================================================== +// Project: Teams.teamsController Unit Test +// Copyright: @2011 My Company, Inc. +// ========================================================================== +/*globals Teams module test ok equals same stop start */ + +module("Teams.teamsController"); + +// TODO: Replace with real unit test for Teams.teamsController +test("test description", function() { + var expected = "test"; + var result = "test"; + equals(result, expected, "test should equal test"); +}); + diff --git a/apps/teams/tests/models/player_test.js b/apps/teams/tests/models/player_test.js new file mode 100644 index 0000000..e914cf2 --- /dev/null +++ b/apps/teams/tests/models/player_test.js @@ -0,0 +1,15 @@ +// ========================================================================== +// Project: Teams.Player Unit Test +// Copyright: @2011 My Company, Inc. +// ========================================================================== +/*globals Teams module test ok equals same stop start */ + +module("Teams.Player"); + +// TODO: Replace with real unit test for Player +test("test description", function() { + var expected = "test"; + var result = "test"; + equals(result, expected, "test should equal test"); +}); + diff --git a/apps/teams/tests/models/team_test.js b/apps/teams/tests/models/team_test.js new file mode 100644 index 0000000..a3527bf --- /dev/null +++ b/apps/teams/tests/models/team_test.js @@ -0,0 +1,15 @@ +// ========================================================================== +// Project: Teams.Team Unit Test +// Copyright: @2011 My Company, Inc. +// ========================================================================== +/*globals Teams module test ok equals same stop start */ + +module("Teams.Team"); + +// TODO: Replace with real unit test for Team +test("test description", function() { + var expected = "test"; + var result = "test"; + equals(result, expected, "test should equal test"); +}); + diff --git a/apps/teams/theme.js b/apps/teams/theme.js new file mode 100644 index 0000000..b9d6b88 --- /dev/null +++ b/apps/teams/theme.js @@ -0,0 +1,27 @@ +// ========================================================================== +// Project: Teams +// Copyright: @2011 My Company, Inc. +// ========================================================================== +/*globals Teams */ + +// This is the theme that defines how your app renders. +// +// Your app is given its own theme so it is easier and less +// messy for you to override specific things just for your +// app. +// +// You don't have to create the whole theme on your own, though: +// your app's theme is based on SproutCore's Ace theme. +// +// NOTE: if you want to change the theme this one is based on, don't +// forget to change the :css_theme property in your buildfile. +Teams.Theme = SC.AceTheme.create({ + name: 'teams' +}); + +// SproutCore needs to know that your app's theme exists +SC.Theme.addTheme(Teams.Theme); + +// Setting it as the default theme makes every pane SproutCore +// creates default to this theme unless otherwise specified. +SC.defaultTheme = 'teams';