Permalink
Browse files

initial commit

  • Loading branch information...
0 parents commit 14108b6f92ca38c747e586a7f6fb65866f83cd66 @ryanb ryanb committed Jul 10, 2012
Showing with 3,627 additions and 0 deletions.
  1. +13 −0 README.md
  2. +15 −0 youhaiku-after/.gitignore
  3. +40 −0 youhaiku-after/Gemfile
  4. +115 −0 youhaiku-after/Gemfile.lock
  5. +11 −0 youhaiku-after/README.md
  6. +7 −0 youhaiku-after/Rakefile
  7. +15 −0 youhaiku-after/app/assets/javascripts/application.js
  8. +3 −0 youhaiku-after/app/assets/javascripts/haikus.js.coffee
  9. +3 −0 youhaiku-after/app/assets/javascripts/sessions.js.coffee
  10. +3 −0 youhaiku-after/app/assets/javascripts/users.js.coffee
  11. +13 −0 youhaiku-after/app/assets/stylesheets/application.css
  12. +14 −0 youhaiku-after/app/assets/stylesheets/haikus.css.scss
  13. +84 −0 youhaiku-after/app/assets/stylesheets/layout.css.scss
  14. +3 −0 youhaiku-after/app/assets/stylesheets/sessions.css.scss
  15. +3 −0 youhaiku-after/app/assets/stylesheets/users.css.scss
  16. +14 −0 youhaiku-after/app/controllers/application_controller.rb
  17. +23 −0 youhaiku-after/app/controllers/haikus_controller.rb
  18. +20 −0 youhaiku-after/app/controllers/sessions_controller.rb
  19. +15 −0 youhaiku-after/app/controllers/users_controller.rb
  20. +2 −0 youhaiku-after/app/helpers/application_helper.rb
  21. +2 −0 youhaiku-after/app/helpers/haikus_helper.rb
  22. +2 −0 youhaiku-after/app/helpers/sessions_helper.rb
  23. +2 −0 youhaiku-after/app/helpers/users_helper.rb
  24. 0 youhaiku-after/app/mailers/.gitkeep
  25. 0 youhaiku-after/app/models/.gitkeep
  26. +7 −0 youhaiku-after/app/models/haiku.rb
  27. +14 −0 youhaiku-after/app/models/user.rb
  28. +11 −0 youhaiku-after/app/views/haikus/_haiku.html.erb
  29. +8 −0 youhaiku-after/app/views/haikus/index.html.erb
  30. +3 −0 youhaiku-after/app/views/haikus/show.html.erb
  31. +30 −0 youhaiku-after/app/views/layouts/application.html.erb
  32. +13 −0 youhaiku-after/app/views/sessions/new.html.erb
  33. +28 −0 youhaiku-after/app/views/users/new.html.erb
  34. +4 −0 youhaiku-after/config.ru
  35. +62 −0 youhaiku-after/config/application.rb
  36. +6 −0 youhaiku-after/config/boot.rb
  37. +25 −0 youhaiku-after/config/database.yml
  38. +5 −0 youhaiku-after/config/environment.rb
  39. +37 −0 youhaiku-after/config/environments/development.rb
  40. +67 −0 youhaiku-after/config/environments/production.rb
  41. +37 −0 youhaiku-after/config/environments/test.rb
  42. +7 −0 youhaiku-after/config/initializers/backtrace_silencers.rb
  43. +15 −0 youhaiku-after/config/initializers/inflections.rb
  44. +5 −0 youhaiku-after/config/initializers/mime_types.rb
  45. +7 −0 youhaiku-after/config/initializers/secret_token.rb
  46. +8 −0 youhaiku-after/config/initializers/session_store.rb
  47. +14 −0 youhaiku-after/config/initializers/wrap_parameters.rb
  48. +5 −0 youhaiku-after/config/locales/en.yml
  49. +13 −0 youhaiku-after/config/routes.rb
  50. +11 −0 youhaiku-after/db/migrate/20120709180303_create_haikus.rb
  51. +10 −0 youhaiku-after/db/migrate/20120709180737_create_users.rb
  52. +59 −0 youhaiku-after/db/migrate/20120709212913_create_reputation_system.rb
  53. +25 −0 youhaiku-after/db/migrate/20120709212914_add_reputations_index.rb
  54. +25 −0 youhaiku-after/db/migrate/20120709212915_add_evaluations_index.rb
  55. +25 −0 youhaiku-after/db/migrate/20120709212916_add_reputation_messages_index.rb
  56. +76 −0 youhaiku-after/db/schema.rb
  57. +16 −0 youhaiku-after/db/seeds.rb
  58. +2 −0 youhaiku-after/doc/README_FOR_APP
  59. 0 youhaiku-after/lib/assets/.gitkeep
  60. 0 youhaiku-after/lib/tasks/.gitkeep
  61. 0 youhaiku-after/log/.gitkeep
  62. +26 −0 youhaiku-after/public/404.html
  63. +26 −0 youhaiku-after/public/422.html
  64. +25 −0 youhaiku-after/public/500.html
  65. 0 youhaiku-after/public/favicon.ico
  66. +5 −0 youhaiku-after/public/robots.txt
  67. +6 −0 youhaiku-after/script/rails
  68. 0 youhaiku-after/test/fixtures/.gitkeep
  69. +9 −0 youhaiku-after/test/fixtures/haikus.yml
  70. +9 −0 youhaiku-after/test/fixtures/users.yml
  71. 0 youhaiku-after/test/functional/.gitkeep
  72. +49 −0 youhaiku-after/test/functional/haikus_controller_test.rb
  73. +9 −0 youhaiku-after/test/functional/sessions_controller_test.rb
  74. +7 −0 youhaiku-after/test/functional/users_controller_test.rb
  75. 0 youhaiku-after/test/integration/.gitkeep
  76. +12 −0 youhaiku-after/test/performance/browsing_test.rb
  77. +13 −0 youhaiku-after/test/test_helper.rb
  78. 0 youhaiku-after/test/unit/.gitkeep
  79. +7 −0 youhaiku-after/test/unit/haiku_test.rb
  80. +4 −0 youhaiku-after/test/unit/helpers/haikus_helper_test.rb
  81. +4 −0 youhaiku-after/test/unit/helpers/sessions_helper_test.rb
  82. +4 −0 youhaiku-after/test/unit/helpers/users_helper_test.rb
  83. +7 −0 youhaiku-after/test/unit/user_test.rb
  84. 0 youhaiku-after/vendor/assets/javascripts/.gitkeep
  85. 0 youhaiku-after/vendor/assets/stylesheets/.gitkeep
  86. 0 youhaiku-after/vendor/plugins/.gitkeep
  87. +15 −0 youhaiku-before/.gitignore
  88. +38 −0 youhaiku-before/Gemfile
  89. +113 −0 youhaiku-before/Gemfile.lock
  90. +11 −0 youhaiku-before/README.md
  91. +7 −0 youhaiku-before/Rakefile
  92. +15 −0 youhaiku-before/app/assets/javascripts/application.js
  93. +3 −0 youhaiku-before/app/assets/javascripts/haikus.js.coffee
  94. +3 −0 youhaiku-before/app/assets/javascripts/sessions.js.coffee
  95. +3 −0 youhaiku-before/app/assets/javascripts/users.js.coffee
  96. +13 −0 youhaiku-before/app/assets/stylesheets/application.css
  97. +14 −0 youhaiku-before/app/assets/stylesheets/haikus.css.scss
  98. +84 −0 youhaiku-before/app/assets/stylesheets/layout.css.scss
  99. +3 −0 youhaiku-before/app/assets/stylesheets/sessions.css.scss
  100. +3 −0 youhaiku-before/app/assets/stylesheets/users.css.scss
  101. +14 −0 youhaiku-before/app/controllers/application_controller.rb
  102. +16 −0 youhaiku-before/app/controllers/haikus_controller.rb
  103. +20 −0 youhaiku-before/app/controllers/sessions_controller.rb
  104. +15 −0 youhaiku-before/app/controllers/users_controller.rb
  105. +2 −0 youhaiku-before/app/helpers/application_helper.rb
  106. +2 −0 youhaiku-before/app/helpers/haikus_helper.rb
  107. +2 −0 youhaiku-before/app/helpers/sessions_helper.rb
  108. +2 −0 youhaiku-before/app/helpers/users_helper.rb
  109. 0 youhaiku-before/app/mailers/.gitkeep
  110. 0 youhaiku-before/app/models/.gitkeep
  111. +5 −0 youhaiku-before/app/models/haiku.rb
  112. +7 −0 youhaiku-before/app/models/user.rb
  113. +6 −0 youhaiku-before/app/views/haikus/_haiku.html.erb
  114. +8 −0 youhaiku-before/app/views/haikus/index.html.erb
  115. +3 −0 youhaiku-before/app/views/haikus/show.html.erb
  116. +29 −0 youhaiku-before/app/views/layouts/application.html.erb
  117. +13 −0 youhaiku-before/app/views/sessions/new.html.erb
  118. +28 −0 youhaiku-before/app/views/users/new.html.erb
  119. +4 −0 youhaiku-before/config.ru
  120. +62 −0 youhaiku-before/config/application.rb
  121. +6 −0 youhaiku-before/config/boot.rb
  122. +25 −0 youhaiku-before/config/database.yml
  123. +5 −0 youhaiku-before/config/environment.rb
  124. +37 −0 youhaiku-before/config/environments/development.rb
  125. +67 −0 youhaiku-before/config/environments/production.rb
  126. +37 −0 youhaiku-before/config/environments/test.rb
  127. +7 −0 youhaiku-before/config/initializers/backtrace_silencers.rb
  128. +15 −0 youhaiku-before/config/initializers/inflections.rb
  129. +5 −0 youhaiku-before/config/initializers/mime_types.rb
  130. +7 −0 youhaiku-before/config/initializers/secret_token.rb
  131. +8 −0 youhaiku-before/config/initializers/session_store.rb
  132. +14 −0 youhaiku-before/config/initializers/wrap_parameters.rb
  133. +5 −0 youhaiku-before/config/locales/en.yml
  134. +11 −0 youhaiku-before/config/routes.rb
  135. +11 −0 youhaiku-before/db/migrate/20120709180303_create_haikus.rb
  136. +10 −0 youhaiku-before/db/migrate/20120709180737_create_users.rb
  137. +32 −0 youhaiku-before/db/schema.rb
  138. +16 −0 youhaiku-before/db/seeds.rb
  139. +2 −0 youhaiku-before/doc/README_FOR_APP
  140. 0 youhaiku-before/lib/assets/.gitkeep
  141. 0 youhaiku-before/lib/tasks/.gitkeep
  142. 0 youhaiku-before/log/.gitkeep
  143. +26 −0 youhaiku-before/public/404.html
  144. +26 −0 youhaiku-before/public/422.html
  145. +25 −0 youhaiku-before/public/500.html
  146. 0 youhaiku-before/public/favicon.ico
  147. +5 −0 youhaiku-before/public/robots.txt
  148. +6 −0 youhaiku-before/script/rails
  149. 0 youhaiku-before/test/fixtures/.gitkeep
  150. +9 −0 youhaiku-before/test/fixtures/haikus.yml
  151. +9 −0 youhaiku-before/test/fixtures/users.yml
  152. 0 youhaiku-before/test/functional/.gitkeep
  153. +49 −0 youhaiku-before/test/functional/haikus_controller_test.rb
  154. +9 −0 youhaiku-before/test/functional/sessions_controller_test.rb
  155. +7 −0 youhaiku-before/test/functional/users_controller_test.rb
  156. 0 youhaiku-before/test/integration/.gitkeep
  157. +12 −0 youhaiku-before/test/performance/browsing_test.rb
  158. +13 −0 youhaiku-before/test/test_helper.rb
  159. 0 youhaiku-before/test/unit/.gitkeep
  160. +7 −0 youhaiku-before/test/unit/haiku_test.rb
  161. +4 −0 youhaiku-before/test/unit/helpers/haikus_helper_test.rb
  162. +4 −0 youhaiku-before/test/unit/helpers/sessions_helper_test.rb
  163. +4 −0 youhaiku-before/test/unit/helpers/users_helper_test.rb
  164. +7 −0 youhaiku-before/test/unit/user_test.rb
  165. 0 youhaiku-before/vendor/assets/javascripts/.gitkeep
  166. 0 youhaiku-before/vendor/assets/stylesheets/.gitkeep
  167. 0 youhaiku-before/vendor/plugins/.gitkeep
  168. +15 −0 youhaiku-from-scratch/.gitignore
  169. +38 −0 youhaiku-from-scratch/Gemfile
  170. +113 −0 youhaiku-from-scratch/Gemfile.lock
  171. +11 −0 youhaiku-from-scratch/README.md
  172. +7 −0 youhaiku-from-scratch/Rakefile
  173. +15 −0 youhaiku-from-scratch/app/assets/javascripts/application.js
  174. +3 −0 youhaiku-from-scratch/app/assets/javascripts/haikus.js.coffee
  175. +3 −0 youhaiku-from-scratch/app/assets/javascripts/sessions.js.coffee
  176. +3 −0 youhaiku-from-scratch/app/assets/javascripts/users.js.coffee
  177. +13 −0 youhaiku-from-scratch/app/assets/stylesheets/application.css
  178. +14 −0 youhaiku-from-scratch/app/assets/stylesheets/haikus.css.scss
  179. +84 −0 youhaiku-from-scratch/app/assets/stylesheets/layout.css.scss
  180. +3 −0 youhaiku-from-scratch/app/assets/stylesheets/sessions.css.scss
  181. +3 −0 youhaiku-from-scratch/app/assets/stylesheets/users.css.scss
  182. +14 −0 youhaiku-from-scratch/app/controllers/application_controller.rb
  183. +25 −0 youhaiku-from-scratch/app/controllers/haikus_controller.rb
  184. +20 −0 youhaiku-from-scratch/app/controllers/sessions_controller.rb
  185. +15 −0 youhaiku-from-scratch/app/controllers/users_controller.rb
  186. +2 −0 youhaiku-from-scratch/app/helpers/application_helper.rb
  187. +2 −0 youhaiku-from-scratch/app/helpers/haikus_helper.rb
  188. +2 −0 youhaiku-from-scratch/app/helpers/sessions_helper.rb
  189. +2 −0 youhaiku-from-scratch/app/helpers/users_helper.rb
  190. 0 youhaiku-from-scratch/app/mailers/.gitkeep
  191. 0 youhaiku-from-scratch/app/models/.gitkeep
  192. +16 −0 youhaiku-from-scratch/app/models/haiku.rb
  193. +14 −0 youhaiku-from-scratch/app/models/haiku_vote.rb
  194. +16 −0 youhaiku-from-scratch/app/models/user.rb
  195. +11 −0 youhaiku-from-scratch/app/views/haikus/_haiku.html.erb
  196. +8 −0 youhaiku-from-scratch/app/views/haikus/index.html.erb
  197. +3 −0 youhaiku-from-scratch/app/views/haikus/show.html.erb
  198. +30 −0 youhaiku-from-scratch/app/views/layouts/application.html.erb
  199. +13 −0 youhaiku-from-scratch/app/views/sessions/new.html.erb
  200. +28 −0 youhaiku-from-scratch/app/views/users/new.html.erb
  201. +4 −0 youhaiku-from-scratch/config.ru
  202. +62 −0 youhaiku-from-scratch/config/application.rb
  203. +6 −0 youhaiku-from-scratch/config/boot.rb
  204. +25 −0 youhaiku-from-scratch/config/database.yml
  205. +5 −0 youhaiku-from-scratch/config/environment.rb
  206. +37 −0 youhaiku-from-scratch/config/environments/development.rb
  207. +67 −0 youhaiku-from-scratch/config/environments/production.rb
  208. +37 −0 youhaiku-from-scratch/config/environments/test.rb
  209. +7 −0 youhaiku-from-scratch/config/initializers/backtrace_silencers.rb
  210. +15 −0 youhaiku-from-scratch/config/initializers/inflections.rb
  211. +5 −0 youhaiku-from-scratch/config/initializers/mime_types.rb
  212. +7 −0 youhaiku-from-scratch/config/initializers/secret_token.rb
  213. +8 −0 youhaiku-from-scratch/config/initializers/session_store.rb
  214. +14 −0 youhaiku-from-scratch/config/initializers/wrap_parameters.rb
  215. +5 −0 youhaiku-from-scratch/config/locales/en.yml
  216. +13 −0 youhaiku-from-scratch/config/routes.rb
  217. +11 −0 youhaiku-from-scratch/db/migrate/20120709180303_create_haikus.rb
  218. +10 −0 youhaiku-from-scratch/db/migrate/20120709180737_create_users.rb
  219. +13 −0 youhaiku-from-scratch/db/migrate/20120709233229_create_haiku_votes.rb
  220. +43 −0 youhaiku-from-scratch/db/schema.rb
  221. +16 −0 youhaiku-from-scratch/db/seeds.rb
  222. +2 −0 youhaiku-from-scratch/doc/README_FOR_APP
  223. 0 youhaiku-from-scratch/lib/assets/.gitkeep
  224. 0 youhaiku-from-scratch/lib/tasks/.gitkeep
  225. 0 youhaiku-from-scratch/log/.gitkeep
  226. +26 −0 youhaiku-from-scratch/public/404.html
  227. +26 −0 youhaiku-from-scratch/public/422.html
  228. +25 −0 youhaiku-from-scratch/public/500.html
  229. 0 youhaiku-from-scratch/public/favicon.ico
  230. +5 −0 youhaiku-from-scratch/public/robots.txt
  231. +6 −0 youhaiku-from-scratch/script/rails
  232. 0 youhaiku-from-scratch/test/fixtures/.gitkeep
  233. +11 −0 youhaiku-from-scratch/test/fixtures/haiku_votes.yml
  234. +9 −0 youhaiku-from-scratch/test/fixtures/haikus.yml
  235. +9 −0 youhaiku-from-scratch/test/fixtures/users.yml
  236. 0 youhaiku-from-scratch/test/functional/.gitkeep
  237. +49 −0 youhaiku-from-scratch/test/functional/haikus_controller_test.rb
  238. +9 −0 youhaiku-from-scratch/test/functional/sessions_controller_test.rb
  239. +7 −0 youhaiku-from-scratch/test/functional/users_controller_test.rb
  240. 0 youhaiku-from-scratch/test/integration/.gitkeep
  241. +12 −0 youhaiku-from-scratch/test/performance/browsing_test.rb
  242. +13 −0 youhaiku-from-scratch/test/test_helper.rb
  243. 0 youhaiku-from-scratch/test/unit/.gitkeep
  244. +7 −0 youhaiku-from-scratch/test/unit/haiku_test.rb
  245. +7 −0 youhaiku-from-scratch/test/unit/haiku_vote_test.rb
  246. +4 −0 youhaiku-from-scratch/test/unit/helpers/haikus_helper_test.rb
  247. +4 −0 youhaiku-from-scratch/test/unit/helpers/sessions_helper_test.rb
  248. +4 −0 youhaiku-from-scratch/test/unit/helpers/users_helper_test.rb
  249. +7 −0 youhaiku-from-scratch/test/unit/user_test.rb
  250. 0 youhaiku-from-scratch/vendor/assets/javascripts/.gitkeep
  251. 0 youhaiku-from-scratch/vendor/assets/stylesheets/.gitkeep
  252. 0 youhaiku-from-scratch/vendor/plugins/.gitkeep
@@ -0,0 +1,13 @@
+# RailsCasts Episode #364: Active Record Reputation System
+
+http://railscasts.com/episodes/364-active-record-reputation-system
+
+Requires Ruby 1.9.2 or higher.
+
+
+### Commands used in this episode
+
+```
+rails g reputation_system
+rake db:migrate
+```
@@ -0,0 +1,15 @@
+# See http://help.github.com/ignore-files/ for more about ignoring files.
+#
+# If you find yourself ignoring temporary files generated by your text editor
+# or operating system, you probably want to add a global ignore instead:
+# git config --global core.excludesfile ~/.gitignore_global
+
+# Ignore bundler config
+/.bundle
+
+# Ignore the default SQLite database.
+/db/*.sqlite3
+
+# Ignore all logfiles and tempfiles.
+/log/*.log
+/tmp
@@ -0,0 +1,40 @@
+source 'https://rubygems.org'
+
+gem 'rails', '3.2.6'
+
+# Bundle edge Rails instead:
+# gem 'rails', :git => 'git://github.com/rails/rails.git'
+
+gem 'sqlite3'
+
+
+# Gems used only for assets and not required
+# in production environments by default.
+group :assets do
+ gem 'sass-rails', '~> 3.2.3'
+ gem 'coffee-rails', '~> 3.2.1'
+
+ # See https://github.com/sstephenson/execjs#readme for more supported runtimes
+ # gem 'therubyracer', :platforms => :ruby
+
+ gem 'uglifier', '>= 1.0.3'
+end
+
+gem 'jquery-rails'
+
+# To use ActiveModel has_secure_password
+gem 'bcrypt-ruby', '~> 3.0.0'
+
+# To use Jbuilder templates for JSON
+# gem 'jbuilder'
+
+# Use unicorn as the app server
+# gem 'unicorn'
+
+# Deploy with Capistrano
+# gem 'capistrano'
+
+# To use debugger
+# gem 'debugger'
+
+gem 'activerecord-reputation-system', require: 'reputation_system'
@@ -0,0 +1,115 @@
+GEM
+ remote: https://rubygems.org/
+ specs:
+ actionmailer (3.2.6)
+ actionpack (= 3.2.6)
+ mail (~> 2.4.4)
+ actionpack (3.2.6)
+ activemodel (= 3.2.6)
+ activesupport (= 3.2.6)
+ builder (~> 3.0.0)
+ erubis (~> 2.7.0)
+ journey (~> 1.0.1)
+ rack (~> 1.4.0)
+ rack-cache (~> 1.2)
+ rack-test (~> 0.6.1)
+ sprockets (~> 2.1.3)
+ activemodel (3.2.6)
+ activesupport (= 3.2.6)
+ builder (~> 3.0.0)
+ activerecord (3.2.6)
+ activemodel (= 3.2.6)
+ activesupport (= 3.2.6)
+ arel (~> 3.0.2)
+ tzinfo (~> 0.3.29)
+ activerecord-reputation-system (1.2.0)
+ activeresource (3.2.6)
+ activemodel (= 3.2.6)
+ activesupport (= 3.2.6)
+ activesupport (3.2.6)
+ i18n (~> 0.6)
+ multi_json (~> 1.0)
+ arel (3.0.2)
+ bcrypt-ruby (3.0.1)
+ builder (3.0.0)
+ coffee-rails (3.2.2)
+ coffee-script (>= 2.2.0)
+ railties (~> 3.2.0)
+ coffee-script (2.2.0)
+ coffee-script-source
+ execjs
+ coffee-script-source (1.3.3)
+ erubis (2.7.0)
+ execjs (1.4.0)
+ multi_json (~> 1.0)
+ hike (1.2.1)
+ i18n (0.6.0)
+ journey (1.0.4)
+ jquery-rails (2.0.2)
+ railties (>= 3.2.0, < 5.0)
+ thor (~> 0.14)
+ json (1.7.3)
+ mail (2.4.4)
+ i18n (>= 0.4.0)
+ mime-types (~> 1.16)
+ treetop (~> 1.4.8)
+ mime-types (1.19)
+ multi_json (1.3.6)
+ polyglot (0.3.3)
+ rack (1.4.1)
+ rack-cache (1.2)
+ rack (>= 0.4)
+ rack-ssl (1.3.2)
+ rack
+ rack-test (0.6.1)
+ rack (>= 1.0)
+ rails (3.2.6)
+ actionmailer (= 3.2.6)
+ actionpack (= 3.2.6)
+ activerecord (= 3.2.6)
+ activeresource (= 3.2.6)
+ activesupport (= 3.2.6)
+ bundler (~> 1.0)
+ railties (= 3.2.6)
+ railties (3.2.6)
+ actionpack (= 3.2.6)
+ activesupport (= 3.2.6)
+ rack-ssl (~> 1.3.2)
+ rake (>= 0.8.7)
+ rdoc (~> 3.4)
+ thor (>= 0.14.6, < 2.0)
+ rake (0.9.2.2)
+ rdoc (3.12)
+ json (~> 1.4)
+ sass (3.1.20)
+ sass-rails (3.2.5)
+ railties (~> 3.2.0)
+ sass (>= 3.1.10)
+ tilt (~> 1.3)
+ sprockets (2.1.3)
+ hike (~> 1.2)
+ rack (~> 1.0)
+ tilt (~> 1.1, != 1.3.0)
+ sqlite3 (1.3.6)
+ thor (0.15.4)
+ tilt (1.3.3)
+ treetop (1.4.10)
+ polyglot
+ polyglot (>= 0.3.1)
+ tzinfo (0.3.33)
+ uglifier (1.2.6)
+ execjs (>= 0.3.0)
+ multi_json (~> 1.3)
+
+PLATFORMS
+ ruby
+
+DEPENDENCIES
+ activerecord-reputation-system
+ bcrypt-ruby (~> 3.0.0)
+ coffee-rails (~> 3.2.1)
+ jquery-rails
+ rails (= 3.2.6)
+ sass-rails (~> 3.2.3)
+ sqlite3
+ uglifier (>= 1.0.3)
@@ -0,0 +1,11 @@
+# RailsCasts Example Application
+
+Run these commands to try it out.
+
+```
+bundle
+rake db:setup
+rails s
+```
+
+Requires Ruby 1.9.2 or later to run.
@@ -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__)
+
+Youhaiku::Application.load_tasks
@@ -0,0 +1,15 @@
+// This is a manifest file that'll be compiled into application.js, which will include all the files
+// listed below.
+//
+// Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
+// or vendor/assets/javascripts of plugins, if any, can be referenced here using a relative path.
+//
+// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
+// the compiled file.
+//
+// WARNING: THE FIRST BLANK LINE MARKS THE END OF WHAT'S TO BE PROCESSED, ANY BLANK LINE SHOULD
+// GO AFTER THE REQUIRES BELOW.
+//
+//= 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,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,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,13 @@
+/*
+ * This is a manifest file that'll be compiled into application.css, which will include all the files
+ * listed below.
+ *
+ * Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
+ * or vendor/assets/stylesheets of plugins, if any, can be referenced here using a relative path.
+ *
+ * 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 .
+ */
@@ -0,0 +1,14 @@
+// Place all the styles related to the haikus controller here.
+// They will automatically be included in application.css.
+// You can use Sass (SCSS) here: http://sass-lang.com/
+.haiku {
+ p {
+ font-size: 18px;
+ margin-top: 20px;
+ margin-bottom: 5px;
+ }
+ em, em a {
+ color: #777;
+ font-style: normal;
+ }
+}
@@ -0,0 +1,84 @@
+html, 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: 80%;
+ margin: 0 auto;
+ background-color: #FFF;
+ padding: 20px 40px;
+ border: solid 1px black;
+ margin-top: 20px;
+}
+
+#flash_notice, #flash_error, #flash_alert {
+ padding: 5px 8px;
+ margin: 10px 0;
+ width: 450px;
+}
+
+#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;
+}
+
+.error_messages ul {
+ margin-bottom: 0;
+}
+
+form .field, form .actions {
+ margin: 8px 0;
+}
+
+#user_nav {
+ float: right;
+}
@@ -0,0 +1,3 @@
+// Place all the styles related to the sessions controller here.
+// They will automatically be included in application.css.
+// You can use Sass (SCSS) here: http://sass-lang.com/
@@ -0,0 +1,3 @@
+// Place all the styles related to the users controller here.
+// They will automatically be included in application.css.
+// You can use Sass (SCSS) here: http://sass-lang.com/
@@ -0,0 +1,14 @@
+class ApplicationController < ActionController::Base
+ protect_from_forgery
+
+private
+
+ def current_user
+ @current_user ||= User.find(session[:user_id]) if session[:user_id]
+ end
+ helper_method :current_user
+
+ def authorize
+ redirect_to login_url, alert: "You must first log in." if current_user.nil?
+ end
+end
@@ -0,0 +1,23 @@
+class HaikusController < ApplicationController
+ before_filter :authorize, except: [:index, :show]
+
+ def index
+ @haikus = Haiku.find_with_reputation(:votes, :all, order: "votes desc")
+ end
+
+ def show
+ @haiku = Haiku.find(params[:id])
+ end
+
+ def create
+ @haiku = current_user.haikus.create!(params[:haiku])
+ redirect_to @haiku, notice: "Successfully created haiku."
+ end
+
+ def vote
+ value = params[:type] == "up" ? 1 : -1
+ @haiku = Haiku.find(params[:id])
+ @haiku.add_or_update_evaluation(:votes, value, current_user)
+ redirect_to :back, notice: "Thank you for voting"
+ end
+end
Oops, something went wrong.

0 comments on commit 14108b6

Please sign in to comment.