adminsite 2.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (115) hide show
  1. checksums.yaml +7 -0
  2. data/Gemfile +12 -0
  3. data/Gemfile.lock +209 -0
  4. data/MIT-LICENSE +20 -0
  5. data/README.markdown +122 -0
  6. data/Rakefile +14 -0
  7. data/USAGE +18 -0
  8. data/VERSION +1 -0
  9. data/app/admin_configs/adminsite/adminsite_admin_user_admin_config.rb +43 -0
  10. data/app/admin_configs/adminsite/adminsite_file_asset_admin_config.rb +32 -0
  11. data/app/admin_configs/adminsite/adminsite_page_admin_config.rb +46 -0
  12. data/app/admin_configs/adminsite/adminsite_page_layout_admin_config.rb +31 -0
  13. data/app/assets/images/adminsite/admin/accept.png +0 -0
  14. data/app/assets/images/adminsite/admin/add.png +0 -0
  15. data/app/assets/images/adminsite/admin/arrow_left.png +0 -0
  16. data/app/assets/images/adminsite/admin/arrow_refresh.png +0 -0
  17. data/app/assets/images/adminsite/admin/arrow_up.png +0 -0
  18. data/app/assets/images/adminsite/admin/cross.png +0 -0
  19. data/app/assets/images/adminsite/admin/logo.gif +0 -0
  20. data/app/assets/images/adminsite/admin/logo.png +0 -0
  21. data/app/assets/images/adminsite/admin/magnifier.png +0 -0
  22. data/app/assets/images/adminsite/admin/newspaper_add.png +0 -0
  23. data/app/assets/images/adminsite/admin/newspaper_delete.png +0 -0
  24. data/app/assets/images/adminsite/admin/openid-icon-small.gif +0 -0
  25. data/app/assets/images/adminsite/admin/page_white_magnify.png +0 -0
  26. data/app/assets/images/adminsite/admin/pencil.png +0 -0
  27. data/app/assets/images/adminsite/admin/rails.png +0 -0
  28. data/app/assets/images/adminsite/admin/reorder.gif +0 -0
  29. data/app/assets/images/adminsite/admin/spinner.gif +0 -0
  30. data/app/assets/javascripts/adminsite/admin.js +13 -0
  31. data/app/assets/javascripts/adminsite/admin/code_editor.js.coffee +40 -0
  32. data/app/assets/javascripts/adminsite/admin/hide_and_show.js +26 -0
  33. data/app/assets/stylesheets/adminsite/admin.scss +16 -0
  34. data/app/assets/stylesheets/adminsite/admin/base.scss +521 -0
  35. data/app/assets/stylesheets/adminsite/admin/code_editor.scss +29 -0
  36. data/app/assets/stylesheets/adminsite/admin/pagination.scss +28 -0
  37. data/app/controllers/adminsite/admin/adminsite_admin_users_controller.rb +21 -0
  38. data/app/controllers/adminsite/admin/adminsite_file_assets_controller.rb +57 -0
  39. data/app/controllers/adminsite/admin/adminsite_page_layouts_controller.rb +41 -0
  40. data/app/controllers/adminsite/admin/adminsite_pages_controller.rb +40 -0
  41. data/app/controllers/adminsite/admin/base_controller.rb +16 -0
  42. data/app/controllers/adminsite/admin/crud_controller.rb +27 -0
  43. data/app/controllers/adminsite/admin/iframe_controller.rb +28 -0
  44. data/app/controllers/adminsite/admin/resources_controller.rb +148 -0
  45. data/app/controllers/adminsite/admin_application_controller.rb +9 -0
  46. data/app/controllers/adminsite/admin_user_sessions_controller.rb +5 -0
  47. data/app/controllers/adminsite/contents_controller.rb +88 -0
  48. data/app/helpers/admin/adminsite_application_helper.rb +174 -0
  49. data/app/helpers/admin_application_helper.rb +3 -0
  50. data/app/models/adminsite/admin_config/base.rb +100 -0
  51. data/app/models/adminsite/admin_user.rb +10 -0
  52. data/app/models/adminsite/file_asset.rb +22 -0
  53. data/app/models/adminsite/page.rb +59 -0
  54. data/app/models/adminsite/page_layout.rb +9 -0
  55. data/app/views/adminsite/admin/adminsite_file_assets/index.html.haml +39 -0
  56. data/app/views/adminsite/admin/adminsite_page_layouts/edit.html.haml +5 -0
  57. data/app/views/adminsite/admin/adminsite_page_layouts/index.html.haml +9 -0
  58. data/app/views/adminsite/admin/adminsite_page_layouts/new.html.haml +5 -0
  59. data/app/views/adminsite/admin/adminsite_pages/edit.html.haml +5 -0
  60. data/app/views/adminsite/admin/adminsite_pages/index.html.haml +16 -0
  61. data/app/views/adminsite/admin/adminsite_pages/new.html.haml +5 -0
  62. data/app/views/adminsite/admin/crud/index.html.haml +4 -0
  63. data/app/views/adminsite/admin/crud/show.html.haml +15 -0
  64. data/app/views/adminsite/admin/iframe/index.haml +14 -0
  65. data/app/views/adminsite/admin/resources/_form.haml +6 -0
  66. data/app/views/adminsite/admin/resources/_list.haml +18 -0
  67. data/app/views/adminsite/admin/resources/_search_form.html.haml +41 -0
  68. data/app/views/adminsite/admin/resources/edit.haml +13 -0
  69. data/app/views/adminsite/admin/resources/index.haml +13 -0
  70. data/app/views/adminsite/admin/resources/new.haml +14 -0
  71. data/app/views/adminsite/admin/resources/show.haml +15 -0
  72. data/app/views/adminsite/admin/shared/_admin_menu.html.haml +6 -0
  73. data/app/views/adminsite/admin/shared/_content_menu.html.haml +4 -0
  74. data/app/views/adminsite/admin/shared/_page_assets_list.html.haml +6 -0
  75. data/app/views/adminsite/admin/shared/_syntax_help.html.haml +24 -0
  76. data/app/views/adminsite/admin_user_sessions/new.html.haml +14 -0
  77. data/app/views/layouts/adminsite/admin.html.haml +31 -0
  78. data/config/initializers/adminsite_constants.rb +2 -0
  79. data/config/initializers/assets.rb +7 -0
  80. data/config/initializers/devise.rb +265 -0
  81. data/config/initializers/filter_parameter_logging.rb +4 -0
  82. data/config/initializers/paperclip.rb +15 -0
  83. data/config/initializers/time_formats.rb +1 -0
  84. data/config/locales/da.devise.yaml +57 -0
  85. data/config/locales/da.yaml +199 -0
  86. data/config/locales/en.devise.yaml +60 -0
  87. data/config/locales/en.yaml +205 -0
  88. data/config/routes.rb +17 -0
  89. data/db/migrate/20101007000000_create_admin.rb +59 -0
  90. data/db/migrate/20101007000001_create_cms_tables.rb +39 -0
  91. data/lib/adminsite.rb +28 -0
  92. data/lib/adminsite/configuration.rb +15 -0
  93. data/lib/adminsite/engine.rb +30 -0
  94. data/lib/adminsite/liquid/tags/asset.rb +70 -0
  95. data/lib/adminsite/version.rb +3 -0
  96. data/lib/generators/adminsite/add_dashboard/add_dashboard_generator.rb +34 -0
  97. data/lib/generators/adminsite/add_dashboard/templates/controllers/admin_dashboard_controller.rb +13 -0
  98. data/lib/generators/adminsite/add_dashboard/templates/views/index.html.haml +6 -0
  99. data/lib/generators/adminsite/add_iframe/add_iframe_generator.rb +42 -0
  100. data/lib/generators/adminsite/add_iframe/templates/controllers/admin_iframe_controller.rb +16 -0
  101. data/lib/generators/adminsite/add_resource/USAGE +0 -0
  102. data/lib/generators/adminsite/add_resource/add_resource_generator.rb +40 -0
  103. data/lib/generators/adminsite/add_resource/templates/admin_configs/resource_admin_config.rb +47 -0
  104. data/lib/generators/adminsite/add_resource/templates/controllers/admin_resource_controller.rb +19 -0
  105. data/lib/generators/adminsite/install/USAGE +13 -0
  106. data/lib/generators/adminsite/install/install_generator.rb +51 -0
  107. data/lib/generators/adminsite/install/templates/assets/adminsite.js +17 -0
  108. data/lib/generators/adminsite/install/templates/assets/adminsite.scss +14 -0
  109. data/lib/generators/adminsite/install/templates/config/locales/adminsite.da.yml +4 -0
  110. data/lib/generators/adminsite/install/templates/config/locales/adminsite.en.yml +6 -0
  111. data/lib/generators/adminsite/install/templates/recipes/application.rb +18 -0
  112. data/lib/generators/adminsite/install/templates/views/_admin_menu.html.haml +8 -0
  113. data/lib/recipes/adminsite.rb +82 -0
  114. data/lib/tasks/adminsite.rake +147 -0
  115. metadata +384 -0
@@ -0,0 +1,9 @@
1
+ class Adminsite::PageLayout < ActiveRecord::Base
2
+ has_many :pages
3
+ validates_presence_of :title
4
+
5
+ def render(args)
6
+ Liquid::Template.parse(self.body.to_s).render(args.stringify_keys)
7
+ end
8
+
9
+ end
@@ -0,0 +1,39 @@
1
+ = error_messages_for @file_asset
2
+
3
+ = form_for(@file_asset, :url => admin_adminsite_file_assets_path(admin_menu: 'CMS'), :html => { :multipart => true }) do |f|
4
+ %p
5
+ %b New file asset
6
+ = f.file_field :attachment, :multiple => ''
7
+ %p
8
+ = submit_tag 'Add'
9
+
10
+ = render :partial => 'adminsite/admin/resources/search_form'
11
+
12
+ = render :partial => 'adminsite/admin/resources/list'
13
+
14
+ //- content_for :header_left do
15
+ // Listing adminsite/file assets
16
+ //
17
+ //= error_messages_for @file_asset
18
+ //
19
+ //= form_for(@file_asset, :url => admin_adminsite_file_assets_path, :html => { :multipart => true }) do |f|
20
+ // %p
21
+ // %b New file asset
22
+ // = f.file_field :attachment, :multiple => ''
23
+ // %p
24
+ // = submit_tag 'Add'
25
+ //
26
+ //- if @resources.any?
27
+ // %table
28
+ // %tr
29
+ // %th
30
+ // %th Filename
31
+ // %th Last update
32
+ // %th
33
+ // - @resources.each do |asset|
34
+ // %tr
35
+ // %td.graphic= image_tag(asset.attachment.url(:original, false), style: 'max-height: 50px;')
36
+ // %td= link_to asset.attachment.url(:original, false), asset.attachment.url(:original, false)
37
+ // %td= h asset.updated_at
38
+ // %td= link_to image_tag('adminsite/admin/cross.png', :size => '16x16'), [:admin, :adminsite, asset], :confirm => 'Are you sure?', :method => ://delete
39
+ //
@@ -0,0 +1,5 @@
1
+ = render :file => 'adminsite/admin/resources/edit'
2
+
3
+ = render :partial => 'adminsite/admin/shared/syntax_help'
4
+ = render :partial => 'adminsite/admin/shared/page_assets_list'
5
+ .clear
@@ -0,0 +1,9 @@
1
+ - if Adminsite::PageLayout.any?
2
+ = render :file => 'adminsite/admin/resources/index'
3
+ - else
4
+ - content_for :header_left do
5
+ = "Listing #{label_resource_class_plural}"
6
+ - content_for :header_right do
7
+ = link_to_new "New #{label_resource_class}", admin_resource_path(nil, 'new')
8
+ There are no page layouts. Go ahead and
9
+ #{link_to 'add the first one', new_admin_adminsite_page_layout_path}.
@@ -0,0 +1,5 @@
1
+ = render :file => 'adminsite/admin/resources/new'
2
+
3
+ = render :partial => 'adminsite/admin/shared/syntax_help'
4
+ = render :partial => 'adminsite/admin/shared/page_assets_list'
5
+
@@ -0,0 +1,5 @@
1
+ = render :file => 'adminsite/admin/resources/edit'
2
+
3
+ = render :partial => 'adminsite/admin/shared/syntax_help'
4
+ = render :partial => 'adminsite/admin/shared/page_assets_list'
5
+ .clear
@@ -0,0 +1,16 @@
1
+ - if Adminsite::Page.any?
2
+ = render :file => 'adminsite/admin/resources/index'
3
+ - elsif Adminsite::PageLayout.exists?
4
+ - content_for :header_left do
5
+ = "Listing #{label_resource_class_plural}"
6
+ - content_for :header_right do
7
+ = link_to_new "New #{label_resource_class}", admin_resource_path(nil, 'new')
8
+ There are no pages. Go ahead and
9
+ #{link_to 'add the first one', new_admin_adminsite_page_path}.
10
+ - else
11
+ - content_for :header_left do
12
+ = "Listing #{label_resource_class_plural}"
13
+ - content_for :header_right do
14
+ = link_to_new "New #{label_resource_class}", admin_resource_path(nil, 'new')
15
+ You should #{link_to 'add a page layout', new_admin_adminsite_page_layout_path}
16
+ before adding your first page.
@@ -0,0 +1,5 @@
1
+ = render :file => 'adminsite/admin/resources/new'
2
+
3
+ = render :partial => 'adminsite/admin/shared/syntax_help'
4
+ = render :partial => 'adminsite/admin/shared/page_assets_list'
5
+
@@ -0,0 +1,4 @@
1
+ - content_for :header_left do
2
+ = controller_name
3
+
4
+ please override in '/app/views/adminsite/admin/#{controller_name}/index.html.haml'
@@ -0,0 +1,15 @@
1
+ - content_for :header_left do
2
+ = controller_name
3
+ - content_for :header_right do
4
+ = link_to_back 'Back', url_for(controller: controller_name, action: :index )
5
+
6
+ please override in '/app/views/adminsite/admin/#{controller_name}/show.html.haml'
7
+
8
+ //.formtastic
9
+ // %table
10
+ // - attributes_show.each do |attr|
11
+ // %tr
12
+ // %th
13
+ // = "#{attr.to_s.titlecase}:"
14
+ // = display_resource_value(@resource, attr)
15
+
@@ -0,0 +1,14 @@
1
+ - content_for :header_left do
2
+ = @iframe_name
3
+ = @controller_name
4
+
5
+ %a{:href => @iframe_url, :style => "float: right;", :target => "_blank"} Open in new window (fullscreen)
6
+ %iframe{:height => '600px', :src => @iframe_url, :width => '100%'}
7
+ :javascript
8
+ $('iframe').load(function(){
9
+ var iframeHeight = $('iframe').contents().find('body').height();
10
+ $('iframe').css({height:iframeHeight});
11
+ });
12
+
13
+
14
+
@@ -0,0 +1,6 @@
1
+ = f.inputs do
2
+ - resource_admin_config.attributes_edit.each do |attr|
3
+ - if attr.is_a?(Hash)
4
+ = f.input attr.keys.first, attr.values.first
5
+ - else
6
+ = f.input attr
@@ -0,0 +1,18 @@
1
+ %table
2
+ %tr
3
+ %th
4
+ - resource_admin_config.attributes_index.each do |attr|
5
+ %th= sort_link(@q, attr)
6
+ - resource_admin_config.default_member_actions.each do |action|
7
+ %th
8
+ - @resources.each do |resource|
9
+ %tr{onClick: 'selectedRow(this);'}
10
+ %td.resource_selection_cell
11
+ = check_box_tag 'collection_selection[]', resource.id, false, :class => 'collection_selection'
12
+ - resource_admin_config.attributes_index.each do |attr|
13
+ = display_resource_value(resource, attr)
14
+ - resource_admin_config.default_member_actions.each do |action|
15
+ %td= send("link_to_#{action}", resource)
16
+
17
+ = paginate(@resources, :window => 2)
18
+ %br
@@ -0,0 +1,41 @@
1
+ - if resource_admin_config.attributes_search.any?
2
+ .search_form
3
+ - show_search_form = @ransack_params[:q].present?
4
+ %a#show{onClick: 'showSearchForm();', style: "#{'display:none' if show_search_form}" } Show Filters
5
+ %a#hide{onClick: 'hideSearchForm();', style: "#{'display:none' unless show_search_form}" } Hide Filters
6
+ = search_form_for(@q, :url => admin_resource_path(nil), method: :get, html: { style: "#{'display:none' unless show_search_form}"} ) do |f|
7
+ = hidden_field_tag :admin_menu, params[:admin_menu]
8
+ %div{id: "#{controller_name}-search"}
9
+ %ul
10
+ - resource_admin_config.attributes_search.each do |search_attr|
11
+ - if (column = column_of_attr(search_attr)).present?
12
+ %li
13
+ - p_value = (@ransack_params[:p] || {})[search_attr]
14
+ - input_type = input_type_of_column(column)
15
+ - predicates = ransack_predicate_input_type(input_type)
16
+ - show_predicate_select = predicates.count > 1
17
+ - field_value = (@ransack_params[:q] || {})["#{search_attr}_#{p_value}"]
18
+ = f.label("#{search_attr}")
19
+
20
+ - if show_predicate_select
21
+ - html_options = {name: "p[#{search_attr}]" , onchange: "document.getElementById('q_#{search_attr}').name = 'q[#{search_attr}_' + this.value + ']' ; "}
22
+ = f.predicate_select({:only => predicates, :selected => p_value, :compounds => false}, html_options )
23
+ - case input_type
24
+ - when :boolean
25
+ = select_tag("q[#{search_attr}_eq]", options_for_select([ "true", "false" ], field_value), include_blank: true)
26
+ - else
27
+ - if show_predicate_select
28
+ = f.search_field(search_attr, value: field_value )
29
+ :javascript
30
+ predicate_obj = document.getElementsByName('p[#{search_attr}]')[0];
31
+ predicate_obj.onchange();
32
+ - else
33
+ = f.search_field("#{search_attr}_#{predicates.first}", value: field_value )
34
+
35
+
36
+
37
+ .actions
38
+ = f.submit "Search"
39
+ = link_to "Reset" , admin_resource_path(nil)
40
+
41
+
@@ -0,0 +1,13 @@
1
+ - content_for :header_left do
2
+ = "Edit #{label_resource_class}: '#{label_resource}'"
3
+ = link_to_show @resource if resource_admin_config.default_member_actions.include?(:show)
4
+ - content_for :header_right do
5
+ = link_to_back 'Back', admin_resource_path
6
+
7
+ = error_messages_for @resource
8
+
9
+ %div{id: resource_class_underscore}
10
+ = semantic_form_for([:admin, @resource], url: admin_resource_path(@resource.id), as: resource_class_underscore, method: :put, html: { method: :put } ) do |f|
11
+ %div{id: "#{resource_class_underscore}-edit"}
12
+ = render :partial => 'form', :locals => { :f => f }
13
+ = submit_tag "Update"
@@ -0,0 +1,13 @@
1
+ - content_for :header_left do
2
+ = "Listing #{label_resource_class_plural}"
3
+ - if resource_admin_config.actions_index.any?
4
+ - content_for :header_right do
5
+ - resource_admin_config.actions_index.each do |action|
6
+ = send("link_to_#{action}", action.to_s.titlecase)
7
+ - resource_admin_config.scopes.each do |scope|
8
+ = link_to "#{scope.to_s.titlecase} (#{resource_class.send(scope).count})", "#{admin_resource_path}&scope=#{scope}"
9
+
10
+ = render :partial => 'search_form'
11
+
12
+ = render :partial => 'list'
13
+
@@ -0,0 +1,14 @@
1
+ - content_for :header_left do
2
+ = "New #{label_resource_class}"
3
+ - content_for :header_right do
4
+ = link_to_back 'Back', admin_resource_path
5
+
6
+ = error_messages_for @resource
7
+
8
+
9
+ %div{id: resource_class_underscore}
10
+ = semantic_form_for([:admin, @resource], :url => admin_resource_path, as: resource_class_underscore, namespace: resource_class_underscore ) do |f|
11
+ %div{id: "#{resource_class_underscore}-new"}
12
+ = render :partial => 'form', :locals => { :f => f }
13
+ = submit_tag "Create"
14
+
@@ -0,0 +1,15 @@
1
+ - content_for :header_left do
2
+ = "Show #{label_resource_class}: '#{label_resource}'"
3
+ = link_to_edit @resource if resource_admin_config.default_member_actions.include?(:edit)
4
+ - content_for :header_right do
5
+ = link_to_back 'Back', admin_resource_path
6
+
7
+ .formtastic
8
+ %table
9
+ - resource_admin_config.attributes_show.each do |attr|
10
+ - attr = attr.keys.first if attr.is_a?(Hash)
11
+ %tr
12
+ %th
13
+ = "#{attr.to_s.titlecase}:"
14
+ = display_resource_value(@resource, attr)
15
+
@@ -0,0 +1,6 @@
1
+ #admin_menu.menu
2
+ %ul
3
+ = yield :admin_menu
4
+ %ul
5
+ = menu_item 'Log out', destroy_adminsite_admin_user_session_path, [], 'log_out', :delete
6
+ .clearfix
@@ -0,0 +1,4 @@
1
+ #content_menu.menu
2
+ %ul
3
+ = yield :content_menu
4
+ .clearfix
@@ -0,0 +1,6 @@
1
+ - if @file_assets.present? && @file_assets.any?
2
+ #page-assets-list
3
+ %h2 Assets
4
+ %ul
5
+ - @file_assets.each do |asset|
6
+ %li= asset.attachment_file_name
@@ -0,0 +1,24 @@
1
+ #syntax-help
2
+ %h2 Liquid parameters
3
+ %p
4
+ %a{ :href => "http://www.liquidmarkup.org/", :target => "_blank" }<
5
+ Liquid template language
6
+ is available, so if you have a user
7
+ %em object
8
+ available you can do something like this:
9
+ %pre {{ user.first_name }}
10
+ Or if you have a collection of objects like
11
+ %i products
12
+ you can:
13
+ ~ "<pre>{% for product in products %}\n {{ product.title }}\n{% endfor %}</pre>"
14
+
15
+ %h2 Including assets
16
+ %p
17
+ You can include assets using this syntax:
18
+ %pre &lt;img src="{% asset logo.jpg %}" /&gt;
19
+ This requires you have uploaded a logo.jpg
20
+ %br
21
+ %strong
22
+ NOTE:
23
+ if you are uploading on Cloudfile CDN, the syntax above will
24
+ replace the path with Cloudfile url.
@@ -0,0 +1,14 @@
1
+ #login-box
2
+ = form_for resource, :as => resource_name, :url => session_path(resource_name), :html => { :id => "loginform" } do |f|
3
+ %p
4
+ %label
5
+ E-mail:
6
+ %br
7
+ = f.text_field :email, :type => 'email'
8
+ %p
9
+ %label
10
+ Password:
11
+ %br
12
+ = f.password_field :password
13
+ %p.submit
14
+ %input{ :type => "submit", :value => "Log in" }
@@ -0,0 +1,31 @@
1
+ !!!
2
+ %html{ "lang" => "en" }
3
+ %head
4
+ %meta{ "charset" => "utf-8" }
5
+ %title
6
+ Administration:
7
+ = controller.action_name.capitalize
8
+ = stylesheet_link_tag 'adminsite'
9
+ = javascript_include_tag 'adminsite'
10
+ %body.adminsite
11
+ %h1
12
+ = render :partial => 'adminsite/admin/shared/admin_menu' if current_adminsite_admin_user.present?
13
+ = render :partial => 'adminsite/admin/shared/content_menu' if current_adminsite_admin_user.present?
14
+
15
+ - if flash[:notice].present?
16
+ #flashnotice
17
+ = flash[:notice]
18
+ - if flash[:error].present? || flash[:alert].present?
19
+ #flasherror
20
+ = flash[:error]
21
+ = flash[:alert]
22
+
23
+ #header
24
+ #header_left
25
+ %h2
26
+ = yield :header_left
27
+ #header_right
28
+ = yield :header_right
29
+ .clearfix
30
+ #wrapper
31
+ = yield
@@ -0,0 +1,2 @@
1
+ module AdminsiteConstants
2
+ end
@@ -0,0 +1,7 @@
1
+ # Be sure to restart your server when you modify this file.
2
+
3
+ # Rails.application.config.assets.paths << Emoji.images_path
4
+
5
+ # Precompile additional assets.
6
+ # application.js, application.css, and all non-JS/CSS in app/assets folder are already added.
7
+ Rails.application.config.assets.precompile += %w( admin.css admin.js )
@@ -0,0 +1,265 @@
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
+ # The secret key used by Devise. Devise uses this key to generate
5
+ # random tokens. Changing this key will render invalid all existing
6
+ # confirmation, reset password and unlock tokens in the database.
7
+ # Devise will use the `secret_key_base` on Rails 4+ applications as its `secret_key`
8
+ # by default. You can change it below and use your own secret key.
9
+ # config.secret_key = '5ad3b8407ae1aae64dd5aa2337d9f45ad5e487a33c2d486bd09f53f1dd50c675fbb5683a5f33a33870d87f6eeb80d09eac888b0a0defa3f1d2777af00a91c221'
10
+
11
+ # ==> Mailer Configuration
12
+ # Configure the e-mail address which will be shown in Devise::Mailer,
13
+ # note that it will be overwritten if you use your own mailer class
14
+ # with default "from" parameter.
15
+ config.mailer_sender = 'please-change-me-at-config-initializers-devise@example.com'
16
+
17
+ # Configure the class responsible to send e-mails.
18
+ # config.mailer = 'Devise::Mailer'
19
+
20
+ # ==> ORM configuration
21
+ # Load and configure the ORM. Supports :active_record (default) and
22
+ # :mongoid (bson_ext recommended) by default. Other ORMs may be
23
+ # available as additional gems.
24
+ require 'devise/orm/active_record'
25
+
26
+ # ==> Configuration for any authentication mechanism
27
+ # Configure which keys are used when authenticating a user. The default is
28
+ # just :email. You can configure it to use [:username, :subdomain], so for
29
+ # authenticating a user, both parameters are required. Remember that those
30
+ # parameters are used only when authenticating and not when retrieving from
31
+ # session. If you need permissions, you should implement that in a before filter.
32
+ # You can also supply a hash where the value is a boolean determining whether
33
+ # or not authentication should be aborted when the value is not present.
34
+ # config.authentication_keys = [:email]
35
+
36
+ # Configure parameters from the request object used for authentication. Each entry
37
+ # given should be a request method and it will automatically be passed to the
38
+ # find_for_authentication method and considered in your model lookup. For instance,
39
+ # if you set :request_keys to [:subdomain], :subdomain will be used on authentication.
40
+ # The same considerations mentioned for authentication_keys also apply to request_keys.
41
+ # config.request_keys = []
42
+
43
+ # Configure which authentication keys should be case-insensitive.
44
+ # These keys will be downcased upon creating or modifying a user and when used
45
+ # to authenticate or find a user. Default is :email.
46
+ config.case_insensitive_keys = [:email]
47
+
48
+ # Configure which authentication keys should have whitespace stripped.
49
+ # These keys will have whitespace before and after removed upon creating or
50
+ # modifying a user and when used to authenticate or find a user. Default is :email.
51
+ config.strip_whitespace_keys = [:email]
52
+
53
+ # Tell if authentication through request.params is enabled. True by default.
54
+ # It can be set to an array that will enable params authentication only for the
55
+ # given strategies, for example, `config.params_authenticatable = [:database]` will
56
+ # enable it only for database (email + password) authentication.
57
+ # config.params_authenticatable = true
58
+
59
+ # Tell if authentication through HTTP Auth is enabled. False by default.
60
+ # It can be set to an array that will enable http authentication only for the
61
+ # given strategies, for example, `config.http_authenticatable = [:database]` will
62
+ # enable it only for database authentication. The supported strategies are:
63
+ # :database = Support basic authentication with authentication key + password
64
+ # config.http_authenticatable = false
65
+
66
+ # If 401 status code should be returned for AJAX requests. True by default.
67
+ # config.http_authenticatable_on_xhr = true
68
+
69
+ # The realm used in Http Basic Authentication. 'Application' by default.
70
+ # config.http_authentication_realm = 'Application'
71
+
72
+ # It will change confirmation, password recovery and other workflows
73
+ # to behave the same regardless if the e-mail provided was right or wrong.
74
+ # Does not affect registerable.
75
+ # config.paranoid = true
76
+
77
+ # By default Devise will store the user in session. You can skip storage for
78
+ # particular strategies by setting this option.
79
+ # Notice that if you are skipping storage for all authentication paths, you
80
+ # may want to disable generating routes to Devise's sessions controller by
81
+ # passing skip: :sessions to `devise_for` in your config/routes.rb
82
+ config.skip_session_storage = [:http_auth]
83
+
84
+ # By default, Devise cleans up the CSRF token on authentication to
85
+ # avoid CSRF token fixation attacks. This means that, when using AJAX
86
+ # requests for sign in and sign up, you need to get a new CSRF token
87
+ # from the server. You can disable this option at your own risk.
88
+ # config.clean_up_csrf_token_on_authentication = true
89
+
90
+ # ==> Configuration for :database_authenticatable
91
+ # For bcrypt, this is the cost for hashing the password and defaults to 10. If
92
+ # using other encryptors, it sets how many times you want the password re-encrypted.
93
+ #
94
+ # Limiting the stretches to just one in testing will increase the performance of
95
+ # your test suite dramatically. However, it is STRONGLY RECOMMENDED to not use
96
+ # a value less than 10 in other environments. Note that, for bcrypt (the default
97
+ # encryptor), the cost increases exponentially with the number of stretches (e.g.
98
+ # a value of 20 is already extremely slow: approx. 60 seconds for 1 calculation).
99
+ config.stretches = Rails.env.test? ? 1 : 10
100
+
101
+ # Setup a pepper to generate the encrypted password.
102
+ # config.pepper = '7560f8f6cf9930937cfdd384236fa9fe6349b1f8442602ee77896ddc13c18a591146a6caa4d016006408c44d22f361d52a814dda3e7daf2ca06f7744dde9649e'
103
+
104
+ # ==> Configuration for :confirmable
105
+ # A period that the user is allowed to access the website even without
106
+ # confirming their account. For instance, if set to 2.days, the user will be
107
+ # able to access the website for two days without confirming their account,
108
+ # access will be blocked just in the third day. Default is 0.days, meaning
109
+ # the user cannot access the website without confirming their account.
110
+ # config.allow_unconfirmed_access_for = 2.days
111
+
112
+ # A period that the user is allowed to confirm their account before their
113
+ # token becomes invalid. For example, if set to 3.days, the user can confirm
114
+ # their account within 3 days after the mail was sent, but on the fourth day
115
+ # their account can't be confirmed with the token any more.
116
+ # Default is nil, meaning there is no restriction on how long a user can take
117
+ # before confirming their account.
118
+ # config.confirm_within = 3.days
119
+
120
+ # If true, requires any email changes to be confirmed (exactly the same way as
121
+ # initial account confirmation) to be applied. Requires additional unconfirmed_email
122
+ # db field (see migrations). Until confirmed, new email is stored in
123
+ # unconfirmed_email column, and copied to email column on successful confirmation.
124
+ config.reconfirmable = true
125
+
126
+ # Defines which key will be used when confirming an account
127
+ # config.confirmation_keys = [:email]
128
+
129
+ # ==> Configuration for :rememberable
130
+ # The time the user will be remembered without asking for credentials again.
131
+ # config.remember_for = 2.weeks
132
+
133
+ # Invalidates all the remember me tokens when the user signs out.
134
+ config.expire_all_remember_me_on_sign_out = true
135
+
136
+ # If true, extends the user's remember period when remembered via cookie.
137
+ # config.extend_remember_period = false
138
+
139
+ # Options to be passed to the created cookie. For instance, you can set
140
+ # secure: true in order to force SSL only cookies.
141
+ # config.rememberable_options = {}
142
+
143
+ # ==> Configuration for :validatable
144
+ # Range for password length.
145
+ config.password_length = 8..72
146
+
147
+ # Email regex used to validate email formats. It simply asserts that
148
+ # one (and only one) @ exists in the given string. This is mainly
149
+ # to give user feedback and not to assert the e-mail validity.
150
+ # config.email_regexp = /\A[^@]+@[^@]+\z/
151
+
152
+ # ==> Configuration for :timeoutable
153
+ # The time you want to timeout the user session without activity. After this
154
+ # time the user will be asked for credentials again. Default is 30 minutes.
155
+ # config.timeout_in = 30.minutes
156
+
157
+ # If true, expires auth token on session timeout.
158
+ # config.expire_auth_token_on_timeout = false
159
+
160
+ # ==> Configuration for :lockable
161
+ # Defines which strategy will be used to lock an account.
162
+ # :failed_attempts = Locks an account after a number of failed attempts to sign in.
163
+ # :none = No lock strategy. You should handle locking by yourself.
164
+ # config.lock_strategy = :failed_attempts
165
+
166
+ # Defines which key will be used when locking and unlocking an account
167
+ # config.unlock_keys = [:email]
168
+
169
+ # Defines which strategy will be used to unlock an account.
170
+ # :email = Sends an unlock link to the user email
171
+ # :time = Re-enables login after a certain amount of time (see :unlock_in below)
172
+ # :both = Enables both strategies
173
+ # :none = No unlock strategy. You should handle unlocking by yourself.
174
+ # config.unlock_strategy = :both
175
+
176
+ # Number of authentication tries before locking an account if lock_strategy
177
+ # is failed attempts.
178
+ # config.maximum_attempts = 20
179
+
180
+ # Time interval to unlock the account if :time is enabled as unlock_strategy.
181
+ # config.unlock_in = 1.hour
182
+
183
+ # Warn on the last attempt before the account is locked.
184
+ # config.last_attempt_warning = true
185
+
186
+ # ==> Configuration for :recoverable
187
+ #
188
+ # Defines which key will be used when recovering the password for an account
189
+ # config.reset_password_keys = [:email]
190
+
191
+ # Time interval you can reset your password with a reset password key.
192
+ # Don't put a too small interval or your users won't have the time to
193
+ # change their passwords.
194
+ config.reset_password_within = 6.hours
195
+
196
+ # When set to false, does not sign a user in automatically after their password is
197
+ # reset. Defaults to true, so a user is signed in automatically after a reset.
198
+ # config.sign_in_after_reset_password = true
199
+
200
+ # ==> Configuration for :encryptable
201
+ # Allow you to use another encryption algorithm besides bcrypt (default). You can use
202
+ # :sha1, :sha512 or encryptors from others authentication tools as :clearance_sha1,
203
+ # :authlogic_sha512 (then you should set stretches above to 20 for default behavior)
204
+ # and :restful_authentication_sha1 (then you should set stretches to 10, and copy
205
+ # REST_AUTH_SITE_KEY to pepper).
206
+ #
207
+ # Require the `devise-encryptable` gem when using anything other than bcrypt
208
+ # config.encryptor = :sha512
209
+
210
+ # ==> Scopes configuration
211
+ # Turn scoped views on. Before rendering "sessions/new", it will first check for
212
+ # "users/sessions/new". It's turned off by default because it's slower if you
213
+ # are using only default views.
214
+ # config.scoped_views = false
215
+
216
+ # Configure the default scope given to Warden. By default it's the first
217
+ # devise role declared in your routes (usually :user).
218
+ # config.default_scope = :user
219
+
220
+ # Set this configuration to false if you want /users/sign_out to sign out
221
+ # only the current scope. By default, Devise signs out all scopes.
222
+ # config.sign_out_all_scopes = true
223
+
224
+ # ==> Navigation configuration
225
+ # Lists the formats that should be treated as navigational. Formats like
226
+ # :html, should redirect to the sign in page when the user does not have
227
+ # access, but formats like :xml or :json, should return 401.
228
+ #
229
+ # If you have any extra navigational formats, like :iphone or :mobile, you
230
+ # should add them to the navigational formats lists.
231
+ #
232
+ # The "*/*" below is required to match Internet Explorer requests.
233
+ # config.navigational_formats = ['*/*', :html]
234
+
235
+ # The default HTTP method used to sign out a resource. Default is :delete.
236
+ config.sign_out_via = :delete
237
+
238
+ # ==> OmniAuth
239
+ # Add a new OmniAuth provider. Check the wiki for more information on setting
240
+ # up on your models and hooks.
241
+ # config.omniauth :github, 'APP_ID', 'APP_SECRET', scope: 'user,public_repo'
242
+
243
+ # ==> Warden configuration
244
+ # If you want to use other strategies, that are not supported by Devise, or
245
+ # change the failure app, you can configure them inside the config.warden block.
246
+ #
247
+ # config.warden do |manager|
248
+ # manager.intercept_401 = false
249
+ # manager.default_strategies(scope: :user).unshift :some_external_strategy
250
+ # end
251
+
252
+ # ==> Mountable engine configurations
253
+ # When using Devise inside an engine, let's call it `MyEngine`, and this engine
254
+ # is mountable, there are some extra configurations to be taken into account.
255
+ # The following options are available, assuming the engine is mounted as:
256
+ #
257
+ # mount MyEngine, at: '/my_engine'
258
+ #
259
+ # The router that invoked `devise_for`, in the example above, would be:
260
+ config.router_name = :adminsite
261
+ #
262
+ # When using OmniAuth, Devise cannot automatically set OmniAuth path,
263
+ # so you need to do it manually. For the users scope, it would be:
264
+ # config.omniauth_path_prefix = '/my_engine/users/auth'
265
+ end