Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

adding episodes 296 and 297

  • Loading branch information...
commit cfcf7ce2735581c96cae2ff00382c38d5722f1b2 1 parent 9fa0e0e
@ryanb authored
Showing with 5,300 additions and 0 deletions.
  1. +10 −0 episode-296/README
  2. +5 −0 episode-296/cms-after/.gitignore
  3. +16 −0 episode-296/cms-after/Gemfile
  4. +137 −0 episode-296/cms-after/Gemfile.lock
  5. +9 −0 episode-296/cms-after/README
  6. +7 −0 episode-296/cms-after/Rakefile
  7. BIN  episode-296/cms-after/app/assets/images/rails.png
  8. +9 −0 episode-296/cms-after/app/assets/javascripts/application.js
  9. +396 −0 episode-296/cms-after/app/assets/javascripts/mercury.js
  10. +3 −0  episode-296/cms-after/app/assets/javascripts/pages.js.coffee
  11. +84 −0 episode-296/cms-after/app/assets/stylesheets/application.css
  12. +17 −0 episode-296/cms-after/app/assets/stylesheets/mercury_overrides.css
  13. +40 −0 episode-296/cms-after/app/assets/stylesheets/pages.css.scss
  14. +3 −0  episode-296/cms-after/app/controllers/application_controller.rb
  15. +17 −0 episode-296/cms-after/app/controllers/pages_controller.rb
  16. +2 −0  episode-296/cms-after/app/helpers/application_helper.rb
  17. +2 −0  episode-296/cms-after/app/helpers/pages_helper.rb
  18. 0  episode-296/cms-after/app/mailers/.gitkeep
  19. 0  episode-296/cms-after/app/models/.gitkeep
  20. +2 −0  episode-296/cms-after/app/models/page.rb
  21. +17 −0 episode-296/cms-after/app/views/layouts/application.html.erb
  22. +25 −0 episode-296/cms-after/app/views/layouts/mercury.html.erb
  23. +6 −0 episode-296/cms-after/app/views/pages/index.html.erb
  24. +15 −0 episode-296/cms-after/app/views/pages/show.html.erb
  25. +4 −0 episode-296/cms-after/config.ru
  26. +48 −0 episode-296/cms-after/config/application.rb
  27. +6 −0 episode-296/cms-after/config/boot.rb
  28. +25 −0 episode-296/cms-after/config/database.yml
  29. +5 −0 episode-296/cms-after/config/environment.rb
  30. +30 −0 episode-296/cms-after/config/environments/development.rb
  31. +60 −0 episode-296/cms-after/config/environments/production.rb
  32. +39 −0 episode-296/cms-after/config/environments/test.rb
  33. +7 −0 episode-296/cms-after/config/initializers/backtrace_silencers.rb
  34. +10 −0 episode-296/cms-after/config/initializers/inflections.rb
  35. +5 −0 episode-296/cms-after/config/initializers/mime_types.rb
  36. +7 −0 episode-296/cms-after/config/initializers/secret_token.rb
  37. +8 −0 episode-296/cms-after/config/initializers/session_store.rb
  38. +14 −0 episode-296/cms-after/config/initializers/wrap_parameters.rb
  39. +5 −0 episode-296/cms-after/config/locales/en.yml
  40. +8 −0 episode-296/cms-after/config/routes.rb
  41. +10 −0 episode-296/cms-after/db/migrate/20111106214638_create_pages.rb
  42. +11 −0 episode-296/cms-after/db/migrate/20111107050254_create_images.rb
  43. +32 −0 episode-296/cms-after/db/schema.rb
  44. +26 −0 episode-296/cms-after/db/seeds.rb
  45. +2 −0  episode-296/cms-after/doc/README_FOR_APP
  46. 0  episode-296/cms-after/lib/assets/.gitkeep
  47. 0  episode-296/cms-after/lib/tasks/.gitkeep
  48. 0  episode-296/cms-after/log/.gitkeep
  49. +26 −0 episode-296/cms-after/public/404.html
  50. +26 −0 episode-296/cms-after/public/422.html
  51. +26 −0 episode-296/cms-after/public/500.html
  52. 0  episode-296/cms-after/public/favicon.ico
  53. +5 −0 episode-296/cms-after/public/robots.txt
  54. +6 −0 episode-296/cms-after/script/rails
  55. 0  episode-296/cms-after/test/fixtures/.gitkeep
  56. +9 −0 episode-296/cms-after/test/fixtures/pages.yml
  57. 0  episode-296/cms-after/test/functional/.gitkeep
  58. +14 −0 episode-296/cms-after/test/functional/pages_controller_test.rb
  59. 0  episode-296/cms-after/test/integration/.gitkeep
  60. +12 −0 episode-296/cms-after/test/performance/browsing_test.rb
  61. +13 −0 episode-296/cms-after/test/test_helper.rb
  62. 0  episode-296/cms-after/test/unit/.gitkeep
  63. +4 −0 episode-296/cms-after/test/unit/helpers/pages_helper_test.rb
  64. +7 −0 episode-296/cms-after/test/unit/page_test.rb
  65. 0  episode-296/cms-after/vendor/assets/stylesheets/.gitkeep
  66. 0  episode-296/cms-after/vendor/plugins/.gitkeep
  67. +5 −0 episode-296/cms-before/.gitignore
  68. +15 −0 episode-296/cms-before/Gemfile
  69. +115 −0 episode-296/cms-before/Gemfile.lock
  70. +9 −0 episode-296/cms-before/README
  71. +7 −0 episode-296/cms-before/Rakefile
  72. BIN  episode-296/cms-before/app/assets/images/rails.png
  73. +9 −0 episode-296/cms-before/app/assets/javascripts/application.js
  74. +3 −0  episode-296/cms-before/app/assets/javascripts/pages.js.coffee
  75. +84 −0 episode-296/cms-before/app/assets/stylesheets/application.css
  76. +40 −0 episode-296/cms-before/app/assets/stylesheets/pages.css.scss
  77. +3 −0  episode-296/cms-before/app/controllers/application_controller.rb
  78. +9 −0 episode-296/cms-before/app/controllers/pages_controller.rb
  79. +2 −0  episode-296/cms-before/app/helpers/application_helper.rb
  80. +2 −0  episode-296/cms-before/app/helpers/pages_helper.rb
  81. 0  episode-296/cms-before/app/mailers/.gitkeep
  82. 0  episode-296/cms-before/app/models/.gitkeep
  83. +2 −0  episode-296/cms-before/app/models/page.rb
  84. +17 −0 episode-296/cms-before/app/views/layouts/application.html.erb
  85. +5 −0 episode-296/cms-before/app/views/pages/index.html.erb
  86. +14 −0 episode-296/cms-before/app/views/pages/show.html.erb
  87. +4 −0 episode-296/cms-before/config.ru
  88. +48 −0 episode-296/cms-before/config/application.rb
  89. +6 −0 episode-296/cms-before/config/boot.rb
  90. +25 −0 episode-296/cms-before/config/database.yml
  91. +5 −0 episode-296/cms-before/config/environment.rb
  92. +30 −0 episode-296/cms-before/config/environments/development.rb
  93. +60 −0 episode-296/cms-before/config/environments/production.rb
  94. +39 −0 episode-296/cms-before/config/environments/test.rb
  95. +7 −0 episode-296/cms-before/config/initializers/backtrace_silencers.rb
  96. +10 −0 episode-296/cms-before/config/initializers/inflections.rb
  97. +5 −0 episode-296/cms-before/config/initializers/mime_types.rb
  98. +7 −0 episode-296/cms-before/config/initializers/secret_token.rb
  99. +8 −0 episode-296/cms-before/config/initializers/session_store.rb
  100. +14 −0 episode-296/cms-before/config/initializers/wrap_parameters.rb
  101. +5 −0 episode-296/cms-before/config/locales/en.yml
  102. +4 −0 episode-296/cms-before/config/routes.rb
  103. +10 −0 episode-296/cms-before/db/migrate/20111106214638_create_pages.rb
  104. +23 −0 episode-296/cms-before/db/schema.rb
  105. +26 −0 episode-296/cms-before/db/seeds.rb
  106. +2 −0  episode-296/cms-before/doc/README_FOR_APP
  107. 0  episode-296/cms-before/lib/assets/.gitkeep
  108. 0  episode-296/cms-before/lib/tasks/.gitkeep
  109. 0  episode-296/cms-before/log/.gitkeep
  110. +26 −0 episode-296/cms-before/public/404.html
  111. +26 −0 episode-296/cms-before/public/422.html
  112. +26 −0 episode-296/cms-before/public/500.html
  113. 0  episode-296/cms-before/public/favicon.ico
  114. +5 −0 episode-296/cms-before/public/robots.txt
  115. +6 −0 episode-296/cms-before/script/rails
  116. 0  episode-296/cms-before/test/fixtures/.gitkeep
  117. +9 −0 episode-296/cms-before/test/fixtures/pages.yml
  118. 0  episode-296/cms-before/test/functional/.gitkeep
  119. +14 −0 episode-296/cms-before/test/functional/pages_controller_test.rb
  120. 0  episode-296/cms-before/test/integration/.gitkeep
  121. +12 −0 episode-296/cms-before/test/performance/browsing_test.rb
  122. +13 −0 episode-296/cms-before/test/test_helper.rb
  123. 0  episode-296/cms-before/test/unit/.gitkeep
  124. +4 −0 episode-296/cms-before/test/unit/helpers/pages_helper_test.rb
  125. +7 −0 episode-296/cms-before/test/unit/page_test.rb
  126. 0  episode-296/cms-before/vendor/assets/stylesheets/.gitkeep
  127. 0  episode-296/cms-before/vendor/plugins/.gitkeep
  128. +14 −0 episode-297/README
  129. +5 −0 episode-297/store-after/.gitignore
  130. +19 −0 episode-297/store-after/Gemfile
  131. +121 −0 episode-297/store-after/Gemfile.lock
  132. +7 −0 episode-297/store-after/README
  133. +7 −0 episode-297/store-after/Rakefile
  134. BIN  episode-297/store-after/app/assets/images/rails.png
  135. +10 −0 episode-297/store-after/app/assets/javascripts/application.js
  136. +6 −0 episode-297/store-after/app/assets/javascripts/members.js.coffee
  137. +13 −0 episode-297/store-after/app/assets/javascripts/membership_number.js
  138. +23 −0 episode-297/store-after/app/assets/javascripts/product.js.coffee
  139. +25 −0 episode-297/store-after/app/assets/javascripts/products.js.coffee
  140. +85 −0 episode-297/store-after/app/assets/stylesheets/application.css.scss
  141. +7 −0 episode-297/store-after/app/assets/stylesheets/members.css.scss
  142. +14 −0 episode-297/store-after/app/assets/stylesheets/products.css.scss
  143. +3 −0  episode-297/store-after/app/controllers/application_controller.rb
  144. +14 −0 episode-297/store-after/app/controllers/members_controller.rb
  145. +48 −0 episode-297/store-after/app/controllers/products_controller.rb
  146. +2 −0  episode-297/store-after/app/helpers/application_helper.rb
  147. +2 −0  episode-297/store-after/app/helpers/members_helper.rb
  148. +11 −0 episode-297/store-after/app/helpers/products_helper.rb
  149. 0  episode-297/store-after/app/mailers/.gitkeep
  150. 0  episode-297/store-after/app/models/.gitkeep
  151. +11 −0 episode-297/store-after/app/models/member.rb
  152. +10 −0 episode-297/store-after/app/models/product.rb
  153. +17 −0 episode-297/store-after/app/views/layouts/application.html.erb
  154. +26 −0 episode-297/store-after/app/views/members/new.html.erb
  155. +33 −0 episode-297/store-after/app/views/products/_form.html.erb
  156. +9 −0 episode-297/store-after/app/views/products/_product.html.mustache
  157. +6 −0 episode-297/store-after/app/views/products/edit.html.erb
  158. +12 −0 episode-297/store-after/app/views/products/index.html.erb
  159. +5 −0 episode-297/store-after/app/views/products/new.html.erb
  160. +23 −0 episode-297/store-after/app/views/products/show.html.erb
  161. +4 −0 episode-297/store-after/config.ru
  162. +48 −0 episode-297/store-after/config/application.rb
  163. +6 −0 episode-297/store-after/config/boot.rb
  164. +25 −0 episode-297/store-after/config/database.yml
  165. +5 −0 episode-297/store-after/config/environment.rb
  166. +30 −0 episode-297/store-after/config/environments/development.rb
  167. +60 −0 episode-297/store-after/config/environments/production.rb
  168. +39 −0 episode-297/store-after/config/environments/test.rb
  169. +7 −0 episode-297/store-after/config/initializers/backtrace_silencers.rb
  170. +10 −0 episode-297/store-after/config/initializers/inflections.rb
  171. +5 −0 episode-297/store-after/config/initializers/mime_types.rb
  172. +10 −0 episode-297/store-after/config/initializers/mustache_template_handler.rb
  173. +7 −0 episode-297/store-after/config/initializers/secret_token.rb
  174. +8 −0 episode-297/store-after/config/initializers/session_store.rb
  175. +14 −0 episode-297/store-after/config/initializers/wrap_parameters.rb
  176. +5 −0 episode-297/store-after/config/locales/en.yml
  177. +5 −0 episode-297/store-after/config/routes.rb
  178. +12 −0 episode-297/store-after/db/migrate/20111030155304_create_products.rb
  179. +10 −0 episode-297/store-after/db/migrate/20111105164010_create_members.rb
  180. +32 −0 episode-297/store-after/db/schema.rb
  181. +34 −0 episode-297/store-after/db/seeds.rb
  182. +2 −0  episode-297/store-after/doc/README_FOR_APP
  183. 0  episode-297/store-after/lib/assets/.gitkeep
  184. 0  episode-297/store-after/lib/tasks/.gitkeep
  185. 0  episode-297/store-after/log/.gitkeep
  186. +26 −0 episode-297/store-after/public/404.html
  187. +26 −0 episode-297/store-after/public/422.html
  188. +26 −0 episode-297/store-after/public/500.html
  189. 0  episode-297/store-after/public/favicon.ico
  190. +5 −0 episode-297/store-after/public/robots.txt
  191. +6 −0 episode-297/store-after/script/rails
  192. 0  episode-297/store-after/test/fixtures/.gitkeep
  193. +9 −0 episode-297/store-after/test/fixtures/members.yml
  194. +13 −0 episode-297/store-after/test/fixtures/products.yml
  195. 0  episode-297/store-after/test/functional/.gitkeep
  196. +9 −0 episode-297/store-after/test/functional/members_controller_test.rb
  197. +49 −0 episode-297/store-after/test/functional/products_controller_test.rb
  198. 0  episode-297/store-after/test/integration/.gitkeep
  199. +12 −0 episode-297/store-after/test/performance/browsing_test.rb
  200. +13 −0 episode-297/store-after/test/test_helper.rb
  201. 0  episode-297/store-after/test/unit/.gitkeep
  202. +4 −0 episode-297/store-after/test/unit/helpers/members_helper_test.rb
  203. +4 −0 episode-297/store-after/test/unit/helpers/products_helper_test.rb
  204. +7 −0 episode-297/store-after/test/unit/member_test.rb
  205. +7 −0 episode-297/store-after/test/unit/product_test.rb
  206. +419 −0 episode-297/store-after/vendor/assets/javascripts/mustache.js
  207. 0  episode-297/store-after/vendor/assets/stylesheets/.gitkeep
  208. 0  episode-297/store-after/vendor/plugins/.gitkeep
  209. +5 −0 episode-297/store-before/.gitignore
  210. +17 −0 episode-297/store-before/Gemfile
  211. +117 −0 episode-297/store-before/Gemfile.lock
  212. +7 −0 episode-297/store-before/README
  213. +7 −0 episode-297/store-before/Rakefile
  214. BIN  episode-297/store-before/app/assets/images/rails.png
  215. +10 −0 episode-297/store-before/app/assets/javascripts/application.js
  216. +6 −0 episode-297/store-before/app/assets/javascripts/members.js.coffee
  217. +13 −0 episode-297/store-before/app/assets/javascripts/membership_number.js
  218. +24 −0 episode-297/store-before/app/assets/javascripts/products.js.coffee
  219. +85 −0 episode-297/store-before/app/assets/stylesheets/application.css.scss
  220. +7 −0 episode-297/store-before/app/assets/stylesheets/members.css.scss
  221. +14 −0 episode-297/store-before/app/assets/stylesheets/products.css.scss
  222. +3 −0  episode-297/store-before/app/controllers/application_controller.rb
  223. +14 −0 episode-297/store-before/app/controllers/members_controller.rb
  224. +48 −0 episode-297/store-before/app/controllers/products_controller.rb
  225. +2 −0  episode-297/store-before/app/helpers/application_helper.rb
  226. +2 −0  episode-297/store-before/app/helpers/members_helper.rb
  227. +11 −0 episode-297/store-before/app/helpers/products_helper.rb
  228. 0  episode-297/store-before/app/mailers/.gitkeep
  229. 0  episode-297/store-before/app/models/.gitkeep
  230. +2 −0  episode-297/store-before/app/models/member.rb
  231. +2 −0  episode-297/store-before/app/models/product.rb
  232. +17 −0 episode-297/store-before/app/views/layouts/application.html.erb
  233. +26 −0 episode-297/store-before/app/views/members/new.html.erb
  234. +33 −0 episode-297/store-before/app/views/products/_form.html.erb
  235. +9 −0 episode-297/store-before/app/views/products/_product.html.mustache
  236. +6 −0 episode-297/store-before/app/views/products/edit.html.erb
  237. +12 −0 episode-297/store-before/app/views/products/index.html.erb
  238. +5 −0 episode-297/store-before/app/views/products/new.html.erb
  239. +23 −0 episode-297/store-before/app/views/products/show.html.erb
  240. +4 −0 episode-297/store-before/config.ru
  241. +48 −0 episode-297/store-before/config/application.rb
  242. +6 −0 episode-297/store-before/config/boot.rb
  243. +25 −0 episode-297/store-before/config/database.yml
  244. +5 −0 episode-297/store-before/config/environment.rb
  245. +30 −0 episode-297/store-before/config/environments/development.rb
  246. +60 −0 episode-297/store-before/config/environments/production.rb
  247. +39 −0 episode-297/store-before/config/environments/test.rb
  248. +7 −0 episode-297/store-before/config/initializers/backtrace_silencers.rb
  249. +10 −0 episode-297/store-before/config/initializers/inflections.rb
  250. +5 −0 episode-297/store-before/config/initializers/mime_types.rb
  251. +10 −0 episode-297/store-before/config/initializers/mustache_template_handler.rb
  252. +7 −0 episode-297/store-before/config/initializers/secret_token.rb
  253. +8 −0 episode-297/store-before/config/initializers/session_store.rb
  254. +14 −0 episode-297/store-before/config/initializers/wrap_parameters.rb
  255. +5 −0 episode-297/store-before/config/locales/en.yml
  256. +5 −0 episode-297/store-before/config/routes.rb
  257. +12 −0 episode-297/store-before/db/migrate/20111030155304_create_products.rb
  258. +10 −0 episode-297/store-before/db/migrate/20111105164010_create_members.rb
  259. +32 −0 episode-297/store-before/db/schema.rb
  260. +34 −0 episode-297/store-before/db/seeds.rb
  261. +2 −0  episode-297/store-before/doc/README_FOR_APP
  262. 0  episode-297/store-before/lib/assets/.gitkeep
  263. 0  episode-297/store-before/lib/tasks/.gitkeep
  264. 0  episode-297/store-before/log/.gitkeep
  265. +26 −0 episode-297/store-before/public/404.html
  266. +26 −0 episode-297/store-before/public/422.html
  267. +26 −0 episode-297/store-before/public/500.html
  268. 0  episode-297/store-before/public/favicon.ico
  269. +5 −0 episode-297/store-before/public/robots.txt
  270. +6 −0 episode-297/store-before/script/rails
  271. 0  episode-297/store-before/test/fixtures/.gitkeep
  272. +9 −0 episode-297/store-before/test/fixtures/members.yml
  273. +13 −0 episode-297/store-before/test/fixtures/products.yml
  274. 0  episode-297/store-before/test/functional/.gitkeep
  275. +9 −0 episode-297/store-before/test/functional/members_controller_test.rb
  276. +49 −0 episode-297/store-before/test/functional/products_controller_test.rb
  277. 0  episode-297/store-before/test/integration/.gitkeep
  278. +12 −0 episode-297/store-before/test/performance/browsing_test.rb
  279. +13 −0 episode-297/store-before/test/test_helper.rb
  280. 0  episode-297/store-before/test/unit/.gitkeep
  281. +4 −0 episode-297/store-before/test/unit/helpers/members_helper_test.rb
  282. +4 −0 episode-297/store-before/test/unit/helpers/products_helper_test.rb
  283. +7 −0 episode-297/store-before/test/unit/member_test.rb
  284. +7 −0 episode-297/store-before/test/unit/product_test.rb
  285. +419 −0 episode-297/store-before/vendor/assets/javascripts/mustache.js
  286. 0  episode-297/store-before/vendor/assets/stylesheets/.gitkeep
  287. 0  episode-297/store-before/vendor/plugins/.gitkeep
View
10 episode-296/README
@@ -0,0 +1,10 @@
+RailsCasts Episode #296: Mercury Editor
+
+http://railscasts.com/episodes/296-mercury-editor
+
+Commands used in episode
+
+ bundle
+ rails g mercury:install
+ rake mercury_engine:install:migrations
+ rake db:migrate
View
5 episode-296/cms-after/.gitignore
@@ -0,0 +1,5 @@
+.bundle
+db/*.sqlite3
+log/*.log
+tmp/
+.sass-cache/
View
16 episode-296/cms-after/Gemfile
@@ -0,0 +1,16 @@
+source 'http://rubygems.org'
+
+gem 'rails', '3.1.1'
+gem 'sqlite3'
+
+# Gems used only for assets and not required
+# in production environments by default.
+group :assets do
+ gem 'sass-rails', '~> 3.1.4'
+ gem 'coffee-rails', '~> 3.1.1'
+ gem 'uglifier', '>= 1.0.3'
+end
+
+gem 'jquery-rails'
+
+gem 'mercury-rails', git: 'https://github.com/jejacks0n/mercury.git', ref: 'a2b16bcdc9'
View
137 episode-296/cms-after/Gemfile.lock
@@ -0,0 +1,137 @@
+GIT
+ remote: https://github.com/jejacks0n/mercury.git
+ revision: a2b16bcdc96f12a21c04e95e145588595847523b
+ ref: a2b16bcdc9
+ specs:
+ mercury-rails (0.2.3)
+ coffee-script
+ formtastic
+ json
+ paperclip
+ rails (~> 3.1.0)
+ sass-rails
+
+GEM
+ remote: http://rubygems.org/
+ specs:
+ actionmailer (3.1.1)
+ actionpack (= 3.1.1)
+ mail (~> 2.3.0)
+ actionpack (3.1.1)
+ activemodel (= 3.1.1)
+ activesupport (= 3.1.1)
+ builder (~> 3.0.0)
+ erubis (~> 2.7.0)
+ i18n (~> 0.6)
+ rack (~> 1.3.2)
+ rack-cache (~> 1.1)
+ rack-mount (~> 0.8.2)
+ rack-test (~> 0.6.1)
+ sprockets (~> 2.0.2)
+ activemodel (3.1.1)
+ activesupport (= 3.1.1)
+ builder (~> 3.0.0)
+ i18n (~> 0.6)
+ activerecord (3.1.1)
+ activemodel (= 3.1.1)
+ activesupport (= 3.1.1)
+ arel (~> 2.2.1)
+ tzinfo (~> 0.3.29)
+ activeresource (3.1.1)
+ activemodel (= 3.1.1)
+ activesupport (= 3.1.1)
+ activesupport (3.1.1)
+ multi_json (~> 1.0)
+ arel (2.2.1)
+ builder (3.0.0)
+ cocaine (0.2.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)
+ erubis (2.7.0)
+ execjs (1.2.9)
+ multi_json (~> 1.0)
+ formtastic (2.0.2)
+ rails (~> 3.0)
+ hike (1.2.1)
+ i18n (0.6.0)
+ jquery-rails (1.0.16)
+ railties (~> 3.0)
+ thor (~> 0.14)
+ json (1.6.1)
+ mail (2.3.0)
+ i18n (>= 0.4.0)
+ mime-types (~> 1.16)
+ treetop (~> 1.4.8)
+ mime-types (1.17.2)
+ multi_json (1.0.3)
+ paperclip (2.4.5)
+ activerecord (>= 2.3.0)
+ activesupport (>= 2.3.2)
+ cocaine (>= 0.0.2)
+ mime-types
+ polyglot (0.3.3)
+ rack (1.3.5)
+ rack-cache (1.1)
+ 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.1)
+ actionmailer (= 3.1.1)
+ actionpack (= 3.1.1)
+ activerecord (= 3.1.1)
+ activeresource (= 3.1.1)
+ activesupport (= 3.1.1)
+ bundler (~> 1.0)
+ railties (= 3.1.1)
+ railties (3.1.1)
+ actionpack (= 3.1.1)
+ activesupport (= 3.1.1)
+ rack-ssl (~> 1.3.2)
+ rake (>= 0.8.7)
+ rdoc (~> 3.4)
+ thor (~> 0.14.6)
+ rake (0.9.2.2)
+ rdoc (3.11)
+ json (~> 1.4)
+ sass (3.1.10)
+ sass-rails (3.1.4)
+ actionpack (~> 3.1.0)
+ railties (~> 3.1.0)
+ sass (>= 3.1.4)
+ sprockets (~> 2.0.0)
+ tilt (~> 1.3.2)
+ sprockets (2.0.3)
+ hike (~> 1.2)
+ rack (~> 1.0)
+ tilt (~> 1.1, != 1.3.0)
+ sqlite3 (1.3.4)
+ thor (0.14.6)
+ tilt (1.3.3)
+ treetop (1.4.10)
+ polyglot
+ polyglot (>= 0.3.1)
+ tzinfo (0.3.31)
+ uglifier (1.0.4)
+ execjs (>= 0.3.0)
+ multi_json (>= 1.0.2)
+
+PLATFORMS
+ ruby
+
+DEPENDENCIES
+ coffee-rails (~> 3.1.1)
+ jquery-rails
+ mercury-rails!
+ rails (= 3.1.1)
+ sass-rails (~> 3.1.4)
+ sqlite3
+ uglifier (>= 1.0.3)
View
9 episode-296/cms-after/README
@@ -0,0 +1,9 @@
+= RailsCasts Example Application
+
+Run these commands to try it out.
+
+ bundle
+ rake db:setup
+ rails s
+
+Ruby 1.9.2 is required to run this example.
View
7 episode-296/cms-after/Rakefile
@@ -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__)
+
+Cms::Application.load_tasks
View
BIN  episode-296/cms-after/app/assets/images/rails.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
9 episode-296/cms-after/app/assets/javascripts/application.js
@@ -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 pages
View
396 episode-296/cms-after/app/assets/javascripts/mercury.js
@@ -0,0 +1,396 @@
+/*!
+ * Mercury Editor is a CoffeeScript and jQuery based WYSIWYG editor. Documentation and other useful information can be
+ * found at https://github.com/jejacks0n/mercury
+ *
+ * Supported browsers:
+ * - Firefox 4+
+ * - Chrome 10+
+ * - Safari 5+
+ *
+ * Copyright (c) 2011 Jeremy Jackson
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
+ * documentation files (the "Software"), to deal in the Software without restriction, including without limitation the
+ * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit
+ * persons to whom the Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
+ * WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
+ * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
+ * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * Minimum jQuery requirements are 1.6
+ *= require mercury/dependencies/jquery-1.6
+ *
+ * You can include the Rails jQuery ujs script here to get some nicer behaviors in modals, panels and lightviews when
+ * using :remote => true within the contents rendered in them.
+ * require jquery_ujs
+ *
+ *= require_self
+ *
+ * If you want to override Mercury functionality, you can do so in a custom file that binds to the mercury:loaded event,
+ * or do so at the end of the current file (mercury.js). There's an example that will help you get started.
+ * require mercury_overrides
+ *
+ * Add all requires for the support libraries that integrate nicely with Mercury Editor.
+ * require mercury/support/history
+ *
+ * Require Mercury Editor itself.
+ *= require mercury/mercury
+ *
+ * Add all requires for plugins that extend or change the behavior of Mercury Editor.
+ * require mercury/plugins/save_as_xml/plugin.js
+ */
+window.Mercury = {
+
+ // # Mercury Configuration
+ config: {
+ // ## Toolbars
+ //
+ // This is where you can customize the toolbars by adding or removing buttons, or changing them and their
+ // behaviors. Any top level object put here will create a new toolbar. Buttons are simply nested inside the
+ // toolbars, along with button groups.
+ //
+ // Some toolbars are custom (the snippetable toolbar for instance), and to denote that use _custom: true. You can
+ // then build the toolbar yourself with it's own behavior.
+ //
+ // Buttons can be grouped, and a button group is simply a way to wrap buttons for styling -- they can also handle
+ // enabling or disabling all the buttons within it by using a context. The table button group is a good example
+ // of this.
+ //
+ // It's important to note that each of the button names (keys), in each toolbar object must be unique, regardless
+ // of if it's in a button group, or nested, etc. This is because styling is applied to them by name, and because
+ // their name is used in the event that's fired when you click on them.
+ //
+ // Button format: `[label, description, {type: action, type: action, etc}]`
+ //
+ // ### The available button types are:
+ //
+ // - toggle: toggles on or off when clicked, otherwise behaves like a button
+ // - modal: opens a modal window, expects the action to be one of:
+ // 1. a string url
+ // 2. a function that returns a string url
+ // - panel: opens a panel dialog, expects the action to be one of:
+ // 1. a string url
+ // 2. a function that returns a string url
+ // - palette: opens a palette window, expects the action to be one of:
+ // 1. a string url
+ // 2. a function that returns a string url
+ // - select: opens a pulldown style window, expects the action to be one of:
+ // 1. a string url
+ // 2. a function that returns a string url
+ // - context: calls a callback function, expects the action to be:
+ // 1. a function that returns a boolean to highlight the button
+ // note: if a function isn't provided, the key will be passed to the contextHandler, in which case a default
+ // context will be used (for more info read the Contexts section below)
+ // - mode: toggle a given mode in the editor, expects the action to be:
+ // 1. a string, denoting the name of the mode
+ // note: it's assumed that when a specific mode is turned on, all other modes will be turned off, which happens
+ // automatically, thus putting the editor into a specific "state"
+ // - regions: allows buttons to be enabled/disabled based on what region type has focus, expects the action to be:
+ // 1. an array of region types (eg. ['editable', 'markupable'])
+ // - preload: allows some dialog views to be loaded when the button is created instead of on first open, expects:
+ // 1. a boolean true / false
+ // note: this is only used by panels, selects, and palettes
+ //
+ // Separators are any "button" that's not an array, and are expected to be a string. You can use two different
+ // separator styles: line ('-'), and spacer (' ').
+ toolbars: {
+ primary: {
+ save: ['Save', 'Save this page'],
+ preview: ['Preview', 'Preview this page', { toggle: true, mode: true }],
+ sep1: ' ',
+ undoredo: {
+ undo: ['Undo', 'Undo your last action'],
+ redo: ['Redo', 'Redo your last action'],
+ sep: ' '
+ },
+ insertLink: ['Link', 'Insert Link', { modal: '/mercury/modals/link.html', regions: ['editable', 'markupable'] }],
+ insertMedia: ['Media', 'Insert Media (images and videos)', { modal: '/mercury/modals/media.html', regions: ['editable', 'markupable'] }],
+ insertTable: ['Table', 'Insert Table', { modal: '/mercury/modals/table.html', regions: ['editable', 'markupable'] }],
+ insertCharacter: ['Character', 'Special Characters', { modal: '/mercury/modals/character.html', regions: ['editable', 'markupable'] }],
+ snippetPanel: ['Snippet', 'Snippet Panel', { panel: '/mercury/panels/snippets.html' }],
+ sep2: ' ',
+ historyPanel: ['History', 'Page Version History', { panel: '/mercury/panels/history.html' }],
+ sep3: ' ',
+ notesPanel: ['Notes', 'Page Notes', { panel: '/mercury/panels/notes.html' }]
+ },
+
+ editable: {
+ _regions: ['editable', 'markupable'],
+ predefined: {
+ style: ['Style', null, { select: '/mercury/selects/style.html', preload: true }],
+ sep1: ' ',
+ formatblock: ['Block Format', null, { select: '/mercury/selects/formatblock.html', preload: true }],
+ sep2: '-'
+ },
+ colors: {
+ backColor: ['Background Color', null, { palette: '/mercury/palettes/backcolor.html', context: true, preload: true, regions: ['editable'] }],
+ sep1: ' ',
+ foreColor: ['Text Color', null, { palette: '/mercury/palettes/forecolor.html', context: true, preload: true, regions: ['editable'] }],
+ sep2: '-'
+ },
+ decoration: {
+ bold: ['Bold', null, { context: true }],
+ italic: ['Italicize', null, { context: true }],
+ overline: ['Overline', null, { context: true, regions: ['editable'] }],
+ strikethrough: ['Strikethrough', null, { context: true, regions: ['editable'] }],
+ underline: ['Underline', null, { context: true, regions: ['editable'] }],
+ sep: '-'
+ },
+ script: {
+ subscript: ['Subscript', null, { context: true }],
+ superscript: ['Superscript', null, { context: true }],
+ sep: '-'
+ },
+ justify: {
+ justifyLeft: ['Align Left', null, { context: true, regions: ['editable'] }],
+ justifyCenter: ['Center', null, { context: true, regions: ['editable'] }],
+ justifyRight: ['Align Right', null, { context: true, regions: ['editable'] }],
+ justifyFull: ['Justify Full', null, { context: true, regions: ['editable'] }],
+ sep: '-'
+ },
+ list: {
+ insertUnorderedList: ['Unordered List', null, { context: true }],
+ insertOrderedList: ['Numbered List', null, { context: true }],
+ sep: '-'
+ },
+ indent: {
+ outdent: ['Decrease Indentation', null],
+ indent: ['Increase Indentation', null],
+ sep: '-'
+ },
+ table: {
+ _context: true,
+ insertRowBefore: ['Insert Table Row', 'Insert a table row before the cursor', { regions: ['editable'] }],
+ insertRowAfter: ['Insert Table Row', 'Insert a table row after the cursor', { regions: ['editable'] }],
+ deleteRow: ['Delete Table Row', 'Delete this table row', { regions: ['editable'] }],
+ insertColumnBefore: ['Insert Table Column', 'Insert a table column before the cursor', { regions: ['editable'] }],
+ insertColumnAfter: ['Insert Table Column', 'Insert a table column after the cursor', { regions: ['editable'] }],
+ deleteColumn: ['Delete Table Column', 'Delete this table column', { regions: ['editable'] }],
+ sep1: ' ',
+ increaseColspan: ['Increase Cell Columns', 'Increase the cells colspan'],
+ decreaseColspan: ['Decrease Cell Columns', 'Decrease the cells colspan and add a new cell'],
+ increaseRowspan: ['Increase Cell Rows', 'Increase the cells rowspan'],
+ decreaseRowspan: ['Decrease Cell Rows', 'Decrease the cells rowspan and add a new cell'],
+ sep2: '-'
+ },
+ rules: {
+ horizontalRule: ['Horizontal Rule', 'Insert a horizontal rule'],
+ sep1: '-'
+ },
+ formatting: {
+ removeFormatting: ['Remove Formatting', 'Remove formatting for the selection', { regions: ['editable'] }],
+ sep2: ' '
+ },
+ editors: {
+ htmlEditor: ['Edit HTML', 'Edit the HTML content', { regions: ['editable'] }]
+ }
+ },
+
+ snippetable: {
+ _custom: true,
+ actions: {
+ editSnippet: ['Edit Snippet Settings', null],
+ sep1: ' ',
+ removeSnippet: ['Remove Snippet', null]
+ }
+ }
+ },
+
+
+ // ## Hijacking Links & Forms
+ //
+ // Mercury will hijack links and forms that don't have a target set, or the target is set to _self and will set it
+ // to _top. This is because the target must be set properly for Mercury to not get in the way of some
+ // functionality, like proper page loads on form submissions etc. Mercury doesn't do this to links or forms that
+ // are within editable regions because it doesn't want to impact the html that's saved. With that being explained,
+ // you can add classes to links or forms that you don't want this behavior added to. Let's say you have links that
+ // open a lightbox style window, and you don't want the targets of these to be set to _top. You can add classes to
+ // this array, and they will be ignored when the hijacking is applied.
+ nonHijackableClasses: [],
+
+
+ // ## Ajax and CSRF Headers
+ //
+ // Some server frameworks require that you provide a specific header for Ajax requests. The values for these CSRF
+ // tokens are typically stored in the rendered DOM. By default, Mercury will look for the Rails specific meta tag,
+ // and provide the X-CSRF-Token header on Ajax requests, but you can modify this configuration if the system you're
+ // using doesn't follow the same standard.
+ csrfSelector: 'meta[name="csrf-token"]',
+ csrfHeader: 'X-CSRF-Token',
+
+
+ // ## Pasting & Sanitizing
+ //
+ // When pasting content into Mercury it may sometimes contain HTML tags and attributes. This markup is used to
+ // style the content and makes the pasted content look (and behave) the same as the original content. This can be a
+ // desired feature or an annoyance, so you can enable various sanitizing methods to clean the content when it's
+ // pasted.
+ //
+ // ### Sanitizing options:
+ // - false: no sanitizing is done, the content is pasted the exact same as it was copied by the user
+ // - 'whitelist': content is cleaned using the settings specified in the tag white list (described below)
+ // - 'text': all html is stripped before pasting, leaving only the raw text
+ //
+ // ### Using the whitelist configuration
+ //
+ // The white list allows you to specify tags and attributes that are allowed when pasting content. Each item in
+ // this object should contain the allowed tag, and an array of attributes that are allowed on that tag. If the
+ // allowed attributes array is empty, all attributes will be removed. If a tag is not present in this list, it will
+ // be removed, but without removing any of the text or tags inside it.
+ //
+ // **Note:** Content is *always* sanitized if looks like it's from MS Word or similar editors regardless of this
+ // configuration.
+ pasting: {
+ sanitize: 'whitelist',
+ whitelist: {
+ h1: [],
+ h2: [],
+ h3: [],
+ h4: [],
+ h5: [],
+ h6: [],
+ table: [],
+ thead: [],
+ tbody: [],
+ tfoot: [],
+ tr: [],
+ th: ['colspan', 'rowspan'],
+ td: ['colspan', 'rowspan'],
+ div: ['class'],
+ span: ['class'],
+ ul: [],
+ ol: [],
+ li: [],
+ b: [],
+ strong: [],
+ i: [],
+ em: [],
+ u: [],
+ strike: [],
+ br: [],
+ p: [],
+ hr: [],
+ a: ['href', 'target', 'title', 'name'],
+ img: ['src', 'title', 'alt']
+ }
+ },
+
+
+ // ## Snippet Options and Preview
+ //
+ // When a user drags a snippet onto the page they'll be prompted to enter options for the given snippet. The server
+ // is expected to respond with a form. Once the user submits this form, an Ajax request is sent to the server with
+ // the options provided; this preview request is expected to respond with the rendered markup for the snippet.
+ //
+ // Name will be replaced with the snippet name (eg. example)
+ snippets: {
+ method: 'POST',
+ optionsUrl: '/mercury/snippets/:name/options.html',
+ previewUrl: '/mercury/snippets/:name/preview.html'
+ },
+
+
+ // ## Image Uploading
+ //
+ // If you drag images (while pressing shift) from your desktop into regions that support it, it will be uploaded
+ // to the server and inserted into the region. This configuration allows you to specify if you want to
+ // disable/enable this feature, the accepted mime-types, file size restrictions, and other things related to
+ // uploading. You can optionally provide a handler function that takes the response from the server and returns an
+ // object: {image: {url: '[your provided url]'}
+ //
+ // **Note:** Image uploading is only supported in some region types, and some browsers.
+ uploading: {
+ enabled: true,
+ allowedMimeTypes: ['image/jpeg', 'image/gif', 'image/png'],
+ maxFileSize: 1235242880,
+ inputName: 'image[image]',
+ url: '/images',
+ handler: false
+ },
+
+
+ // ## Behaviors
+ //
+ // Behaviors are used to change the default behaviors of a given region type when a given button is clicked. For
+ // example, you may prefer to add HR tags using an HR wrapped within a div with a classname (for styling). You
+ // can add your own complex behaviors here.
+ //
+ // You can see how the behavior matches up directly with the button names. It's also important to note that the
+ // callback functions are executed within the scope of the given region, so you have access to all it's methods.
+ // Here's some examples to help you get started.
+ behaviors: {
+ //foreColor: function(selection, options) { selection.wrap('<span style="color:' + options.value.toHex() + '">', true) },
+ htmlEditor: function() { Mercury.modal('/mercury/modals/htmleditor.html', { title: 'HTML Editor', fullHeight: true, handler: 'htmlEditor' }); }
+ },
+
+
+ // ## Contexts
+ //
+ // Contexts are used callback functions used for highlighting and disabling/enabling buttons and buttongroups.
+ // When the cursor enters an element within an html region for instance we want to disable or highlight buttons
+ // based on the properties of the given node. You can see some examples of contexts in:
+ //
+ // Mercury.Toolbar.Button.contexts
+ // and
+ // Mercury.Toolbar.ButtonGroup.contexts
+
+
+ // ## Region Class
+ //
+ // Mercury identifies editable regions by a region class. This class has to be added in your HTML in advance, and
+ // is the only real Mercury code/naming exposed in the implementation of Mercury. To allow this to be as
+ // configurable as possible, you can set the name of the class here. When switching to preview mode, this
+ // configuration is used to generate a class to indicate that Mercury is in preview mode -- which will be this
+ // class with '-preview' appended (so, mercury-region-preview by default)
+ regionClass: 'mercury-region',
+
+
+ // ## Styles
+ //
+ // Mercury tries to stay as much out of your code as possible, but because regions appear within your document we
+ // need to include a few styles to indicate regions, as well as the different states of them (eg. focused). These
+ // styles are injected into your document, and as simple as they might be, you may want to change them. You can do
+ // so here. {{regionClass}} will be automatically replaced with whatever you have set in the regionClass
+ // configuration directive.
+ injectedStyles: '' +
+ '.{{regionClass}} { min-height: 10px; outline: 1px dotted #09F } ' +
+ '.{{regionClass}}:focus, .{{regionClass}}.focus { outline: none; -webkit-box-shadow: 0 0 10px #09F, 0 0 1px #045; box-shadow: 0 0 10px #09F, 0 0 1px #045 }' +
+ '.{{regionClass}}:after { content: "."; display: block; visibility: hidden; clear: both; height: 0; overflow: hidden; }' +
+ '.{{regionClass}} table, .{{regionClass}} td, .{{regionClass}} th { border: 1px dotted red; min-width: 6px; }' +
+ '.mercury-textarea { border: 0; box-sizing: border-box; -moz-box-sizing: border-box; -webkit-box-sizing: border-box; resize: none; }' +
+ '.mercury-textarea:focus { outline: none; }'
+ },
+
+ // ## Silent Mode
+ //
+ // Turning silent mode on will disable asking about unsaved changes before leaving the page.
+ silent: false,
+
+ // ## Debug Mode
+ //
+ // Turning debug mode on will log events and other various things (using console.debug if available).
+ debug: false
+
+};
+
+// The mercury:loaded event is provided in case you want to override default Mercury Editor behavior. It will fire
+// directly after the Mercury scripts have loaded, but before anything has been initialized. It's a good place to add
+// or change functionality.
+// jQuery(window).bind('mercury:loaded', function() {
+// Mercury.PageEditor.prototype.iframeSrc = function(url) { return '/testing'; }
+// });
+
+$(window).bind('mercury:ready', function() {
+ var link = $('#mercury_iframe').contents().find('#edit_link');
+ Mercury.saveURL = link.data('save-url');
+ link.hide();
+});
+
+$(window).bind('mercury:saved', function() {
+ window.location = window.location.href.replace(/\/editor\//i, '/');
+});
View
3  episode-296/cms-after/app/assets/javascripts/pages.js.coffee
@@ -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/
View
84 episode-296/cms-after/app/assets/stylesheets/application.css
@@ -0,0 +1,84 @@
+/*
+ * This is a manifest file that'll automatically include all the stylesheets available in this directory
+ * and any sub-directories. You're free to add application-wide styles to this file and they'll appear at
+ * the top of the compiled file, but it's generally better to create a new file per style scope.
+ *= require_self
+ *= require_tree .
+*/
+
+body {
+ background-color: #4B7399;
+ font-family: Verdana, Helvetica, Arial;
+ font-size: 14px;
+}
+
+a img {
+ border: none;
+}
+
+a {
+ color: #0000FF;
+}
+
+.clear {
+ clear: both;
+ height: 0;
+ overflow: hidden;
+}
+
+#container {
+ width: 75%;
+ margin: 0 auto;
+ background-color: #FFF;
+ border: solid 1px black;
+ margin-top: 20px;
+ position: relative;
+}
+
+#flash_notice, #flash_error, #flash_alert {
+ padding: 5px 8px;
+ margin: 10px 0;
+ margin-right: 150px;
+}
+
+#flash_notice {
+ background-color: #CFC;
+ border: solid 1px #6C6;
+}
+
+#flash_error, #flash_alert {
+ background-color: #FCC;
+ border: solid 1px #C66;
+}
+
+.field_with_errors {
+ display: inline;
+}
+
+.error_messages {
+ width: 400px;
+ border: 2px solid #CF0000;
+ padding: 0px;
+ padding-bottom: 12px;
+ margin-bottom: 20px;
+ background-color: #f0f0f0;
+ font-size: 12px;
+}
+
+.error_messages h2 {
+ text-align: left;
+ font-weight: bold;
+ padding: 5px 10px;
+ font-size: 12px;
+ margin: 0;
+ background-color: #c00;
+ color: #fff;
+}
+
+.error_messages p {
+ margin: 8px 10px;
+}
+
+form .field, form .actions {
+ margin: 12px 0;
+}
View
17 episode-296/cms-after/app/assets/stylesheets/mercury_overrides.css
@@ -0,0 +1,17 @@
+/*!
+ * Mercury Editor is a Coffeescript and jQuery based WYSIWYG editor. Documentation and other useful information can be
+ * found at https://github.com/jejacks0n/mercury
+ *
+ * This file is intended to provide a standard way to override the CSS that comes default with Mercury Editor, and
+ * includes an example button style, should you ever need to add new ones yourself. Read the toolbar configuration in
+ * mercury.js for more on how to add your own buttons to the toolbar.
+ */
+
+/* Disable text sizing in webkit (ipad/iphone etc -- should apply to mercury only) */
+html { -webkit-text-size-adjust: none; }
+
+/* Button example */
+.mercury-primary-toolbar .mercury-inspector-button em,
+.mercury-expander-button[data-button="inspector"] em {
+ background-image: url(/assets/mercury/toolbar/primary/inspectorpanel.png);
+}
View
40 episode-296/cms-after/app/assets/stylesheets/pages.css.scss
@@ -0,0 +1,40 @@
+// Place all the styles related to the pages controller here.
+// They will automatically be included in application.css.
+// You can use Sass (SCSS) here: http://sass-lang.com/
+#header {
+ position: relative;
+ border-bottom: solid 1px #CCC;
+
+ h1 {
+ color: #000;
+ font-size: 34px;
+ margin: 0;
+ padding-left: 30px;
+ padding-top: 20px;
+ padding-bottom: 10px;
+ }
+
+ #navigation {
+ position: absolute;
+ right: 30px;
+ bottom: 10px;
+ list-style: none;
+ margin: 0;
+ padding: 0;
+
+ li {
+ display: inline;
+ margin: 0;
+ padding-left: 20px;
+ color: #5E5F63;
+
+ a {
+ text-decoration: none;
+ }
+ }
+ }
+}
+
+.content {
+ margin: 25px 30px;
+}
View
3  episode-296/cms-after/app/controllers/application_controller.rb
@@ -0,0 +1,3 @@
+class ApplicationController < ActionController::Base
+ protect_from_forgery
+end
View
17 episode-296/cms-after/app/controllers/pages_controller.rb
@@ -0,0 +1,17 @@
+class PagesController < ApplicationController
+ def index
+ @pages = Page.all
+ end
+
+ def show
+ @page = Page.find(params[:id])
+ end
+
+ def mercury_update
+ page = Page.find(params[:id])
+ page.name = params[:content][:page_name][:value]
+ page.content = params[:content][:page_content][:value]
+ page.save!
+ render text: ""
+ end
+end
View
2  episode-296/cms-after/app/helpers/application_helper.rb
@@ -0,0 +1,2 @@
+module ApplicationHelper
+end
View
2  episode-296/cms-after/app/helpers/pages_helper.rb
@@ -0,0 +1,2 @@
+module PagesHelper
+end
View
0  episode-296/cms-after/app/mailers/.gitkeep
No changes.
View
0  episode-296/cms-after/app/models/.gitkeep
No changes.
View
2  episode-296/cms-after/app/models/page.rb
@@ -0,0 +1,2 @@
+class Page < ActiveRecord::Base
+end
View
17 episode-296/cms-after/app/views/layouts/application.html.erb
@@ -0,0 +1,17 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <title>Mercury Example</title>
+ <%= stylesheet_link_tag "application" %>
+ <%= javascript_include_tag "application" %>
+ <%= csrf_meta_tag %>
+ </head>
+ <body>
+ <div id="container">
+ <% flash.each do |name, msg| %>
+ <%= content_tag :div, msg, :id => "flash_#{name}" %>
+ <% end %>
+ <%= yield %>
+ </div>
+ </body>
+</html>
View
25 episode-296/cms-after/app/views/layouts/mercury.html.erb
@@ -0,0 +1,25 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <meta name="viewport" content="width=device-width, maximum-scale=1.0, initial-scale=1.0">
+ <%= csrf_meta_tags %>
+ <title>Mercury Editor</title>
+ <%= stylesheet_link_tag 'mercury', 'mercury_overrides' %>
+ <%= javascript_include_tag 'mercury' %>
+ </head>
+ <body>
+ <% if Rails.application.config.respond_to?(:mercury_config) %>
+ <%= javascript_tag("jQuery.extend(Mercury.config, #{Rails.application.config.mercury_config});") %>
+ <% end -%>
+
+ <script type="text/javascript">
+ var saveUrl = null;
+ var options = {
+ saveStyle: 'form', // 'form', or 'json' (default json)
+ saveMethod: null, // 'POST', or 'PUT', (create, vs. update -- default POST)
+ visible: null // if the interface should start visible or not (default true)
+ };
+ new Mercury.PageEditor(saveUrl, options);
+ </script>
+ </body>
+</html>
View
6 episode-296/cms-after/app/views/pages/index.html.erb
@@ -0,0 +1,6 @@
+<h1>Pages</h1>
+<ul>
+<% @pages.each do |page| %>
+ <li><%= link_to page.name, page %></li>
+<% end %>
+</ul>
View
15 episode-296/cms-after/app/views/pages/show.html.erb
@@ -0,0 +1,15 @@
+<div id="header">
+ <h1><span id="page_name" class="mercury-region" data-type="editable"><%= raw @page.name %></span></h1>
+ <ul id="navigation">
+ <% Page.all.each do |page| %>
+ <li><%= link_to_unless_current page.name, page %></li>
+ <% end %>
+ </ul>
+</div>
+
+<div class="content">
+ <div id="page_content" class="mercury-region" data-type="editable">
+ <%= raw @page.content %>
+ </div>
+ <p><%= link_to "Edit Page", "/editor" + request.path, id: "edit_link", data: {save_url: mercury_update_page_path(@page)} %></p>
+</div>
View
4 episode-296/cms-after/config.ru
@@ -0,0 +1,4 @@
+# This file is used by Rack-based servers to start the application.
+
+require ::File.expand_path('../config/environment', __FILE__)
+run Cms::Application
View
48 episode-296/cms-after/config/application.rb
@@ -0,0 +1,48 @@
+require File.expand_path('../boot', __FILE__)
+
+require 'rails/all'
+
+if defined?(Bundler)
+ # If you precompile assets before deploying to production, use this line
+ Bundler.require(*Rails.groups(:assets => %w(development test)))
+ # If you want your assets lazily compiled in production, use this line
+ # Bundler.require(:default, :assets, Rails.env)
+end
+
+module Cms
+ class Application < Rails::Application
+ # Settings in config/environments/* take precedence over those specified here.
+ # Application configuration should go into files in config/initializers
+ # -- all .rb files in that directory are automatically loaded.
+
+ # Custom directories with classes and modules you want to be autoloadable.
+ # config.autoload_paths += %W(#{config.root}/extras)
+
+ # Only load the plugins named here, in the order given (default is alphabetical).
+ # :all can be used as a placeholder for all plugins not explicitly named.
+ # config.plugins = [ :exception_notification, :ssl_requirement, :all ]
+
+ # Activate observers that should always be running.
+ # config.active_record.observers = :cacher, :garbage_collector, :forum_observer
+
+ # Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
+ # Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC.
+ # config.time_zone = 'Central Time (US & Canada)'
+
+ # The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
+ # config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
+ # config.i18n.default_locale = :de
+
+ # Configure the default encoding used in templates for Ruby 1.9.
+ config.encoding = "utf-8"
+
+ # Configure sensitive parameters which will be filtered from the log file.
+ config.filter_parameters += [:password]
+
+ # Enable the asset pipeline
+ config.assets.enabled = true
+
+ # Version of your assets, change this if you want to expire all your assets
+ config.assets.version = '1.0'
+ end
+end
View
6 episode-296/cms-after/config/boot.rb
@@ -0,0 +1,6 @@
+require 'rubygems'
+
+# Set up gems listed in the Gemfile.
+ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__)
+
+require 'bundler/setup' if File.exists?(ENV['BUNDLE_GEMFILE'])
View
25 episode-296/cms-after/config/database.yml
@@ -0,0 +1,25 @@
+# SQLite version 3.x
+# gem install sqlite3
+#
+# Ensure the SQLite 3 gem is defined in your Gemfile
+# gem 'sqlite3'
+development:
+ adapter: sqlite3
+ database: db/development.sqlite3
+ pool: 5
+ timeout: 5000
+
+# Warning: The database defined as "test" will be erased and
+# re-generated from your development database when you run "rake".
+# Do not set this db to the same as development or production.
+test:
+ adapter: sqlite3
+ database: db/test.sqlite3
+ pool: 5
+ timeout: 5000
+
+production:
+ adapter: sqlite3
+ database: db/production.sqlite3
+ pool: 5
+ timeout: 5000
View
5 episode-296/cms-after/config/environment.rb
@@ -0,0 +1,5 @@
+# Load the rails application
+require File.expand_path('../application', __FILE__)
+
+# Initialize the rails application
+Cms::Application.initialize!
View
30 episode-296/cms-after/config/environments/development.rb
@@ -0,0 +1,30 @@
+Cms::Application.configure do
+ # Settings specified here will take precedence over those in config/application.rb
+
+ # In the development environment your application's code is reloaded on
+ # every request. This slows down response time but is perfect for development
+ # since you don't have to restart the web server when you make code changes.
+ config.cache_classes = false
+
+ # Log error messages when you accidentally call methods on nil.
+ config.whiny_nils = true
+
+ # Show full error reports and disable caching
+ config.consider_all_requests_local = true
+ config.action_controller.perform_caching = false
+
+ # Don't care if the mailer can't send
+ config.action_mailer.raise_delivery_errors = false
+
+ # Print deprecation notices to the Rails logger
+ config.active_support.deprecation = :log
+
+ # Only use best-standards-support built into browsers
+ config.action_dispatch.best_standards_support = :builtin
+
+ # Do not compress assets
+ config.assets.compress = false
+
+ # Expands the lines which load the assets
+ config.assets.debug = true
+end
View
60 episode-296/cms-after/config/environments/production.rb
@@ -0,0 +1,60 @@
+Cms::Application.configure do
+ # Settings specified here will take precedence over those in config/application.rb
+
+ # Code is not reloaded between requests
+ config.cache_classes = true
+
+ # Full error reports are disabled and caching is turned on
+ config.consider_all_requests_local = false
+ config.action_controller.perform_caching = true
+
+ # Disable Rails's static asset server (Apache or nginx will already do this)
+ config.serve_static_assets = false
+
+ # Compress JavaScripts and CSS
+ config.assets.compress = true
+
+ # Don't fallback to assets pipeline if a precompiled asset is missed
+ config.assets.compile = false
+
+ # Generate digests for assets URLs
+ config.assets.digest = true
+
+ # Defaults to Rails.root.join("public/assets")
+ # config.assets.manifest = YOUR_PATH
+
+ # Specifies the header that your server uses for sending files
+ # config.action_dispatch.x_sendfile_header = "X-Sendfile" # for apache
+ # config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for nginx
+
+ # Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.
+ # config.force_ssl = true
+
+ # See everything in the log (default is :info)
+ # config.log_level = :debug
+
+ # Use a different logger for distributed setups
+ # config.logger = SyslogLogger.new
+
+ # Use a different cache store in production
+ # config.cache_store = :mem_cache_store
+
+ # Enable serving of images, stylesheets, and JavaScripts from an asset server
+ # config.action_controller.asset_host = "http://assets.example.com"
+
+ # Precompile additional assets (application.js, application.css, and all non-JS/CSS are already added)
+ # config.assets.precompile += %w( search.js )
+
+ # Disable delivery errors, bad email addresses will be ignored
+ # config.action_mailer.raise_delivery_errors = false
+
+ # Enable threaded mode
+ # config.threadsafe!
+
+ # Enable locale fallbacks for I18n (makes lookups for any locale fall back to
+ # the I18n.default_locale when a translation can not be found)
+ config.i18n.fallbacks = true
+
+ # Send deprecation notices to registered listeners
+ config.active_support.deprecation = :notify
+end
View
39 episode-296/cms-after/config/environments/test.rb
@@ -0,0 +1,39 @@
+Cms::Application.configure do
+ # Settings specified here will take precedence over those in config/application.rb
+
+ # The test environment is used exclusively to run your application's
+ # test suite. You never need to work with it otherwise. Remember that
+ # your test database is "scratch space" for the test suite and is wiped
+ # and recreated between test runs. Don't rely on the data there!
+ config.cache_classes = true
+
+ # Configure static asset server for tests with Cache-Control for performance
+ config.serve_static_assets = true
+ config.static_cache_control = "public, max-age=3600"
+
+ # Log error messages when you accidentally call methods on nil
+ config.whiny_nils = true
+
+ # Show full error reports and disable caching
+ config.consider_all_requests_local = true
+ config.action_controller.perform_caching = false
+
+ # Raise exceptions instead of rendering exception templates
+ config.action_dispatch.show_exceptions = false
+
+ # Disable request forgery protection in test environment
+ config.action_controller.allow_forgery_protection = false
+
+ # Tell Action Mailer not to deliver emails to the real world.
+ # The :test delivery method accumulates sent emails in the
+ # ActionMailer::Base.deliveries array.
+ config.action_mailer.delivery_method = :test
+
+ # Use SQL instead of Active Record's schema dumper when creating the test database.
+ # This is necessary if your schema can't be completely dumped by the schema dumper,
+ # like if you have constraints or database-specific column types
+ # config.active_record.schema_format = :sql
+
+ # Print deprecation notices to the stderr
+ config.active_support.deprecation = :stderr
+end
View
7 episode-296/cms-after/config/initializers/backtrace_silencers.rb
@@ -0,0 +1,7 @@
+# Be sure to restart your server when you modify this file.
+
+# You can add backtrace silencers for libraries that you're using but don't wish to see in your backtraces.
+# Rails.backtrace_cleaner.add_silencer { |line| line =~ /my_noisy_library/ }
+
+# You can also remove all the silencers if you're trying to debug a problem that might stem from framework code.
+# Rails.backtrace_cleaner.remove_silencers!
View
10 episode-296/cms-after/config/initializers/inflections.rb
@@ -0,0 +1,10 @@
+# Be sure to restart your server when you modify this file.
+
+# Add new inflection rules using the following format
+# (all these examples are active by default):
+# ActiveSupport::Inflector.inflections do |inflect|
+# inflect.plural /^(ox)$/i, '\1en'
+# inflect.singular /^(ox)en/i, '\1'
+# inflect.irregular 'person', 'people'
+# inflect.uncountable %w( fish sheep )
+# end
View
5 episode-296/cms-after/config/initializers/mime_types.rb
@@ -0,0 +1,5 @@
+# Be sure to restart your server when you modify this file.
+
+# Add new mime types for use in respond_to blocks:
+# Mime::Type.register "text/richtext", :rtf
+# Mime::Type.register_alias "text/html", :iphone
View
7 episode-296/cms-after/config/initializers/secret_token.rb
@@ -0,0 +1,7 @@
+# Be sure to restart your server when you modify this file.
+
+# Your secret key for verifying the integrity of signed cookies.
+# If you change this key, all old signed cookies will become invalid!
+# Make sure the secret is at least 30 characters and all random,
+# no regular words or you'll be exposed to dictionary attacks.
+Cms::Application.config.secret_token = 'd12e1fa3fa2407dab539d1f537e4260dfbcf13ddc78666638f960df20442e87bf563f466fe62f0426b62fa270b78b1ff9534a82db4d9db023655fa835d826c8a'
View
8 episode-296/cms-after/config/initializers/session_store.rb
@@ -0,0 +1,8 @@
+# Be sure to restart your server when you modify this file.
+
+Cms::Application.config.session_store :cookie_store, key: '_cms_session'
+
+# Use the database for sessions instead of the cookie-based default,
+# which shouldn't be used to store highly confidential information
+# (create the session table with "rails generate session_migration")
+# Cms::Application.config.session_store :active_record_store
View
14 episode-296/cms-after/config/initializers/wrap_parameters.rb
@@ -0,0 +1,14 @@
+# Be sure to restart your server when you modify this file.
+#
+# This file contains settings for ActionController::ParamsWrapper which
+# is enabled by default.
+
+# Enable parameter wrapping for JSON. You can disable this by setting :format to an empty array.
+ActiveSupport.on_load(:action_controller) do
+ wrap_parameters format: [:json]
+end
+
+# Disable root element in JSON by default.
+ActiveSupport.on_load(:active_record) do
+ self.include_root_in_json = false
+end
View
5 episode-296/cms-after/config/locales/en.yml
@@ -0,0 +1,5 @@
+# Sample localization file for English. Add more files in this directory for other locales.
+# See https://github.com/svenfuchs/rails-i18n/tree/master/rails%2Flocale for starting points.
+
+en:
+ hello: "Hello world"
View
8 episode-296/cms-after/config/routes.rb
@@ -0,0 +1,8 @@
+Cms::Application.routes.draw do
+ Mercury::Engine.routes
+
+ root to: 'pages#index'
+ resources :pages do
+ member { post :mercury_update }
+ end
+end
View
10 episode-296/cms-after/db/migrate/20111106214638_create_pages.rb
@@ -0,0 +1,10 @@
+class CreatePages < ActiveRecord::Migration
+ def change
+ create_table :pages do |t|
+ t.string :name
+ t.text :content
+
+ t.timestamps
+ end
+ end
+end
View
11 episode-296/cms-after/db/migrate/20111107050254_create_images.rb
@@ -0,0 +1,11 @@
+class CreateImages < ActiveRecord::Migration
+ def change
+ create_table :images do |t|
+ t.string :image_file_name
+ t.string :image_content_type
+ t.integer :image_file_size
+ t.datetime :image_updated_at
+ t.timestamps
+ end
+ end
+end
View
32 episode-296/cms-after/db/schema.rb
@@ -0,0 +1,32 @@
+# encoding: UTF-8
+# This file is auto-generated from the current state of the database. Instead
+# of editing this file, please use the migrations feature of Active Record to
+# incrementally modify your database, and then regenerate this schema definition.
+#
+# Note that this schema.rb definition is the authoritative source for your
+# database schema. If you need to create the application database on another
+# system, you should be using db:schema:load, not running all the migrations
+# from scratch. The latter is a flawed and unsustainable approach (the more migrations
+# you'll amass, the slower it'll run and the greater likelihood for issues).
+#
+# It's strongly recommended to check this file into your version control system.
+
+ActiveRecord::Schema.define(:version => 20111107050254) do
+
+ create_table "images", :force => true do |t|
+ t.string "image_file_name"
+ t.string "image_content_type"
+ t.integer "image_file_size"
+ t.datetime "image_updated_at"
+ t.datetime "created_at"
+ t.datetime "updated_at"
+ end
+
+ create_table "pages", :force => true do |t|
+ t.string "name"
+ t.text "content"
+ t.datetime "created_at"
+ t.datetime "updated_at"
+ end
+
+end
View
26 episode-296/cms-after/db/seeds.rb
@@ -0,0 +1,26 @@
+# This file should contain all the record creation needed to seed the database with its default values.
+# The data can then be loaded with the rake db:seed (or created alongside the db with db:setup).
+#
+# Examples:
+#
+# cities = City.create([{ name: 'Chicago' }, { name: 'Copenhagen' }])
+# Mayor.create(name: 'Emanuel', city: cities.first)
+Page.create! name: "Welcome", content: <<-HTML
+<p>In this RailsCasts episode we are going to look at the <a href="http://jejacks0n.github.com/mercury/">Mercury Editor</a>. It allows you to edit a document in-place, right in the HTML. It works in the following browsers.</p>
+<ul>
+ <li>Firefox 4+</li>
+ <li>Chrome 10+</li>
+ <li>Safari 5+</li>
+</ul>
+<p>Try it out here by clicking on the <strong><em>Edit Page</em></strong> link below. There you will be able to change this page content and even the title above.</p>
+HTML
+
+Page.create! name: "Products", content: <<-HTML
+<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
+<p>Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
+HTML
+
+Page.create! name: "About Us", content: <<-HTML
+<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
+<p>Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
+HTML
View
2  episode-296/cms-after/doc/README_FOR_APP
@@ -0,0 +1,2 @@
+Use this README file to introduce your application and point to useful places in the API for learning more.
+Run "rake doc:app" to generate API documentation for your models, controllers, helpers, and libraries.
View
0  episode-296/cms-after/lib/assets/.gitkeep
No changes.
View
0  episode-296/cms-after/lib/tasks/.gitkeep
No changes.
View
0  episode-296/cms-after/log/.gitkeep
No changes.
View
26 episode-296/cms-after/public/404.html
@@ -0,0 +1,26 @@
+<!DOCTYPE html>
+<html>
+<head>
+ <title>The page you were looking for doesn't exist (404)</title>
+ <style type="text/css">
+ body { background-color: #fff; color: #666; text-align: center; font-family: arial, sans-serif; }
+ div.dialog {
+ width: 25em;
+ padding: 0 4em;
+ margin: 4em auto 0 auto;
+ border: 1px solid #ccc;
+ border-right-color: #999;
+ border-bottom-color: #999;
+ }
+ h1 { font-size: 100%; color: #f00; line-height: 1.5em; }
+ </style>
+</head>
+
+<body>
+ <!-- This file lives in public/404.html -->
+ <div class="dialog">
+ <h1>The page you were looking for doesn't exist.</h1>
+ <p>You may have mistyped the address or the page may have moved.</p>
+ </div>
+</body>
+</html>
View
26 episode-296/cms-after/public/422.html
@@ -0,0 +1,26 @@
+<!DOCTYPE html>
+<html>
+<head>
+ <title>The change you wanted was rejected (422)</title>
+ <style type="text/css">
+ body { background-color: #fff; color: #666; text-align: center; font-family: arial, sans-serif; }
+ div.dialog {
+ width: 25em;
+ padding: 0 4em;
+ margin: 4em auto 0 auto;
+ border: 1px solid #ccc;
+ border-right-color: #999;
+ border-bottom-color: #999;
+ }
+ h1 { font-size: 100%; color: #f00; line-height: 1.5em; }
+ </style>
+</head>
+
+<body>
+ <!-- This file lives in public/422.html -->
+ <div class="dialog">
+ <h1>The change you wanted was rejected.</h1>
+ <p>Maybe you tried to change something you didn't have access to.</p>
+ </div>
+</body>
+</html>
View
26 episode-296/cms-after/public/500.html
@@ -0,0 +1,26 @@
+<!DOCTYPE html>
+<html>
+<head>
+ <title>We're sorry, but something went wrong (500)</title>
+ <style type="text/css">
+ body { background-color: #fff; color: #666; text-align: center; font-family: arial, sans-serif; }
+ div.dialog {
+ width: 25em;
+ padding: 0 4em;
+ margin: 4em auto 0 auto;
+ border: 1px solid #ccc;
+ border-right-color: #999;
+ border-bottom-color: #999;
+ }
+ h1 { font-size: 100%; color: #f00; line-height: 1.5em; }
+ </style>
+</head>
+
+<body>
+ <!-- This file lives in public/500.html -->
+ <div class="dialog">
+ <h1>We're sorry, but something went wrong.</h1>
+ <p>We've been notified about this issue and we'll take a look at it shortly.</p>
+ </div>
+</body>
+</html>
View
0  episode-296/cms-after/public/favicon.ico
No changes.
View
5 episode-296/cms-after/public/robots.txt
@@ -0,0 +1,5 @@
+# See http://www.robotstxt.org/wc/norobots.html for documentation on how to use the robots.txt file
+#
+# To ban all spiders from the entire site uncomment the next two lines:
+# User-Agent: *
+# Disallow: /
View
6 episode-296/cms-after/script/rails
@@ -0,0 +1,6 @@
+#!/usr/bin/env ruby
+# This command will automatically be run when you run "rails" with Rails 3 gems installed from the root of your application.
+
+APP_PATH = File.expand_path('../../config/application', __FILE__)
+require File.expand_path('../../config/boot', __FILE__)
+require 'rails/commands'
View
0  episode-296/cms-after/test/fixtures/.gitkeep
No changes.
View
9 episode-296/cms-after/test/fixtures/pages.yml
@@ -0,0 +1,9 @@
+# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/Fixtures.html
+
+one:
+ name: MyString
+ content: MyText
+
+two:
+ name: MyString
+ content: MyText
View
0  episode-296/cms-after/test/functional/.gitkeep
No changes.
View
14 episode-296/cms-after/test/functional/pages_controller_test.rb
@@ -0,0 +1,14 @@
+require 'test_helper'
+
+class PagesControllerTest < ActionController::TestCase
+ test "should get index" do
+ get :index
+ assert_response :success
+ end
+
+ test "should get show" do
+ get :show
+ assert_response :success
+ end
+
+end
View
0  episode-296/cms-after/test/integration/.gitkeep
No changes.
View
12 episode-296/cms-after/test/performance/browsing_test.rb
@@ -0,0 +1,12 @@
+require 'test_helper'
+require 'rails/performance_test_help'
+
+class BrowsingTest < ActionDispatch::PerformanceTest
+ # Refer to the documentation for all available options
+ # self.profile_options = { :runs => 5, :metrics => [:wall_time, :memory]
+ # :output => 'tmp/performance', :formats => [:flat] }
+
+ def test_homepage
+ get '/'
+ end
+end
View
13 episode-296/cms-after/test/test_helper.rb
@@ -0,0 +1,13 @@
+ENV["RAILS_ENV"] = "test"
+require File.expand_path('../../config/environment', __FILE__)
+require 'rails/test_help'
+
+class ActiveSupport::TestCase
+ # Setup all fixtures in test/fixtures/*.(yml|csv) for all tests in alphabetical order.
+ #
+ # Note: You'll currently still have to declare fixtures explicitly in integration tests
+ # -- they do not yet inherit this setting
+ fixtures :all
+
+ # Add more helper methods to be used by all tests here...
+end
View
0  episode-296/cms-after/test/unit/.gitkeep
No changes.
View
4 episode-296/cms-after/test/unit/helpers/pages_helper_test.rb
@@ -0,0 +1,4 @@
+require 'test_helper'
+
+class PagesHelperTest < ActionView::TestCase
+end
View
7 episode-296/cms-after/test/unit/page_test.rb
@@ -0,0 +1,7 @@
+require 'test_helper'
+
+class PageTest < ActiveSupport::TestCase
+ # test "the truth" do
+ # assert true
+ # end
+end
View
0  episode-296/cms-after/vendor/assets/stylesheets/.gitkeep
No changes.
View
0  episode-296/cms-after/vendor/plugins/.gitkeep
No changes.
View
5 episode-296/cms-before/.gitignore
@@ -0,0 +1,5 @@
+.bundle
+db/*.sqlite3
+log/*.log
+tmp/
+.sass-cache/
View
15 episode-296/cms-before/Gemfile
@@ -0,0 +1,15 @@
+source 'http://rubygems.org'
+
+gem 'rails', '3.1.1'
+gem 'sqlite3'
+
+# Gems used only for assets and not required
+# in production environments by default.
+group :assets do
+ gem 'sass-rails', '~> 3.1.4'
+ gem 'coffee-rails', '~> 3.1.1'
+ gem 'uglifier', '>= 1.0.3'
+end
+
+gem 'jquery-rails'
+
View
115 episode-296/cms-before/Gemfile.lock
@@ -0,0 +1,115 @@
+GEM
+ remote: http://rubygems.org/
+ specs:
+ actionmailer (3.1.1)
+ actionpack (= 3.1.1)
+ mail (~> 2.3.0)
+ actionpack (3.1.1)
+ activemodel (= 3.1.1)
+ activesupport (= 3.1.1)
+ builder (~> 3.0.0)
+ erubis (~> 2.7.0)
+ i18n (~> 0.6)
+ rack (~> 1.3.2)
+ rack-cache (~> 1.1)
+ rack-mount (~> 0.8.2)
+ rack-test (~> 0.6.1)
+ sprockets (~> 2.0.2)
+ activemodel (3.1.1)
+ activesupport (= 3.1.1)
+ builder (~> 3.0.0)
+ i18n (~> 0.6)
+ activerecord (3.1.1)
+ activemodel (= 3.1.1)
+ activesupport (= 3.1.1)
+ arel (~> 2.2.1)
+ tzinfo (~> 0.3.29)
+ activeresource (3.1.1)
+ activemodel (= 3.1.1)
+ activesupport (= 3.1.1)
+ activesupport (3.1.1)
+ multi_json (~> 1.0)
+ arel (2.2.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)
+ erubis (2.7.0)
+ execjs (1.2.9)
+ multi_json (~> 1.0)
+ hike (1.2.1)
+ i18n (0.6.0)
+ jquery-rails (1.0.16)
+ railties (~> 3.0)
+ thor (~> 0.14)
+ json (1.6.1)
+ mail (2.3.0)
+ i18n (>= 0.4.0)
+ mime-types (~> 1.16)
+ treetop (~> 1.4.8)
+ mime-types (1.17.2)
+ multi_json (1.0.3)
+ polyglot (0.3.3)
+ rack (1.3.5)
+ rack-cache (1.1)
+ 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.1)
+ actionmailer (= 3.1.1)
+ actionpack (= 3.1.1)
+ activerecord (= 3.1.1)
+ activeresource (= 3.1.1)
+ activesupport (= 3.1.1)
+ bundler (~> 1.0)
+ railties (= 3.1.1)
+ railties (3.1.1)
+ actionpack (= 3.1.1)
+ activesupport (= 3.1.1)
+ rack-ssl (~> 1.3.2)
+ rake (>= 0.8.7)
+ rdoc (~> 3.4)
+ thor (~> 0.14.6)
+ rake (0.9.2.2)
+ rdoc (3.11)
+ json (~> 1.4)
+ sass (3.1.10)
+ sass-rails (3.1.4)
+ actionpack (~> 3.1.0)
+ railties (~> 3.1.0)
+ sass (>= 3.1.4)
+ sprockets (~> 2.0.0)
+ tilt (~> 1.3.2)
+ sprockets (2.0.3)
+ hike (~> 1.2)
+ rack (~> 1.0)
+ tilt (~> 1.1, != 1.3.0)
+ sqlite3 (1.3.4)
+ thor (0.14.6)
+ tilt (1.3.3)
+ treetop (1.4.10)
+ polyglot
+ polyglot (>= 0.3.1)
+ tzinfo (0.3.31)
+ uglifier (1.0.4)
+ execjs (>= 0.3.0)
+ multi_json (>= 1.0.2)
+
+PLATFORMS
+ ruby
+
+DEPENDENCIES
+ coffee-rails (~> 3.1.1)
+ jquery-rails
+ rails (= 3.1.1)
+ sass-rails (~> 3.1.4)
+ sqlite3
+ uglifier (>= 1.0.3)
View
9 episode-296/cms-before/README
@@ -0,0 +1,9 @@
+= RailsCasts Example Application
+
+Run these commands to try it out.
+
+ bundle
+ rake db:setup
+ rails s
+
+Ruby 1.9.2 is required to run this example.
View
7 episode-296/cms-before/Rakefile
@@ -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__)
+
+Cms::Application.load_tasks
View
BIN  episode-296/cms-before/app/assets/images/rails.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
9 episode-296/cms-before/app/assets/javascripts/application.js
@@ -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 .
View
3  episode-296/cms-before/app/assets/javascripts/pages.js.coffee
@@ -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/
View
84 episode-296/cms-before/app/assets/stylesheets/application.css
@@ -0,0 +1,84 @@
+/*
+ * This is a manifest file that'll automatically include all the stylesheets available in this directory
+ * and any sub-directories. You're free to add application-wide styles to this file and they'll appear at
+ * the top of the compiled file, but it's generally better to create a new file per style scope.
+ *= require_self
+ *= require_tree .
+*/
+
+body {
+ background-color: #4B7399;
+ font-family: Verdana, Helvetica, Arial;
+ font-size: 14px;
+}
+
+a img {
+ border: none;
+}
+
+a {
+ color: #0000FF;
+}
+
+.clear {
+ clear: both;
+ height: 0;
+ overflow: hidden;
+}
+
+#container {
+ width: 75%;
+ margin: 0 auto;
+ background-color: #FFF;
+ border: solid 1px black;
+ margin-top: 20px;
+ position: relative;
+}
+
+#flash_notice, #flash_error, #flash_alert {
+ padding: 5px 8px;
+ margin: 10px 0;
+ margin-right: 150px;
+}
+
+#flash_notice {
+ background-color: #CFC;
+ border: solid 1px #6C6;
+}
+
+#flash_error, #flash_alert {
+ background-color: #FCC;
+ border: solid 1px #C66;
+}
+
+.field_with_errors {
+ display: inline;
+}
+
+.error_messages {
+ width: 400px;
+ border: 2px solid #CF0000;
+ padding: 0px;
+ padding-bottom: 12px;
+ margin-bottom: 20px;
+ background-color: #f0f0f0;
+