Permalink
Browse files

V2 Complete Rewrite

  • Loading branch information...
0 parents commit 443a3c221a2afd910db716765d46b814c77bb4c6 andey committed Dec 20, 2012
Showing with 3,841 additions and 0 deletions.
  1. +10 −0 .gitignore
  2. +21 −0 Gemfile
  3. +141 −0 Gemfile.lock
  4. +3 −0 README.rdoc
  5. +7 −0 Rakefile
  6. BIN app/assets/images/glyphicons-halflings-white.png
  7. BIN app/assets/images/glyphicons-halflings.png
  8. +8 −0 app/assets/images/triangle_down.svg
  9. +8 −0 app/assets/images/triangle_up.svg
  10. +15 −0 app/assets/javascripts/application.js
  11. +6 −0 app/assets/javascripts/bootstrap.min.js
  12. +4 −0 app/assets/javascripts/layout.js.coffee
  13. +52 −0 app/assets/javascripts/submit.js.coffee
  14. +20 −0 app/assets/stylesheets/amas.css.sass
  15. +17 −0 app/assets/stylesheets/application.css
  16. +12 −0 app/assets/stylesheets/bootstrap.min.css
  17. +26 −0 app/assets/stylesheets/layout.css.sass
  18. +8 −0 app/assets/stylesheets/tags.css.sass
  19. +45 −0 app/controllers/admin/admins_controller.rb
  20. +86 −0 app/controllers/admin/amas_controller.rb
  21. +72 −0 app/controllers/admin/comments_controller.rb
  22. +82 −0 app/controllers/admin/entities_controller.rb
  23. +72 −0 app/controllers/admin/users_controller.rb
  24. +72 −0 app/controllers/amas_controller.rb
  25. +25 −0 app/controllers/api/amas_controller.rb
  26. +23 −0 app/controllers/api/entities_controller.rb
  27. +51 −0 app/controllers/application_controller.rb
  28. +12 −0 app/controllers/entities_controller.rb
  29. +13 −0 app/controllers/entity_controller.rb
  30. +3 −0 app/controllers/pages_controller.rb
  31. +21 −0 app/controllers/tags_controller.rb
  32. +38 −0 app/controllers/user_sessions_controller.rb
  33. +13 −0 app/controllers/users_controller.rb
  34. +2 −0 app/helpers/admin/admins_helper.rb
  35. +39 −0 app/helpers/amas_helper.rb
  36. +2 −0 app/helpers/api/amas_helper.rb
  37. +2 −0 app/helpers/api/entities_helper.rb
  38. +2 −0 app/helpers/application_helper.rb
  39. +2 −0 app/helpers/entities_helper.rb
  40. +5 −0 app/helpers/entity_helper.rb
  41. +18 −0 app/helpers/reddit_helper.rb
  42. +2 −0 app/helpers/tags_helper.rb
  43. +2 −0 app/helpers/user_sessions_helper.rb
  44. +2 −0 app/helpers/users_helper.rb
  45. 0 app/mailers/.gitkeep
  46. 0 app/models/.gitkeep
  47. +4 −0 app/models/admin.rb
  48. +6 −0 app/models/ama.rb
  49. +6 −0 app/models/comment.rb
  50. +12 −0 app/models/entity.rb
  51. +21 −0 app/models/user.rb
  52. +2 −0 app/models/user_session.rb
  53. +21 −0 app/views/admin/admins/_form.html.erb
  54. +32 −0 app/views/admin/admins/index.html.erb
  55. +26 −0 app/views/admin/admins/new.html.erb
  56. +53 −0 app/views/admin/amas/_form.html.erb
  57. +59 −0 app/views/admin/amas/edit.html.erb
  58. +29 −0 app/views/admin/amas/index.html.erb
  59. +5 −0 app/views/admin/amas/new.html.erb
  60. +57 −0 app/views/admin/amas/show.html.erb
  61. +45 −0 app/views/admin/comments/_form.html.erb
  62. +6 −0 app/views/admin/comments/edit.html.erb
  63. +34 −0 app/views/admin/comments/index.html.erb
  64. +5 −0 app/views/admin/comments/new.html.erb
  65. +40 −0 app/views/admin/comments/show.html.erb
  66. +29 −0 app/views/admin/entities/_form.html.erb
  67. +39 −0 app/views/admin/entities/edit.html.erb
  68. +40 −0 app/views/admin/entities/index.html.erb
  69. +5 −0 app/views/admin/entities/new.html.erb
  70. +46 −0 app/views/admin/entities/show.html.erb
  71. +37 −0 app/views/admin/users/_form.html.erb
  72. +6 −0 app/views/admin/users/edit.html.erb
  73. +33 −0 app/views/admin/users/index.html.erb
  74. +5 −0 app/views/admin/users/new.html.erb
  75. +30 −0 app/views/admin/users/show.html.erb
  76. +1 −0 app/views/amas/create.html.erb
  77. +80 −0 app/views/amas/new.html.erb
  78. +30 −0 app/views/amas/show.html.erb
  79. +21 −0 app/views/entities/show.html.erb
  80. +44 −0 app/views/entity/show.html.erb
  81. +39 −0 app/views/layouts/admin.html.erb
  82. +14 −0 app/views/layouts/application.html.erb
  83. +92 −0 app/views/layouts/public.html.erb
  84. +34 −0 app/views/pages/contact.html.erb
  85. +106 −0 app/views/pages/privacy.html.erb
  86. +137 −0 app/views/pages/terms.html.erb
  87. +62 −0 app/views/tags/index.html.erb
  88. +13 −0 app/views/tags/show.html.erb
  89. +64 −0 app/views/user_sessions/new.html.erb
  90. +36 −0 app/views/users/show.html.erb
  91. +4 −0 config.ru
  92. +18 −0 config/application.rb
  93. +6 −0 config/boot.rb
  94. +5 −0 config/environment.rb
  95. +18 −0 config/environments/development.rb
  96. +15 −0 config/environments/production.rb
  97. +37 −0 config/environments/test.rb
  98. +7 −0 config/initializers/backtrace_silencers.rb
  99. +1 −0 config/initializers/high_voltage.rb
  100. +15 −0 config/initializers/inflections.rb
  101. +5 −0 config/initializers/mime_types.rb
  102. +7 −0 config/initializers/secret_token.rb
  103. +8 −0 config/initializers/session_store.rb
  104. +14 −0 config/initializers/wrap_parameters.rb
  105. +5 −0 config/locales/en.yml
  106. +38 −0 config/routes.rb
  107. +13 −0 db/migrate/20121210195238_create_users.rb
  108. +8 −0 db/migrate/20121210195239_create_admins.rb
  109. +16 −0 db/migrate/20121210201523_create_amas.rb
  110. +14 −0 db/migrate/20121210201732_create_comments.rb
  111. +11 −0 db/migrate/20121211003944_create_entities.rb
  112. +8 −0 db/migrate/20121211004331_create_entities_users_join_table.rb
  113. +30 −0 db/migrate/20121212001850_acts_as_taggable_on_migration.rb
  114. +91 −0 db/schema.rb
  115. +4 −0 db/seeds.rb
  116. +2 −0 doc/README_FOR_APP
  117. +169 −0 lib/api/reddit.rb
  118. 0 lib/assets/.gitkeep
  119. +19 −0 lib/helper/slugs.rb
  120. +8 −0 lib/override/json.rb
  121. 0 lib/tasks/.gitkeep
  122. +12 −0 lib/tasks/find_new_amas.rake
  123. +8 −0 lib/tasks/populate_amas.rake
  124. 0 log/.gitkeep
  125. +26 −0 public/404.html
  126. +26 −0 public/422.html
  127. +25 −0 public/500.html
  128. 0 public/favicon.ico
  129. +5 −0 public/robots.txt
  130. +6 −0 script/rails
  131. 0 test/fixtures/.gitkeep
  132. +7 −0 test/fixtures/admin/admins.yml
  133. +11 −0 test/fixtures/admin/entities_users.yml
  134. +23 −0 test/fixtures/amas.yml
  135. +19 −0 test/fixtures/comments.yml
  136. +11 −0 test/fixtures/entities.yml
  137. +11 −0 test/fixtures/user_sessions.yml
  138. +15 −0 test/fixtures/users.yml
  139. 0 test/functional/.gitkeep
  140. +49 −0 test/functional/admin/admins_controller_test.rb
  141. +49 −0 test/functional/admin/entities_users_controller_test.rb
  142. +49 −0 test/functional/amas_controller_test.rb
  143. +7 −0 test/functional/api/amas_controller_test.rb
  144. +7 −0 test/functional/api/entities_controller_test.rb
  145. +49 −0 test/functional/comments_controller_test.rb
  146. +53 −0 test/functional/entities_controller_test.rb
  147. +7 −0 test/functional/protected/account_controller_test.rb
  148. +7 −0 test/functional/public/tags_controller_test.rb
  149. +7 −0 test/functional/user_session_controller_test.rb
  150. +7 −0 test/functional/user_sessions_controller_test.rb
  151. +49 −0 test/functional/users_controller_test.rb
  152. 0 test/integration/.gitkeep
  153. +12 −0 test/performance/browsing_test.rb
  154. +13 −0 test/test_helper.rb
  155. 0 test/unit/.gitkeep
  156. +7 −0 test/unit/admin/admin_test.rb
  157. +7 −0 test/unit/admin/entities_user_test.rb
  158. +7 −0 test/unit/ama_test.rb
  159. +7 −0 test/unit/comment_test.rb
  160. +7 −0 test/unit/entity_test.rb
  161. +4 −0 test/unit/helpers/admin/admins_helper_test.rb
  162. +4 −0 test/unit/helpers/admin/entities_users_helper_test.rb
  163. +4 −0 test/unit/helpers/amas_helper_test.rb
  164. +4 −0 test/unit/helpers/api/amas_helper_test.rb
  165. +4 −0 test/unit/helpers/api/entities_helper_test.rb
  166. +4 −0 test/unit/helpers/comments_helper_test.rb
  167. +4 −0 test/unit/helpers/entities_helper_test.rb
  168. +4 −0 test/unit/helpers/entity_helper_test.rb
  169. +4 −0 test/unit/helpers/protected/account_helper_test.rb
  170. +4 −0 test/unit/helpers/public/tags_helper_test.rb
  171. +4 −0 test/unit/helpers/tags_helper_test.rb
  172. +4 −0 test/unit/helpers/user_session_helper_test.rb
  173. +4 −0 test/unit/helpers/user_sessions_helper_test.rb
  174. +4 −0 test/unit/helpers/users_helper_test.rb
  175. +7 −0 test/unit/user_session_test.rb
  176. +7 −0 test/unit/user_test.rb
  177. 0 vendor/assets/javascripts/.gitkeep
  178. 0 vendor/assets/stylesheets/.gitkeep
  179. 0 vendor/plugins/.gitkeep
@@ -0,0 +1,10 @@
+#Rails
+/config/database.yml
+/.bundle
+/db/backup
+/db/*.sqlite3
+/log/*.log
+/tmp
+
+#Rubymine IDE
+/.idea
21 Gemfile
@@ -0,0 +1,21 @@
+source 'https://rubygems.org'
+
+gem 'rails', '3.2.9'
+gem 'pg'
+gem 'sqlite3'
+gem 'thin'
+gem 'jquery-rails'
+gem 'authlogic'
+gem 'will_paginate'
+gem 'bootstrap-will_paginate'
+gem 'wikipedia-client'
+gem 'high_voltage'
+gem 'acts-as-taggable-on'
+gem 'htmlentities'
+gem 'awesome_print'
+
+group :assets do
+ gem 'sass-rails', '~> 3.2.3'
+ gem 'coffee-rails', '~> 3.2.1'
+ gem 'uglifier', '>= 1.0.3'
+end
@@ -0,0 +1,141 @@
+GEM
+ remote: https://rubygems.org/
+ specs:
+ actionmailer (3.2.9)
+ actionpack (= 3.2.9)
+ mail (~> 2.4.4)
+ actionpack (3.2.9)
+ activemodel (= 3.2.9)
+ activesupport (= 3.2.9)
+ builder (~> 3.0.0)
+ erubis (~> 2.7.0)
+ journey (~> 1.0.4)
+ rack (~> 1.4.0)
+ rack-cache (~> 1.2)
+ rack-test (~> 0.6.1)
+ sprockets (~> 2.2.1)
+ activemodel (3.2.9)
+ activesupport (= 3.2.9)
+ builder (~> 3.0.0)
+ activerecord (3.2.9)
+ activemodel (= 3.2.9)
+ activesupport (= 3.2.9)
+ arel (~> 3.0.2)
+ tzinfo (~> 0.3.29)
+ activeresource (3.2.9)
+ activemodel (= 3.2.9)
+ activesupport (= 3.2.9)
+ activesupport (3.2.9)
+ i18n (~> 0.6)
+ multi_json (~> 1.0)
+ acts-as-taggable-on (2.3.3)
+ rails (~> 3.0)
+ arel (3.0.2)
+ authlogic (3.2.0)
+ activerecord (>= 3.0.0)
+ activesupport (>= 3.0.0)
+ awesome_print (1.1.0)
+ bootstrap-will_paginate (0.0.9)
+ will_paginate
+ builder (3.0.4)
+ 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.4.0)
+ daemons (1.1.9)
+ erubis (2.7.0)
+ eventmachine (1.0.0)
+ execjs (1.4.0)
+ multi_json (~> 1.0)
+ high_voltage (1.2.1)
+ hike (1.2.1)
+ htmlentities (4.3.1)
+ i18n (0.6.1)
+ journey (1.0.4)
+ jquery-rails (2.1.4)
+ railties (>= 3.0, < 5.0)
+ thor (>= 0.14, < 2.0)
+ json (1.7.5)
+ mail (2.4.4)
+ i18n (>= 0.4.0)
+ mime-types (~> 1.16)
+ treetop (~> 1.4.8)
+ mime-types (1.19)
+ multi_json (1.5.0)
+ pg (0.14.1)
+ 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.2)
+ rack (>= 1.0)
+ rails (3.2.9)
+ actionmailer (= 3.2.9)
+ actionpack (= 3.2.9)
+ activerecord (= 3.2.9)
+ activeresource (= 3.2.9)
+ activesupport (= 3.2.9)
+ bundler (~> 1.0)
+ railties (= 3.2.9)
+ railties (3.2.9)
+ actionpack (= 3.2.9)
+ activesupport (= 3.2.9)
+ rack-ssl (~> 1.3.2)
+ rake (>= 0.8.7)
+ rdoc (~> 3.4)
+ thor (>= 0.14.6, < 2.0)
+ rake (10.0.2)
+ rdoc (3.12)
+ json (~> 1.4)
+ sass (3.2.3)
+ sass-rails (3.2.5)
+ railties (~> 3.2.0)
+ sass (>= 3.1.10)
+ tilt (~> 1.3)
+ sprockets (2.2.2)
+ hike (~> 1.2)
+ multi_json (~> 1.0)
+ rack (~> 1.0)
+ tilt (~> 1.1, != 1.3.0)
+ sqlite3 (1.3.6)
+ thin (1.5.0)
+ daemons (>= 1.0.9)
+ eventmachine (>= 0.12.6)
+ rack (>= 1.0.0)
+ thor (0.16.0)
+ tilt (1.3.3)
+ treetop (1.4.12)
+ polyglot
+ polyglot (>= 0.3.1)
+ tzinfo (0.3.35)
+ uglifier (1.3.0)
+ execjs (>= 0.3.0)
+ multi_json (~> 1.0, >= 1.0.2)
+ wikipedia-client (1.0.0)
+ will_paginate (3.0.3)
+
+PLATFORMS
+ ruby
+
+DEPENDENCIES
+ acts-as-taggable-on
+ authlogic
+ awesome_print
+ bootstrap-will_paginate
+ coffee-rails (~> 3.2.1)
+ high_voltage
+ htmlentities
+ jquery-rails
+ pg
+ rails (= 3.2.9)
+ sass-rails (~> 3.2.3)
+ sqlite3
+ thin
+ uglifier (>= 1.0.3)
+ wikipedia-client
+ will_paginate
@@ -0,0 +1,3 @@
+== BestofAMA Source
+
+BestofAMA.com is a directory and archive of popular reddit.com "Ask me Anythings"
@@ -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__)
+
+Bestofama::Application.load_tasks
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@@ -0,0 +1,8 @@
+<?xml version="1.0" standalone="yes"?>
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN"
+ "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+ <svg width="35px" height="35px" viewBox="0 0 200 200"
+ xmlns="http://www.w3.org/2000/svg" version="1.1">
+ <polygon style="fill:none;stroke:#000000;stroke-width:2.5px"
+ points="183.138438763306,172 16.8615612366939,172 100,28" transform="translate(0,200) scale(1,-1)" />
+</svg>
@@ -0,0 +1,8 @@
+<?xml version="1.0" standalone="yes"?>
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN"
+ "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+ <svg width="35px" height="35px" viewBox="0 0 200 200"
+ xmlns="http://www.w3.org/2000/svg" version="1.1">
+ <polygon style="fill:grey;stroke:#000000;stroke-width:2.5px"
+ points="183.138438763306,172 16.8615612366939,172 100,28" />
+</svg>
@@ -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 .

Large diffs are not rendered by default.

Oops, something went wrong.
@@ -0,0 +1,4 @@
+jQuery ->
+ $("#li-navbar-search-button a").click ->
+ $("#li-navbar-search-button").addClass("hidden")
+ $("#li-navbar-search-form").removeClass("hidden")
@@ -0,0 +1,52 @@
+find_entity_by_wiki_slug = (url) ->
+ matches = url.match("http://en.wikipedia.org/wiki/(.*)")
+ if matches?
+ return $.getJSON("/api/entities/find_by_wiki_slug.json?q=" + matches[1])
+ ;
+ else
+ return false
+
+find_ama_by_key = (url) ->
+ matches = url.match('/IAmA/comments/([a-z0-9]{5,6})/')
+ if matches?
+ return $.getJSON("/api/ama/find_by_key.json?key=" + matches[1])
+ ;
+ else
+ return false
+
+jQuery ->
+ $("#submit_ama_url_input").change ->
+ data = find_ama_by_key $("#submit_ama_url_input").val()
+ if data == false
+ $("#submit_ama_url").removeClass("success")
+ $("#submit_ama_url").addClass("error")
+ $("#submit_ama_url .help-inline").html('<i class="icon-remove"></i> Invalid URL')
+ else
+ data.done (response) ->
+ if response["result"] == false
+ $("#submit_ama_url").removeClass("error")
+ $("#submit_ama_url").addClass("success")
+ $("#submit_ama_url .help-inline").html('<i class="icon-ok-sign"></i>')
+ else
+ $("#submit_ama_url").removeClass("success")
+ $("#submit_ama_url").addClass("error")
+ $("#submit_ama_url .help-inline").html('<i class="icon-remove"></i> AMA already in database')
+
+ $("#submit_wiki_url_input").change ->
+ data = find_entity_by_wiki_slug $("#submit_wiki_url_input").val()
+ if data == false
+ $("#submit_wiki_url").removeClass("success")
+ $("#submit_wiki_url").addClass("error")
+ $("#submit_wiki_url .help-inline").html('<i class="icon-remove"></i> Invalid URL')
+ else
+ data.done (response) ->
+ if response["result"] == false
+ $("#submit_wiki_url").removeClass("error")
+ $("#submit_wiki_url").addClass("success")
+ $("#submit_wiki_url .help-inline").html('<i class="icon-ok-sign"></i> Entity not found, please enter in details')
+ $("#submit_step3").removeClass("hidden")
+ else
+ $("#submit_wiki_url").removeClass("error")
+ $("#submit_wiki_url").addClass("success")
+ $("#submit_wiki_url .help-inline").html('<i class="icon-ok-sign"></i> Match Found.')
+
@@ -0,0 +1,20 @@
+.ama-karma-meter-large
+ font-size: 20px
+ padding-top: 15px
+ text-align: center
+
+.ama-karma-meter-small
+ font-size: 15px
+ text-align: center
+ img
+ width: 20px
+
+.label-info
+ a:link
+ color: white
+ a:visited
+ color: white
+ a:hover
+ color: white
+ a:active
+ color: white
@@ -0,0 +1,17 @@
+/*
+ * 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 .
+ */
+
+.hidden {
+ display: none;
+}

Large diffs are not rendered by default.

Oops, something went wrong.
@@ -0,0 +1,26 @@
+html, body
+ margin: 0
+ padding: 0
+ height: 100%
+
+#wrapper
+ min-height: 100%
+ position: relative
+
+#content
+ padding-top: 60px
+ padding-bottom: 175px
+
+#footer
+ width: 100%
+ height: 100px
+ position: absolute
+ bottom: 0
+ left: 0
+
+footer
+ margin-top: 10px
+
+#current_user_username
+ font-weight: bold
+ color: white
@@ -0,0 +1,8 @@
+#tag_cloud
+ line-height: 1.6em
+ .s
+ font-size: 0.8em
+ .m
+ font-size: 1.2em
+ .l
+ font-size: 1.8em
Oops, something went wrong.

0 comments on commit 443a3c2

Please sign in to comment.