Permalink
Browse files

adding episode 284

  • Loading branch information...
1 parent 88fe65d commit 6fdd190a897dcc5bd959e9fdd265a68960cac1f8 @ryanb committed Sep 19, 2011
Showing with 2,611 additions and 0 deletions.
  1. +10 −0 episode-284/README
  2. +5 −0 episode-284/store-after/.gitignore
  3. +35 −0 episode-284/store-after/Gemfile
  4. +155 −0 episode-284/store-after/Gemfile.lock
  5. +8 −0 episode-284/store-after/README
  6. +7 −0 episode-284/store-after/Rakefile
  7. +48 −0 episode-284/store-after/app/admin/dashboards.rb
  8. +15 −0 episode-284/store-after/app/admin/products.rb
  9. BIN episode-284/store-after/app/assets/images/rails.png
  10. +1 −0 episode-284/store-after/app/assets/javascripts/active_admin.js
  11. +9 −0 episode-284/store-after/app/assets/javascripts/application.js
  12. +3 −0 episode-284/store-after/app/assets/javascripts/products.js.coffee
  13. +10 −0 episode-284/store-after/app/assets/stylesheets/active_admin.css.scss
  14. +82 −0 episode-284/store-after/app/assets/stylesheets/application.css.scss
  15. +3 −0 episode-284/store-after/app/assets/stylesheets/products.css.scss
  16. +3 −0 episode-284/store-after/app/controllers/application_controller.rb
  17. +9 −0 episode-284/store-after/app/controllers/products_controller.rb
  18. +2 −0 episode-284/store-after/app/helpers/application_helper.rb
  19. +23 −0 episode-284/store-after/app/helpers/error_messages_helper.rb
  20. +18 −0 episode-284/store-after/app/helpers/layout_helper.rb
  21. +2 −0 episode-284/store-after/app/helpers/products_helper.rb
  22. 0 episode-284/store-after/app/mailers/.gitkeep
  23. 0 episode-284/store-after/app/models/.gitkeep
  24. +9 −0 episode-284/store-after/app/models/admin_user.rb
  25. +3 −0 episode-284/store-after/app/models/category.rb
  26. +4 −0 episode-284/store-after/app/models/product.rb
  27. +19 −0 episode-284/store-after/app/views/layouts/application.html.erb
  28. +11 −0 episode-284/store-after/app/views/products/index.html.erb
  29. +21 −0 episode-284/store-after/app/views/products/show.html.erb
  30. +4 −0 episode-284/store-after/config.ru
  31. +48 −0 episode-284/store-after/config/application.rb
  32. +6 −0 episode-284/store-after/config/boot.rb
  33. +25 −0 episode-284/store-after/config/database.yml
  34. +5 −0 episode-284/store-after/config/environment.rb
  35. +32 −0 episode-284/store-after/config/environments/development.rb
  36. +60 −0 episode-284/store-after/config/environments/production.rb
  37. +42 −0 episode-284/store-after/config/environments/test.rb
  38. +100 −0 episode-284/store-after/config/initializers/active_admin.rb
  39. +7 −0 episode-284/store-after/config/initializers/backtrace_silencers.rb
  40. +211 −0 episode-284/store-after/config/initializers/devise.rb
  41. +10 −0 episode-284/store-after/config/initializers/inflections.rb
  42. +5 −0 episode-284/store-after/config/initializers/mime_types.rb
  43. +7 −0 episode-284/store-after/config/initializers/secret_token.rb
  44. +8 −0 episode-284/store-after/config/initializers/session_store.rb
  45. +14 −0 episode-284/store-after/config/initializers/wrap_parameters.rb
  46. +58 −0 episode-284/store-after/config/locales/devise.en.yml
  47. +5 −0 episode-284/store-after/config/locales/en.yml
  48. +8 −0 episode-284/store-after/config/routes.rb
  49. +16 −0 episode-284/store-after/db/migrate/20110919134727_create_admin_notes.rb
  50. +25 −0 episode-284/store-after/db/migrate/20110919134728_move_admin_notes_to_comments.rb
  51. +11 −0 episode-284/store-after/db/migrate/20110919171838_create_products.rb
  52. +9 −0 episode-284/store-after/db/migrate/20110919174935_create_categories.rb
  53. +5 −0 episode-284/store-after/db/migrate/20110919174955_add_category_id_to_products.rb
  54. +31 −0 episode-284/store-after/db/migrate/20110919204722_devise_create_admin_users.rb
  55. +64 −0 episode-284/store-after/db/schema.rb
  56. +7 −0 episode-284/store-after/db/seeds.rb
  57. +2 −0 episode-284/store-after/doc/README_FOR_APP
  58. 0 episode-284/store-after/lib/assets/.gitkeep
  59. 0 episode-284/store-after/lib/tasks/.gitkeep
  60. 0 episode-284/store-after/log/.gitkeep
  61. +26 −0 episode-284/store-after/public/404.html
  62. +26 −0 episode-284/store-after/public/422.html
  63. +26 −0 episode-284/store-after/public/500.html
  64. 0 episode-284/store-after/public/favicon.ico
  65. +5 −0 episode-284/store-after/public/robots.txt
  66. +6 −0 episode-284/store-after/script/rails
  67. 0 episode-284/store-after/test/fixtures/.gitkeep
  68. +10 −0 episode-284/store-after/test/fixtures/admin_users.yml
  69. +16 −0 episode-284/store-after/test/fixtures/categories.yml
  70. +62 −0 episode-284/store-after/test/fixtures/products.yml
  71. 0 episode-284/store-after/test/functional/.gitkeep
  72. +49 −0 episode-284/store-after/test/functional/products_controller_test.rb
  73. 0 episode-284/store-after/test/integration/.gitkeep
  74. +12 −0 episode-284/store-after/test/performance/browsing_test.rb
  75. +13 −0 episode-284/store-after/test/test_helper.rb
  76. 0 episode-284/store-after/test/unit/.gitkeep
  77. +7 −0 episode-284/store-after/test/unit/admin_user_test.rb
  78. +7 −0 episode-284/store-after/test/unit/category_test.rb
  79. +4 −0 episode-284/store-after/test/unit/helpers/products_helper_test.rb
  80. +7 −0 episode-284/store-after/test/unit/product_test.rb
  81. 0 episode-284/store-after/vendor/assets/stylesheets/.gitkeep
  82. 0 episode-284/store-after/vendor/plugins/.gitkeep
  83. +5 −0 episode-284/store-before/.gitignore
  84. +33 −0 episode-284/store-before/Gemfile
  85. +119 −0 episode-284/store-before/Gemfile.lock
  86. +8 −0 episode-284/store-before/README
  87. +7 −0 episode-284/store-before/Rakefile
  88. BIN episode-284/store-before/app/assets/images/rails.png
  89. +9 −0 episode-284/store-before/app/assets/javascripts/application.js
  90. +3 −0 episode-284/store-before/app/assets/javascripts/products.js.coffee
  91. +88 −0 episode-284/store-before/app/assets/stylesheets/application.css
  92. +3 −0 episode-284/store-before/app/assets/stylesheets/products.css.scss
  93. +3 −0 episode-284/store-before/app/controllers/application_controller.rb
  94. +9 −0 episode-284/store-before/app/controllers/products_controller.rb
  95. +2 −0 episode-284/store-before/app/helpers/application_helper.rb
  96. +23 −0 episode-284/store-before/app/helpers/error_messages_helper.rb
  97. +18 −0 episode-284/store-before/app/helpers/layout_helper.rb
  98. +2 −0 episode-284/store-before/app/helpers/products_helper.rb
  99. 0 episode-284/store-before/app/mailers/.gitkeep
  100. 0 episode-284/store-before/app/models/.gitkeep
  101. +3 −0 episode-284/store-before/app/models/category.rb
  102. +3 −0 episode-284/store-before/app/models/product.rb
  103. +19 −0 episode-284/store-before/app/views/layouts/application.html.erb
  104. +11 −0 episode-284/store-before/app/views/products/index.html.erb
  105. +21 −0 episode-284/store-before/app/views/products/show.html.erb
  106. +4 −0 episode-284/store-before/config.ru
  107. +48 −0 episode-284/store-before/config/application.rb
  108. +6 −0 episode-284/store-before/config/boot.rb
  109. +25 −0 episode-284/store-before/config/database.yml
  110. +5 −0 episode-284/store-before/config/environment.rb
  111. +32 −0 episode-284/store-before/config/environments/development.rb
  112. +60 −0 episode-284/store-before/config/environments/production.rb
  113. +42 −0 episode-284/store-before/config/environments/test.rb
  114. +7 −0 episode-284/store-before/config/initializers/backtrace_silencers.rb
  115. +10 −0 episode-284/store-before/config/initializers/inflections.rb
  116. +5 −0 episode-284/store-before/config/initializers/mime_types.rb
  117. +7 −0 episode-284/store-before/config/initializers/secret_token.rb
  118. +8 −0 episode-284/store-before/config/initializers/session_store.rb
  119. +14 −0 episode-284/store-before/config/initializers/wrap_parameters.rb
  120. +5 −0 episode-284/store-before/config/locales/en.yml
  121. +4 −0 episode-284/store-before/config/routes.rb
  122. +11 −0 episode-284/store-before/db/migrate/20110919171838_create_products.rb
  123. +9 −0 episode-284/store-before/db/migrate/20110919174935_create_categories.rb
  124. +5 −0 episode-284/store-before/db/migrate/20110919174955_add_category_id_to_products.rb
  125. +31 −0 episode-284/store-before/db/schema.rb
  126. +7 −0 episode-284/store-before/db/seeds.rb
  127. +2 −0 episode-284/store-before/doc/README_FOR_APP
  128. 0 episode-284/store-before/lib/assets/.gitkeep
  129. 0 episode-284/store-before/lib/tasks/.gitkeep
  130. 0 episode-284/store-before/log/.gitkeep
  131. +26 −0 episode-284/store-before/public/404.html
  132. +26 −0 episode-284/store-before/public/422.html
  133. +26 −0 episode-284/store-before/public/500.html
  134. 0 episode-284/store-before/public/favicon.ico
  135. +5 −0 episode-284/store-before/public/robots.txt
  136. +6 −0 episode-284/store-before/script/rails
  137. 0 episode-284/store-before/test/fixtures/.gitkeep
  138. +16 −0 episode-284/store-before/test/fixtures/categories.yml
  139. +62 −0 episode-284/store-before/test/fixtures/products.yml
  140. 0 episode-284/store-before/test/functional/.gitkeep
  141. +49 −0 episode-284/store-before/test/functional/products_controller_test.rb
  142. 0 episode-284/store-before/test/integration/.gitkeep
  143. +12 −0 episode-284/store-before/test/performance/browsing_test.rb
  144. +13 −0 episode-284/store-before/test/test_helper.rb
  145. 0 episode-284/store-before/test/unit/.gitkeep
  146. +7 −0 episode-284/store-before/test/unit/category_test.rb
  147. +4 −0 episode-284/store-before/test/unit/helpers/products_helper_test.rb
  148. +7 −0 episode-284/store-before/test/unit/product_test.rb
  149. 0 episode-284/store-before/vendor/assets/stylesheets/.gitkeep
  150. 0 episode-284/store-before/vendor/plugins/.gitkeep
View
@@ -0,0 +1,10 @@
+RailsCasts Episode #284: Active Admin
+
+http://railscasts.com/episodes/284-active-admin
+
+Commands used in episode
+
+ bundle
+ rails g active_admin:install
+ rake db:migrate
+ rails g active_admin:resource product
@@ -0,0 +1,5 @@
+.bundle
+db/*.sqlite3
+log/*.log
+tmp/
+.sass-cache/
@@ -0,0 +1,35 @@
+source 'http://rubygems.org'
+
+gem 'rails', '3.1.0'
+
+# Bundle edge Rails instead:
+# gem 'rails', :git => 'git://github.com/rails/rails.git'
+
+gem 'sqlite3'
+
+gem 'activeadmin'
+
+
+# Gems used only for assets and not required
+# in production environments by default.
+group :assets do
+ gem 'sass-rails', " ~> 3.1.0"
+ gem 'coffee-rails', "~> 3.1.0"
+ gem 'uglifier'
+end
+
+gem 'jquery-rails'
+
+# Use unicorn as the web server
+# gem 'unicorn'
+
+# Deploy with Capistrano
+# gem 'capistrano'
+
+# To use debugger
+# gem 'ruby-debug19', :require => 'ruby-debug'
+
+group :test do
+ # Pretty printed test output
+ gem 'turn', :require => false
+end
@@ -0,0 +1,155 @@
+GEM
+ remote: http://rubygems.org/
+ specs:
+ actionmailer (3.1.0)
+ actionpack (= 3.1.0)
+ mail (~> 2.3.0)
+ actionpack (3.1.0)
+ activemodel (= 3.1.0)
+ activesupport (= 3.1.0)
+ builder (~> 3.0.0)
+ erubis (~> 2.7.0)
+ i18n (~> 0.6)
+ rack (~> 1.3.2)
+ rack-cache (~> 1.0.3)
+ rack-mount (~> 0.8.2)
+ rack-test (~> 0.6.1)
+ sprockets (~> 2.0.0)
+ activeadmin (0.3.1)
+ devise (>= 1.1.2)
+ fastercsv
+ formtastic (>= 1.1.0)
+ inherited_resources (< 1.3.0)
+ kaminari (>= 0.12.4)
+ meta_search (>= 0.9.2)
+ rails (>= 3.0.0)
+ sass (>= 3.1.0)
+ activemodel (3.1.0)
+ activesupport (= 3.1.0)
+ bcrypt-ruby (~> 3.0.0)
+ builder (~> 3.0.0)
+ i18n (~> 0.6)
+ activerecord (3.1.0)
+ activemodel (= 3.1.0)
+ activesupport (= 3.1.0)
+ arel (~> 2.2.1)
+ tzinfo (~> 0.3.29)
+ activeresource (3.1.0)
+ activemodel (= 3.1.0)
+ activesupport (= 3.1.0)
+ activesupport (3.1.0)
+ multi_json (~> 1.0)
+ ansi (1.3.0)
+ arel (2.2.1)
+ bcrypt-ruby (3.0.1)
+ builder (3.0.0)
+ coffee-rails (3.1.1)
+ coffee-script (>= 2.2.0)
+ railties (~> 3.1.0)
+ coffee-script (2.2.0)
+ coffee-script-source
+ execjs
+ coffee-script-source (1.1.2)
+ devise (1.4.5)
+ bcrypt-ruby (~> 3.0)
+ orm_adapter (~> 0.0.3)
+ warden (~> 1.0.3)
+ erubis (2.7.0)
+ execjs (1.2.6)
+ multi_json (~> 1.0)
+ fastercsv (1.5.4)
+ formtastic (1.2.4)
+ actionpack (>= 2.3.7)
+ activesupport (>= 2.3.7)
+ i18n (~> 0.4)
+ has_scope (0.5.1)
+ hike (1.2.1)
+ i18n (0.6.0)
+ inherited_resources (1.2.2)
+ has_scope (~> 0.5.0)
+ responders (~> 0.6.0)
+ jquery-rails (1.0.14)
+ railties (~> 3.0)
+ thor (~> 0.14)
+ kaminari (0.12.4)
+ rails (>= 3.0.0)
+ mail (2.3.0)
+ i18n (>= 0.4.0)
+ mime-types (~> 1.16)
+ treetop (~> 1.4.8)
+ meta_search (1.1.1)
+ actionpack (~> 3.1.0)
+ activerecord (~> 3.1.0)
+ activesupport (~> 3.1.0)
+ polyamorous (~> 0.5.0)
+ mime-types (1.16)
+ multi_json (1.0.3)
+ orm_adapter (0.0.5)
+ polyamorous (0.5.0)
+ activerecord (~> 3.0)
+ polyglot (0.3.2)
+ rack (1.3.3)
+ rack-cache (1.0.3)
+ rack (>= 0.4)
+ rack-mount (0.8.3)
+ rack (>= 1.0.0)
+ rack-ssl (1.3.2)
+ rack
+ rack-test (0.6.1)
+ rack (>= 1.0)
+ rails (3.1.0)
+ actionmailer (= 3.1.0)
+ actionpack (= 3.1.0)
+ activerecord (= 3.1.0)
+ activeresource (= 3.1.0)
+ activesupport (= 3.1.0)
+ bundler (~> 1.0)
+ railties (= 3.1.0)
+ railties (3.1.0)
+ actionpack (= 3.1.0)
+ activesupport (= 3.1.0)
+ rack-ssl (~> 1.3.2)
+ rake (>= 0.8.7)
+ rdoc (~> 3.4)
+ thor (~> 0.14.6)
+ rake (0.9.2)
+ rdoc (3.9.4)
+ responders (0.6.4)
+ sass (3.1.7)
+ sass-rails (3.1.2)
+ actionpack (~> 3.1.0)
+ railties (~> 3.1.0)
+ sass (>= 3.1.4)
+ sprockets (~> 2.0.0)
+ tilt (~> 1.3.2)
+ sprockets (2.0.0)
+ hike (~> 1.2)
+ rack (~> 1.0)
+ tilt (!= 1.3.0, ~> 1.1)
+ sqlite3 (1.3.4)
+ thor (0.14.6)
+ tilt (1.3.3)
+ treetop (1.4.10)
+ polyglot
+ polyglot (>= 0.3.1)
+ turn (0.8.2)
+ ansi (>= 1.2.2)
+ tzinfo (0.3.29)
+ uglifier (1.0.3)
+ execjs (>= 0.3.0)
+ multi_json (>= 1.0.2)
+ warden (1.0.5)
+ rack (>= 1.0)
+
+PLATFORMS
+ ruby
+
+DEPENDENCIES
+ activeadmin
+ coffee-rails (~> 3.1.0)
+ jquery-rails
+ rails (= 3.1.0)
+ sass-rails (~> 3.1.0)
+ sqlite3
+ turn
+ uglifier
@@ -0,0 +1,8 @@
+= RailsCasts Example Application
+
+Run these commands to try it out.
+
+ bundle
+ rake db:migrate
+ rake db:fixtures:load
+ rails s
@@ -0,0 +1,7 @@
+#!/usr/bin/env rake
+# Add your own tasks in files placed in lib/tasks ending in .rake,
+# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
+
+require File.expand_path('../config/application', __FILE__)
+
+Store::Application.load_tasks
@@ -0,0 +1,48 @@
+ActiveAdmin::Dashboards.build do
+
+ section "Recent Products" do
+ table_for Product.order("released_at desc").limit(5) do
+ column :name do |product|
+ link_to product.name, [:admin, product]
+ end
+ column :released_at
+ end
+ strong { link_to "View All Products", admin_products_path }
+ end
+
+ # Define your dashboard sections here. Each block will be
+ # rendered on the dashboard in the context of the view. So just
+ # return the content which you would like to display.
+
+ # == Simple Dashboard Section
+ # Here is an example of a simple dashboard section
+ #
+ # section "Recent Posts" do
+ # ul do
+ # Post.recent(5).collect do |post|
+ # li link_to(post.title, admin_post_path(post))
+ # end
+ # end
+ # end
+
+ # == Render Partial Section
+ # The block is rendered within the context of the view, so you can
+ # easily render a partial rather than build content in ruby.
+ #
+ # section "Recent Posts" do
+ # div do
+ # render 'recent_posts' # => this will render /app/views/admin/dashboard/_recent_posts.html.erb
+ # end
+ # end
+
+ # == Section Ordering
+ # The dashboard sections are ordered by a given priority from top left to
+ # bottom right. The default priority is 10. By giving a section numerically lower
+ # priority it will be sorted higher. For example:
+ #
+ # section "Recent Posts", :priority => 10
+ # section "Recent User", :priority => 1
+ #
+ # Will render the "Recent Users" then the "Recent Posts" sections on the dashboard.
+
+end
@@ -0,0 +1,15 @@
+ActiveAdmin.register Product do
+ scope :unreleased
+
+ index do
+ column :name
+ column :category
+ column "Release Date", :released_at
+ column :price, :sortable => :price do |product|
+ div :class => "price" do
+ number_to_currency product.price
+ end
+ end
+ default_actions
+ end
+end
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@@ -0,0 +1 @@
+//= require active_admin/base
@@ -0,0 +1,9 @@
+// This is a manifest file that'll be compiled into including all the files listed below.
+// Add new JavaScript/Coffee code in separate files in this directory and they'll automatically
+// be included in the compiled file accessible from http://example.com/assets/application.js
+// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
+// the compiled file.
+//
+//= require jquery
+//= require jquery_ujs
+//= require_tree .
@@ -0,0 +1,3 @@
+# Place all the behaviors and hooks related to the matching controller here.
+# All this logic will automatically be available in application.js.
+# You can use CoffeeScript in this file: http://jashkenas.github.com/coffee-script/
@@ -0,0 +1,10 @@
+// Active Admin CSS Styles
+@import "active_admin/mixins";
+@import "active_admin/base";
+
+// To customize the Active Admin interfaces, add your
+// styles here:
+
+.price {
+ text-align: right;
+}
Oops, something went wrong.

0 comments on commit 6fdd190

Please sign in to comment.