kuhsaft 0.3.6 → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (240) hide show
  1. data/README.md +127 -77
  2. data/Rakefile +15 -10
  3. data/app/assets/javascripts/kuhsaft/application.js +2 -0
  4. data/app/assets/javascripts/kuhsaft/cms/application.js +16 -4
  5. data/app/assets/javascripts/kuhsaft/cms/customizations.js +1 -0
  6. data/app/assets/stylesheets/kuhsaft/application.css.sass +4 -0
  7. data/app/assets/stylesheets/kuhsaft/cms/application.css.sass +125 -0
  8. data/app/assets/stylesheets/kuhsaft/cms/customizations.css.sass +1 -0
  9. data/app/controllers/kuhsaft/application_controller.rb +5 -0
  10. data/app/controllers/kuhsaft/cms/admin_controller.rb +8 -10
  11. data/app/controllers/kuhsaft/cms/bricks_controller.rb +35 -0
  12. data/app/controllers/kuhsaft/cms/pages_controller.rb +16 -19
  13. data/app/controllers/kuhsaft/pages_controller.rb +4 -10
  14. data/app/helpers/cms_helper.rb +3 -3
  15. data/app/helpers/kuhsaft/application_helper.rb +21 -0
  16. data/app/helpers/kuhsaft/cms/application_helper.rb +10 -0
  17. data/app/helpers/kuhsaft/cms/pages_helper.rb +14 -0
  18. data/app/helpers/pages_helper.rb +18 -21
  19. data/app/models/kuhsaft/accordion_brick.rb +16 -0
  20. data/app/models/kuhsaft/accordion_item_brick.rb +22 -0
  21. data/app/models/kuhsaft/brick.rb +85 -0
  22. data/app/models/kuhsaft/brick_type.rb +7 -0
  23. data/app/models/kuhsaft/cms.rb +7 -0
  24. data/app/models/kuhsaft/cms/admin.rb +20 -0
  25. data/app/models/kuhsaft/column_brick.rb +23 -0
  26. data/app/models/kuhsaft/image_brick.rb +19 -0
  27. data/app/models/kuhsaft/image_size.rb +52 -0
  28. data/app/models/kuhsaft/link_brick.rb +19 -0
  29. data/app/models/kuhsaft/page.rb +83 -101
  30. data/app/models/kuhsaft/partition.rb +18 -0
  31. data/app/models/kuhsaft/placeholder_brick.rb +11 -0
  32. data/app/models/kuhsaft/slider_brick.rb +16 -0
  33. data/app/models/kuhsaft/text_brick.rb +9 -0
  34. data/app/models/kuhsaft/two_column_brick.rb +50 -0
  35. data/app/models/kuhsaft/video_brick.rb +20 -0
  36. data/app/uploaders/kuhsaft/asset_uploader.rb +2 -2
  37. data/app/uploaders/kuhsaft/image_brick_image_uploader.rb +63 -0
  38. data/app/views/kuhsaft/accordion_bricks/_accordion_brick.html.haml +3 -0
  39. data/app/{assets/stylesheets/kuhsaft/cms/base/partials/_forms.css.sass → views/kuhsaft/accordion_bricks/accordion_brick/_edit.html.haml} +0 -0
  40. data/app/views/kuhsaft/accordion_item_bricks/_accordion_item_brick.html.haml +8 -0
  41. data/app/views/kuhsaft/accordion_item_bricks/accordion_item_brick/_edit.html.haml +1 -0
  42. data/app/views/kuhsaft/cms/admin/_brick_type_dropdown.html.haml +10 -0
  43. data/app/views/kuhsaft/cms/admin/_content_language_switch.html.haml +7 -0
  44. data/app/views/kuhsaft/cms/admin/_empty_state.html.haml +5 -0
  45. data/app/views/kuhsaft/cms/admin/_main_navigation.html.haml +6 -0
  46. data/app/views/kuhsaft/cms/assets/index.html.haml +2 -2
  47. data/app/views/kuhsaft/cms/bricks/_brick_item.html.haml +38 -0
  48. data/app/views/kuhsaft/cms/bricks/_brick_list.html.haml +4 -0
  49. data/app/views/kuhsaft/cms/bricks/create.js.haml +1 -0
  50. data/app/views/kuhsaft/cms/bricks/destroy.js.haml +7 -0
  51. data/app/views/kuhsaft/cms/bricks/update.js.haml +2 -0
  52. data/app/views/kuhsaft/cms/pages/_branch.html.haml +17 -9
  53. data/app/views/kuhsaft/cms/pages/_form.html.haml +25 -60
  54. data/app/views/kuhsaft/cms/pages/edit.html.haml +14 -8
  55. data/app/views/kuhsaft/cms/pages/index.html.haml +8 -8
  56. data/app/views/kuhsaft/cms/pages/new.html.haml +1 -10
  57. data/app/views/kuhsaft/column_bricks/_column_brick.html.haml +3 -0
  58. data/app/views/kuhsaft/{cms/page_parts/edit.html.haml → column_bricks/column_brick/_edit.html.haml} +0 -0
  59. data/app/views/kuhsaft/image_bricks/_image_brick.html.haml +9 -0
  60. data/app/views/kuhsaft/image_bricks/image_brick/_edit.html.haml +10 -0
  61. data/app/views/kuhsaft/link_bricks/_link_brick.html.haml +3 -0
  62. data/app/views/kuhsaft/link_bricks/link_brick/_edit.html.haml +3 -0
  63. data/app/views/kuhsaft/pages/show.html.haml +5 -3
  64. data/app/views/kuhsaft/placeholder_bricks/_placeholder_brick.html.haml +2 -0
  65. data/app/views/kuhsaft/placeholder_bricks/placeholder_brick/_edit.html.haml +1 -0
  66. data/app/views/kuhsaft/slider_bricks/_slider_brick.html.haml +10 -0
  67. data/app/views/kuhsaft/{cms/page_parts/index.html.haml → slider_bricks/slider_brick/_edit.html.haml} +0 -0
  68. data/app/views/kuhsaft/text_bricks/_text_brick.html.haml +12 -0
  69. data/app/views/kuhsaft/text_bricks/text_brick/_edit.html.haml +2 -0
  70. data/app/views/kuhsaft/two_column_bricks/_two_column_brick.html.haml +3 -0
  71. data/app/views/kuhsaft/two_column_bricks/two_column_brick/_childs.html.haml +5 -0
  72. data/app/views/kuhsaft/two_column_bricks/two_column_brick/_edit.html.haml +1 -0
  73. data/app/views/kuhsaft/video_bricks/_video_brick.html.haml +9 -0
  74. data/app/views/kuhsaft/video_bricks/video_brick/_edit.html.haml +8 -0
  75. data/app/views/layouts/kuhsaft/cms/application.html.haml +20 -0
  76. data/config/initializers/devise.rb +231 -0
  77. data/config/initializers/simple_form.rb +142 -0
  78. data/config/initializers/simple_form_bootstrap.rb +45 -0
  79. data/config/locales/kuhsaft.en.yml +4 -1
  80. data/config/locales/models/kuhsaft/accordion_brick/de.yml +4 -0
  81. data/config/locales/models/kuhsaft/accordion_item_brick/de.yml +7 -0
  82. data/config/locales/models/kuhsaft/column_brick/de.yml +6 -0
  83. data/config/locales/models/kuhsaft/image_brick/de.yml +10 -0
  84. data/config/locales/models/kuhsaft/image_size/de.yml +13 -0
  85. data/config/locales/models/kuhsaft/link_brick/de.yml +9 -0
  86. data/config/locales/models/kuhsaft/page/de.yml +17 -0
  87. data/config/locales/models/kuhsaft/placeholder_brick/de.yml +8 -0
  88. data/config/locales/models/kuhsaft/slider_brick/de.yml +4 -0
  89. data/config/locales/models/kuhsaft/text_brick/de.yml +8 -0
  90. data/config/locales/models/kuhsaft/two_column_brick/de.yml +7 -0
  91. data/config/locales/models/kuhsaft/video_brick/de.yml +9 -0
  92. data/config/locales/simple_form.en.yml +26 -0
  93. data/config/locales/views/kuhsaft/cms/admin/de.yml +10 -0
  94. data/config/locales/views/kuhsaft/cms/bricks/de.yml +8 -0
  95. data/config/locales/views/kuhsaft/cms/pages/de.yml +9 -0
  96. data/config/locales/views/kuhsaft/cms/video_bricks/de.yml +7 -0
  97. data/config/locales/views/kuhsaft/text_brick/de.yml +6 -0
  98. data/config/locales/views/layouts/de.yml +6 -0
  99. data/config/routes.rb +10 -11
  100. data/db/migrate/01_create_kuhsaft_pages.rb +31 -0
  101. data/db/migrate/02_create_kuhsaft_bricks.rb +23 -0
  102. data/db/migrate/03_create_kuhsaft_brick_types.rb +12 -0
  103. data/db/migrate/04_create_kuhsaft_assets.rb +10 -0
  104. data/db/migrate/05_create_kuhsaft_cms_admins.rb +46 -0
  105. data/db/migrate/06_add_template_name_to_kuhsaft_bricks.rb +7 -0
  106. data/db/seeds.rb +14 -0
  107. data/lib/generators/kuhsaft/translations/add_generator.rb +26 -0
  108. data/lib/kuhsaft.rb +8 -1
  109. data/lib/kuhsaft/brick_list.rb +71 -0
  110. data/lib/kuhsaft/engine.rb +17 -12
  111. data/lib/kuhsaft/partial_extractor.rb +21 -0
  112. data/lib/kuhsaft/translatable.rb +40 -0
  113. data/lib/kuhsaft/version.rb +1 -1
  114. data/lib/tasks/kuhsaft_tasks.rake +10 -0
  115. data/lib/templates/kuhsaft/translations/add_translation.html.erb +13 -0
  116. data/spec/dummy/Rakefile +1 -1
  117. data/spec/dummy/app/assets/javascripts/application.js +9 -3
  118. data/spec/dummy/app/assets/stylesheets/application.css +11 -5
  119. data/spec/dummy/app/controllers/application_controller.rb +0 -6
  120. data/spec/dummy/app/views/layouts/application.html.erb +1 -1
  121. data/spec/dummy/config/application.rb +24 -7
  122. data/spec/dummy/config/boot.rb +3 -2
  123. data/spec/dummy/config/database.yml +6 -3
  124. data/spec/dummy/config/environments/development.rb +8 -1
  125. data/spec/dummy/config/environments/production.rb +9 -2
  126. data/spec/dummy/config/environments/test.rb +4 -9
  127. data/spec/dummy/config/initializers/inflections.rb +5 -0
  128. data/spec/dummy/config/initializers/secret_token.rb +1 -1
  129. data/spec/dummy/config/initializers/session_store.rb +1 -1
  130. data/spec/dummy/config/initializers/wrap_parameters.rb +1 -1
  131. data/spec/dummy/config/locales/en.yml +2 -2
  132. data/spec/dummy/config/routes.rb +2 -57
  133. data/spec/dummy/db/{migrate/.gitkeep → .gitkeep} +0 -0
  134. data/spec/dummy/public/500.html +0 -1
  135. data/spec/dummy/{lib/tasks → public/stylesheets}/.gitkeep +0 -0
  136. data/spec/factories.rb +11 -17
  137. data/spec/features/cms_auth_spec.rb +9 -0
  138. data/spec/features/cms_pages_spec.rb +23 -0
  139. data/spec/helpers/kuhsaft/cms/application_helper_spec.rb +25 -0
  140. data/spec/lib/brick_list_spec.rb +39 -0
  141. data/spec/lib/engine_spec.rb +25 -0
  142. data/spec/lib/translatable_spec.rb +85 -0
  143. data/spec/models/accordion_brick_spec.rb +32 -0
  144. data/spec/models/accordion_item_brick_spec.rb +50 -0
  145. data/spec/models/asset_spec.rb +25 -23
  146. data/spec/models/brick_spec.rb +110 -0
  147. data/spec/models/cms/admin_spec.rb +26 -0
  148. data/spec/models/column_brick_spec.rb +32 -0
  149. data/spec/models/image_brick_spec.rb +36 -0
  150. data/spec/models/image_size_spec.rb +36 -0
  151. data/spec/models/link_brick_spec.rb +45 -0
  152. data/spec/models/page_spec.rb +262 -281
  153. data/spec/models/placeholder_brick_spec.rb +40 -0
  154. data/spec/models/slider_brick_spec.rb +20 -0
  155. data/spec/models/text_brick_spec.rb +14 -0
  156. data/spec/models/two_column_brick_spec.rb +72 -0
  157. data/spec/models/video_brick_spec.rb +26 -0
  158. data/spec/spec_helper.rb +60 -51
  159. data/spec/support/kuhsaft_spec_helper.rb +4 -28
  160. data/spec/support/request_macros.rb +19 -0
  161. data/vendor/assets/javascripts/redactor.min.js +12 -0
  162. data/vendor/assets/stylesheets/redactor.css +692 -0
  163. metadata +402 -346
  164. data/.gitignore +0 -19
  165. data/.rspec +0 -2
  166. data/.rvmrc +0 -47
  167. data/CHANGELOG.md +0 -81
  168. data/Gemfile +0 -2
  169. data/Guardfile +0 -25
  170. data/LICENSE +0 -7
  171. data/app/assets/images/kuhsaft/add-child-page.png +0 -0
  172. data/app/assets/images/kuhsaft/closedhand.cur +0 -0
  173. data/app/assets/images/kuhsaft/delete.png +0 -0
  174. data/app/assets/images/kuhsaft/header-bg.jpg +0 -0
  175. data/app/assets/images/kuhsaft/module-nav-tab-bg.png +0 -0
  176. data/app/assets/images/kuhsaft/openhand.cur +0 -0
  177. data/app/assets/images/kuhsaft/page-edit-icon.png +0 -0
  178. data/app/assets/images/kuhsaft/page-new-icon.png +0 -0
  179. data/app/assets/images/kuhsaft/page-part-draggable-area.png +0 -0
  180. data/app/assets/images/kuhsaft/page-tree-breadcrumb-arrow.png +0 -0
  181. data/app/assets/images/kuhsaft/pages-breadcrumb-icon.png +0 -0
  182. data/app/assets/images/kuhsaft/tab-bg.png +0 -0
  183. data/app/assets/images/kuhsaft/toggle-arrow-closed.png +0 -0
  184. data/app/assets/images/kuhsaft/toggle-arrow-open.png +0 -0
  185. data/app/assets/images/kuhsaft/wrapper-bg.png +0 -0
  186. data/app/assets/javascripts/kuhsaft/cms/backend.js +0 -34
  187. data/app/assets/javascripts/kuhsaft/cms/jquery-ui-1.8.12.custom.min.js +0 -192
  188. data/app/assets/javascripts/kuhsaft/cms/jquery.elastic.source.js +0 -161
  189. data/app/assets/javascripts/kuhsaft/cms/jquery.min.js +0 -18
  190. data/app/assets/javascripts/kuhsaft/cms/jquery_ujs.js +0 -336
  191. data/app/assets/stylesheets/kuhsaft/cms/application.css +0 -6
  192. data/app/assets/stylesheets/kuhsaft/cms/base/base.css.sass +0 -9
  193. data/app/assets/stylesheets/kuhsaft/cms/base/partials/_assets.css.sass +0 -15
  194. data/app/assets/stylesheets/kuhsaft/cms/base/partials/_buttons.css.sass +0 -34
  195. data/app/assets/stylesheets/kuhsaft/cms/base/partials/_generic.css.sass +0 -342
  196. data/app/assets/stylesheets/kuhsaft/cms/base/partials/_simple_form.css.sass +0 -76
  197. data/app/controllers/kuhsaft/cms/page_parts_controller.rb +0 -34
  198. data/app/models/kuhsaft/localized_page.rb +0 -81
  199. data/app/models/kuhsaft/page_part.rb +0 -12
  200. data/app/models/kuhsaft/page_part/content.rb +0 -76
  201. data/app/models/kuhsaft/page_part/markdown.rb +0 -8
  202. data/app/views/kuhsaft/cms/page_parts/destroy.js.haml +0 -1
  203. data/app/views/kuhsaft/cms/page_parts/new.html.haml +0 -0
  204. data/app/views/kuhsaft/cms/page_parts/show.html.haml +0 -0
  205. data/app/views/kuhsaft/cms/page_parts/update.js.haml +0 -0
  206. data/app/views/kuhsaft/page_part/markdowns/_edit_markdown.html.haml +0 -1
  207. data/app/views/kuhsaft/page_part/markdowns/_show_markdown.html.haml +0 -1
  208. data/app/views/kuhsaft/pages/index.html.haml +0 -0
  209. data/app/views/layouts/kuhsaft/admin.html.haml +0 -35
  210. data/config/initializers/generators.rb +0 -7
  211. data/config/initializers/page_parts.rb +0 -17
  212. data/kuhsaft.gemspec +0 -39
  213. data/lib/generators/kuhsaft/install/assets_generator.rb +0 -12
  214. data/lib/generators/kuhsaft/install/migrations_generator.rb +0 -43
  215. data/lib/templates/kuhsaft/install/acts_as_taggable_on_migration.rb +0 -37
  216. data/lib/templates/kuhsaft/install/add_fulltext_to_localized_page.rb +0 -9
  217. data/lib/templates/kuhsaft/install/add_page_type_to_localized_pages.rb +0 -9
  218. data/lib/templates/kuhsaft/install/add_published_at_to_localized_pages.rb +0 -9
  219. data/lib/templates/kuhsaft/install/add_tags_to_page_part_contents.rb +0 -9
  220. data/lib/templates/kuhsaft/install/add_type_to_page_part_contents.rb +0 -9
  221. data/lib/templates/kuhsaft/install/add_url_to_localized_pages.rb +0 -9
  222. data/lib/templates/kuhsaft/install/create_assets.rb +0 -12
  223. data/lib/templates/kuhsaft/install/create_kuhsaft_localized_pages.rb +0 -19
  224. data/lib/templates/kuhsaft/install/create_kuhsaft_pages.rb +0 -14
  225. data/lib/templates/kuhsaft/install/create_page_part_contents.rb +0 -14
  226. data/spec/controllers/cms_assets_controller_spec.rb +0 -26
  227. data/spec/controllers/cms_pages_controller_spec.rb +0 -65
  228. data/spec/controllers/page_parts_controller_spec.rb +0 -60
  229. data/spec/controllers/pages_controller_spec.rb +0 -30
  230. data/spec/dummy/app/assets/images/rails.png +0 -0
  231. data/spec/helpers/cms_helper_spec.rb +0 -22
  232. data/spec/helpers/pages_helper_spec.rb +0 -119
  233. data/spec/integration/navigation_spec.rb +0 -9
  234. data/spec/models/localized_page_spec.rb +0 -266
  235. data/spec/models/page_part_content_spec.rb +0 -95
  236. data/spec/models/page_part_spec.rb +0 -17
  237. data/spec/requests/cms_pages_spec.rb +0 -27
  238. data/spec/routing/assets_routing_spec.rb +0 -63
  239. data/spec/routing/page_part_routing_spec.rb +0 -70
  240. data/spec/routing/pages_routing_spec.rb +0 -74
@@ -0,0 +1,2 @@
1
+ %div{ :class => placeholder_brick.to_style_class }
2
+ = render "kuhsaft/placeholder_bricks/partials/#{placeholder_brick.template_name}" if placeholder_brick.template_name.present?
@@ -0,0 +1 @@
1
+ = form.input :template_name, :as => :select, :collection => Kuhsaft::PlaceholderBrick.available_partials, :include_blank => true
@@ -0,0 +1,10 @@
1
+ %div{ :class => slider_brick.to_style_class, :id => slider_brick.to_style_id }
2
+ .carousel-inner
3
+ - slider_brick.bricks.each do |brick|
4
+ .item{ :class => (slider_brick.bricks.first == brick ? 'active' : '')}
5
+ = render brick
6
+
7
+ %a.carousel-control.left{ :href => "##{slider_brick.to_style_id}", 'data-slide' => 'prev' }
8
+ ‹
9
+ %a.carousel-control.right{ :href => "##{slider_brick.to_style_id}", 'data-slide' => 'next' }
10
+ ›
@@ -0,0 +1,12 @@
1
+ %div{ :class => text_brick.to_style_class }
2
+ - if text_brick.read_more_text.present?
3
+ .expandable{ :id => text_brick.to_style_id }
4
+ = text_brick.text.html_safe
5
+ %a.more{ :href => '#' }
6
+ = t('.read_more')
7
+ .expandable-content.hidden
8
+ = text_brick.read_more_text.html_safe
9
+ %a.less{ :href => "##{text_brick.to_style_id}" }
10
+ = t('.read_less')
11
+ - else
12
+ = text_brick.text.html_safe
@@ -0,0 +1,2 @@
1
+ = form.input :text, :as => :text, :input_html => { :class => 'js-editor' }
2
+ = form.input :read_more_text, :as => :text, :input_html => { :class => 'js-editor' }
@@ -0,0 +1,3 @@
1
+ %div{ :class => two_column_brick.to_style_class }
2
+ - two_column_brick.bricks.each_with_index do |column_brick, idx|
3
+ = render column_brick, :column_style => Kuhsaft::Partition.style_for_index(two_column_brick.partitioning, idx)
@@ -0,0 +1,5 @@
1
+ - if brick.respond_to?(:bricks)
2
+ .row-fluid
3
+ - brick.bricks.each_with_index do |b, idx|
4
+ %div{ :class => Kuhsaft::Partition.style_for_index(brick.partitioning, idx) }
5
+ = render 'kuhsaft/cms/bricks/brick_item', :brick => b
@@ -0,0 +1 @@
1
+ = form.input :partitioning, :as => :select, :collection => Kuhsaft::TwoColumnBrick.partitionings
@@ -0,0 +1,9 @@
1
+ %div{ :class => video_brick.to_style_class }
2
+ - if video_brick.video == Kuhsaft::VideoBrick::YOUTUBE
3
+ %video.sublime{ 'data-youtube-id' => video_brick.href, 'data-settings' => 'autoresize:fit', :preload => 'none' }
4
+ - elsif video_brick.video == Kuhsaft::VideoBrick::VIMEO || video_brick.video == Kuhsaft::VideoBrick::EXTERNAL
5
+ %video.sublime{ 'data-settings' => 'autoresize:fit', :preload => 'none' }
6
+ %source{ :src => video_brick.href }
7
+ - else
8
+ - if video_brick.embed_src.present?
9
+ = video_brick.embed_src.html_safe
@@ -0,0 +1,8 @@
1
+ - if brick.errors.any?
2
+ .alert.alert-error
3
+ = t('.any_source_error')
4
+
5
+ = form.input :video, :collection => Kuhsaft::VideoBrick.source_types
6
+ = form.input :href, :as => :string, :input_html => { :class => 'span6' }
7
+ %hr
8
+ = form.input :embed_src, :as => :text, :input_html => { :class => 'span6', :rows => 5 }, :hint => t('.embed_src_optional')
@@ -0,0 +1,20 @@
1
+ !!!
2
+ %html
3
+ %head
4
+ %meta{ charset: "utf-8" }
5
+ %title Kuhsaft CMS
6
+ = stylesheet_link_tag 'kuhsaft/cms/application.css', :media => 'screen, projection'
7
+ = csrf_meta_tag
8
+
9
+ %body{ :class => "#{controller_name}" }
10
+ .navbar.navbar-fixed-top
11
+ .navbar-inner
12
+ .container
13
+ = render 'main_navigation'
14
+
15
+ #toolbar
16
+ .container.cms
17
+ .row-fluid
18
+ .span-12
19
+ = yield
20
+ = javascript_include_tag 'kuhsaft/cms/application.js'
@@ -0,0 +1,231 @@
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
+ # ==> Mailer Configuration
5
+ # Configure the e-mail address which will be shown in Devise::Mailer,
6
+ # note that it will be overwritten if you use your own mailer class with default "from" parameter.
7
+ config.mailer_sender = "please-change-me-at-config-initializers-devise@example.com"
8
+
9
+ # Configure the class responsible to send e-mails.
10
+ # config.mailer = "Devise::Mailer"
11
+
12
+ # ==> ORM configuration
13
+ # Load and configure the ORM. Supports :active_record (default) and
14
+ # :mongoid (bson_ext recommended) by default. Other ORMs may be
15
+ # available as additional gems.
16
+ require 'devise/orm/active_record'
17
+
18
+ # ==> Configuration for any authentication mechanism
19
+ # Configure which keys are used when authenticating a user. The default is
20
+ # just :email. You can configure it to use [:username, :subdomain], so for
21
+ # authenticating a user, both parameters are required. Remember that those
22
+ # parameters are used only when authenticating and not when retrieving from
23
+ # session. If you need permissions, you should implement that in a before filter.
24
+ # You can also supply a hash where the value is a boolean determining whether
25
+ # or not authentication should be aborted when the value is not present.
26
+ # config.authentication_keys = [ :email ]
27
+
28
+ # Configure parameters from the request object used for authentication. Each entry
29
+ # given should be a request method and it will automatically be passed to the
30
+ # find_for_authentication method and considered in your model lookup. For instance,
31
+ # if you set :request_keys to [:subdomain], :subdomain will be used on authentication.
32
+ # The same considerations mentioned for authentication_keys also apply to request_keys.
33
+ # config.request_keys = []
34
+
35
+ # Configure which authentication keys should be case-insensitive.
36
+ # These keys will be downcased upon creating or modifying a user and when used
37
+ # to authenticate or find a user. Default is :email.
38
+ config.case_insensitive_keys = [ :email ]
39
+
40
+ # Configure which authentication keys should have whitespace stripped.
41
+ # These keys will have whitespace before and after removed upon creating or
42
+ # modifying a user and when used to authenticate or find a user. Default is :email.
43
+ config.strip_whitespace_keys = [ :email ]
44
+
45
+ # Tell if authentication through request.params is enabled. True by default.
46
+ # It can be set to an array that will enable params authentication only for the
47
+ # given strategies, for example, `config.params_authenticatable = [:database]` will
48
+ # enable it only for database (email + password) authentication.
49
+ # config.params_authenticatable = true
50
+
51
+ # Tell if authentication through HTTP Basic Auth is enabled. False by default.
52
+ # It can be set to an array that will enable http authentication only for the
53
+ # given strategies, for example, `config.http_authenticatable = [:token]` will
54
+ # enable it only for token authentication.
55
+ # config.http_authenticatable = false
56
+
57
+ # If http headers should be returned for AJAX requests. True by default.
58
+ # config.http_authenticatable_on_xhr = true
59
+
60
+ # The realm used in Http Basic Authentication. "Application" by default.
61
+ # config.http_authentication_realm = "Application"
62
+
63
+ # It will change confirmation, password recovery and other workflows
64
+ # to behave the same regardless if the e-mail provided was right or wrong.
65
+ # Does not affect registerable.
66
+ # config.paranoid = true
67
+
68
+ # By default Devise will store the user in session. You can skip storage for
69
+ # :http_auth and :token_auth by adding those symbols to the array below.
70
+ # Notice that if you are skipping storage for all authentication paths, you
71
+ # may want to disable generating routes to Devise's sessions controller by
72
+ # passing :skip => :sessions to `devise_for` in your config/routes.rb
73
+ config.skip_session_storage = [:http_auth]
74
+
75
+ # ==> Configuration for :database_authenticatable
76
+ # For bcrypt, this is the cost for hashing the password and defaults to 10. If
77
+ # using other encryptors, it sets how many times you want the password re-encrypted.
78
+ #
79
+ # Limiting the stretches to just one in testing will increase the performance of
80
+ # your test suite dramatically. However, it is STRONGLY RECOMMENDED to not use
81
+ # a value less than 10 in other environments.
82
+ config.stretches = Rails.env.test? ? 1 : 10
83
+
84
+ # Setup a pepper to generate the encrypted password.
85
+ # config.pepper = "2384ca9bc8766c6b40e6b055c0e9244680c06e48db1aaf3c281c0d4974bd177b51aa696c92743fb5e32d138d7945db111fac9c570d1550a1fdaf5f55a721673a"
86
+
87
+ # ==> Configuration for :confirmable
88
+ # A period that the user is allowed to access the website even without
89
+ # confirming his account. For instance, if set to 2.days, the user will be
90
+ # able to access the website for two days without confirming his account,
91
+ # access will be blocked just in the third day. Default is 0.days, meaning
92
+ # the user cannot access the website without confirming his account.
93
+ # config.allow_unconfirmed_access_for = 2.days
94
+
95
+ # If true, requires any email changes to be confirmed (exactly the same way as
96
+ # initial account confirmation) to be applied. Requires additional unconfirmed_email
97
+ # db field (see migrations). Until confirmed new email is stored in
98
+ # unconfirmed email column, and copied to email column on successful confirmation.
99
+ config.reconfirmable = true
100
+
101
+ # Defines which key will be used when confirming an account
102
+ # config.confirmation_keys = [ :email ]
103
+
104
+ # ==> Configuration for :rememberable
105
+ # The time the user will be remembered without asking for credentials again.
106
+ # config.remember_for = 2.weeks
107
+
108
+ # If true, extends the user's remember period when remembered via cookie.
109
+ # config.extend_remember_period = false
110
+
111
+ # Options to be passed to the created cookie. For instance, you can set
112
+ # :secure => true in order to force SSL only cookies.
113
+ # config.rememberable_options = {}
114
+
115
+ # ==> Configuration for :validatable
116
+ # Range for password length. Default is 6..128.
117
+ # config.password_length = 6..128
118
+
119
+ # Email regex used to validate email formats. It simply asserts that
120
+ # an one (and only one) @ exists in the given string. This is mainly
121
+ # to give user feedback and not to assert the e-mail validity.
122
+ # config.email_regexp = /\A[^@]+@[^@]+\z/
123
+
124
+ # ==> Configuration for :timeoutable
125
+ # The time you want to timeout the user session without activity. After this
126
+ # time the user will be asked for credentials again. Default is 30 minutes.
127
+ # config.timeout_in = 30.minutes
128
+
129
+ # If true, expires auth token on session timeout.
130
+ # config.expire_auth_token_on_timeout = false
131
+
132
+ # ==> Configuration for :lockable
133
+ # Defines which strategy will be used to lock an account.
134
+ # :failed_attempts = Locks an account after a number of failed attempts to sign in.
135
+ # :none = No lock strategy. You should handle locking by yourself.
136
+ # config.lock_strategy = :failed_attempts
137
+
138
+ # Defines which key will be used when locking and unlocking an account
139
+ # config.unlock_keys = [ :email ]
140
+
141
+ # Defines which strategy will be used to unlock an account.
142
+ # :email = Sends an unlock link to the user email
143
+ # :time = Re-enables login after a certain amount of time (see :unlock_in below)
144
+ # :both = Enables both strategies
145
+ # :none = No unlock strategy. You should handle unlocking by yourself.
146
+ # config.unlock_strategy = :both
147
+
148
+ # Number of authentication tries before locking an account if lock_strategy
149
+ # is failed attempts.
150
+ # config.maximum_attempts = 20
151
+
152
+ # Time interval to unlock the account if :time is enabled as unlock_strategy.
153
+ # config.unlock_in = 1.hour
154
+
155
+ # ==> Configuration for :recoverable
156
+ #
157
+ # Defines which key will be used when recovering the password for an account
158
+ # config.reset_password_keys = [ :email ]
159
+
160
+ # Time interval you can reset your password with a reset password key.
161
+ # Don't put a too small interval or your users won't have the time to
162
+ # change their passwords.
163
+ config.reset_password_within = 6.hours
164
+
165
+ # ==> Configuration for :encryptable
166
+ # Allow you to use another encryption algorithm besides bcrypt (default). You can use
167
+ # :sha1, :sha512 or encryptors from others authentication tools as :clearance_sha1,
168
+ # :authlogic_sha512 (then you should set stretches above to 20 for default behavior)
169
+ # and :restful_authentication_sha1 (then you should set stretches to 10, and copy
170
+ # REST_AUTH_SITE_KEY to pepper)
171
+ # config.encryptor = :sha512
172
+
173
+ # ==> Configuration for :token_authenticatable
174
+ # Defines name of the authentication token params key
175
+ # config.token_authentication_key = :auth_token
176
+
177
+ # ==> Scopes configuration
178
+ # Turn scoped views on. Before rendering "sessions/new", it will first check for
179
+ # "users/sessions/new". It's turned off by default because it's slower if you
180
+ # are using only default views.
181
+ # config.scoped_views = false
182
+
183
+ # Configure the default scope given to Warden. By default it's the first
184
+ # devise role declared in your routes (usually :user).
185
+ # config.default_scope = :user
186
+
187
+ # Set this configuration to false if you want /users/sign_out to sign out
188
+ # only the current scope. By default, Devise signs out all scopes.
189
+ # config.sign_out_all_scopes = true
190
+
191
+ # ==> Navigation configuration
192
+ # Lists the formats that should be treated as navigational. Formats like
193
+ # :html, should redirect to the sign in page when the user does not have
194
+ # access, but formats like :xml or :json, should return 401.
195
+ #
196
+ # If you have any extra navigational formats, like :iphone or :mobile, you
197
+ # should add them to the navigational formats lists.
198
+ #
199
+ # The "*/*" below is required to match Internet Explorer requests.
200
+ # config.navigational_formats = ["*/*", :html]
201
+
202
+ # The default HTTP method used to sign out a resource. Default is :delete.
203
+ config.sign_out_via = :delete
204
+
205
+ # ==> OmniAuth
206
+ # Add a new OmniAuth provider. Check the wiki for more information on setting
207
+ # up on your models and hooks.
208
+ # config.omniauth :github, 'APP_ID', 'APP_SECRET', :scope => 'user,public_repo'
209
+
210
+ # ==> Warden configuration
211
+ # If you want to use other strategies, that are not supported by Devise, or
212
+ # change the failure app, you can configure them inside the config.warden block.
213
+ #
214
+ # config.warden do |manager|
215
+ # manager.intercept_401 = false
216
+ # manager.default_strategies(:scope => :user).unshift :some_external_strategy
217
+ # end
218
+
219
+ # ==> Mountable engine configurations
220
+ # When using Devise inside an engine, let's call it `MyEngine`, and this engine
221
+ # is mountable, there are some extra configurations to be taken into account.
222
+ # The following options are available, assuming the engine is mounted as:
223
+ #
224
+ # mount MyEngine, at: "/my_engine"
225
+ #
226
+ config.router_name = :kuhsaft
227
+ #
228
+ # When using omniauth, Devise cannot automatically set Omniauth path,
229
+ # so you need to do it manually. For the users scope, it would be:
230
+ # config.omniauth_path_prefix = "/my_engine/users/auth"
231
+ end
@@ -0,0 +1,142 @@
1
+ # Use this setup block to configure all options available in SimpleForm.
2
+ SimpleForm.setup do |config|
3
+ # Wrappers are used by the form builder to generate a
4
+ # complete input. You can remove any component from the
5
+ # wrapper, change the order or even add your own to the
6
+ # stack. The options given below are used to wrap the
7
+ # whole input.
8
+ config.wrappers :default, :class => :input,
9
+ :hint_class => :field_with_hint, :error_class => :field_with_errors do |b|
10
+ ## Extensions enabled by default
11
+ # Any of these extensions can be disabled for a
12
+ # given input by passing: `f.input EXTENSION_NAME => false`.
13
+ # You can make any of these extensions optional by
14
+ # renaming `b.use` to `b.optional`.
15
+
16
+ # Determines whether to use HTML5 (:email, :url, ...)
17
+ # and required attributes
18
+ b.use :html5
19
+
20
+ # Calculates placeholders automatically from I18n
21
+ # You can also pass a string as f.input :placeholder => "Placeholder"
22
+ b.use :placeholder
23
+
24
+ ## Optional extensions
25
+ # They are disabled unless you pass `f.input EXTENSION_NAME => :lookup`
26
+ # to the input. If so, they will retrieve the values from the model
27
+ # if any exists. If you want to enable the lookup for any of those
28
+ # extensions by default, you can change `b.optional` to `b.use`.
29
+
30
+ # Calculates maxlength from length validations for string inputs
31
+ b.optional :maxlength
32
+
33
+ # Calculates pattern from format validations for string inputs
34
+ b.optional :pattern
35
+
36
+ # Calculates min and max from length validations for numeric inputs
37
+ b.optional :min_max
38
+
39
+ # Calculates readonly automatically from readonly attributes
40
+ b.optional :readonly
41
+
42
+ ## Inputs
43
+ b.use :label_input
44
+ b.use :hint, :wrap_with => { :tag => :span, :class => :hint }
45
+ b.use :error, :wrap_with => { :tag => :span, :class => :error }
46
+ end
47
+
48
+ # The default wrapper to be used by the FormBuilder.
49
+ config.default_wrapper = :default
50
+
51
+ # Define the way to render check boxes / radio buttons with labels.
52
+ # Defaults to :nested for bootstrap config.
53
+ # :inline => input + label
54
+ # :nested => label > input
55
+ config.boolean_style = :nested
56
+
57
+ # Default class for buttons
58
+ config.button_class = 'btn'
59
+
60
+ # Method used to tidy up errors. Specify any Rails Array method.
61
+ # :first lists the first message for each field.
62
+ # Use :to_sentence to list all errors for each field.
63
+ # config.error_method = :first
64
+
65
+ # Default tag used for error notification helper.
66
+ config.error_notification_tag = :div
67
+
68
+ # CSS class to add for error notification helper.
69
+ config.error_notification_class = 'alert alert-error'
70
+
71
+ # ID to add for error notification helper.
72
+ # config.error_notification_id = nil
73
+
74
+ # Series of attempts to detect a default label method for collection.
75
+ # config.collection_label_methods = [ :to_label, :name, :title, :to_s ]
76
+
77
+ # Series of attempts to detect a default value method for collection.
78
+ # config.collection_value_methods = [ :id, :to_s ]
79
+
80
+ # You can wrap a collection of radio/check boxes in a pre-defined tag, defaulting to none.
81
+ # config.collection_wrapper_tag = nil
82
+
83
+ # You can define the class to use on all collection wrappers. Defaulting to none.
84
+ # config.collection_wrapper_class = nil
85
+
86
+ # You can wrap each item in a collection of radio/check boxes with a tag,
87
+ # defaulting to :span. Please note that when using :boolean_style = :nested,
88
+ # SimpleForm will force this option to be a label.
89
+ # config.item_wrapper_tag = :span
90
+
91
+ # You can define a class to use in all item wrappers. Defaulting to none.
92
+ # config.item_wrapper_class = nil
93
+
94
+ # How the label text should be generated altogether with the required text.
95
+ # config.label_text = lambda { |label, required| "#{required} #{label}" }
96
+
97
+ # You can define the class to use on all labels. Default is nil.
98
+ config.label_class = 'control-label'
99
+
100
+ # You can define the class to use on all forms. Default is simple_form.
101
+ # config.form_class = :simple_form
102
+
103
+ # You can define which elements should obtain additional classes
104
+ # config.generate_additional_classes_for = [:wrapper, :label, :input]
105
+
106
+ # Whether attributes are required by default (or not). Default is true.
107
+ # config.required_by_default = true
108
+
109
+ # Tell browsers whether to use default HTML5 validations (novalidate option).
110
+ # Default is enabled.
111
+ config.browser_validations = false
112
+
113
+ # Collection of methods to detect if a file type was given.
114
+ # config.file_methods = [ :mounted_as, :file?, :public_filename ]
115
+
116
+ # Custom mappings for input types. This should be a hash containing a regexp
117
+ # to match as key, and the input type that will be used when the field name
118
+ # matches the regexp as value.
119
+ # config.input_mappings = { /count/ => :integer }
120
+
121
+ # Custom wrappers for input types. This should be a hash containing an input
122
+ # type as key and the wrapper that will be used for all inputs with specified type.
123
+ # config.wrapper_mappings = { :string => :prepend }
124
+
125
+ # Default priority for time_zone inputs.
126
+ # config.time_zone_priority = nil
127
+
128
+ # Default priority for country inputs.
129
+ # config.country_priority = nil
130
+
131
+ # Default size for text inputs.
132
+ # config.default_input_size = 50
133
+
134
+ # When false, do not use translations for labels.
135
+ # config.translate_labels = true
136
+
137
+ # Automatically discover new inputs in Rails' autoload path.
138
+ # config.inputs_discovery = true
139
+
140
+ # Cache SimpleForm inputs discovery
141
+ # config.cache_discovery = !Rails.env.development?
142
+ end