tolaria 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (219) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +66 -0
  3. data/.yardopts +4 -0
  4. data/CNAME +1 -0
  5. data/CONTRIBUTING.md +32 -0
  6. data/Gemfile +2 -0
  7. data/LICENSE.md +9 -0
  8. data/README.md +538 -0
  9. data/Rakefile +52 -0
  10. data/app/assets/fonts/admin/fontawesome.eot +0 -0
  11. data/app/assets/fonts/admin/fontawesome.svg +565 -0
  12. data/app/assets/fonts/admin/fontawesome.ttf +0 -0
  13. data/app/assets/fonts/admin/fontawesome.woff +0 -0
  14. data/app/assets/fonts/admin/fontawesome.woff2 +0 -0
  15. data/app/assets/images/admin/columbia_banner.png +0 -0
  16. data/app/assets/images/admin/favicon.ico +0 -0
  17. data/app/assets/images/admin/noise.png +0 -0
  18. data/app/assets/images/admin/select_arrows.svg +1 -0
  19. data/app/assets/javascripts/admin/admin.js +4 -0
  20. data/app/assets/javascripts/admin/base.js +12 -0
  21. data/app/assets/javascripts/admin/lib/backbone.js +1888 -0
  22. data/app/assets/javascripts/admin/lib/jquery.chosen.js +1272 -0
  23. data/app/assets/javascripts/admin/lib/jquery.js +10361 -0
  24. data/app/assets/javascripts/admin/lib/jquery.selection.js +352 -0
  25. data/app/assets/javascripts/admin/lib/moment.js +3103 -0
  26. data/app/assets/javascripts/admin/lib/no.js +6 -0
  27. data/app/assets/javascripts/admin/lib/underscore.js +1570 -0
  28. data/app/assets/javascripts/admin/models/composer_buttons.js +45 -0
  29. data/app/assets/javascripts/admin/models/rails_meta.js +4 -0
  30. data/app/assets/javascripts/admin/views/field_with_errors.js +19 -0
  31. data/app/assets/javascripts/admin/views/fields/attachment_field.js +32 -0
  32. data/app/assets/javascripts/admin/views/fields/has_many.js +64 -0
  33. data/app/assets/javascripts/admin/views/fields/image_association_select.js +31 -0
  34. data/app/assets/javascripts/admin/views/fields/markdown_composer.js +167 -0
  35. data/app/assets/javascripts/admin/views/fields/searchable_select.js +70 -0
  36. data/app/assets/javascripts/admin/views/fields/slug_field.js +38 -0
  37. data/app/assets/javascripts/admin/views/fields/swatch_field.js +55 -0
  38. data/app/assets/javascripts/admin/views/fields/timestamp_field.js +80 -0
  39. data/app/assets/javascripts/admin/views/flash_message.js +18 -0
  40. data/app/assets/javascripts/admin/views/form_orchestrator.js +41 -0
  41. data/app/assets/javascripts/admin/views/navigation.js +20 -0
  42. data/app/assets/javascripts/admin/views/resource_form.js +18 -0
  43. data/app/assets/javascripts/admin/views/search_form.js +20 -0
  44. data/app/assets/javascripts/admin/views/sessions.js +109 -0
  45. data/app/assets/javascripts/admin/views/virtual_form.js +47 -0
  46. data/app/assets/stylesheets/admin/_base.scss +5 -0
  47. data/app/assets/stylesheets/admin/_reset.scss +149 -0
  48. data/app/assets/stylesheets/admin/_root.scss +63 -0
  49. data/app/assets/stylesheets/admin/admin.scss +4 -0
  50. data/app/assets/stylesheets/admin/components/_blank_slate.scss +44 -0
  51. data/app/assets/stylesheets/admin/components/_buttons.scss +82 -0
  52. data/app/assets/stylesheets/admin/components/_flash_message.scss +64 -0
  53. data/app/assets/stylesheets/admin/components/_footer.scss +9 -0
  54. data/app/assets/stylesheets/admin/components/_header.scss +107 -0
  55. data/app/assets/stylesheets/admin/components/_index_table.scss +120 -0
  56. data/app/assets/stylesheets/admin/components/_main.scss +68 -0
  57. data/app/assets/stylesheets/admin/components/_markdown_body.scss +109 -0
  58. data/app/assets/stylesheets/admin/components/_navigation.scss +110 -0
  59. data/app/assets/stylesheets/admin/components/_pagination.scss +36 -0
  60. data/app/assets/stylesheets/admin/components/_pill.scss +11 -0
  61. data/app/assets/stylesheets/admin/components/_resource_form.scss +222 -0
  62. data/app/assets/stylesheets/admin/components/_search_form.scss +36 -0
  63. data/app/assets/stylesheets/admin/components/_sessions.scss +152 -0
  64. data/app/assets/stylesheets/admin/components/_show_table.scss +67 -0
  65. data/app/assets/stylesheets/admin/components/forms/_attachment_field.scss +59 -0
  66. data/app/assets/stylesheets/admin/components/forms/_chosen.scss +478 -0
  67. data/app/assets/stylesheets/admin/components/forms/_image_association_select.scss +20 -0
  68. data/app/assets/stylesheets/admin/components/forms/_markdown_composer.scss +149 -0
  69. data/app/assets/stylesheets/admin/components/forms/_nested_fields.scss +63 -0
  70. data/app/assets/stylesheets/admin/components/forms/_searchable_select.scss +8 -0
  71. data/app/assets/stylesheets/admin/components/forms/_slug_field.scss +20 -0
  72. data/app/assets/stylesheets/admin/components/forms/_swatch_field.scss +47 -0
  73. data/app/assets/stylesheets/admin/components/forms/_timestamp_field.scss +15 -0
  74. data/app/assets/stylesheets/admin/components/help_link.scss +6 -0
  75. data/app/assets/stylesheets/admin/mixins/_clearfix.scss +18 -0
  76. data/app/assets/stylesheets/admin/mixins/_min_max_width.scss +11 -0
  77. data/app/assets/stylesheets/admin/mixins/_rgbb.scss +7 -0
  78. data/app/assets/stylesheets/admin/mixins/_visuallyhidden.scss +33 -0
  79. data/app/assets/stylesheets/admin/settings/_animations.scss +21 -0
  80. data/app/assets/stylesheets/admin/settings/_breakpoints.scss +2 -0
  81. data/app/assets/stylesheets/admin/settings/_colors.scss +32 -0
  82. data/app/assets/stylesheets/admin/settings/_fonts.scss +31 -0
  83. data/app/assets/stylesheets/admin/settings/_icons.scss +1658 -0
  84. data/app/controllers/admin/admin_controller.rb +21 -0
  85. data/app/controllers/admin/sessions_controller.rb +112 -0
  86. data/app/controllers/tolaria/resource_controller.rb +132 -0
  87. data/app/controllers/tolaria/tolaria_controller.rb +40 -0
  88. data/app/helpers/admin/table_helper.rb +175 -0
  89. data/app/helpers/admin/view_helper.rb +76 -0
  90. data/app/mailers/passcode_mailer.rb +11 -0
  91. data/app/models/administrator.rb +146 -0
  92. data/app/views/admin/administrators/_form.html.erb +16 -0
  93. data/app/views/admin/administrators/_index.html.erb +20 -0
  94. data/app/views/admin/administrators/_search.html.erb +5 -0
  95. data/app/views/admin/administrators/_show.html.erb +14 -0
  96. data/app/views/admin/help/help_link.html.erb +16 -0
  97. data/app/views/admin/session/form.html.erb +52 -0
  98. data/app/views/admin/shared/_flash_messages.html.erb +42 -0
  99. data/app/views/admin/shared/_footer.html.erb +8 -0
  100. data/app/views/admin/shared/_head.html.erb +11 -0
  101. data/app/views/admin/shared/_header.html.erb +43 -0
  102. data/app/views/admin/shared/_navigation.html.erb +47 -0
  103. data/app/views/admin/shared/_skiplinks.html.erb +0 -0
  104. data/app/views/admin/shared/forms/_attachment_field.html.erb +17 -0
  105. data/app/views/admin/shared/forms/_has_many.html.erb +14 -0
  106. data/app/views/admin/shared/forms/_has_many_header.html.erb +19 -0
  107. data/app/views/admin/shared/forms/_image_association_select.html.erb +6 -0
  108. data/app/views/admin/shared/forms/_image_field.html.erb +19 -0
  109. data/app/views/admin/shared/forms/_markdown_composer.html.erb +29 -0
  110. data/app/views/admin/shared/forms/_searchable_select.html.erb +3 -0
  111. data/app/views/admin/shared/forms/_slug_field.html.erb +9 -0
  112. data/app/views/admin/shared/forms/_swatch_field.html.erb +4 -0
  113. data/app/views/admin/shared/forms/_timestamp_field.html.erb +19 -0
  114. data/app/views/admin/tolaria_resource/_form_buttons.html.erb +10 -0
  115. data/app/views/admin/tolaria_resource/_index_table.html.erb +73 -0
  116. data/app/views/admin/tolaria_resource/_search_form.html.erb +32 -0
  117. data/app/views/admin/tolaria_resource/_show_buttons.html.erb +13 -0
  118. data/app/views/admin/tolaria_resource/edit.html.erb +34 -0
  119. data/app/views/admin/tolaria_resource/index.html.erb +36 -0
  120. data/app/views/admin/tolaria_resource/new.html.erb +1 -0
  121. data/app/views/admin/tolaria_resource/show.html.erb +52 -0
  122. data/app/views/kaminari/admin/_first_page.html.erb +9 -0
  123. data/app/views/kaminari/admin/_last_page.html.erb +9 -0
  124. data/app/views/kaminari/admin/_next_page.html.erb +9 -0
  125. data/app/views/kaminari/admin/_page.html.erb +17 -0
  126. data/app/views/kaminari/admin/_paginator.html.erb +21 -0
  127. data/app/views/kaminari/admin/_prev_page.html.erb +9 -0
  128. data/app/views/layouts/admin/admin.html.erb +21 -0
  129. data/app/views/layouts/admin/sessions.html.erb +12 -0
  130. data/app/views/passcode_mailer/passcode.text.erb +5 -0
  131. data/lib/generators/tolaria/install/install_generator.rb +21 -0
  132. data/lib/generators/tolaria/install/templates/administrators_migration.rb +31 -0
  133. data/lib/generators/tolaria/install/templates/tolaria_initializer.rb +93 -0
  134. data/lib/tasks/admin.rake +32 -0
  135. data/lib/tolaria.rb +27 -0
  136. data/lib/tolaria/active_record.rb +55 -0
  137. data/lib/tolaria/admin.rb +4 -0
  138. data/lib/tolaria/categories.rb +21 -0
  139. data/lib/tolaria/config.rb +40 -0
  140. data/lib/tolaria/default_config.rb +74 -0
  141. data/lib/tolaria/engine.rb +23 -0
  142. data/lib/tolaria/form_buildable.rb +203 -0
  143. data/lib/tolaria/help_links.rb +78 -0
  144. data/lib/tolaria/introspection.rb +13 -0
  145. data/lib/tolaria/manage.rb +57 -0
  146. data/lib/tolaria/managed_class.rb +90 -0
  147. data/lib/tolaria/markdown.rb +28 -0
  148. data/lib/tolaria/random_tokens.rb +16 -0
  149. data/lib/tolaria/reload.rb +21 -0
  150. data/lib/tolaria/routes.rb +33 -0
  151. data/lib/tolaria/version.rb +13 -0
  152. data/test/demo/Rakefile +4 -0
  153. data/test/demo/app/assets/javascripts/application.js +1 -0
  154. data/test/demo/app/assets/stylesheets/application.scss +1 -0
  155. data/test/demo/app/controllers/application_controller.rb +5 -0
  156. data/test/demo/app/controllers/concerns/.keep +0 -0
  157. data/test/demo/app/controllers/homepage_controller.rb +4 -0
  158. data/test/demo/app/helpers/application_helper.rb +2 -0
  159. data/test/demo/app/mailers/.keep +0 -0
  160. data/test/demo/app/models/.keep +0 -0
  161. data/test/demo/app/models/blog_post.rb +43 -0
  162. data/test/demo/app/models/footnote.rb +5 -0
  163. data/test/demo/app/models/image.rb +19 -0
  164. data/test/demo/app/models/legal_page.rb +24 -0
  165. data/test/demo/app/models/miscellany.rb +12 -0
  166. data/test/demo/app/models/topic.rb +22 -0
  167. data/test/demo/app/models/video.rb +16 -0
  168. data/test/demo/app/views/admin/blog_posts/_form.html.erb +48 -0
  169. data/test/demo/app/views/admin/blog_posts/_search.html.erb +5 -0
  170. data/test/demo/app/views/admin/help/markdown-help.md +95 -0
  171. data/test/demo/app/views/admin/images/_form.html.erb +26 -0
  172. data/test/demo/app/views/admin/legal_pages/_form.html.erb +15 -0
  173. data/test/demo/app/views/admin/topics/_form.html.erb +3 -0
  174. data/test/demo/app/views/admin/videos/_form.html.erb +11 -0
  175. data/test/demo/app/views/homepage/homepage.html.erb +3 -0
  176. data/test/demo/app/views/layouts/application.html.erb +14 -0
  177. data/test/demo/bin/bundle +3 -0
  178. data/test/demo/bin/rails +4 -0
  179. data/test/demo/bin/rake +4 -0
  180. data/test/demo/bin/setup +29 -0
  181. data/test/demo/config.ru +4 -0
  182. data/test/demo/config/application.rb +26 -0
  183. data/test/demo/config/boot.rb +4 -0
  184. data/test/demo/config/database.yml +18 -0
  185. data/test/demo/config/environment.rb +3 -0
  186. data/test/demo/config/environments/development.rb +43 -0
  187. data/test/demo/config/environments/test.rb +44 -0
  188. data/test/demo/config/initializers/assets.rb +11 -0
  189. data/test/demo/config/initializers/cookies_serializer.rb +2 -0
  190. data/test/demo/config/initializers/filter_parameter_logging.rb +3 -0
  191. data/test/demo/config/initializers/inflections.rb +17 -0
  192. data/test/demo/config/initializers/markdown.rb +44 -0
  193. data/test/demo/config/initializers/secret_token.rb +2 -0
  194. data/test/demo/config/initializers/session_store.rb +2 -0
  195. data/test/demo/config/initializers/tolaria.rb +17 -0
  196. data/test/demo/config/initializers/wrap_parameters.rb +14 -0
  197. data/test/demo/config/routes.rb +4 -0
  198. data/test/demo/db/migrate/20150601202901_create_administrators.rb +31 -0
  199. data/test/demo/db/migrate/20150603204006_add_testing_models.rb +27 -0
  200. data/test/demo/db/migrate/20150609232013_create_footnotes.rb +10 -0
  201. data/test/demo/db/migrate/20150610135235_create_additional_demo_objects.rb +50 -0
  202. data/test/demo/db/schema.rb +112 -0
  203. data/test/demo/log/.keep +0 -0
  204. data/test/demo/public/404.html +67 -0
  205. data/test/demo/public/422.html +67 -0
  206. data/test/demo/public/500.html +66 -0
  207. data/test/demo/public/favicon.ico +0 -0
  208. data/test/integration/help_link_test.rb +73 -0
  209. data/test/integration/interface_test.rb +63 -0
  210. data/test/integration/router_test.rb +73 -0
  211. data/test/integration/session_test.rb +88 -0
  212. data/test/test_helper.rb +58 -0
  213. data/test/unit/configuration_test.rb +21 -0
  214. data/test/unit/managed_classes_test.rb +54 -0
  215. data/test/unit/markdown_test.rb +12 -0
  216. data/test/unit/menu_test.rb +32 -0
  217. data/test/unit/random_tokens_test.rb +13 -0
  218. data/tolaria.gemspec +35 -0
  219. metadata +499 -0
@@ -0,0 +1,5 @@
1
+ <%= f.label ransack_text_search_chain(BlogPost), "Containing the text" %>
2
+ <%= f.search_field ransack_text_search_chain(BlogPost) %>
3
+
4
+ <%= f.label :topics_label_cont, "In the category" %>
5
+ <%= f.searchable_select :topics_label_cont, Topic.order("label ASC"), :id, :label, prompt:"Any category" %>
@@ -0,0 +1,95 @@
1
+ ## Paragraphs
2
+
3
+ Paragraphs are separated by empty newlines.
4
+
5
+ This is a paragraph
6
+ This line is part of the same paragraph
7
+
8
+ This is a new paragraph
9
+
10
+ ## Manual Line Breaks
11
+
12
+ End a line with two or more spaces:
13
+
14
+ Roses are red,
15
+ Violets are blue.
16
+
17
+ ## Headers
18
+
19
+ Add a number of hash signs `#` equal to the header level
20
+
21
+ # Header Level 1
22
+ ## Header Level 2
23
+ ## Header Level 3
24
+
25
+ ## Lists
26
+
27
+ Ordered list use numbers:
28
+
29
+ 1. Foo
30
+ 2. Bar
31
+
32
+ Unordered lists use dashes or stars:
33
+
34
+ - A list item.
35
+ - A list item.
36
+ - A list item.
37
+
38
+ * Foo
39
+ * Bar
40
+
41
+ You can nest them:
42
+
43
+ - First
44
+ - Second
45
+ - Bastard
46
+ 1. Brownian motion
47
+ 2. bupkis
48
+ - BELITTLER
49
+ 3. burper
50
+ - Cunning
51
+
52
+ ## Blockquotes
53
+
54
+ > Email-style angle brackets
55
+ > are used for blockquotes.
56
+
57
+ ## Phrase Emphasis
58
+
59
+ *italic* **bold**
60
+ _italic_ __bold__
61
+
62
+ ## Links
63
+
64
+ Inline links:
65
+
66
+ An [example](http://example.com/)
67
+
68
+ Reference-style links:
69
+
70
+ An [example][id]. Then, anywhere
71
+ else in the doc, define the link:
72
+
73
+ [id]: http://example.com/
74
+
75
+ Email Links: Email addresses are automatically parsed by Markdown, but if you want to add an email subject or other parameters to the link, you would do it like this:
76
+
77
+ [email@example.org](mailto:email@example.org?subject=Insert%20Subject)
78
+
79
+ ## Inline Images
80
+
81
+ Simple inline images (not recommended) can be inserted with:
82
+
83
+ ![alt text](/path/img.jpg)
84
+
85
+ ## Code Spans
86
+
87
+ Inline code is delimited with backticks
88
+
89
+ `code` spans are delimited
90
+ by backticks.
91
+
92
+ For full pre-formatted code blocks, indent every line of a code block by at least 4 spaces.
93
+
94
+ This is a pre-formatted
95
+ code block.
@@ -0,0 +1,26 @@
1
+ <%= f.label :title, "Title" %>
2
+ <%= f.text_field :title, placeholder: "Image title" %>
3
+ <%= f.hint "The title of this image, not shown to site visitors. Use a clear name that helps you quickly find the image." %>
4
+
5
+ <%= f.label :alternate_text, "Alternate Text" %>
6
+ <%= f.text_area :alternate_text, placeholder: "Alt text" %>
7
+ <%= f.hint %{
8
+ Text that represents this image when described to users that can't see it.
9
+ Provide text that could replace the image if it wasn't there.
10
+ You should succinctly note what is important or what is occuring,
11
+ rather than simply describing everything in the picture.
12
+ Blank alternate text implies that the image is only for visual-interest
13
+ and that describing it is not required.
14
+ } %>
15
+
16
+ <%= f.label :credit, "Credit" %>
17
+ <%= f.text_field :credit, placeholder: "Photographer name or company name" %>
18
+ <%= f.hint "The image credit for this file." %>
19
+
20
+ <%= f.label :keywords, "Keywords" %>
21
+ <%= f.text_area :keywords, placeholder: "Keywords" %>
22
+ <%= f.hint "Extra, optional, internal-only keywords to help search for this image." %>
23
+
24
+ <%= f.label :attachment_address, "Image File" %>
25
+ <%= f.image_field :attachment_address %>
26
+ <%= f.hint "Attach a high-quality image file, at least 1200×600 pixels in size. The subject should be centered." %>
@@ -0,0 +1,15 @@
1
+ <%= f.label :title, "Title" %>
2
+ <%= f.text_field :title, placeholder:"Page title" %>
3
+ <%= f.hint "The title of this page." %>
4
+
5
+ <%= f.label :slug, "URL Slug" %>
6
+ <%= f.slug_field :slug, placeholder:"page-slug", pattern:"/*", class:"monospace" %>
7
+ <%= f.hint "The URL fragment for this page." %>
8
+
9
+ <%= f.label :summary %>
10
+ <%= f.text_area :summary, rows:3, placeholder:"Summary for search engines and social media" %>
11
+ <%= f.hint "Summarize this page content in less than 300 characters. The summary is used for search engine results." %>
12
+
13
+ <%= f.label :body %>
14
+ <%= f.markdown_composer :body %>
15
+ <%= f.hint "The body of this post. You can use Markdown!" %>
@@ -0,0 +1,3 @@
1
+ <%= f.label :label, "Topic Label" %>
2
+ <%= f.slug_field :label, placeholder:"Topic label", pattern:"/blog/*" %>
3
+ <%= f.hint "The name of this topic" %>
@@ -0,0 +1,11 @@
1
+ <%= f.label :title, "Video title" %>
2
+ <%= f.text_field :title, placeholder:"Title" %>
3
+ <%= f.hint "The title of this video" %>
4
+
5
+ <%= f.label :youtube_id, "YouTube ID" %>
6
+ <%= f.text_field :youtube_id, class:"monospace" %>
7
+ <%= f.hint "The YouTube ID for this video embed" %>
8
+
9
+ <%= f.label :description %>
10
+ <%= f.text_area :description %>
11
+ <%= f.hint "A summary of this video's purpose. Used as caption when embedding the video." %>
@@ -0,0 +1,3 @@
1
+ <h1>Demo Application Homepage</h1>
2
+ <p>This file is here so that visiting the site root doesn't cause an exception.</p>
3
+ <p>You probably wanted to go to <%= link_to "/admin", admin_root_path %></p>
@@ -0,0 +1,14 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>Test Application</title>
5
+ <%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track' => true %>
6
+ <%= javascript_include_tag 'application', 'data-turbolinks-track' => true %>
7
+ <%= csrf_meta_tags %>
8
+ </head>
9
+ <body>
10
+
11
+ <%= yield %>
12
+
13
+ </body>
14
+ </html>
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env ruby
2
+ ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__)
3
+ load Gem.bin_path('bundler', 'bundle')
@@ -0,0 +1,4 @@
1
+ #!/usr/bin/env ruby
2
+ APP_PATH = File.expand_path('../../config/application', __FILE__)
3
+ require_relative '../config/boot'
4
+ require 'rails/commands'
@@ -0,0 +1,4 @@
1
+ #!/usr/bin/env ruby
2
+ require_relative '../config/boot'
3
+ require 'rake'
4
+ Rake.application.run
@@ -0,0 +1,29 @@
1
+ #!/usr/bin/env ruby
2
+ require 'pathname'
3
+
4
+ # path to your application root.
5
+ APP_ROOT = Pathname.new File.expand_path('../../', __FILE__)
6
+
7
+ Dir.chdir APP_ROOT do
8
+ # This script is a starting point to setup your application.
9
+ # Add necessary setup steps to this file:
10
+
11
+ puts "== Installing dependencies =="
12
+ system "gem install bundler --conservative"
13
+ system "bundle check || bundle install"
14
+
15
+ # puts "\n== Copying sample files =="
16
+ # unless File.exist?("config/database.yml")
17
+ # system "cp config/database.yml.sample config/database.yml"
18
+ # end
19
+
20
+ puts "\n== Preparing database =="
21
+ system "bin/rake db:setup"
22
+
23
+ puts "\n== Removing old logs and tempfiles =="
24
+ system "rm -f log/*"
25
+ system "rm -rf tmp/cache"
26
+
27
+ puts "\n== Restarting application server =="
28
+ system "touch tmp/restart.txt"
29
+ end
@@ -0,0 +1,4 @@
1
+ # This file is used by Rack-based servers to start the application.
2
+
3
+ require ::File.expand_path("../config/environment", __FILE__)
4
+ run Rails.application
@@ -0,0 +1,26 @@
1
+ require File.expand_path("../boot", __FILE__)
2
+ require "rails/all"
3
+ Bundler.require(*Rails.groups)
4
+ require "tolaria"
5
+
6
+ module Demo
7
+ class Application < Rails::Application
8
+
9
+ # Settings in config/environments/* take precedence over those specified here.
10
+ # Application configuration should go into files in config/initializers
11
+ # -- all .rb files in that directory are automatically loaded.
12
+
13
+ # Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
14
+ # Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC.
15
+ # config.time_zone = 'Central Time (US & Canada)'
16
+
17
+ # The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
18
+ # config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
19
+ # config.i18n.default_locale = :de
20
+
21
+ # Do not swallow errors in after_commit/after_rollback callbacks.
22
+ config.active_record.raise_in_transactional_callbacks = true
23
+
24
+ end
25
+ end
26
+
@@ -0,0 +1,4 @@
1
+ # Set up gems listed in the Gemfile.
2
+ ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../../../Gemfile", __FILE__)
3
+ require "bundler/setup" if File.exist?(ENV["BUNDLE_GEMFILE"])
4
+ $LOAD_PATH.unshift File.expand_path("../../../../lib", __FILE__)
@@ -0,0 +1,18 @@
1
+ # Use SQLite 3 for the development database
2
+
3
+ default: &default
4
+ adapter: sqlite3
5
+ pool: 5
6
+ timeout: 5000
7
+
8
+ development:
9
+ <<: *default
10
+ database: db/development.sqlite3
11
+
12
+ # Warning: The database defined as "test" will be erased and
13
+ # re-generated from your development database when you run "rake".
14
+ # Do not set this db to the same as development or production.
15
+
16
+ test:
17
+ <<: *default
18
+ database: db/test.sqlite3
@@ -0,0 +1,3 @@
1
+ # Initialize the Rails application.
2
+ require File.expand_path("../application", __FILE__)
3
+ Rails.application.initialize!
@@ -0,0 +1,43 @@
1
+ Rails.application.configure do
2
+
3
+ # Settings specified here will take precedence over those in config/application.rb.
4
+
5
+ # In the development environment your application's code is reloaded on
6
+ # every request. This slows down response time but is perfect for development
7
+ # since you don't have to restart the web server when you make code changes.
8
+ config.cache_classes = false
9
+
10
+ # Do not eager load code on boot.
11
+ config.eager_load = false
12
+
13
+ # Show full error reports and disable caching.
14
+ config.consider_all_requests_local = true
15
+ config.action_controller.perform_caching = false
16
+
17
+ # Don't care if the mailer can't send.
18
+ config.action_mailer.raise_delivery_errors = false
19
+
20
+ # Print deprecation notices to the Rails logger.
21
+ config.active_support.deprecation = :log
22
+
23
+ # Raise an error on page load if there are pending migrations.
24
+ config.active_record.migration_error = :page_load
25
+
26
+ # Debug mode disables concatenation and preprocessing of assets.
27
+ # This option may cause significant delays in view rendering with a large
28
+ # number of complex assets.
29
+ config.assets.debug = true
30
+
31
+ # Asset digests allow you to set far-future HTTP expiration dates on all assets,
32
+ # yet still be able to expire them through the digest params.
33
+ config.assets.digest = true
34
+
35
+ # Adds additional error checking when serving assets at runtime.
36
+ # Checks for improperly declared sprockets dependencies.
37
+ # Raises helpful error messages.
38
+ config.assets.raise_runtime_errors = true
39
+
40
+ # Raises error for missing translations
41
+ # config.action_view.raise_on_missing_translations = true
42
+
43
+ end
@@ -0,0 +1,44 @@
1
+ Rails.application.configure do
2
+
3
+ # Settings specified here will take precedence over those in config/application.rb.
4
+
5
+ # The test environment is used exclusively to run your application's
6
+ # test suite. You never need to work with it otherwise. Remember that
7
+ # your test database is "scratch space" for the test suite and is wiped
8
+ # and recreated between test runs. Don't rely on the data there!
9
+ config.cache_classes = true
10
+
11
+ # Do not eager load code on boot. This avoids loading your whole application
12
+ # just for the purpose of running a single test. If you are using a tool that
13
+ # preloads Rails for running tests, you may have to set it to true.
14
+ config.eager_load = false
15
+
16
+ # Configure static file server for tests with Cache-Control for performance.
17
+ config.serve_static_files = true
18
+ config.static_cache_control = "public, max-age=3600"
19
+
20
+ # Show full error reports and disable caching.
21
+ config.consider_all_requests_local = true
22
+ config.action_controller.perform_caching = false
23
+
24
+ # Raise exceptions instead of rendering exception templates.
25
+ config.action_dispatch.show_exceptions = false
26
+
27
+ # Disable request forgery protection in test environment.
28
+ config.action_controller.allow_forgery_protection = false
29
+
30
+ # Tell Action Mailer not to deliver emails to the real world.
31
+ # The :test delivery method accumulates sent emails in the
32
+ # ActionMailer::Base.deliveries array.
33
+ config.action_mailer.delivery_method = :test
34
+
35
+ # Randomize the order test cases are executed.
36
+ config.active_support.test_order = :random
37
+
38
+ # Print deprecation notices to the stderr.
39
+ config.active_support.deprecation = :stderr
40
+
41
+ # Raises error for missing translations
42
+ # config.action_view.raise_on_missing_translations = true
43
+
44
+ end
@@ -0,0 +1,11 @@
1
+ # Be sure to restart your server when you modify this file.
2
+
3
+ # Version of your assets, change this if you want to expire all your assets.
4
+ Rails.application.config.assets.version = "1.0"
5
+
6
+ # Add additional assets to the asset load path
7
+ # Rails.application.config.assets.paths << Emoji.images_path
8
+
9
+ # Precompile additional assets.
10
+ # application.js, application.css, and all non-JS/CSS in app/assets folder are already added.
11
+ # Rails.application.config.assets.precompile += %w( search.js )
@@ -0,0 +1,2 @@
1
+ # Be sure to restart your server when you modify this file.
2
+ Rails.application.config.action_dispatch.cookies_serializer = :json
@@ -0,0 +1,3 @@
1
+ # Be sure to restart your server when you modify this file.
2
+ # Configure sensitive parameters which will be filtered from the log file.
3
+ Rails.application.config.filter_parameters += [:password]
@@ -0,0 +1,17 @@
1
+ # Add new inflection rules using the following format
2
+ # (all these examples are active by default):
3
+ # ActiveSupport::Inflector.inflections do |inflect|
4
+ # inflect.plural /^(ox)$/i, '\1en'
5
+ # inflect.singular /^(ox)en/i, '\1'
6
+ # inflect.irregular 'person', 'people'
7
+ # inflect.uncountable %w( fish sheep )
8
+ # end
9
+ #
10
+ # These inflection rules are supported but not enabled by default:
11
+ # ActiveSupport::Inflector.inflections do |inflect|
12
+ # inflect.acronym 'RESTful'
13
+ # end
14
+
15
+ ActiveSupport::Inflector.inflections do |inflect|
16
+ inflect.uncountable %w[miscellany]
17
+ end
@@ -0,0 +1,44 @@
1
+ require "redcarpet"
2
+
3
+ module Rails::Markdown
4
+
5
+ # For details on these options see https://github.com/vmg/redcarpet
6
+ MARKDOWN_OPTIONS = {
7
+ autolink: true,
8
+ disable_indented_code_blocks: false,
9
+ fenced_code_blocks: true,
10
+ filter_html: nil, # Allow raw HTML
11
+ footnotes: false,
12
+ hard_wrap: false,
13
+ highlight: false, # Really ugly and misused
14
+ lax_spacing: true,
15
+ link_attributes: {},
16
+ no_images: false,
17
+ no_intra_emphasis: true,
18
+ no_links: false,
19
+ no_styles: true, # Don't make any <style> tags
20
+ prettify: false, # Support for google-code-prettify
21
+ quote: false,
22
+ safe_links_only: true, # Only allow HTTP/S links, not FTP or SMB, etc
23
+ space_after_headers: true,
24
+ strikethrough: true,
25
+ superscript: true,
26
+ tables: false, # Tables only if we style and allow for it
27
+ underline: false, # This is really ugly and misused
28
+ with_toc_data: false,
29
+ xhtml: false, # Output HTML5 instead
30
+ }
31
+
32
+ class HTMLRendererWithPants < ::Redcarpet::Render::HTML
33
+ # Smarten quotes and typography
34
+ include Redcarpet::Render::SmartyPants
35
+ end
36
+
37
+ # Given a markdown document, run it through our Markdown system
38
+ def self.render(markdown_document)
39
+ @options ||= MARKDOWN_OPTIONS
40
+ @redcarpet ||= ::Redcarpet::Markdown.new(HTMLRendererWithPants.new(@options), @options)
41
+ @redcarpet.render(markdown_document).html_safe
42
+ end
43
+
44
+ end