answers-core 0.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (293) hide show
  1. checksums.yaml +7 -0
  2. data/Rakefile +6 -0
  3. data/answers-core.gemspec +30 -0
  4. data/app/assets/fonts/answers/League_Gothic-webfont.eot +0 -0
  5. data/app/assets/fonts/answers/League_Gothic-webfont.svg +230 -0
  6. data/app/assets/fonts/answers/League_Gothic-webfont.ttf +0 -0
  7. data/app/assets/fonts/answers/League_Gothic-webfont.woff +0 -0
  8. data/app/assets/images/OaklandCityTree.png +0 -0
  9. data/app/assets/images/background_image.jpg +0 -0
  10. data/app/assets/images/background_pattern.png +0 -0
  11. data/app/assets/images/beta.png +0 -0
  12. data/app/assets/images/bg_transparent.png +0 -0
  13. data/app/assets/images/border.png +0 -0
  14. data/app/assets/images/brigade.png +0 -0
  15. data/app/assets/images/cfa.png +0 -0
  16. data/app/assets/images/cfa_logo.png +0 -0
  17. data/app/assets/images/cfa_logo_footer.png +0 -0
  18. data/app/assets/images/favicon.ico +0 -0
  19. data/app/assets/images/forest.jpeg +0 -0
  20. data/app/assets/images/getting_started_btn.png +0 -0
  21. data/app/assets/images/govuk.png +0 -0
  22. data/app/assets/images/openoaklandlogo.png +0 -0
  23. data/app/assets/images/quick_answers_icon.png +0 -0
  24. data/app/assets/images/quick_answers_icon_small.png +0 -0
  25. data/app/assets/images/searchIcon.png +0 -0
  26. data/app/assets/images/wmd-buttons.png +0 -0
  27. data/app/assets/images/yellow_bg.png +0 -0
  28. data/app/assets/javascripts/answers.js +19 -0
  29. data/app/assets/javascripts/answers/Markdown.Extra.js +304 -0
  30. data/app/assets/javascripts/answers/active_admin.js +62 -0
  31. data/app/assets/javascripts/answers/pagedown/LICENSE.txt +32 -0
  32. data/app/assets/javascripts/answers/pagedown/Markdown.Converter.js +1332 -0
  33. data/app/assets/javascripts/answers/pagedown/Markdown.Editor.js +2212 -0
  34. data/app/assets/javascripts/answers/pagedown/Markdown.Sanitizer.js +108 -0
  35. data/app/assets/javascripts/answers/pagedown/README.txt +0 -0
  36. data/app/assets/javascripts/answers/pagedown/demo/browser/demo.css +120 -0
  37. data/app/assets/javascripts/answers/pagedown/demo/browser/demo.html +83 -0
  38. data/app/assets/javascripts/answers/pagedown/demo/node/demo.js +44 -0
  39. data/app/assets/javascripts/answers/pagedown/local/Markdown.local.fr.js +43 -0
  40. data/app/assets/javascripts/answers/pagedown/node-pagedown.js +2 -0
  41. data/app/assets/javascripts/answers/pagedown/package.json +12 -0
  42. data/app/assets/javascripts/answers/pagedown/resources/wmd-buttons.psd +0 -0
  43. data/app/assets/javascripts/answers/pagedown/wmd-buttons.png +0 -0
  44. data/app/assets/javascripts/answers/skip_nav.js +8 -0
  45. data/app/assets/stylesheets/answers/active_admin.css.scss +17 -0
  46. data/app/assets/stylesheets/answers/active_admin_custom.css.scss +35 -0
  47. data/app/assets/stylesheets/answers/formatting.css +82 -0
  48. data/app/assets/stylesheets/answers/mobile.css +149 -0
  49. data/app/assets/stylesheets/answers/tags.css.scss +3 -0
  50. data/app/assets/stylesheets/answers/theme.css +916 -0
  51. data/app/controllers/answers/answers_controller.rb +26 -0
  52. data/app/controllers/answers/api/v1/answers_controller.rb +38 -0
  53. data/app/controllers/answers/api/v1/api_controller.rb +13 -0
  54. data/app/controllers/answers/api/v1/questions_controller.rb +39 -0
  55. data/app/controllers/answers/api/v1/taggings_controller.rb +46 -0
  56. data/app/controllers/answers/api/v1/tags_controller.rb +38 -0
  57. data/app/controllers/answers/application_controller.rb +27 -0
  58. data/app/controllers/answers/home_controller.rb +17 -0
  59. data/app/controllers/answers/questions_controller.rb +33 -0
  60. data/app/controllers/answers/search_controller.rb +22 -0
  61. data/app/controllers/answers/tags_controller.rb +36 -0
  62. data/app/helpers/answers/tags_helper.rb +7 -0
  63. data/app/models/.gitkeep +0 -0
  64. data/app/models/answers/ability.rb +28 -0
  65. data/app/models/answers/administrator.rb +5 -0
  66. data/app/models/answers/answer.rb +6 -0
  67. data/app/models/answers/api/v1/api_user.rb +5 -0
  68. data/app/models/answers/question.rb +31 -0
  69. data/app/models/answers/user.rb +30 -0
  70. data/app/views/answers/admin/contacts/_article.html.erb +0 -0
  71. data/app/views/answers/admin/dashboard/_dashboard.html.erb +5 -0
  72. data/app/views/answers/admin/guide_steps/_form.html.erb +17 -0
  73. data/app/views/answers/api/v1/answers/_answer.json.jbuilder +2 -0
  74. data/app/views/answers/api/v1/answers/index.json.jbuilder +1 -0
  75. data/app/views/answers/api/v1/answers/show.json.jbuilder +1 -0
  76. data/app/views/answers/api/v1/questions/_question.json.jbuilder +2 -0
  77. data/app/views/answers/api/v1/questions/index.json.jbuilder +1 -0
  78. data/app/views/answers/api/v1/questions/show.json.jbuilder +1 -0
  79. data/app/views/answers/api/v1/taggings/_tagging.json.jbuilder +3 -0
  80. data/app/views/answers/api/v1/taggings/index.json.jbuilder +1 -0
  81. data/app/views/answers/api/v1/taggings/show.json.jbuilder +1 -0
  82. data/app/views/answers/api/v1/tags/_tag.json.jbuilder +2 -0
  83. data/app/views/answers/api/v1/tags/index.json.jbuilder +1 -0
  84. data/app/views/answers/api/v1/tags/show.json.jbuilder +1 -0
  85. data/app/views/answers/devise/confirmations/new.html.erb +12 -0
  86. data/app/views/answers/devise/mailer/confirmation_instructions.html.erb +5 -0
  87. data/app/views/answers/devise/mailer/reset_password_instructions.html.erb +8 -0
  88. data/app/views/answers/devise/mailer/unlock_instructions.html.erb +7 -0
  89. data/app/views/answers/devise/passwords/edit.html.erb +24 -0
  90. data/app/views/answers/devise/passwords/new.html.erb +20 -0
  91. data/app/views/answers/devise/registrations/edit.html.erb +25 -0
  92. data/app/views/answers/devise/registrations/new.html.erb +18 -0
  93. data/app/views/answers/devise/sessions/new.html.erb +25 -0
  94. data/app/views/answers/devise/shared/_links.erb +25 -0
  95. data/app/views/answers/devise/unlocks/new.html.erb +12 -0
  96. data/app/views/answers/home/_article.html.erb +3 -0
  97. data/app/views/answers/home/_category.html.erb +8 -0
  98. data/app/views/answers/home/about.html.erb +72 -0
  99. data/app/views/answers/home/index.html.erb +44 -0
  100. data/app/views/answers/questions/index.html.erb +21 -0
  101. data/app/views/answers/questions/show.html.erb +31 -0
  102. data/app/views/answers/search/index.html.erb +32 -0
  103. data/app/views/answers/shared/_articles_sidebar.html.erb +22 -0
  104. data/app/views/answers/shared/_autocomplete.html.erb +8 -0
  105. data/app/views/answers/shared/_categories_sidebar.html.erb +12 -0
  106. data/app/views/answers/shared/_search_form.html.erb +4 -0
  107. data/app/views/answers/shared/admin/_administration.html.erb +38 -0
  108. data/app/views/answers/shared/admin/_article_actions.html.erb +86 -0
  109. data/app/views/answers/shared/admin/_article_content.html.erb +27 -0
  110. data/app/views/answers/shared/admin/_article_details.html.erb +11 -0
  111. data/app/views/answers/shared/admin/_article_form.html.erb +20 -0
  112. data/app/views/answers/shared/admin/_author_pic.html.erb +0 -0
  113. data/app/views/answers/tags/index.html.erb +34 -0
  114. data/app/views/answers/tags/show.html.erb +31 -0
  115. data/app/views/layouts/answers/application.html.erb +97 -0
  116. data/config.ru +5 -0
  117. data/config/initializers/active_admin.rb +245 -0
  118. data/config/initializers/devise.rb +228 -0
  119. data/config/locales/devise.en.yml +57 -0
  120. data/config/locales/en.yml +129 -0
  121. data/config/routes.rb +22 -0
  122. data/config/secrets.yml +68 -0
  123. data/db/migrate/20140911060606_answers_up.rb +79 -0
  124. data/lib/answers-core.rb +1 -0
  125. data/lib/answers.rb +175 -0
  126. data/lib/answers/admin/answer.rb +29 -0
  127. data/lib/answers/admin/dashboard.rb +75 -0
  128. data/lib/answers/admin/question.rb +57 -0
  129. data/lib/answers/admin/tag.rb +12 -0
  130. data/lib/answers/admin/users.rb +65 -0
  131. data/lib/answers/core.rb +25 -0
  132. data/lib/answers/core/configuration.rb +90 -0
  133. data/lib/answers/core/engine.rb +116 -0
  134. data/lib/answers/engine.rb +62 -0
  135. data/lib/answers/errors.rb +13 -0
  136. data/lib/answers/plugin.rb +75 -0
  137. data/lib/answers/plugins.rb +73 -0
  138. data/lib/answers/version.rb +16 -0
  139. data/lib/api_client.rb +20 -0
  140. data/lib/assets/.gitkeep +0 -0
  141. data/lib/assets/eng_stop.csv +1 -0
  142. data/lib/generators/answers/clash_keywords.yml +3 -0
  143. data/lib/generators/answers/cms/cms_generator.rb +314 -0
  144. data/lib/generators/answers/cms/templates/.gitignore +91 -0
  145. data/lib/generators/answers/cms/templates/app/decorators/controllers/answers/.keep +0 -0
  146. data/lib/generators/answers/cms/templates/app/decorators/models/answers/.keep +0 -0
  147. data/lib/generators/answers/cms/templates/app/views/sitemap/index.xml.builder +15 -0
  148. data/lib/generators/answers/cms/templates/config/database.yml.mysql +20 -0
  149. data/lib/generators/answers/cms/templates/config/database.yml.postgresql +58 -0
  150. data/lib/generators/answers/cms/templates/config/database.yml.sqlite3 +18 -0
  151. data/lib/generators/answers/core/core_generator.rb +10 -0
  152. data/lib/generators/answers/core/templates/config/initializers/answers/core.rb.erb +35 -0
  153. data/lib/generators/answers/dummy/dummy_generator.rb +86 -0
  154. data/lib/generators/answers/dummy/templates/rails/Rakefile +7 -0
  155. data/lib/generators/answers/dummy/templates/rails/application.js +3 -0
  156. data/lib/generators/answers/dummy/templates/rails/application.rb.erb +12 -0
  157. data/lib/generators/answers/dummy/templates/rails/boot.rb.erb +6 -0
  158. data/lib/generators/answers/dummy/templates/rails/database.yml +34 -0
  159. data/lib/generators/answers/dummy/templates/rails/routes.rb +3 -0
  160. data/lib/generators/answers/engine/USAGE +24 -0
  161. data/lib/generators/answers/engine/engine_generator.rb +44 -0
  162. data/lib/generators/answers/engine/templates/.gitignore +2 -0
  163. data/lib/generators/answers/engine/templates/Gemfile +42 -0
  164. data/lib/generators/answers/engine/templates/Rakefile +19 -0
  165. data/lib/generators/answers/engine/templates/answers-extension_plural_name.gemspec +19 -0
  166. data/lib/generators/answers/engine/templates/app/controllers/answers/namespace/admin/plural_name_controller.rb.erb +14 -0
  167. data/lib/generators/answers/engine/templates/app/controllers/answers/namespace/plural_name_controller.rb.erb +34 -0
  168. data/lib/generators/answers/engine/templates/app/models/answers/namespace/singular_name.rb.erb +37 -0
  169. data/lib/generators/answers/engine/templates/app/views/answers/namespace/admin/plural_name/_actions.html.erb +25 -0
  170. data/lib/generators/answers/engine/templates/app/views/answers/namespace/admin/plural_name/_form.html.erb +65 -0
  171. data/lib/generators/answers/engine/templates/app/views/answers/namespace/admin/plural_name/_plural_name.html.erb +2 -0
  172. data/lib/generators/answers/engine/templates/app/views/answers/namespace/admin/plural_name/_records.html.erb +16 -0
  173. data/lib/generators/answers/engine/templates/app/views/answers/namespace/admin/plural_name/_singular_name.html.erb +33 -0
  174. data/lib/generators/answers/engine/templates/app/views/answers/namespace/admin/plural_name/_sortable_list.html.erb +5 -0
  175. data/lib/generators/answers/engine/templates/app/views/answers/namespace/admin/plural_name/edit.html.erb +1 -0
  176. data/lib/generators/answers/engine/templates/app/views/answers/namespace/admin/plural_name/index.html.erb +7 -0
  177. data/lib/generators/answers/engine/templates/app/views/answers/namespace/admin/plural_name/new.html.erb +1 -0
  178. data/lib/generators/answers/engine/templates/app/views/answers/namespace/plural_name/index.html.erb +11 -0
  179. data/lib/generators/answers/engine/templates/app/views/answers/namespace/plural_name/show.html.erb +39 -0
  180. data/lib/generators/answers/engine/templates/config/locales/cs.yml +28 -0
  181. data/lib/generators/answers/engine/templates/config/locales/en.yml +28 -0
  182. data/lib/generators/answers/engine/templates/config/locales/es.yml +29 -0
  183. data/lib/generators/answers/engine/templates/config/locales/fr.yml +28 -0
  184. data/lib/generators/answers/engine/templates/config/locales/it.yml +28 -0
  185. data/lib/generators/answers/engine/templates/config/locales/nb.yml +28 -0
  186. data/lib/generators/answers/engine/templates/config/locales/nl.yml +28 -0
  187. data/lib/generators/answers/engine/templates/config/locales/sk.yml +28 -0
  188. data/lib/generators/answers/engine/templates/config/locales/tr.yml +28 -0
  189. data/lib/generators/answers/engine/templates/config/locales/zh-CN.yml +30 -0
  190. data/lib/generators/answers/engine/templates/config/routes.rb.erb +19 -0
  191. data/lib/generators/answers/engine/templates/db/migrate/1_create_namespace_plural_name.rb.erb +39 -0
  192. data/lib/generators/answers/engine/templates/db/seeds.rb.erb +21 -0
  193. data/lib/generators/answers/engine/templates/lib/answers-extension_plural_name.rb.erb +1 -0
  194. data/lib/generators/answers/engine/templates/lib/answers/plural_name.rb.erb +21 -0
  195. data/lib/generators/answers/engine/templates/lib/answers/plural_name/engine.rb.erb +23 -0
  196. data/lib/generators/answers/engine/templates/lib/generators/answers/extension_plural_name_generator.rb.erb +19 -0
  197. data/lib/generators/answers/engine/templates/lib/tasks/answers/extension_plural_name.rake +13 -0
  198. data/lib/generators/answers/engine/templates/readme.md +10 -0
  199. data/lib/generators/answers/engine/templates/script/rails +10 -0
  200. data/lib/generators/answers/engine/templates/spec/features/answers/namespace/admin/plural_name_spec.rb.erb +200 -0
  201. data/lib/generators/answers/engine/templates/spec/models/answers/namespace/singular_name_spec.rb.erb +20 -0
  202. data/lib/generators/answers/engine/templates/spec/spec_helper.rb +31 -0
  203. data/lib/generators/answers/engine/templates/spec/support/factories/answers/plural_name.rb.erb +7 -0
  204. data/lib/generators/answers/engine/templates/tasks/rspec.rake +6 -0
  205. data/lib/generators/answers/engine/templates/tasks/testing.rake +8 -0
  206. data/lib/generators/answers/generator.rb +292 -0
  207. data/lib/markdownifier.rb +11 -0
  208. data/log/.gitkeep +0 -0
  209. data/log/development.log +12870 -0
  210. data/log/newrelic_agent.log +1339 -0
  211. data/log/test.log +233181 -0
  212. data/public/404.html +25 -0
  213. data/public/422.html +25 -0
  214. data/public/500.html +24 -0
  215. data/public/favicon.ico +0 -0
  216. data/public/robots.txt +5 -0
  217. data/script/delayed_job +5 -0
  218. data/spec/controllers/answers_controller_spec.rb +55 -0
  219. data/spec/controllers/api/v1/answers_controller_spec.rb +144 -0
  220. data/spec/controllers/api/v1/questions_controller_spec.rb +144 -0
  221. data/spec/controllers/api/v1/taggings_controller_spec.rb +126 -0
  222. data/spec/controllers/api/v1/tags_controller_spec.rb +126 -0
  223. data/spec/controllers/home_controller_spec.rb +60 -0
  224. data/spec/controllers/questions_controller_spec.rb +55 -0
  225. data/spec/controllers/tags_controller_spec.rb +42 -0
  226. data/spec/factories/answers.rb +10 -0
  227. data/spec/factories/questions.rb +8 -0
  228. data/spec/factories/tags.rb +8 -0
  229. data/spec/factories/user.rb +32 -0
  230. data/spec/features/admin_dashboard_spec.rb +53 -0
  231. data/spec/features/admin_user_spec.rb +61 -0
  232. data/spec/features/searches_spec.rb +101 -0
  233. data/spec/fixtures/Article/_before_validation/sets_access_count_if_nil.yml +223 -0
  234. data/spec/fixtures/Article/_delete_orphaned_keywords/updating_an_article/destroys_orphaned_keywords_associated.yml +223 -0
  235. data/spec/fixtures/Article/_delete_orphaned_keywords/when_deleting_an_article/destroys_all_keywords_associated.yml +223 -0
  236. data/spec/fixtures/Article/_find_by_friendly_id/when_an_article_does_not_exist/does_not_raise_an_exception.yml +223 -0
  237. data/spec/fixtures/Article/_find_by_friendly_id/when_an_article_exists/returns_the_corresponding_article.yml +223 -0
  238. data/spec/fixtures/Article/_find_by_type/excludes_articles_not_matching_specified_type.yml +223 -0
  239. data/spec/fixtures/Article/_find_by_type/returns_articles_matching_type.yml +223 -0
  240. data/spec/fixtures/Article/_hits/before_an_article_has_been_viewed/has_zero_hits.yml +223 -0
  241. data/spec/fixtures/Article/_hits/returns_number_of_views/has_seven_views.yml +223 -0
  242. data/spec/fixtures/Article/_indexable_/returns_false_if_article_is_not_published.yml +223 -0
  243. data/spec/fixtures/Article/_indexable_/returns_true_if_article_is_published.yml +223 -0
  244. data/spec/fixtures/Article/_legacy_/returns_true_if_render_markdown_is_false.yml +223 -0
  245. data/spec/fixtures/Article/_qm_after_create/creates_wordcounts_for_relevant_keywords.yml +223 -0
  246. data/spec/fixtures/Article/_record_hit/viewing_an_article/increases_hit_by_one.yml +223 -0
  247. data/spec/fixtures/Article/_related/has_no_related_articles/.yml +223 -0
  248. data/spec/fixtures/Article/_related/has_related_articles/.yml +223 -0
  249. data/spec/fixtures/Article/_remove_stop_words/removes_common_english_words_from_the_string.yml +223 -0
  250. data/spec/fixtures/Article/_search/_search_titles/query_is_present_in_the_title/.yml +223 -0
  251. data/spec/fixtures/Article/_search/_search_titles/returns_an_empty_array_when_the_search_term_is_present_in_an_article_but_not_the_title.yml +223 -0
  252. data/spec/fixtures/Article/_search/matches_articles_in_the_database.yml +223 -0
  253. data/spec/fixtures/Article/_search/query_does_not_match_anything_in_the_database/returns_an_empty_array.yml +223 -0
  254. data/spec/fixtures/Article/_search/query_is_a_single_space/.yml +223 -0
  255. data/spec/fixtures/Article/_search/query_is_an_empty_string/.yml +223 -0
  256. data/spec/fixtures/Article/_to_s/when_an_article_has_a_category/returns_a_string_containing_title_id_and_category.yml +223 -0
  257. data/spec/fixtures/Article/can_be_published/an_unpublished_article/is_published.yml +223 -0
  258. data/spec/fixtures/Article/can_be_published/an_unpublished_article/returns_status_Published.yml +223 -0
  259. data/spec/fixtures/Article/has_a_friendly_url.yml +223 -0
  260. data/spec/fixtures/Article/is_valid_with_a_title.yml +223 -0
  261. data/spec/fixtures/Searches/search_results/1_result_found/.yml +22047 -0
  262. data/spec/fixtures/Searches/search_results/no_results_found/.yml +393 -0
  263. data/spec/fixtures/Searches/search_results/several_results_found/should_contain_the_title_and_preview_of_both_articles.yml +223 -0
  264. data/spec/fixtures/Searches/search_results/several_results_found/show_the_query.yml +277 -0
  265. data/spec/fixtures/articles.yml +428 -0
  266. data/spec/fixtures/categories.yml +17 -0
  267. data/spec/fixtures/contacts.yml +11 -0
  268. data/spec/fixtures/dragon_keyword_cassette.yml +77 -0
  269. data/spec/fixtures/oakland_answers.yml +2379 -0
  270. data/spec/helpers/tags_helper_spec.rb +15 -0
  271. data/spec/lib/markdownifier_spec.rb +12 -0
  272. data/spec/models/ability_spec.rb +36 -0
  273. data/spec/models/answer_spec.rb +5 -0
  274. data/spec/models/question_spec.rb +70 -0
  275. data/spec/models/user_spec.rb +55 -0
  276. data/spec/routing/answers_routing_spec.rb +19 -0
  277. data/spec/routing/questions_routing_spec.rb +19 -0
  278. data/spec/routing/routes_spec.rb +13 -0
  279. data/spec/security/brakeman_spec.rb +37 -0
  280. data/spec/spec_helper.rb +61 -0
  281. data/spec/support/login_helpers.rb +10 -0
  282. data/spec/support/wait_for_ajax_helper.rb +7 -0
  283. data/spec/support/wait_for_dom_helper.rb +12 -0
  284. data/spec/views/questions/index.html.erb_spec.rb +16 -0
  285. data/spec/views/questions/show.html.erb_spec.rb +14 -0
  286. data/spec/views/tags/index.html.erb_spec.rb +5 -0
  287. data/spec/views/tags/show.html.erb_spec.rb +5 -0
  288. data/vendor/assets/javascripts/.gitkeep +0 -0
  289. data/vendor/assets/stylesheets/.gitkeep +0 -0
  290. data/vendor/assets/stylesheets/bootstrap.css +3990 -0
  291. data/vendor/crudgen/lib/generators/crudgen/install_generator.rb +23 -0
  292. data/vendor/plugins/.gitkeep +0 -0
  293. metadata +484 -0
data/config.ru ADDED
@@ -0,0 +1,5 @@
1
+ # This file is used by Rack-based servers to start the application.
2
+
3
+ require ::File.expand_path('../config/environment', __FILE__)
4
+ use Rack::Deflater
5
+ run Rails.application
@@ -0,0 +1,245 @@
1
+ ActiveAdmin.setup do |config|
2
+
3
+ # == Site Title
4
+ #
5
+ # Set the title that is displayed on the main layout
6
+ # for each of the active admin pages.
7
+ #
8
+ config.site_title = "#{ENV["OFFICIAL_CITY_NAME"]} Answers CMS"
9
+
10
+ # Set the link url for the title. For example, to take
11
+ # users to your main site. Defaults to no link.
12
+ #
13
+ config.site_title_link = "/admin"
14
+
15
+ # Set an optional image to be displayed for the header
16
+ # instead of a string (overrides :site_title)
17
+ #
18
+ # Note: Aim for an image that's 21px high so it fits in the header.
19
+ #
20
+ # config.site_title_image = "logo.png"
21
+
22
+ # == Default Namespace
23
+ #
24
+ # Set the default namespace each administration resource
25
+ # will be added to.
26
+ #
27
+ # eg:
28
+ # config.default_namespace = :hello_world
29
+ #
30
+ # This will create resources in the HelloWorld module and
31
+ # will namespace routes to /hello_world/*
32
+ #
33
+ # To set no namespace by default, use:
34
+ # config.default_namespace = false
35
+ #
36
+ # Default:
37
+ # config.default_namespace = :admin
38
+ #
39
+ # You can customize the settings for each namespace by using
40
+ # a namespace block. For example, to change the site title
41
+ # within a namespace:
42
+ #
43
+ # config.namespace :admin do |admin|
44
+ # admin.site_title = "Custom Admin Title"
45
+ # end
46
+ #
47
+ # This will ONLY change the title for the admin section. Other
48
+ # namespaces will continue to use the main "site_title" configuration.
49
+
50
+ # == User Authentication
51
+ #
52
+ # Active Admin will automatically call an authentication
53
+ # method in a before filter of all controller actions to
54
+ # ensure that there is a currently logged in admin user.
55
+ #
56
+ # This setting changes the method which Active Admin calls
57
+ # within the application controller.
58
+ config.authentication_method = :authenticate_user!
59
+
60
+ # == User Authorization
61
+ #
62
+ # Active Admin will automatically call an authorization
63
+ # method in a before filter of all controller actions to
64
+ # ensure that there is a user with proper rights. You can use
65
+ # CanCanAdapter or make your own. Please refer to documentation.
66
+ config.authorization_adapter = ActiveAdmin::CanCanAdapter
67
+
68
+ # You can customize your CanCan Ability class name here.
69
+ config.cancan_ability_class = "Answers::Ability"
70
+
71
+ # You can specify a method to be called on unauthorized access.
72
+ # This is necessary in order to prevent a redirect loop which happens
73
+ # because, by default, user gets redirected to Dashboard. If user
74
+ # doesn't have access to Dashboard, he'll end up in a redirect loop.
75
+ # Method provided here should be defined in application_controller.rb.
76
+ # config.on_unauthorized_access = :access_denied
77
+
78
+ # == Current User
79
+ #
80
+ # Active Admin will associate actions with the current
81
+ # user performing them.
82
+ #
83
+ # This setting changes the method which Active Admin calls
84
+ # (within the application controller) to return the currently logged in user.
85
+ config.current_user_method = :current_user
86
+
87
+
88
+ # == Logging Out
89
+ #
90
+ # Active Admin displays a logout link on each screen. These
91
+ # settings configure the location and method used for the link.
92
+ #
93
+ # This setting changes the path where the link points to. If it's
94
+ # a string, the strings is used as the path. If it's a Symbol, we
95
+ # will call the method to return the path.
96
+ #
97
+ # Default:
98
+ config.logout_link_path = "/users/sign_out"
99
+
100
+ # This setting changes the http method used when rendering the
101
+ # link. For example :get, :delete, :put, etc..
102
+ #
103
+ # Default:
104
+ config.logout_link_method = :delete
105
+
106
+
107
+ # == Root
108
+ #
109
+ # Set the action to call for the root path. You can set different
110
+ # roots for each namespace.
111
+ #
112
+ # Default:
113
+ # config.root_to = 'dashboard#index'
114
+
115
+
116
+ # == Admin Comments
117
+ #
118
+ # This allows your users to comment on any resource registered with Active Admin.
119
+ #
120
+ # You can completely disable comments:
121
+ # config.allow_comments = false
122
+ #
123
+ # You can disable the menu item for the comments index page:
124
+ # config.show_comments_in_menu = false
125
+ #
126
+ # You can change the name under which comments are registered:
127
+ # config.comments_registration_name = 'AdminComment'
128
+
129
+
130
+ # == Batch Actions
131
+ #
132
+ # Enable and disable Batch Actions
133
+ #
134
+ config.batch_actions = true
135
+
136
+
137
+ # == Controller Filters
138
+ #
139
+ # You can add before, after and around filters to all of your
140
+ # Active Admin resources and pages from here.
141
+ #
142
+ # config.before_filter :do_something_awesome
143
+
144
+
145
+ # == Setting a Favicon
146
+ #
147
+ # config.favicon = '/assets/favicon.ico'
148
+
149
+
150
+ # == Removing Breadcrumbs
151
+ #
152
+ # Breadcrumbs are enabled by default. You can customize them for individual
153
+ # resources or you can disable them globally from here.
154
+ #
155
+ # config.breadcrumb = false
156
+
157
+
158
+ # == Register Stylesheets & Javascripts
159
+ #
160
+ # We recommend using the built in Active Admin layout and loading
161
+ # up your own stylesheets / javascripts to customize the look
162
+ # and feel.
163
+ #
164
+ # To load a stylesheet:
165
+ # config.register_stylesheet 'my_stylesheet.css'
166
+ #
167
+ # You can provide an options hash for more control, which is passed along to stylesheet_link_tag():
168
+ # config.register_stylesheet 'my_print_stylesheet.css', :media => :print
169
+ #
170
+ # To load a javascript file:
171
+ # config.register_javascript 'my_javascript.js'
172
+
173
+
174
+ # == CSV options
175
+ #
176
+ # Set the CSV builder separator
177
+ # config.csv_options = { :col_sep => ';' }
178
+ #
179
+ # Force the use of quotes
180
+ # config.csv_options = { :force_quotes => true }
181
+
182
+
183
+ # == Menu System
184
+ #
185
+ # You can add a navigation menu to be used in your application, or configure a provided menu
186
+ #
187
+ # To change the default utility navigation to show a link to your website & a logout btn
188
+ #
189
+ # config.namespace :admin do |admin|
190
+ # admin.build_menu :utility_navigation do |menu|
191
+ # menu.add label: "My Great Website", url: "http://www.mygreatwebsite.com", html_options: { target: :blank }
192
+ # admin.add_logout_button_to_menu menu
193
+ # end
194
+ # end
195
+ #
196
+ # If you wanted to add a static menu item to the default menu provided:
197
+ #
198
+ # config.namespace :admin do |admin|
199
+ # admin.build_menu :default do |menu|
200
+ # menu.add label: "My Great Website", url: "http://www.mygreatwebsite.com", html_options: { target: :blank }
201
+ # end
202
+ # end
203
+
204
+
205
+ # == Download Links
206
+ #
207
+ # You can disable download links on resource listing pages,
208
+ # or customize the formats shown per namespace/globally
209
+ #
210
+ # To disable/customize for the :admin namespace:
211
+ #
212
+ # config.namespace :admin do |admin|
213
+ #
214
+ # # Disable the links entirely
215
+ # admin.download_links = false
216
+ #
217
+ # # Only show XML & PDF options
218
+ # admin.download_links = [:xml, :pdf]
219
+ #
220
+ # # Enable/disable the links based on block
221
+ # # (for example, with cancan)
222
+ # admin.download_links = proc { can?(:view_download_links) }
223
+ #
224
+ # end
225
+
226
+
227
+ # == Pagination
228
+ #
229
+ # Pagination is enabled by default for all resources.
230
+ # You can control the default per page count for all resources here.
231
+ #
232
+ # config.default_per_page = 30
233
+
234
+
235
+ # == Filters
236
+ #
237
+ # By default the index screen includes a “Filters” sidebar on the right
238
+ # hand side with a filter for each attribute of the registered model.
239
+ # You can enable or disable them for all resources here.
240
+ #
241
+ # config.filters = true
242
+
243
+
244
+ config.load_paths << "#{Answers.root}/core/lib/answers/admin"
245
+ end
@@ -0,0 +1,228 @@
1
+ # Use this hook to configure devise mailer, warden hooks and so forth.
2
+ # Many of these configuration options can be set straight in your model.
3
+ Devise.setup do |config|
4
+
5
+ config.secret_key = Rails.application.secrets.secret_key_base
6
+ # ==> Mailer Configuration
7
+ # Configure the e-mail address which will be shown in Devise::Mailer,
8
+ # note that it will be overwritten if you use your own mailer class with default "from" parameter.
9
+ config.mailer_sender = ENV['ACTION_MAILER_URL'] || Rails.application.config.action_mailer.default_url_options
10
+
11
+ # Configure the class responsible to send e-mails.
12
+ # config.mailer = "Devise::Mailer"
13
+
14
+ # Automatically apply schema changes in tableless databases
15
+ # config.apply_schema = false
16
+
17
+ # ==> ORM configuration
18
+ # Load and configure the ORM. Supports :active_record (default) and
19
+ # :mongoid (bson_ext recommended) by default. Other ORMs may be
20
+ # available as additional gems.
21
+ require 'devise/orm/active_record'
22
+
23
+ # ==> Configuration for any authentication mechanism
24
+ # Configure which keys are used when authenticating a user. The default is
25
+ # just :email. You can configure it to use [:username, :subdomain], so for
26
+ # authenticating a user, both parameters are required. Remember that those
27
+ # parameters are used only when authenticating and not when retrieving from
28
+ # session. If you need permissions, you should implement that in a before filter.
29
+ # You can also supply a hash where the value is a boolean determining whether
30
+ # or not authentication should be aborted when the value is not present.
31
+ # config.authentication_keys = [ :email ]
32
+
33
+ # Configure parameters from the request object used for authentication. Each entry
34
+ # given should be a request method and it will automatically be passed to the
35
+ # find_for_authentication method and considered in your model lookup. For instance,
36
+ # if you set :request_keys to [:subdomain], :subdomain will be used on authentication.
37
+ # The same considerations mentioned for authentication_keys also apply to request_keys.
38
+ # config.request_keys = []
39
+
40
+ # Configure which authentication keys should be case-insensitive.
41
+ # These keys will be downcased upon creating or modifying a user and when used
42
+ # to authenticate or find a user. Default is :email.
43
+ config.case_insensitive_keys = [ :email ]
44
+
45
+ # Configure which authentication keys should have whitespace stripped.
46
+ # These keys will have whitespace before and after removed upon creating or
47
+ # modifying a user and when used to authenticate or find a user. Default is :email.
48
+ config.strip_whitespace_keys = [ :email ]
49
+
50
+ # Tell if authentication through request.params is enabled. True by default.
51
+ # It can be set to an array that will enable params authentication only for the
52
+ # given strategies, for example, `config.params_authenticatable = [:database]` will
53
+ # enable it only for database (email + password) authentication.
54
+ # config.params_authenticatable = true
55
+
56
+ # Tell if authentication through HTTP Basic Auth is enabled. False by default.
57
+ # It can be set to an array that will enable http authentication only for the
58
+ # given strategies, for example, `config.http_authenticatable = [:token]` will
59
+ # enable it only for token authentication.
60
+ # config.http_authenticatable = false
61
+
62
+ # If http headers should be returned for AJAX requests. True by default.
63
+ # config.http_authenticatable_on_xhr = true
64
+
65
+ # The realm used in Http Basic Authentication. "Application" by default.
66
+ # config.http_authentication_realm = "Application"
67
+
68
+ # It will change confirmation, password recovery and other workflows
69
+ # to behave the same regardless if the e-mail provided was right or wrong.
70
+ # Does not affect registerable.
71
+ # config.paranoid = true
72
+
73
+ # By default Devise will store the user in session. You can skip storage for
74
+ # :http_auth and :token_auth by adding those symbols to the array below.
75
+ # Notice that if you are skipping storage for all authentication paths, you
76
+ # may want to disable generating routes to Devise's sessions controller by
77
+ # passing :skip => :sessions to `devise_for` in your config/routes.rb
78
+ config.skip_session_storage = [:http_auth]
79
+
80
+ # ==> Configuration for :database_authenticatable
81
+ # For bcrypt, this is the cost for hashing the password and defaults to 10. If
82
+ # using other encryptors, it sets how many times you want the password re-encrypted.
83
+ #
84
+ # Limiting the stretches to just one in testing will increase the performance of
85
+ # your test suite dramatically. However, it is STRONGLY RECOMMENDED to not use
86
+ # a value less than 10 in other environments.
87
+ config.stretches = Rails.env.test? ? 1 : 10
88
+
89
+ # Setup a pepper to generate the encrypted password.
90
+ # config.pepper = "5c9d8edfa6cb7711b45be51365fd0048e3b31c74ab28beec2112e4a4cfdc9f56aa1ae659d72c42aa590e30984a92a0de4fb654c928bbcfd96bbc450bf6ccd074"
91
+
92
+ # ==> Configuration for :confirmable
93
+ # A period that the user is allowed to access the website even without
94
+ # confirming his account. For instance, if set to 2.days, the user will be
95
+ # able to access the website for two days without confirming his account,
96
+ # access will be blocked just in the third day. Default is 0.days, meaning
97
+ # the user cannot access the website without confirming his account.
98
+ # config.allow_unconfirmed_access_for = 2.days
99
+
100
+ # If true, requires any email changes to be confirmed (exctly the same way as
101
+ # initial account confirmation) to be applied. Requires additional unconfirmed_email
102
+ # db field (see migrations). Until confirmed new email is stored in
103
+ # unconfirmed email column, and copied to email column on successful confirmation.
104
+ config.reconfirmable = true
105
+
106
+ # Defines which key will be used when confirming an account
107
+ # config.confirmation_keys = [ :email ]
108
+
109
+ # ==> Configuration for :rememberable
110
+ # The time the user will be remembered without asking for credentials again.
111
+ # config.remember_for = 2.weeks
112
+
113
+ # If true, extends the user's remember period when remembered via cookie.
114
+ # config.extend_remember_period = false
115
+
116
+ # If true, uses the password salt as remember token. This should be turned
117
+ # to false if you are not using database authenticatable.
118
+ #config.use_salt_as_remember_token = true
119
+
120
+ # Options to be passed to the created cookie. For instance, you can set
121
+ # :secure => true in order to force SSL only cookies.
122
+ # config.cookie_options = {}
123
+
124
+ # ==> Configuration for :validatable
125
+ # Range for password length. Default is 6..128.
126
+ # config.password_length = 6..128
127
+
128
+ # Email regex used to validate email formats. It simply asserts that
129
+ # an one (and only one) @ exists in the given string. This is mainly
130
+ # to give user feedback and not to assert the e-mail validity.
131
+ # config.email_regexp = /\A[^@]+@[^@]+\z/
132
+
133
+ # ==> Configuration for :timeoutable
134
+ # The time you want to timeout the user session without activity. After this
135
+ # time the user will be asked for credentials again. Default is 30 minutes.
136
+ # config.timeout_in = 30.minutes
137
+
138
+ # ==> Configuration for :lockable
139
+ # Defines which strategy will be used to lock an account.
140
+ # :failed_attempts = Locks an account after a number of failed attempts to sign in.
141
+ # :none = No lock strategy. You should handle locking by yourself.
142
+ # config.lock_strategy = :failed_attempts
143
+
144
+ # Defines which key will be used when locking and unlocking an account
145
+ # config.unlock_keys = [ :email ]
146
+
147
+ # Defines which strategy will be used to unlock an account.
148
+ # :email = Sends an unlock link to the user email
149
+ # :time = Re-enables login after a certain amount of time (see :unlock_in below)
150
+ # :both = Enables both strategies
151
+ # :none = No unlock strategy. You should handle unlocking by yourself.
152
+ # config.unlock_strategy = :both
153
+
154
+ # Number of authentication tries before locking an account if lock_strategy
155
+ # is failed attempts.
156
+ # config.maximum_attempts = 20
157
+
158
+ # Time interval to unlock the account if :time is enabled as unlock_strategy.
159
+ # config.unlock_in = 1.hour
160
+
161
+ # ==> Configuration for :recoverable
162
+ #
163
+ # Defines which key will be used when recovering the password for an account
164
+ # config.reset_password_keys = [ :email ]
165
+
166
+ # Time interval you can reset your password with a reset password key.
167
+ # Don't put a too small interval or your users won't have the time to
168
+ # change their passwords.
169
+ config.reset_password_within = 6.hours
170
+
171
+ # ==> Configuration for :encryptable
172
+ # Allow you to use another encryption algorithm besides bcrypt (default). You can use
173
+ # :sha1, :sha512 or encryptors from others authentication tools as :clearance_sha1,
174
+ # :authlogic_sha512 (then you should set stretches above to 20 for default behavior)
175
+ # and :restful_authentication_sha1 (then you should set stretches to 10, and copy
176
+ # REST_AUTH_SITE_KEY to pepper)
177
+ # config.encryptor = :sha512
178
+
179
+ # ==> Configuration for :token_authenticatable
180
+ # Defines name of the authentication token params key
181
+ # config.token_authentication_key = :auth_token
182
+
183
+ # ==> Scopes configuration
184
+ # Turn scoped views on. Before rendering "sessions/new", it will first check for
185
+ # "users/sessions/new". It's turned off by default because it's slower if you
186
+ # are using only default views.
187
+ config.scoped_views = true
188
+
189
+ # Configure the default scope given to Warden. By default it's the first
190
+ # devise role declared in your routes (usually :user).
191
+ # config.default_scope = :user
192
+
193
+ # Configure sign_out behavior.
194
+ # Sign_out action can be scoped (i.e. /users/sign_out affects only :user scope).
195
+ # The default is true, which means any logout action will sign out all active scopes.
196
+ # config.sign_out_all_scopes = true
197
+
198
+ # ==> Navigation configuration
199
+ # Lists the formats that should be treated as navigational. Formats like
200
+ # :html, should redirect to the sign in page when the user does not have
201
+ # access, but formats like :xml or :json, should return 401.
202
+ #
203
+ # If you have any extra navigational formats, like :iphone or :mobile, you
204
+ # should add them to the navigational formats lists.
205
+ #
206
+ # The "*/*" below is required to match Internet Explorer requests.
207
+ # config.navigational_formats = ["*/*", :html]
208
+
209
+ # The default HTTP method used to sign out a resource. Default is :delete.
210
+ config.sign_out_via = :delete
211
+
212
+ # ==> OmniAuth
213
+ # Add a new OmniAuth provider. Check the wiki for more information on setting
214
+ # up on your models and hooks.
215
+ # config.omniauth :github, 'APP_ID', 'APP_SECRET', :scope => 'user,public_repo'
216
+
217
+ # ==> Warden configuration
218
+ # If you want to use other strategies, that are not supported by Devise, or
219
+ # change the failure app, you can configure them inside the config.warden block.
220
+ #
221
+ # config.warden do |manager|
222
+ # manager.intercept_401 = false
223
+ # manager.default_strategies(:scope => :user).unshift :some_external_strategy
224
+ # end
225
+
226
+ config.router_name = :answers
227
+ config.parent_controller = 'Answers::ApplicationController'
228
+ end