├── .gitignore ├── Gemfile ├── Gemfile.lock ├── README ├── Rakefile ├── app ├── assets │ ├── images │ │ └── rails.png │ ├── javascripts │ │ ├── application.js.coffee │ │ ├── loader.js.coffee.erb │ │ ├── templates │ │ │ ├── all.js │ │ │ └── test.js.hjs │ │ └── views │ │ │ └── test.js.coffee │ └── stylesheets │ │ └── application.css ├── controllers │ ├── application_controller.rb │ └── static_controller.rb ├── helpers │ └── application_helper.rb ├── mailers │ └── .gitkeep ├── models │ └── .gitkeep └── views │ ├── layouts │ └── application.html.erb │ └── static │ └── index.html.erb ├── config.ru ├── config ├── application.rb ├── boot.rb ├── database.yml ├── environment.rb ├── environments │ ├── development.rb │ ├── production.rb │ └── test.rb ├── initializers │ ├── backtrace_silencers.rb │ ├── inflections.rb │ ├── mime_types.rb │ ├── secret_token.rb │ ├── session_store.rb │ └── wrap_parameters.rb ├── locales │ └── en.yml └── routes.rb ├── db └── seeds.rb ├── doc └── README_FOR_APP ├── lib ├── assets │ └── .gitkeep └── tasks │ └── .gitkeep ├── log └── .gitkeep ├── public ├── 404.html ├── 422.html ├── 500.html ├── favicon.ico └── robots.txt ├── script └── rails ├── test ├── fixtures │ └── .gitkeep ├── functional │ └── .gitkeep ├── integration │ └── .gitkeep ├── performance │ └── browsing_test.rb ├── test_helper.rb └── unit │ └── .gitkeep └── vendor ├── assets ├── javascripts │ └── head.js └── stylesheets │ └── .gitkeep └── plugins └── .gitkeep /.gitignore: -------------------------------------------------------------------------------- 1 | # See http://help.github.com/ignore-files/ for more about ignoring files. 2 | # 3 | # If you find yourself ignoring temporary files generated by your text editor 4 | # or operating system, you probably want to add a global ignore instead: 5 | # git config --global core.excludesfile ~/.gitignore_global 6 | 7 | # Ignore bundler config 8 | /.bundle 9 | 10 | # Ignore the default SQLite database. 11 | /db/*.sqlite3 12 | 13 | # Ignore all logfiles and tempfiles. 14 | /log/*.log 15 | /tmp 16 | -------------------------------------------------------------------------------- /Gemfile: -------------------------------------------------------------------------------- 1 | source 'http://rubygems.org' 2 | 3 | gem 'rails', '3.1.3' 4 | gem "ember-rails", :git => "git://github.com/emberjs/ember-rails.git" 5 | gem 'sqlite3' 6 | 7 | # Gems used only for assets and not required 8 | # in production environments by default. 9 | group :assets do 10 | gem 'sass-rails', '~> 3.1.5' 11 | gem 'coffee-rails', '~> 3.1.1' 12 | gem 'uglifier', '>= 1.0.3' 13 | end 14 | 15 | gem 'jquery-rails' 16 | 17 | # To use ActiveModel has_secure_password 18 | # gem 'bcrypt-ruby', '~> 3.0.0' 19 | 20 | # Use unicorn as the web server 21 | # gem 'unicorn' 22 | 23 | # Deploy with Capistrano 24 | # gem 'capistrano' 25 | 26 | # To use debugger 27 | # gem 'ruby-debug19', :require => 'ruby-debug' 28 | 29 | group :test do 30 | # Pretty printed test output 31 | gem 'turn', '0.8.2', :require => false 32 | end 33 | -------------------------------------------------------------------------------- /Gemfile.lock: -------------------------------------------------------------------------------- 1 | GIT 2 | remote: git://github.com/emberjs/ember-rails.git 3 | revision: bcd35f3557471bae29b04c5f7b653df22443f761 4 | specs: 5 | ember-rails (0.2.2) 6 | execjs (>= 1.2) 7 | railties (>= 3.0) 8 | 9 | GEM 10 | remote: http://rubygems.org/ 11 | specs: 12 | actionmailer (3.1.3) 13 | actionpack (= 3.1.3) 14 | mail (~> 2.3.0) 15 | actionpack (3.1.3) 16 | activemodel (= 3.1.3) 17 | activesupport (= 3.1.3) 18 | builder (~> 3.0.0) 19 | erubis (~> 2.7.0) 20 | i18n (~> 0.6) 21 | rack (~> 1.3.5) 22 | rack-cache (~> 1.1) 23 | rack-mount (~> 0.8.2) 24 | rack-test (~> 0.6.1) 25 | sprockets (~> 2.0.3) 26 | activemodel (3.1.3) 27 | activesupport (= 3.1.3) 28 | builder (~> 3.0.0) 29 | i18n (~> 0.6) 30 | activerecord (3.1.3) 31 | activemodel (= 3.1.3) 32 | activesupport (= 3.1.3) 33 | arel (~> 2.2.1) 34 | tzinfo (~> 0.3.29) 35 | activeresource (3.1.3) 36 | activemodel (= 3.1.3) 37 | activesupport (= 3.1.3) 38 | activesupport (3.1.3) 39 | multi_json (~> 1.0) 40 | ansi (1.4.1) 41 | arel (2.2.1) 42 | builder (3.0.0) 43 | coffee-rails (3.1.1) 44 | coffee-script (>= 2.2.0) 45 | railties (~> 3.1.0) 46 | coffee-script (2.2.0) 47 | coffee-script-source 48 | execjs 49 | coffee-script-source (1.2.0) 50 | erubis (2.7.0) 51 | execjs (1.3.0) 52 | multi_json (~> 1.0) 53 | hike (1.2.1) 54 | i18n (0.6.0) 55 | jquery-rails (1.0.19) 56 | railties (~> 3.0) 57 | thor (~> 0.14) 58 | json (1.6.5) 59 | mail (2.3.0) 60 | i18n (>= 0.4.0) 61 | mime-types (~> 1.16) 62 | treetop (~> 1.4.8) 63 | mime-types (1.17.2) 64 | multi_json (1.0.4) 65 | polyglot (0.3.3) 66 | rack (1.3.6) 67 | rack-cache (1.1) 68 | rack (>= 0.4) 69 | rack-mount (0.8.3) 70 | rack (>= 1.0.0) 71 | rack-ssl (1.3.2) 72 | rack 73 | rack-test (0.6.1) 74 | rack (>= 1.0) 75 | rails (3.1.3) 76 | actionmailer (= 3.1.3) 77 | actionpack (= 3.1.3) 78 | activerecord (= 3.1.3) 79 | activeresource (= 3.1.3) 80 | activesupport (= 3.1.3) 81 | bundler (~> 1.0) 82 | railties (= 3.1.3) 83 | railties (3.1.3) 84 | actionpack (= 3.1.3) 85 | activesupport (= 3.1.3) 86 | rack-ssl (~> 1.3.2) 87 | rake (>= 0.8.7) 88 | rdoc (~> 3.4) 89 | thor (~> 0.14.6) 90 | rake (0.9.2.2) 91 | rdoc (3.12) 92 | json (~> 1.4) 93 | sass (3.1.12) 94 | sass-rails (3.1.5) 95 | actionpack (~> 3.1.0) 96 | railties (~> 3.1.0) 97 | sass (~> 3.1.10) 98 | tilt (~> 1.3.2) 99 | sprockets (2.0.3) 100 | hike (~> 1.2) 101 | rack (~> 1.0) 102 | tilt (~> 1.1, != 1.3.0) 103 | sqlite3 (1.3.5) 104 | thor (0.14.6) 105 | tilt (1.3.3) 106 | treetop (1.4.10) 107 | polyglot 108 | polyglot (>= 0.3.1) 109 | turn (0.8.2) 110 | ansi (>= 1.2.2) 111 | tzinfo (0.3.31) 112 | uglifier (1.1.0) 113 | execjs (>= 0.3.0) 114 | multi_json (>= 1.0.2) 115 | 116 | PLATFORMS 117 | ruby 118 | 119 | DEPENDENCIES 120 | coffee-rails (~> 3.1.1) 121 | ember-rails! 122 | jquery-rails 123 | rails (= 3.1.3) 124 | sass-rails (~> 3.1.5) 125 | sqlite3 126 | turn (= 0.8.2) 127 | uglifier (>= 1.0.3) 128 | -------------------------------------------------------------------------------- /README: -------------------------------------------------------------------------------- 1 | == Welcome to Rails 2 | 3 | Rails is a web-application framework that includes everything needed to create 4 | database-backed web applications according to the Model-View-Control pattern. 5 | 6 | This pattern splits the view (also called the presentation) into "dumb" 7 | templates that are primarily responsible for inserting pre-built data in between 8 | HTML tags. The model contains the "smart" domain objects (such as Account, 9 | Product, Person, Post) that holds all the business logic and knows how to 10 | persist themselves to a database. The controller handles the incoming requests 11 | (such as Save New Account, Update Product, Show Post) by manipulating the model 12 | and directing data to the view. 13 | 14 | In Rails, the model is handled by what's called an object-relational mapping 15 | layer entitled Active Record. This layer allows you to present the data from 16 | database rows as objects and embellish these data objects with business logic 17 | methods. You can read more about Active Record in 18 | link:files/vendor/rails/activerecord/README.html. 19 | 20 | The controller and view are handled by the Action Pack, which handles both 21 | layers by its two parts: Action View and Action Controller. These two layers 22 | are bundled in a single package due to their heavy interdependence. This is 23 | unlike the relationship between the Active Record and Action Pack that is much 24 | more separate. Each of these packages can be used independently outside of 25 | Rails. You can read more about Action Pack in 26 | link:files/vendor/rails/actionpack/README.html. 27 | 28 | 29 | == Getting Started 30 | 31 | 1. At the command prompt, create a new Rails application: 32 | rails new myapp (where myapp is the application name) 33 | 34 | 2. Change directory to myapp and start the web server: 35 | cd myapp; rails server (run with --help for options) 36 | 37 | 3. Go to http://localhost:3000/ and you'll see: 38 | "Welcome aboard: You're riding Ruby on Rails!" 39 | 40 | 4. Follow the guidelines to start developing your application. You can find 41 | the following resources handy: 42 | 43 | * The Getting Started Guide: http://guides.rubyonrails.org/getting_started.html 44 | * Ruby on Rails Tutorial Book: http://www.railstutorial.org/ 45 | 46 | 47 | == Debugging Rails 48 | 49 | Sometimes your application goes wrong. Fortunately there are a lot of tools that 50 | will help you debug it and get it back on the rails. 51 | 52 | First area to check is the application log files. Have "tail -f" commands 53 | running on the server.log and development.log. Rails will automatically display 54 | debugging and runtime information to these files. Debugging info will also be 55 | shown in the browser on requests from 127.0.0.1. 56 | 57 | You can also log your own messages directly into the log file from your code 58 | using the Ruby logger class from inside your controllers. Example: 59 | 60 | class WeblogController < ActionController::Base 61 | def destroy 62 | @weblog = Weblog.find(params[:id]) 63 | @weblog.destroy 64 | logger.info("#{Time.now} Destroyed Weblog ID ##{@weblog.id}!") 65 | end 66 | end 67 | 68 | The result will be a message in your log file along the lines of: 69 | 70 | Mon Oct 08 14:22:29 +1000 2007 Destroyed Weblog ID #1! 71 | 72 | More information on how to use the logger is at http://www.ruby-doc.org/core/ 73 | 74 | Also, Ruby documentation can be found at http://www.ruby-lang.org/. There are 75 | several books available online as well: 76 | 77 | * Programming Ruby: http://www.ruby-doc.org/docs/ProgrammingRuby/ (Pickaxe) 78 | * Learn to Program: http://pine.fm/LearnToProgram/ (a beginners guide) 79 | 80 | These two books will bring you up to speed on the Ruby language and also on 81 | programming in general. 82 | 83 | 84 | == Debugger 85 | 86 | Debugger support is available through the debugger command when you start your 87 | Mongrel or WEBrick server with --debugger. This means that you can break out of 88 | execution at any point in the code, investigate and change the model, and then, 89 | resume execution! You need to install ruby-debug to run the server in debugging 90 | mode. With gems, use sudo gem install ruby-debug. Example: 91 | 92 | class WeblogController < ActionController::Base 93 | def index 94 | @posts = Post.all 95 | debugger 96 | end 97 | end 98 | 99 | So the controller will accept the action, run the first line, then present you 100 | with a IRB prompt in the server window. Here you can do things like: 101 | 102 | >> @posts.inspect 103 | => "[#nil, "body"=>nil, "id"=>"1"}>, 105 | #"Rails", "body"=>"Only ten..", "id"=>"2"}>]" 107 | >> @posts.first.title = "hello from a debugger" 108 | => "hello from a debugger" 109 | 110 | ...and even better, you can examine how your runtime objects actually work: 111 | 112 | >> f = @posts.first 113 | => #nil, "body"=>nil, "id"=>"1"}> 114 | >> f. 115 | Display all 152 possibilities? (y or n) 116 | 117 | Finally, when you're ready to resume execution, you can enter "cont". 118 | 119 | 120 | == Console 121 | 122 | The console is a Ruby shell, which allows you to interact with your 123 | application's domain model. Here you'll have all parts of the application 124 | configured, just like it is when the application is running. You can inspect 125 | domain models, change values, and save to the database. Starting the script 126 | without arguments will launch it in the development environment. 127 | 128 | To start the console, run rails console from the application 129 | directory. 130 | 131 | Options: 132 | 133 | * Passing the -s, --sandbox argument will rollback any modifications 134 | made to the database. 135 | * Passing an environment name as an argument will load the corresponding 136 | environment. Example: rails console production. 137 | 138 | To reload your controllers and models after launching the console run 139 | reload! 140 | 141 | More information about irb can be found at: 142 | link:http://www.rubycentral.org/pickaxe/irb.html 143 | 144 | 145 | == dbconsole 146 | 147 | You can go to the command line of your database directly through rails 148 | dbconsole. You would be connected to the database with the credentials 149 | defined in database.yml. Starting the script without arguments will connect you 150 | to the development database. Passing an argument will connect you to a different 151 | database, like rails dbconsole production. Currently works for MySQL, 152 | PostgreSQL and SQLite 3. 153 | 154 | == Description of Contents 155 | 156 | The default directory structure of a generated Ruby on Rails application: 157 | 158 | |-- app 159 | | |-- assets 160 | | |-- images 161 | | |-- javascripts 162 | | `-- stylesheets 163 | | |-- controllers 164 | | |-- helpers 165 | | |-- mailers 166 | | |-- models 167 | | `-- views 168 | | `-- layouts 169 | |-- config 170 | | |-- environments 171 | | |-- initializers 172 | | `-- locales 173 | |-- db 174 | |-- doc 175 | |-- lib 176 | | `-- tasks 177 | |-- log 178 | |-- public 179 | |-- script 180 | |-- test 181 | | |-- fixtures 182 | | |-- functional 183 | | |-- integration 184 | | |-- performance 185 | | `-- unit 186 | |-- tmp 187 | | |-- cache 188 | | |-- pids 189 | | |-- sessions 190 | | `-- sockets 191 | `-- vendor 192 | |-- assets 193 | `-- stylesheets 194 | `-- plugins 195 | 196 | app 197 | Holds all the code that's specific to this particular application. 198 | 199 | app/assets 200 | Contains subdirectories for images, stylesheets, and JavaScript files. 201 | 202 | app/controllers 203 | Holds controllers that should be named like weblogs_controller.rb for 204 | automated URL mapping. All controllers should descend from 205 | ApplicationController which itself descends from ActionController::Base. 206 | 207 | app/models 208 | Holds models that should be named like post.rb. Models descend from 209 | ActiveRecord::Base by default. 210 | 211 | app/views 212 | Holds the template files for the view that should be named like 213 | weblogs/index.html.erb for the WeblogsController#index action. All views use 214 | eRuby syntax by default. 215 | 216 | app/views/layouts 217 | Holds the template files for layouts to be used with views. This models the 218 | common header/footer method of wrapping views. In your views, define a layout 219 | using the layout :default and create a file named default.html.erb. 220 | Inside default.html.erb, call <% yield %> to render the view using this 221 | layout. 222 | 223 | app/helpers 224 | Holds view helpers that should be named like weblogs_helper.rb. These are 225 | generated for you automatically when using generators for controllers. 226 | Helpers can be used to wrap functionality for your views into methods. 227 | 228 | config 229 | Configuration files for the Rails environment, the routing map, the database, 230 | and other dependencies. 231 | 232 | db 233 | Contains the database schema in schema.rb. db/migrate contains all the 234 | sequence of Migrations for your schema. 235 | 236 | doc 237 | This directory is where your application documentation will be stored when 238 | generated using rake doc:app 239 | 240 | lib 241 | Application specific libraries. Basically, any kind of custom code that 242 | doesn't belong under controllers, models, or helpers. This directory is in 243 | the load path. 244 | 245 | public 246 | The directory available for the web server. Also contains the dispatchers and the 247 | default HTML files. This should be set as the DOCUMENT_ROOT of your web 248 | server. 249 | 250 | script 251 | Helper scripts for automation and generation. 252 | 253 | test 254 | Unit and functional tests along with fixtures. When using the rails generate 255 | command, template test files will be generated for you and placed in this 256 | directory. 257 | 258 | vendor 259 | External libraries that the application depends on. Also includes the plugins 260 | subdirectory. If the app has frozen rails, those gems also go here, under 261 | vendor/rails/. This directory is in the load path. 262 | -------------------------------------------------------------------------------- /Rakefile: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env rake 2 | # Add your own tasks in files placed in lib/tasks ending in .rake, 3 | # for example lib/tasks/capistrano.rake, and they will automatically be available to Rake. 4 | 5 | require File.expand_path('../config/application', __FILE__) 6 | 7 | SproutcoreExample::Application.load_tasks 8 | -------------------------------------------------------------------------------- /app/assets/images/rails.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/keithpitt/ember-rails-example/262ec6920fe722c4f7d2105e88d498a405174d09/app/assets/images/rails.png -------------------------------------------------------------------------------- /app/assets/javascripts/application.js.coffee: -------------------------------------------------------------------------------- 1 | 2 | window.EmberRailsTest = SC.Application.create 3 | 4 | start: -> 5 | testView = EmberRailsTest.TestView.create() 6 | testView.appendTo ($ "#container") 7 | -------------------------------------------------------------------------------- /app/assets/javascripts/loader.js.coffee.erb: -------------------------------------------------------------------------------- 1 | //= require head.js 2 | 3 | head.js "http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js", 4 | "<%= asset_path("ember-dev.js") %>", 5 | "<%= asset_path("application.js") %>", 6 | "<%= asset_path("views/test.js") %>", 7 | "<%= asset_path("templates/all.js") %>", (-> 8 | do EmberRailsTest.start 9 | ) 10 | -------------------------------------------------------------------------------- /app/assets/javascripts/templates/all.js: -------------------------------------------------------------------------------- 1 | //= require_tree . 2 | -------------------------------------------------------------------------------- /app/assets/javascripts/templates/test.js.hjs: -------------------------------------------------------------------------------- 1 |
{{something}}
2 | -------------------------------------------------------------------------------- /app/assets/javascripts/views/test.js.coffee: -------------------------------------------------------------------------------- 1 | 2 | EmberRailsTest.TestView = SC.View.extend 3 | 4 | templateName: "templates/test" 5 | 6 | something: SC.computed(-> 7 | "Something is here!!!" 8 | ) 9 | -------------------------------------------------------------------------------- /app/assets/stylesheets/application.css: -------------------------------------------------------------------------------- 1 | /* 2 | * This is a manifest file that'll automatically include all the stylesheets available in this directory 3 | * and any sub-directories. You're free to add application-wide styles to this file and they'll appear at 4 | * the top of the compiled file, but it's generally better to create a new file per style scope. 5 | *= require_self 6 | *= require_tree . 7 | */ -------------------------------------------------------------------------------- /app/controllers/application_controller.rb: -------------------------------------------------------------------------------- 1 | class ApplicationController < ActionController::Base 2 | protect_from_forgery 3 | end 4 | -------------------------------------------------------------------------------- /app/controllers/static_controller.rb: -------------------------------------------------------------------------------- 1 | class StaticController < ApplicationController 2 | 3 | def index 4 | 5 | end 6 | 7 | end 8 | -------------------------------------------------------------------------------- /app/helpers/application_helper.rb: -------------------------------------------------------------------------------- 1 | module ApplicationHelper 2 | end 3 | -------------------------------------------------------------------------------- /app/mailers/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/keithpitt/ember-rails-example/262ec6920fe722c4f7d2105e88d498a405174d09/app/mailers/.gitkeep -------------------------------------------------------------------------------- /app/models/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/keithpitt/ember-rails-example/262ec6920fe722c4f7d2105e88d498a405174d09/app/models/.gitkeep -------------------------------------------------------------------------------- /app/views/layouts/application.html.erb: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | SproutcoreExample 5 | <%= javascript_include_tag "head" %> 6 | <%= javascript_include_tag "loader" %> 7 | <%= stylesheet_link_tag "application" %> 8 | <%= csrf_meta_tags %> 9 | 10 | 11 | 12 | <%= yield %> 13 | 14 |
15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /app/views/static/index.html.erb: -------------------------------------------------------------------------------- 1 |

Welcome!

2 | -------------------------------------------------------------------------------- /config.ru: -------------------------------------------------------------------------------- 1 | # This file is used by Rack-based servers to start the application. 2 | 3 | require ::File.expand_path('../config/environment', __FILE__) 4 | run SproutcoreExample::Application 5 | -------------------------------------------------------------------------------- /config/application.rb: -------------------------------------------------------------------------------- 1 | require File.expand_path('../boot', __FILE__) 2 | 3 | # Pick the frameworks you want: 4 | # require "active_record/railtie" 5 | require "action_controller/railtie" 6 | require "action_mailer/railtie" 7 | require "active_resource/railtie" 8 | require "sprockets/railtie" 9 | require "rails/test_unit/railtie" 10 | 11 | if defined?(Bundler) 12 | # If you precompile assets before deploying to production, use this line 13 | Bundler.require(*Rails.groups(:assets => %w(development test))) 14 | # If you want your assets lazily compiled in production, use this line 15 | # Bundler.require(:default, :assets, Rails.env) 16 | end 17 | 18 | module SproutcoreExample 19 | class Application < Rails::Application 20 | # Settings in config/environments/* take precedence over those specified here. 21 | # Application configuration should go into files in config/initializers 22 | # -- all .rb files in that directory are automatically loaded. 23 | 24 | # Custom directories with classes and modules you want to be autoloadable. 25 | # config.autoload_paths += %W(#{config.root}/extras) 26 | 27 | # Only load the plugins named here, in the order given (default is alphabetical). 28 | # :all can be used as a placeholder for all plugins not explicitly named. 29 | # config.plugins = [ :exception_notification, :ssl_requirement, :all ] 30 | 31 | # Activate observers that should always be running. 32 | # config.active_record.observers = :cacher, :garbage_collector, :forum_observer 33 | 34 | # Set Time.zone default to the specified zone and make Active Record auto-convert to this zone. 35 | # Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC. 36 | # config.time_zone = 'Central Time (US & Canada)' 37 | 38 | # The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded. 39 | # config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s] 40 | # config.i18n.default_locale = :de 41 | 42 | # Configure the default encoding used in templates for Ruby 1.9. 43 | config.encoding = "utf-8" 44 | 45 | # Configure sensitive parameters which will be filtered from the log file. 46 | config.filter_parameters += [:password] 47 | 48 | # Enable the asset pipeline 49 | config.assets.enabled = true 50 | 51 | # Version of your assets, change this if you want to expire all your assets 52 | config.assets.version = '1.0' 53 | end 54 | end 55 | -------------------------------------------------------------------------------- /config/boot.rb: -------------------------------------------------------------------------------- 1 | require 'rubygems' 2 | 3 | # Set up gems listed in the Gemfile. 4 | ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__) 5 | 6 | require 'bundler/setup' if File.exists?(ENV['BUNDLE_GEMFILE']) 7 | -------------------------------------------------------------------------------- /config/database.yml: -------------------------------------------------------------------------------- 1 | # SQLite version 3.x 2 | # gem install sqlite3 3 | # 4 | # Ensure the SQLite 3 gem is defined in your Gemfile 5 | # gem 'sqlite3' 6 | development: 7 | adapter: sqlite3 8 | database: db/development.sqlite3 9 | pool: 5 10 | timeout: 5000 11 | 12 | # Warning: The database defined as "test" will be erased and 13 | # re-generated from your development database when you run "rake". 14 | # Do not set this db to the same as development or production. 15 | test: 16 | adapter: sqlite3 17 | database: db/test.sqlite3 18 | pool: 5 19 | timeout: 5000 20 | 21 | production: 22 | adapter: sqlite3 23 | database: db/production.sqlite3 24 | pool: 5 25 | timeout: 5000 26 | -------------------------------------------------------------------------------- /config/environment.rb: -------------------------------------------------------------------------------- 1 | # Load the rails application 2 | require File.expand_path('../application', __FILE__) 3 | 4 | # Initialize the rails application 5 | SproutcoreExample::Application.initialize! 6 | -------------------------------------------------------------------------------- /config/environments/development.rb: -------------------------------------------------------------------------------- 1 | SproutcoreExample::Application.configure do 2 | # Settings specified here will take precedence over those in config/application.rb 3 | 4 | # In the development environment your application's code is reloaded on 5 | # every request. This slows down response time but is perfect for development 6 | # since you don't have to restart the web server when you make code changes. 7 | config.cache_classes = false 8 | 9 | # Log error messages when you accidentally call methods on nil. 10 | config.whiny_nils = true 11 | 12 | # Show full error reports and disable caching 13 | config.consider_all_requests_local = true 14 | config.action_controller.perform_caching = false 15 | 16 | # Don't care if the mailer can't send 17 | config.action_mailer.raise_delivery_errors = false 18 | 19 | # Print deprecation notices to the Rails logger 20 | config.active_support.deprecation = :log 21 | 22 | # Only use best-standards-support built into browsers 23 | config.action_dispatch.best_standards_support = :builtin 24 | 25 | # Do not compress assets 26 | config.assets.compress = false 27 | 28 | # Expands the lines which load the assets 29 | config.assets.debug = true 30 | end 31 | -------------------------------------------------------------------------------- /config/environments/production.rb: -------------------------------------------------------------------------------- 1 | SproutcoreExample::Application.configure do 2 | # Settings specified here will take precedence over those in config/application.rb 3 | 4 | # Code is not reloaded between requests 5 | config.cache_classes = true 6 | 7 | # Full error reports are disabled and caching is turned on 8 | config.consider_all_requests_local = false 9 | config.action_controller.perform_caching = true 10 | 11 | # Disable Rails's static asset server (Apache or nginx will already do this) 12 | config.serve_static_assets = false 13 | 14 | # Compress JavaScripts and CSS 15 | config.assets.compress = true 16 | 17 | # Don't fallback to assets pipeline if a precompiled asset is missed 18 | config.assets.compile = false 19 | 20 | # Generate digests for assets URLs 21 | config.assets.digest = true 22 | 23 | # Defaults to Rails.root.join("public/assets") 24 | # config.assets.manifest = YOUR_PATH 25 | 26 | # Specifies the header that your server uses for sending files 27 | # config.action_dispatch.x_sendfile_header = "X-Sendfile" # for apache 28 | # config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for nginx 29 | 30 | # Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies. 31 | # config.force_ssl = true 32 | 33 | # See everything in the log (default is :info) 34 | # config.log_level = :debug 35 | 36 | # Use a different logger for distributed setups 37 | # config.logger = SyslogLogger.new 38 | 39 | # Use a different cache store in production 40 | # config.cache_store = :mem_cache_store 41 | 42 | # Enable serving of images, stylesheets, and JavaScripts from an asset server 43 | # config.action_controller.asset_host = "http://assets.example.com" 44 | 45 | # Precompile additional assets (application.js, application.css, and all non-JS/CSS are already added) 46 | # config.assets.precompile += %w( search.js ) 47 | 48 | # Disable delivery errors, bad email addresses will be ignored 49 | # config.action_mailer.raise_delivery_errors = false 50 | 51 | # Enable threaded mode 52 | # config.threadsafe! 53 | 54 | # Enable locale fallbacks for I18n (makes lookups for any locale fall back to 55 | # the I18n.default_locale when a translation can not be found) 56 | config.i18n.fallbacks = true 57 | 58 | # Send deprecation notices to registered listeners 59 | config.active_support.deprecation = :notify 60 | end 61 | -------------------------------------------------------------------------------- /config/environments/test.rb: -------------------------------------------------------------------------------- 1 | SproutcoreExample::Application.configure do 2 | # Settings specified here will take precedence over those in config/application.rb 3 | 4 | # The test environment is used exclusively to run your application's 5 | # test suite. You never need to work with it otherwise. Remember that 6 | # your test database is "scratch space" for the test suite and is wiped 7 | # and recreated between test runs. Don't rely on the data there! 8 | config.cache_classes = true 9 | 10 | # Configure static asset server for tests with Cache-Control for performance 11 | config.serve_static_assets = true 12 | config.static_cache_control = "public, max-age=3600" 13 | 14 | # Log error messages when you accidentally call methods on nil 15 | config.whiny_nils = true 16 | 17 | # Show full error reports and disable caching 18 | config.consider_all_requests_local = true 19 | config.action_controller.perform_caching = false 20 | 21 | # Raise exceptions instead of rendering exception templates 22 | config.action_dispatch.show_exceptions = false 23 | 24 | # Disable request forgery protection in test environment 25 | config.action_controller.allow_forgery_protection = false 26 | 27 | # Tell Action Mailer not to deliver emails to the real world. 28 | # The :test delivery method accumulates sent emails in the 29 | # ActionMailer::Base.deliveries array. 30 | config.action_mailer.delivery_method = :test 31 | 32 | # Use SQL instead of Active Record's schema dumper when creating the test database. 33 | # This is necessary if your schema can't be completely dumped by the schema dumper, 34 | # like if you have constraints or database-specific column types 35 | # config.active_record.schema_format = :sql 36 | 37 | # Print deprecation notices to the stderr 38 | config.active_support.deprecation = :stderr 39 | 40 | # Raise exception on mass assignment protection for Active Record models 41 | config.active_record.mass_assignment_sanitizer = :strict 42 | end 43 | -------------------------------------------------------------------------------- /config/initializers/backtrace_silencers.rb: -------------------------------------------------------------------------------- 1 | # Be sure to restart your server when you modify this file. 2 | 3 | # You can add backtrace silencers for libraries that you're using but don't wish to see in your backtraces. 4 | # Rails.backtrace_cleaner.add_silencer { |line| line =~ /my_noisy_library/ } 5 | 6 | # You can also remove all the silencers if you're trying to debug a problem that might stem from framework code. 7 | # Rails.backtrace_cleaner.remove_silencers! 8 | -------------------------------------------------------------------------------- /config/initializers/inflections.rb: -------------------------------------------------------------------------------- 1 | # Be sure to restart your server when you modify this file. 2 | 3 | # Add new inflection rules using the following format 4 | # (all these examples are active by default): 5 | # ActiveSupport::Inflector.inflections do |inflect| 6 | # inflect.plural /^(ox)$/i, '\1en' 7 | # inflect.singular /^(ox)en/i, '\1' 8 | # inflect.irregular 'person', 'people' 9 | # inflect.uncountable %w( fish sheep ) 10 | # end 11 | -------------------------------------------------------------------------------- /config/initializers/mime_types.rb: -------------------------------------------------------------------------------- 1 | # Be sure to restart your server when you modify this file. 2 | 3 | # Add new mime types for use in respond_to blocks: 4 | # Mime::Type.register "text/richtext", :rtf 5 | # Mime::Type.register_alias "text/html", :iphone 6 | -------------------------------------------------------------------------------- /config/initializers/secret_token.rb: -------------------------------------------------------------------------------- 1 | # Be sure to restart your server when you modify this file. 2 | 3 | # Your secret key for verifying the integrity of signed cookies. 4 | # If you change this key, all old signed cookies will become invalid! 5 | # Make sure the secret is at least 30 characters and all random, 6 | # no regular words or you'll be exposed to dictionary attacks. 7 | SproutcoreExample::Application.config.secret_token = '6670ef84b9a2c630c175c62505ea624ba52c5b4eedafca15cc977426b2eed2638399f96113771cee41e442aff0d6ac30787e3697954a123fc811ce20fcffce34' 8 | -------------------------------------------------------------------------------- /config/initializers/session_store.rb: -------------------------------------------------------------------------------- 1 | # Be sure to restart your server when you modify this file. 2 | 3 | SproutcoreExample::Application.config.session_store :cookie_store, key: '_sproutcore-example_session' 4 | 5 | # Use the database for sessions instead of the cookie-based default, 6 | # which shouldn't be used to store highly confidential information 7 | # (create the session table with "rails generate session_migration") 8 | # SproutcoreExample::Application.config.session_store :active_record_store 9 | -------------------------------------------------------------------------------- /config/initializers/wrap_parameters.rb: -------------------------------------------------------------------------------- 1 | # Be sure to restart your server when you modify this file. 2 | # 3 | # This file contains settings for ActionController::ParamsWrapper which 4 | # is enabled by default. 5 | 6 | # Enable parameter wrapping for JSON. You can disable this by setting :format to an empty array. 7 | ActiveSupport.on_load(:action_controller) do 8 | wrap_parameters format: [:json] 9 | end 10 | 11 | # Disable root element in JSON by default. 12 | ActiveSupport.on_load(:active_record) do 13 | self.include_root_in_json = false 14 | end 15 | -------------------------------------------------------------------------------- /config/locales/en.yml: -------------------------------------------------------------------------------- 1 | # Sample localization file for English. Add more files in this directory for other locales. 2 | # See https://github.com/svenfuchs/rails-i18n/tree/master/rails%2Flocale for starting points. 3 | 4 | en: 5 | hello: "Hello world" 6 | -------------------------------------------------------------------------------- /config/routes.rb: -------------------------------------------------------------------------------- 1 | SproutcoreExample::Application.routes.draw do 2 | 3 | root :to => 'static#index' 4 | 5 | end 6 | -------------------------------------------------------------------------------- /db/seeds.rb: -------------------------------------------------------------------------------- 1 | # This file should contain all the record creation needed to seed the database with its default values. 2 | # The data can then be loaded with the rake db:seed (or created alongside the db with db:setup). 3 | # 4 | # Examples: 5 | # 6 | # cities = City.create([{ name: 'Chicago' }, { name: 'Copenhagen' }]) 7 | # Mayor.create(name: 'Emanuel', city: cities.first) 8 | -------------------------------------------------------------------------------- /doc/README_FOR_APP: -------------------------------------------------------------------------------- 1 | Use this README file to introduce your application and point to useful places in the API for learning more. 2 | Run "rake doc:app" to generate API documentation for your models, controllers, helpers, and libraries. 3 | -------------------------------------------------------------------------------- /lib/assets/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/keithpitt/ember-rails-example/262ec6920fe722c4f7d2105e88d498a405174d09/lib/assets/.gitkeep -------------------------------------------------------------------------------- /lib/tasks/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/keithpitt/ember-rails-example/262ec6920fe722c4f7d2105e88d498a405174d09/lib/tasks/.gitkeep -------------------------------------------------------------------------------- /log/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/keithpitt/ember-rails-example/262ec6920fe722c4f7d2105e88d498a405174d09/log/.gitkeep -------------------------------------------------------------------------------- /public/404.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | The page you were looking for doesn't exist (404) 5 | 17 | 18 | 19 | 20 | 21 |
22 |

The page you were looking for doesn't exist.

23 |

You may have mistyped the address or the page may have moved.

24 |
25 | 26 | 27 | -------------------------------------------------------------------------------- /public/422.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | The change you wanted was rejected (422) 5 | 17 | 18 | 19 | 20 | 21 |
22 |

The change you wanted was rejected.

23 |

Maybe you tried to change something you didn't have access to.

24 |
25 | 26 | 27 | -------------------------------------------------------------------------------- /public/500.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | We're sorry, but something went wrong (500) 5 | 17 | 18 | 19 | 20 | 21 |
22 |

We're sorry, but something went wrong.

23 |

We've been notified about this issue and we'll take a look at it shortly.

24 |
25 | 26 | 27 | -------------------------------------------------------------------------------- /public/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/keithpitt/ember-rails-example/262ec6920fe722c4f7d2105e88d498a405174d09/public/favicon.ico -------------------------------------------------------------------------------- /public/robots.txt: -------------------------------------------------------------------------------- 1 | # See http://www.robotstxt.org/wc/norobots.html for documentation on how to use the robots.txt file 2 | # 3 | # To ban all spiders from the entire site uncomment the next two lines: 4 | # User-Agent: * 5 | # Disallow: / 6 | -------------------------------------------------------------------------------- /script/rails: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | # This command will automatically be run when you run "rails" with Rails 3 gems installed from the root of your application. 3 | 4 | APP_PATH = File.expand_path('../../config/application', __FILE__) 5 | require File.expand_path('../../config/boot', __FILE__) 6 | require 'rails/commands' 7 | -------------------------------------------------------------------------------- /test/fixtures/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/keithpitt/ember-rails-example/262ec6920fe722c4f7d2105e88d498a405174d09/test/fixtures/.gitkeep -------------------------------------------------------------------------------- /test/functional/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/keithpitt/ember-rails-example/262ec6920fe722c4f7d2105e88d498a405174d09/test/functional/.gitkeep -------------------------------------------------------------------------------- /test/integration/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/keithpitt/ember-rails-example/262ec6920fe722c4f7d2105e88d498a405174d09/test/integration/.gitkeep -------------------------------------------------------------------------------- /test/performance/browsing_test.rb: -------------------------------------------------------------------------------- 1 | require 'test_helper' 2 | require 'rails/performance_test_help' 3 | 4 | class BrowsingTest < ActionDispatch::PerformanceTest 5 | # Refer to the documentation for all available options 6 | # self.profile_options = { :runs => 5, :metrics => [:wall_time, :memory] 7 | # :output => 'tmp/performance', :formats => [:flat] } 8 | 9 | def test_homepage 10 | get '/' 11 | end 12 | end 13 | -------------------------------------------------------------------------------- /test/test_helper.rb: -------------------------------------------------------------------------------- 1 | ENV["RAILS_ENV"] = "test" 2 | require File.expand_path('../../config/environment', __FILE__) 3 | require 'rails/test_help' 4 | 5 | class ActiveSupport::TestCase 6 | # Setup all fixtures in test/fixtures/*.(yml|csv) for all tests in alphabetical order. 7 | # 8 | # Note: You'll currently still have to declare fixtures explicitly in integration tests 9 | # -- they do not yet inherit this setting 10 | fixtures :all 11 | 12 | # Add more helper methods to be used by all tests here... 13 | end 14 | -------------------------------------------------------------------------------- /test/unit/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/keithpitt/ember-rails-example/262ec6920fe722c4f7d2105e88d498a405174d09/test/unit/.gitkeep -------------------------------------------------------------------------------- /vendor/assets/javascripts/head.js: -------------------------------------------------------------------------------- 1 | /** 2 | Head JS The only script in your 3 | Copyright Tero Piirainen (tipiirai) 4 | License MIT / http://bit.ly/mit-license 5 | Version 0.96 6 | 7 | http://headjs.com 8 | */ 9 | (function(doc) { 10 | 11 | var html = doc.documentElement, 12 | conf = { 13 | screens: [320, 480, 640, 768, 1024, 1280, 1440, 1680, 1920], 14 | section: "-section", 15 | page: "-page", 16 | head: "head" 17 | }, 18 | klass = []; 19 | 20 | 21 | if (window.head_conf) { 22 | for (var key in head_conf) { 23 | if (head_conf[key] !== undefined) { 24 | conf[key] = head_conf[key]; 25 | } 26 | } 27 | } 28 | 29 | function pushClass(name) { 30 | klass[klass.length] = name; 31 | } 32 | 33 | function removeClass(name) { 34 | var re = new RegExp("\\b" + name + "\\b"); 35 | html.className = html.className.replace(re, ''); 36 | } 37 | 38 | function each(arr, fn) { 39 | for (var i = 0, arr_length = arr.length; i < arr_length; i++) { 40 | fn.call(arr, arr[i], i); 41 | } 42 | } 43 | 44 | // API 45 | var api = window[conf.head] = function() { 46 | api.ready.apply(null, arguments); 47 | }; 48 | 49 | api.feature = function(key, enabled, queue) { 50 | 51 | // internal: apply all classes 52 | if (!key) { 53 | html.className += ' ' + klass.join( ' ' ); 54 | klass = []; 55 | return; 56 | } 57 | 58 | if (Object.prototype.toString.call(enabled) == '[object Function]') { 59 | enabled = enabled.call(); 60 | } 61 | 62 | pushClass((enabled ? '' : 'no-') + key); 63 | api[key] = !!enabled; 64 | 65 | // apply class to HTML element 66 | if (!queue) { 67 | removeClass('no-' + key); 68 | removeClass(key); 69 | api.feature(); 70 | } 71 | 72 | return api; 73 | }; 74 | 75 | // browser type & version 76 | var ua = navigator.userAgent.toLowerCase(); 77 | 78 | ua = /(webkit)[ \/]([\w.]+)/.exec( ua ) || 79 | /(opera)(?:.*version)?[ \/]([\w.]+)/.exec( ua ) || 80 | /(msie) ([\w.]+)/.exec( ua ) || 81 | !/compatible/.test( ua ) && /(mozilla)(?:.*? rv:([\w.]+))?/.exec( ua ) || []; 82 | 83 | 84 | if (ua[1] == 'msie') { 85 | ua[1] = 'ie'; 86 | ua[2] = document.documentMode || ua[2]; 87 | } 88 | 89 | pushClass(ua[1]); 90 | 91 | api.browser = { version: ua[2] }; 92 | api.browser[ua[1]] = true; 93 | 94 | // IE specific 95 | if (api.browser.ie) { 96 | 97 | pushClass("ie" + parseFloat(ua[2])); 98 | 99 | // IE versions 100 | for (var ver = 3; ver < 11; ver++) { 101 | if (parseFloat(ua[2]) < ver) { pushClass("lt-ie" + ver); } 102 | } 103 | 104 | // HTML5 support 105 | each("abbr|article|aside|audio|canvas|details|figcaption|figure|footer|header|hgroup|mark|meter|nav|output|progress|section|summary|time|video".split("|"), function(el) { 106 | doc.createElement(el); 107 | }); 108 | 109 | } 110 | 111 | 112 | // CSS "router" 113 | each(location.pathname.split("/"), function(el, i) { 114 | 115 | if (this.length > 2 && this[i + 1] !== undefined) { 116 | if (i) { pushClass(this.slice(1, i+1).join("-") + conf.section); } 117 | 118 | } else { 119 | 120 | // pageId 121 | var id = el || "index", index = id.indexOf("."); 122 | if (index > 0) { id = id.substring(0, index); } 123 | html.id = id + conf.page; 124 | 125 | // on root? 126 | if (!i) { pushClass("root" + conf.section); } 127 | } 128 | }); 129 | 130 | 131 | // screen resolution: w-100, lt-480, lt-1024 ... 132 | function screenSize() { 133 | var w = window.outerWidth || html.clientWidth; 134 | 135 | // remove earlier widths 136 | html.className = html.className.replace(/ (w|lt)-\d+/g, ""); 137 | 138 | // add new ones 139 | pushClass("w-" + Math.round(w / 100) * 100); 140 | 141 | each(conf.screens, function(width) { 142 | if (w <= width) { pushClass("lt-" + width); } 143 | }); 144 | 145 | api.feature(); 146 | } 147 | 148 | screenSize(); 149 | window.onresize = screenSize; 150 | 151 | api.feature("js", true).feature(); 152 | 153 | })(document); 154 | 155 | 156 | /** 157 | Head JS The only script in your 158 | Copyright Tero Piirainen (tipiirai) 159 | License MIT / http://bit.ly/mit-license 160 | Version 0.96 161 | 162 | http://headjs.com 163 | */ 164 | (function() { 165 | /* 166 | To add a new test: 167 | 168 | head.feature("video", function() { 169 | var tag = document.createElement('video'); 170 | return !!tag.canPlayType; 171 | }); 172 | 173 | Good place to grab more tests 174 | 175 | https://github.com/Modernizr/Modernizr/blob/master/modernizr.js 176 | */ 177 | 178 | 179 | /* CSS modernizer */ 180 | var el = document.createElement("i"), 181 | style = el.style, 182 | prefs = ' -o- -moz- -ms- -webkit- -khtml- '.split(' '), 183 | domPrefs = 'Webkit Moz O ms Khtml'.split(' '), 184 | 185 | head_var = window.head_conf && head_conf.head || "head", 186 | api = window[head_var]; 187 | 188 | 189 | // Thanks Paul Irish! 190 | function testProps(props) { 191 | for (var i in props) { 192 | if (style[props[i]] !== undefined) { 193 | return true; 194 | } 195 | } 196 | } 197 | 198 | 199 | function testAll(prop) { 200 | var camel = prop.charAt(0).toUpperCase() + prop.substr(1), 201 | props = (prop + ' ' + domPrefs.join(camel + ' ') + camel).split(' '); 202 | 203 | return !!testProps(props); 204 | } 205 | 206 | var tests = { 207 | 208 | gradient: function() { 209 | var s1 = 'background-image:', 210 | s2 = 'gradient(linear,left top,right bottom,from(#9f9),to(#fff));', 211 | s3 = 'linear-gradient(left top,#eee,#fff);'; 212 | 213 | style.cssText = (s1 + prefs.join(s2 + s1) + prefs.join(s3 + s1)).slice(0,-s1.length); 214 | return !!style.backgroundImage; 215 | }, 216 | 217 | rgba: function() { 218 | style.cssText = "background-color:rgba(0,0,0,0.5)"; 219 | return !!style.backgroundColor; 220 | }, 221 | 222 | opacity: function() { 223 | return el.style.opacity === ""; 224 | }, 225 | 226 | textshadow: function() { 227 | return style.textShadow === ''; 228 | }, 229 | 230 | multiplebgs: function() { 231 | style.cssText = "background:url(//:),url(//:),red url(//:)"; 232 | return new RegExp("(url\\s*\\(.*?){3}").test(style.background); 233 | }, 234 | 235 | boxshadow: function() { 236 | return testAll("boxShadow"); 237 | }, 238 | 239 | borderimage: function() { 240 | return testAll("borderImage"); 241 | }, 242 | 243 | borderradius: function() { 244 | return testAll("borderRadius"); 245 | }, 246 | 247 | cssreflections: function() { 248 | return testAll("boxReflect"); 249 | }, 250 | 251 | csstransforms: function() { 252 | return testAll("transform"); 253 | }, 254 | 255 | csstransitions: function() { 256 | return testAll("transition"); 257 | }, 258 | 259 | /* 260 | font-face support. Uses browser sniffing but is synchronous. 261 | 262 | http://paulirish.com/2009/font-face-feature-detection/ 263 | */ 264 | fontface: function() { 265 | var ua = navigator.userAgent, parsed; 266 | 267 | if (/*@cc_on@if(@_jscript_version>=5)!@end@*/0) 268 | return true; 269 | 270 | if (parsed = ua.match(/Chrome\/(\d+\.\d+\.\d+\.\d+)/)) 271 | return parsed[1] >= '4.0.249.4' || 1 * parsed[1].split(".")[0] > 5; 272 | if ((parsed = ua.match(/Safari\/(\d+\.\d+)/)) && !/iPhone/.test(ua)) 273 | return parsed[1] >= '525.13'; 274 | if (/Opera/.test({}.toString.call(window.opera))) 275 | return opera.version() >= '10.00'; 276 | if (parsed = ua.match(/rv:(\d+\.\d+\.\d+)[^b].*Gecko\//)) 277 | return parsed[1] >= '1.9.1'; 278 | 279 | return false; 280 | } 281 | }; 282 | 283 | // queue features 284 | for (var key in tests) { 285 | if (tests[key]) { 286 | api.feature(key, tests[key].call(), true); 287 | } 288 | } 289 | 290 | // enable features at once 291 | api.feature(); 292 | 293 | })(); 294 | 295 | 296 | /** 297 | Head JS The only script in your 298 | Copyright Tero Piirainen (tipiirai) 299 | License MIT / http://bit.ly/mit-license 300 | Version 0.96 301 | 302 | http://headjs.com 303 | */ 304 | (function(doc) { 305 | 306 | var head = doc.documentElement, 307 | isHeadReady, 308 | isDomReady, 309 | domWaiters = [], 310 | queue = [], // waiters for the "head ready" event 311 | handlers = {}, // user functions waiting for events 312 | scripts = {}, // loadable scripts in different states 313 | isAsync = doc.createElement("script").async === true || "MozAppearance" in doc.documentElement.style || window.opera; 314 | 315 | 316 | /*** public API ***/ 317 | var head_var = window.head_conf && head_conf.head || "head", 318 | api = window[head_var] = (window[head_var] || function() { api.ready.apply(null, arguments); }); 319 | 320 | // states 321 | var PRELOADED = 1, 322 | PRELOADING = 2, 323 | LOADING = 3, 324 | LOADED = 4; 325 | 326 | 327 | // Method 1: simply load and let browser take care of ordering 328 | if (isAsync) { 329 | 330 | api.js = function() { 331 | 332 | var args = arguments, 333 | fn = args[args.length -1], 334 | els = {}; 335 | 336 | if (!isFunc(fn)) { fn = null; } 337 | 338 | each(args, function(el, i) { 339 | 340 | if (el != fn) { 341 | el = getScript(el); 342 | els[el.name] = el; 343 | 344 | load(el, fn && i == args.length -2 ? function() { 345 | if (allLoaded(els)) { one(fn); } 346 | 347 | } : null); 348 | } 349 | }); 350 | 351 | return api; 352 | }; 353 | 354 | 355 | // Method 2: preload with text/cache hack 356 | } else { 357 | 358 | api.js = function() { 359 | 360 | var args = arguments, 361 | rest = [].slice.call(args, 1), 362 | next = rest[0]; 363 | 364 | // wait for a while. immediate execution causes some browsers to ignore caching 365 | if (!isHeadReady) { 366 | queue.push(function() { 367 | api.js.apply(null, args); 368 | }); 369 | return api; 370 | } 371 | 372 | // multiple arguments 373 | if (next) { 374 | 375 | // load 376 | each(rest, function(el) { 377 | if (!isFunc(el)) { 378 | preload(getScript(el)); 379 | } 380 | }); 381 | 382 | // execute 383 | load(getScript(args[0]), isFunc(next) ? next : function() { 384 | api.js.apply(null, rest); 385 | }); 386 | 387 | 388 | // single script 389 | } else { 390 | load(getScript(args[0])); 391 | } 392 | 393 | return api; 394 | }; 395 | } 396 | 397 | api.ready = function(key, fn) { 398 | 399 | // DOM ready check: head.ready(document, function() { }); 400 | if (key == doc) { 401 | if (isDomReady) { one(fn); } 402 | else { domWaiters.push(fn); } 403 | return api; 404 | } 405 | 406 | // shift arguments 407 | if (isFunc(key)) { 408 | fn = key; 409 | key = "ALL"; 410 | } 411 | 412 | // make sure arguments are sane 413 | if (typeof key != 'string' || !isFunc(fn)) { return api; } 414 | 415 | var script = scripts[key]; 416 | 417 | // script already loaded --> execute and return 418 | if (script && script.state == LOADED || key == 'ALL' && allLoaded() && isDomReady) { 419 | one(fn); 420 | return api; 421 | } 422 | 423 | var arr = handlers[key]; 424 | if (!arr) { arr = handlers[key] = [fn]; } 425 | else { arr.push(fn); } 426 | return api; 427 | }; 428 | 429 | 430 | // perform this when DOM is ready 431 | api.ready(doc, function() { 432 | 433 | if (allLoaded()) { 434 | each(handlers.ALL, function(fn) { 435 | one(fn); 436 | }); 437 | } 438 | 439 | if (api.feature) { 440 | api.feature("domloaded", true); 441 | } 442 | }); 443 | 444 | 445 | /*** private functions ***/ 446 | 447 | 448 | // call function once 449 | function one(fn) { 450 | if (fn._done) { return; } 451 | fn(); 452 | fn._done = 1; 453 | } 454 | 455 | 456 | function toLabel(url) { 457 | var els = url.split("/"), 458 | name = els[els.length -1], 459 | i = name.indexOf("?"); 460 | 461 | return i != -1 ? name.substring(0, i) : name; 462 | } 463 | 464 | 465 | function getScript(url) { 466 | 467 | var script; 468 | 469 | if (typeof url == 'object') { 470 | for (var key in url) { 471 | if (url[key]) { 472 | script = { name: key, url: url[key] }; 473 | } 474 | } 475 | } else { 476 | script = { name: toLabel(url), url: url }; 477 | } 478 | 479 | var existing = scripts[script.name]; 480 | if (existing && existing.url === script.url) { return existing; } 481 | 482 | scripts[script.name] = script; 483 | return script; 484 | } 485 | 486 | 487 | function each(arr, fn) { 488 | if (!arr) { return; } 489 | 490 | // arguments special type 491 | if (typeof arr == 'object') { arr = [].slice.call(arr); } 492 | 493 | // do the job 494 | for (var i = 0; i < arr.length; i++) { 495 | fn.call(arr, arr[i], i); 496 | } 497 | } 498 | 499 | function isFunc(el) { 500 | return Object.prototype.toString.call(el) == '[object Function]'; 501 | } 502 | 503 | function allLoaded(els) { 504 | 505 | els = els || scripts; 506 | 507 | var loaded; 508 | 509 | for (var name in els) { 510 | if (els.hasOwnProperty(name) && els[name].state != LOADED) { return false; } 511 | loaded = true; 512 | } 513 | 514 | return loaded; 515 | } 516 | 517 | 518 | function onPreload(script) { 519 | script.state = PRELOADED; 520 | 521 | each(script.onpreload, function(el) { 522 | el.call(); 523 | }); 524 | } 525 | 526 | function preload(script, callback) { 527 | 528 | if (script.state === undefined) { 529 | 530 | script.state = PRELOADING; 531 | script.onpreload = []; 532 | 533 | scriptTag({ src: script.url, type: 'cache'}, function() { 534 | onPreload(script); 535 | }); 536 | } 537 | } 538 | 539 | function load(script, callback) { 540 | 541 | if (script.state == LOADED) { 542 | return callback && callback(); 543 | } 544 | 545 | if (script.state == LOADING) { 546 | return api.ready(script.name, callback); 547 | } 548 | 549 | if (script.state == PRELOADING) { 550 | return script.onpreload.push(function() { 551 | load(script, callback); 552 | }); 553 | } 554 | 555 | script.state = LOADING; 556 | 557 | scriptTag(script.url, function() { 558 | 559 | script.state = LOADED; 560 | 561 | if (callback) { callback(); } 562 | 563 | // handlers for this script 564 | each(handlers[script.name], function(fn) { 565 | one(fn); 566 | }); 567 | 568 | // everything ready 569 | if (allLoaded() && isDomReady) { 570 | each(handlers.ALL, function(fn) { 571 | one(fn); 572 | }); 573 | } 574 | }); 575 | } 576 | 577 | 578 | function scriptTag(src, callback) { 579 | 580 | var s = doc.createElement('script'); 581 | s.type = 'text/' + (src.type || 'javascript'); 582 | s.src = src.src || src; 583 | s.async = false; 584 | 585 | s.onreadystatechange = s.onload = function() { 586 | 587 | var state = s.readyState; 588 | 589 | if (!callback.done && (!state || /loaded|complete/.test(state))) { 590 | callback.done = true; 591 | callback(); 592 | } 593 | }; 594 | 595 | // use body if available. more safe in IE 596 | (doc.body || head).appendChild(s); 597 | } 598 | 599 | /* 600 | The much desired DOM ready check 601 | Thanks to jQuery and http://javascript.nwbox.com/IEContentLoaded/ 602 | */ 603 | 604 | function fireReady() { 605 | if (!isDomReady) { 606 | isDomReady = true; 607 | each(domWaiters, function(fn) { 608 | one(fn); 609 | }); 610 | } 611 | } 612 | 613 | // W3C 614 | if (window.addEventListener) { 615 | doc.addEventListener("DOMContentLoaded", fireReady, false); 616 | 617 | // fallback. this is always called 618 | window.addEventListener("load", fireReady, false); 619 | 620 | // IE 621 | } else if (window.attachEvent) { 622 | 623 | // for iframes 624 | doc.attachEvent("onreadystatechange", function() { 625 | if (doc.readyState === "complete" ) { 626 | fireReady(); 627 | } 628 | }); 629 | 630 | 631 | // avoid frames with different domains issue 632 | var frameElement = 1; 633 | 634 | try { 635 | frameElement = window.frameElement; 636 | 637 | } catch(e) {} 638 | 639 | 640 | if (!frameElement && head.doScroll) { 641 | 642 | (function() { 643 | try { 644 | head.doScroll("left"); 645 | fireReady(); 646 | 647 | } catch(e) { 648 | setTimeout(arguments.callee, 1); 649 | return; 650 | } 651 | })(); 652 | } 653 | 654 | // fallback 655 | window.attachEvent("onload", fireReady); 656 | } 657 | 658 | 659 | // enable document.readyState for Firefox <= 3.5 660 | if (!doc.readyState && doc.addEventListener) { 661 | doc.readyState = "loading"; 662 | doc.addEventListener("DOMContentLoaded", handler = function () { 663 | doc.removeEventListener("DOMContentLoaded", handler, false); 664 | doc.readyState = "complete"; 665 | }, false); 666 | } 667 | 668 | /* 669 | We wait for 300 ms before script loading starts. for some reason this is needed 670 | to make sure scripts are cached. Not sure why this happens yet. A case study: 671 | 672 | https://github.com/headjs/headjs/issues/closed#issue/83 673 | */ 674 | setTimeout(function() { 675 | isHeadReady = true; 676 | each(queue, function(fn) { fn(); }); 677 | 678 | }, 300); 679 | 680 | })(document); 681 | 682 | -------------------------------------------------------------------------------- /vendor/assets/stylesheets/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/keithpitt/ember-rails-example/262ec6920fe722c4f7d2105e88d498a405174d09/vendor/assets/stylesheets/.gitkeep -------------------------------------------------------------------------------- /vendor/plugins/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/keithpitt/ember-rails-example/262ec6920fe722c4f7d2105e88d498a405174d09/vendor/plugins/.gitkeep --------------------------------------------------------------------------------