lotus_admin 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (91) hide show
  1. checksums.yaml +7 -0
  2. data/MIT-LICENSE +20 -0
  3. data/README.md +63 -0
  4. data/Rakefile +20 -0
  5. data/app/assets/config/lotus_admin_manifest.js +2 -0
  6. data/app/assets/images/lotus_admin/profile-menu.png +0 -0
  7. data/app/assets/javascripts/lotus_admin/application.js +5 -0
  8. data/app/assets/stylesheets/lotus_admin/application.css.scss +9 -0
  9. data/app/assets/stylesheets/lotus_admin/components/_alerts.scss +5 -0
  10. data/app/assets/stylesheets/lotus_admin/components/_all.scss +4 -0
  11. data/app/assets/stylesheets/lotus_admin/components/_devise.scss +3 -0
  12. data/app/assets/stylesheets/lotus_admin/components/_forms.scss +7 -0
  13. data/app/assets/stylesheets/lotus_admin/components/_tables.scss +27 -0
  14. data/app/controllers/concerns/lotus_admin/devise_controllers.rb +7 -0
  15. data/app/controllers/concerns/lotus_admin/exposure.rb +27 -0
  16. data/app/controllers/concerns/lotus_admin/permitted_params.rb +18 -0
  17. data/app/controllers/lotus_admin/application_controller.rb +20 -0
  18. data/app/controllers/lotus_admin/authenticated_controller.rb +20 -0
  19. data/app/controllers/lotus_admin/confirmations_controller.rb +3 -0
  20. data/app/controllers/lotus_admin/dashboard_controller.rb +5 -0
  21. data/app/controllers/lotus_admin/passwords_controller.rb +3 -0
  22. data/app/controllers/lotus_admin/profiles_controller.rb +20 -0
  23. data/app/controllers/lotus_admin/sessions_controller.rb +3 -0
  24. data/app/controllers/lotus_admin/users_controller.rb +45 -0
  25. data/app/helpers/lotus_admin/application_helper.rb +18 -0
  26. data/app/helpers/lotus_admin/form_helpers.rb +25 -0
  27. data/app/helpers/lotus_admin/link_helpers.rb +27 -0
  28. data/app/helpers/lotus_admin/pagination_helpers.rb +7 -0
  29. data/app/helpers/lotus_admin/panel_helpers.rb +24 -0
  30. data/app/helpers/lotus_admin/sidebar_helpers.rb +25 -0
  31. data/app/jobs/lotus_admin/application_job.rb +4 -0
  32. data/app/mailers/lotus_admin/application_mailer.rb +6 -0
  33. data/app/mailers/lotus_admin/user_mailer.rb +10 -0
  34. data/app/models/lotus_admin/application_record.rb +5 -0
  35. data/app/models/lotus_admin/user.rb +17 -0
  36. data/app/views/administrators/_links.html.haml +20 -0
  37. data/app/views/administrators/confirmations/new.html.haml +13 -0
  38. data/app/views/administrators/passwords/edit.html.haml +15 -0
  39. data/app/views/administrators/passwords/new.html.haml +11 -0
  40. data/app/views/administrators/sessions/new.html.haml +11 -0
  41. data/app/views/kaminari/lotus_admin/_first_page.html.haml +2 -0
  42. data/app/views/kaminari/lotus_admin/_gap.html.haml +1 -0
  43. data/app/views/kaminari/lotus_admin/_last_page.html.haml +2 -0
  44. data/app/views/kaminari/lotus_admin/_next_page.html.haml +2 -0
  45. data/app/views/kaminari/lotus_admin/_page.html.haml +2 -0
  46. data/app/views/kaminari/lotus_admin/_paginator.html.haml +12 -0
  47. data/app/views/kaminari/lotus_admin/_prev_page.html.haml +2 -0
  48. data/app/views/layouts/lotus_admin/_devise_footer.html.haml +0 -0
  49. data/app/views/layouts/lotus_admin/_favicons.html.haml +0 -0
  50. data/app/views/layouts/lotus_admin/_footer.html.haml +2 -0
  51. data/app/views/layouts/lotus_admin/_footer_scripts.html.haml +2 -0
  52. data/app/views/layouts/lotus_admin/_header.html.haml +31 -0
  53. data/app/views/layouts/lotus_admin/_header_dropdown_items.html.haml +0 -0
  54. data/app/views/layouts/lotus_admin/_html_head.html.haml +9 -0
  55. data/app/views/layouts/lotus_admin/_javascripts.html.haml +1 -0
  56. data/app/views/layouts/lotus_admin/_sidebar.html.haml +22 -0
  57. data/app/views/layouts/lotus_admin/_sidebar_items.html.haml +9 -0
  58. data/app/views/layouts/lotus_admin/_stylesheets.html.haml +5 -0
  59. data/app/views/layouts/lotus_admin/application.html.haml +22 -0
  60. data/app/views/layouts/lotus_admin/devise.html.haml +19 -0
  61. data/app/views/layouts/lotus_admin/mailer.html.haml +10 -0
  62. data/app/views/layouts/lotus_admin/mailer.text.erb +4 -0
  63. data/app/views/lotus_admin/dashboard/show.html.haml +1 -0
  64. data/app/views/lotus_admin/profiles/edit.html.haml +26 -0
  65. data/app/views/lotus_admin/shared/_collection_pagination.html.haml +7 -0
  66. data/app/views/lotus_admin/user_mailer/invited.html.haml +8 -0
  67. data/app/views/lotus_admin/user_mailer/invited.text.erb +5 -0
  68. data/app/views/lotus_admin/users/_form.html.haml +10 -0
  69. data/app/views/lotus_admin/users/edit.html.haml +12 -0
  70. data/app/views/lotus_admin/users/index.html.haml +30 -0
  71. data/app/views/lotus_admin/users/new.html.haml +9 -0
  72. data/app/views/lotus_admin/users/show.html.haml +24 -0
  73. data/config/initializers/devise.rb +280 -0
  74. data/config/initializers/simple_form.rb +170 -0
  75. data/config/initializers/simple_form_bootstrap.rb +155 -0
  76. data/config/initializers/simple_form_material.rb +35 -0
  77. data/config/locales/dates.en.yml +11 -0
  78. data/config/locales/devise.en.yml +64 -0
  79. data/config/locales/mailers.en.yml +5 -0
  80. data/config/locales/page_titles.en.yml +30 -0
  81. data/config/locales/simple_form.en.yml +31 -0
  82. data/config/locales/users.en.yml +29 -0
  83. data/config/routes.rb +8 -0
  84. data/db/migrate/20180228124526_devise_create_lotus_admin_users.rb +46 -0
  85. data/db/migrate/20180228210938_add_timezone_to_users.rb +5 -0
  86. data/lib/lotus_admin.rb +17 -0
  87. data/lib/lotus_admin/engine.rb +19 -0
  88. data/lib/lotus_admin/version.rb +3 -0
  89. data/lib/tasks/lotus_admin_tasks.rake +6 -0
  90. data/lib/templates/erb/scaffold/_form.html.erb +14 -0
  91. metadata +371 -0
@@ -0,0 +1,8 @@
1
+ %p
2
+ Hi #{ @resource.name },
3
+
4
+ %p
5
+ Someone has invited you to join and administer #{ I18n.t('app.name') }. Please click the link below in the next 2 days to set your password and activate your account.
6
+
7
+ %p
8
+ = link_to 'Create my Password', edit_password_url(@resource, reset_password_token: @token)
@@ -0,0 +1,5 @@
1
+ Hi <%= @resource.name %>,
2
+
3
+ Someone has invited you to join and administer <%= I18n.t('app.name') %>. Please click the link below in the next 2 days to set your password and activate your account.
4
+
5
+ <%= edit_password_url(@resource, reset_password_token: @token) %>
@@ -0,0 +1,10 @@
1
+ = material_form_for [lotus_admin, user] do |f|
2
+ .form-inputs
3
+ = f.input :first_name
4
+ = f.input :last_name
5
+ = f.input :email
6
+ = f.input :time_zone, priority: /US/
7
+
8
+ .form-actions
9
+ = material_form_submit(user)
10
+ = material_form_cancel(lotus_admin.polymorphic_path(resource_class))
@@ -0,0 +1,12 @@
1
+ .block-header
2
+ %h2= page_title!("Edit #{ resource_class.model_name.human }")
3
+
4
+ %ul.actions
5
+ %li= new_link
6
+
7
+ .card
8
+ .card-header
9
+ = t('.help')
10
+
11
+ .card-body.card-padding
12
+ = render 'form'
@@ -0,0 +1,30 @@
1
+ .block-header
2
+ %h2= page_title!(resource_class.model_name.human(count: 2))
3
+
4
+ %ul.actions
5
+ %li= new_link
6
+
7
+ .card
8
+ .card-body.table-responsive
9
+ %table.table.table-striped.table-bordered
10
+ %thead
11
+ %th #
12
+ %th First
13
+ %th Last
14
+ %th Email
15
+ %th
16
+
17
+ %tbody
18
+ - users.each do |user|
19
+ %tr
20
+ %td= link_to user.id, view_link(user)
21
+ %td= user.first_name
22
+ %td= user.last_name
23
+ %td= user.email
24
+ %td.actions-col
25
+ %ul.actions
26
+ %li= view_link(user)
27
+ %li= edit_link(user)
28
+ %li= destroy_link(user)
29
+
30
+ = pagination(users)
@@ -0,0 +1,9 @@
1
+ .block-header
2
+ %h2= page_title!("New #{ resource_class.model_name.human }")
3
+
4
+ .card
5
+ .card-header
6
+ = t('.help')
7
+
8
+ .card-body.card-padding
9
+ = render 'form'
@@ -0,0 +1,24 @@
1
+ .block-header
2
+ %h2= page_title!("#{ resource_class.model_name.human } Details")
3
+
4
+ %ul.actions
5
+ %li= edit_link(user)
6
+ %li= destroy_link(user)
7
+
8
+ .card
9
+ .card-header
10
+ %h2= resource_class.model_name.human
11
+
12
+ .card-body
13
+ .row
14
+ .col-sm-6
15
+ .list-group
16
+ = panel_attribute(user, :first_name)
17
+ = panel_attribute(user, :last_name)
18
+ = panel_attribute(user, :time_zone)
19
+
20
+ .col-sm-5
21
+ .list-group
22
+ = panel_attribute(user, :email)
23
+ = panel_attribute(user, :created_at) do
24
+ = I18n.l(user.created_at)
@@ -0,0 +1,280 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Use this hook to configure devise mailer, warden hooks and so forth.
4
+ # Many of these configuration options can be set straight in your model.
5
+ Devise.setup do |config|
6
+ # The secret key used by Devise. Devise uses this key to generate
7
+ # random tokens. Changing this key will render invalid all existing
8
+ # confirmation, reset password and unlock tokens in the database.
9
+ # Devise will use the `secret_key_base` as its `secret_key`
10
+ # by default. You can change it below and use your own secret key.
11
+ # config.secret_key = '1ed6017d618bd2d2bf6de37ae065faee7f6ee284ec554d5fefaf0f326cae8d6869b39b03d453af314e53432a72f660c3d531533bc78a1d6a79d57dccaea77809'
12
+
13
+ # ==> Mailer Configuration
14
+ # Configure the e-mail address which will be shown in Devise::Mailer,
15
+ # note that it will be overwritten if you use your own mailer class
16
+ # with default "from" parameter.
17
+ config.mailer_sender = Rails.application.secrets.action_mailer_default_sender_address
18
+
19
+ # Configure the class responsible to send e-mails.
20
+ # config.mailer = 'Devise::Mailer'
21
+
22
+ # Configure the parent class responsible to send e-mails.
23
+ # config.parent_mailer = 'ActionMailer::Base'
24
+
25
+ # ==> ORM configuration
26
+ # Load and configure the ORM. Supports :active_record (default) and
27
+ # :mongoid (bson_ext recommended) by default. Other ORMs may be
28
+ # available as additional gems.
29
+ require 'devise/orm/active_record'
30
+
31
+ # ==> Configuration for any authentication mechanism
32
+ # Configure which keys are used when authenticating a user. The default is
33
+ # just :email. You can configure it to use [:username, :subdomain], so for
34
+ # authenticating a user, both parameters are required. Remember that those
35
+ # parameters are used only when authenticating and not when retrieving from
36
+ # session. If you need permissions, you should implement that in a before filter.
37
+ # You can also supply a hash where the value is a boolean determining whether
38
+ # or not authentication should be aborted when the value is not present.
39
+ # config.authentication_keys = [:email]
40
+
41
+ # Configure parameters from the request object used for authentication. Each entry
42
+ # given should be a request method and it will automatically be passed to the
43
+ # find_for_authentication method and considered in your model lookup. For instance,
44
+ # if you set :request_keys to [:subdomain], :subdomain will be used on authentication.
45
+ # The same considerations mentioned for authentication_keys also apply to request_keys.
46
+ # config.request_keys = []
47
+
48
+ # Configure which authentication keys should be case-insensitive.
49
+ # These keys will be downcased upon creating or modifying a user and when used
50
+ # to authenticate or find a user. Default is :email.
51
+ config.case_insensitive_keys = [:email]
52
+
53
+ # Configure which authentication keys should have whitespace stripped.
54
+ # These keys will have whitespace before and after removed upon creating or
55
+ # modifying a user and when used to authenticate or find a user. Default is :email.
56
+ config.strip_whitespace_keys = [:email]
57
+
58
+ # Tell if authentication through request.params is enabled. True by default.
59
+ # It can be set to an array that will enable params authentication only for the
60
+ # given strategies, for example, `config.params_authenticatable = [:database]` will
61
+ # enable it only for database (email + password) authentication.
62
+ # config.params_authenticatable = true
63
+
64
+ # Tell if authentication through HTTP Auth is enabled. False by default.
65
+ # It can be set to an array that will enable http authentication only for the
66
+ # given strategies, for example, `config.http_authenticatable = [:database]` will
67
+ # enable it only for database authentication. The supported strategies are:
68
+ # :database = Support basic authentication with authentication key + password
69
+ # config.http_authenticatable = false
70
+
71
+ # If 401 status code should be returned for AJAX requests. True by default.
72
+ # config.http_authenticatable_on_xhr = true
73
+
74
+ # The realm used in Http Basic Authentication. 'Application' by default.
75
+ # config.http_authentication_realm = 'Application'
76
+
77
+ # It will change confirmation, password recovery and other workflows
78
+ # to behave the same regardless if the e-mail provided was right or wrong.
79
+ # Does not affect registerable.
80
+ # config.paranoid = true
81
+
82
+ # By default Devise will store the user in session. You can skip storage for
83
+ # particular strategies by setting this option.
84
+ # Notice that if you are skipping storage for all authentication paths, you
85
+ # may want to disable generating routes to Devise's sessions controller by
86
+ # passing skip: :sessions to `devise_for` in your config/routes.rb
87
+ config.skip_session_storage = [:http_auth]
88
+
89
+ # By default, Devise cleans up the CSRF token on authentication to
90
+ # avoid CSRF token fixation attacks. This means that, when using AJAX
91
+ # requests for sign in and sign up, you need to get a new CSRF token
92
+ # from the server. You can disable this option at your own risk.
93
+ # config.clean_up_csrf_token_on_authentication = true
94
+
95
+ # When false, Devise will not attempt to reload routes on eager load.
96
+ # This can reduce the time taken to boot the app but if your application
97
+ # requires the Devise mappings to be loaded during boot time the application
98
+ # won't boot properly.
99
+ # config.reload_routes = true
100
+
101
+ # ==> Configuration for :database_authenticatable
102
+ # For bcrypt, this is the cost for hashing the password and defaults to 11. If
103
+ # using other algorithms, it sets how many times you want the password to be hashed.
104
+ #
105
+ # Limiting the stretches to just one in testing will increase the performance of
106
+ # your test suite dramatically. However, it is STRONGLY RECOMMENDED to not use
107
+ # a value less than 10 in other environments. Note that, for bcrypt (the default
108
+ # algorithm), the cost increases exponentially with the number of stretches (e.g.
109
+ # a value of 20 is already extremely slow: approx. 60 seconds for 1 calculation).
110
+ config.stretches = Rails.env.test? ? 1 : 11
111
+
112
+ # Set up a pepper to generate the hashed password.
113
+ # config.pepper = 'f7cb0d07056a0ff70994ca8fe1d142ce358f264134b374609d3b03177648780fcbe802db5b9e055e86aa2948fa912503d35f00b165b619ec9b8cd24ad9e64add'
114
+
115
+ # Send a notification to the original email when the user's email is changed.
116
+ config.send_email_changed_notification = true
117
+
118
+ # Send a notification email when the user's password is changed.
119
+ config.send_password_change_notification = true
120
+
121
+ # ==> Configuration for :confirmable
122
+ # A period that the user is allowed to access the website even without
123
+ # confirming their account. For instance, if set to 2.days, the user will be
124
+ # able to access the website for two days without confirming their account,
125
+ # access will be blocked just in the third day. Default is 0.days, meaning
126
+ # the user cannot access the website without confirming their account.
127
+ # config.allow_unconfirmed_access_for = 2.days
128
+
129
+ # A period that the user is allowed to confirm their account before their
130
+ # token becomes invalid. For example, if set to 3.days, the user can confirm
131
+ # their account within 3 days after the mail was sent, but on the fourth day
132
+ # their account can't be confirmed with the token any more.
133
+ # Default is nil, meaning there is no restriction on how long a user can take
134
+ # before confirming their account.
135
+ # config.confirm_within = 3.days
136
+
137
+ # If true, requires any email changes to be confirmed (exactly the same way as
138
+ # initial account confirmation) to be applied. Requires additional unconfirmed_email
139
+ # db field (see migrations). Until confirmed, new email is stored in
140
+ # unconfirmed_email column, and copied to email column on successful confirmation.
141
+ config.reconfirmable = true
142
+
143
+ # Defines which key will be used when confirming an account
144
+ # config.confirmation_keys = [:email]
145
+
146
+ # ==> Configuration for :rememberable
147
+ # The time the user will be remembered without asking for credentials again.
148
+ # config.remember_for = 2.weeks
149
+
150
+ # Invalidates all the remember me tokens when the user signs out.
151
+ config.expire_all_remember_me_on_sign_out = true
152
+
153
+ # If true, extends the user's remember period when remembered via cookie.
154
+ # config.extend_remember_period = false
155
+
156
+ # Options to be passed to the created cookie. For instance, you can set
157
+ # secure: true in order to force SSL only cookies.
158
+ # config.rememberable_options = {}
159
+
160
+ # ==> Configuration for :validatable
161
+ # Range for password length.
162
+ config.password_length = 6..128
163
+
164
+ # Email regex used to validate email formats. It simply asserts that
165
+ # one (and only one) @ exists in the given string. This is mainly
166
+ # to give user feedback and not to assert the e-mail validity.
167
+ config.email_regexp = /\A[^@\s]+@[^@\s]+\z/
168
+
169
+ # ==> Configuration for :timeoutable
170
+ # The time you want to timeout the user session without activity. After this
171
+ # time the user will be asked for credentials again. Default is 30 minutes.
172
+ # config.timeout_in = 30.minutes
173
+
174
+ # ==> Configuration for :lockable
175
+ # Defines which strategy will be used to lock an account.
176
+ # :failed_attempts = Locks an account after a number of failed attempts to sign in.
177
+ # :none = No lock strategy. You should handle locking by yourself.
178
+ # config.lock_strategy = :failed_attempts
179
+
180
+ # Defines which key will be used when locking and unlocking an account
181
+ # config.unlock_keys = [:email]
182
+
183
+ # Defines which strategy will be used to unlock an account.
184
+ # :email = Sends an unlock link to the user email
185
+ # :time = Re-enables login after a certain amount of time (see :unlock_in below)
186
+ # :both = Enables both strategies
187
+ # :none = No unlock strategy. You should handle unlocking by yourself.
188
+ # config.unlock_strategy = :both
189
+
190
+ # Number of authentication tries before locking an account if lock_strategy
191
+ # is failed attempts.
192
+ # config.maximum_attempts = 20
193
+
194
+ # Time interval to unlock the account if :time is enabled as unlock_strategy.
195
+ # config.unlock_in = 1.hour
196
+
197
+ # Warn on the last attempt before the account is locked.
198
+ # config.last_attempt_warning = true
199
+
200
+ # ==> Configuration for :recoverable
201
+ #
202
+ # Defines which key will be used when recovering the password for an account
203
+ # config.reset_password_keys = [:email]
204
+
205
+ # Time interval you can reset your password with a reset password key.
206
+ # Don't put a too small interval or your users won't have the time to
207
+ # change their passwords.
208
+ config.reset_password_within = 6.hours
209
+
210
+ # When set to false, does not sign a user in automatically after their password is
211
+ # reset. Defaults to true, so a user is signed in automatically after a reset.
212
+ # config.sign_in_after_reset_password = true
213
+
214
+ # ==> Configuration for :encryptable
215
+ # Allow you to use another hashing or encryption algorithm besides bcrypt (default).
216
+ # You can use :sha1, :sha512 or algorithms from others authentication tools as
217
+ # :clearance_sha1, :authlogic_sha512 (then you should set stretches above to 20
218
+ # for default behavior) and :restful_authentication_sha1 (then you should set
219
+ # stretches to 10, and copy REST_AUTH_SITE_KEY to pepper).
220
+ #
221
+ # Require the `devise-encryptable` gem when using anything other than bcrypt
222
+ # config.encryptor = :sha512
223
+
224
+ # ==> Scopes configuration
225
+ # Turn scoped views on. Before rendering "sessions/new", it will first check for
226
+ # "users/sessions/new". It's turned off by default because it's slower if you
227
+ # are using only default views.
228
+ config.scoped_views = true
229
+
230
+ # Configure the default scope given to Warden. By default it's the first
231
+ # devise role declared in your routes (usually :user).
232
+ # config.default_scope = :user
233
+
234
+ # Set this configuration to false if you want /users/sign_out to sign out
235
+ # only the current scope. By default, Devise signs out all scopes.
236
+ # config.sign_out_all_scopes = true
237
+
238
+ # ==> Navigation configuration
239
+ # Lists the formats that should be treated as navigational. Formats like
240
+ # :html, should redirect to the sign in page when the user does not have
241
+ # access, but formats like :xml or :json, should return 401.
242
+ #
243
+ # If you have any extra navigational formats, like :iphone or :mobile, you
244
+ # should add them to the navigational formats lists.
245
+ #
246
+ # The "*/*" below is required to match Internet Explorer requests.
247
+ # config.navigational_formats = ['*/*', :html]
248
+
249
+ # The default HTTP method used to sign out a resource. Default is :delete.
250
+ config.sign_out_via = :delete
251
+
252
+ # ==> OmniAuth
253
+ # Add a new OmniAuth provider. Check the wiki for more information on setting
254
+ # up on your models and hooks.
255
+ # config.omniauth :github, 'APP_ID', 'APP_SECRET', scope: 'user,public_repo'
256
+
257
+ # ==> Warden configuration
258
+ # If you want to use other strategies, that are not supported by Devise, or
259
+ # change the failure app, you can configure them inside the config.warden block.
260
+ #
261
+ # config.warden do |manager|
262
+ # manager.intercept_401 = false
263
+ # manager.default_strategies(scope: :user).unshift :some_external_strategy
264
+ # end
265
+
266
+ # ==> Mountable engine configurations
267
+ # When using Devise inside an engine, let's call it `MyEngine`, and this engine
268
+ # is mountable, there are some extra configurations to be taken into account.
269
+ # The following options are available, assuming the engine is mounted as:
270
+ #
271
+ # mount MyEngine, at: '/my_engine'
272
+ #
273
+ # The router that invoked `devise_for`, in the example above, would be:
274
+ config.router_name = :lotus_admin
275
+ config.parent_controller = 'LotusAdmin::ApplicationController'
276
+ #
277
+ # When using OmniAuth, Devise cannot automatically set OmniAuth path,
278
+ # so you need to do it manually. For the users scope, it would be:
279
+ # config.omniauth_path_prefix = '/my_engine/users/auth'
280
+ end
@@ -0,0 +1,170 @@
1
+ # frozen_string_literal: true
2
+ # Use this setup block to configure all options available in SimpleForm.
3
+ SimpleForm.setup do |config|
4
+ # Wrappers are used by the form builder to generate a
5
+ # complete input. You can remove any component from the
6
+ # wrapper, change the order or even add your own to the
7
+ # stack. The options given below are used to wrap the
8
+ # whole input.
9
+ config.wrappers :default, class: :input,
10
+ hint_class: :field_with_hint, error_class: :field_with_errors do |b|
11
+ ## Extensions enabled by default
12
+ # Any of these extensions can be disabled for a
13
+ # given input by passing: `f.input EXTENSION_NAME => false`.
14
+ # You can make any of these extensions optional by
15
+ # renaming `b.use` to `b.optional`.
16
+
17
+ # Determines whether to use HTML5 (:email, :url, ...)
18
+ # and required attributes
19
+ b.use :html5
20
+
21
+ # Calculates placeholders automatically from I18n
22
+ # You can also pass a string as f.input placeholder: "Placeholder"
23
+ b.use :placeholder
24
+
25
+ ## Optional extensions
26
+ # They are disabled unless you pass `f.input EXTENSION_NAME => true`
27
+ # to the input. If so, they will retrieve the values from the model
28
+ # if any exists. If you want to enable any of those
29
+ # extensions by default, you can change `b.optional` to `b.use`.
30
+
31
+ # Calculates maxlength from length validations for string inputs
32
+ # and/or database column lengths
33
+ b.optional :maxlength
34
+
35
+ # Calculate minlength from length validations for string inputs
36
+ b.optional :minlength
37
+
38
+ # Calculates pattern from format validations for string inputs
39
+ b.optional :pattern
40
+
41
+ # Calculates min and max from length validations for numeric inputs
42
+ b.optional :min_max
43
+
44
+ # Calculates readonly automatically from readonly attributes
45
+ b.optional :readonly
46
+
47
+ ## Inputs
48
+ b.use :label_input
49
+ b.use :hint, wrap_with: { tag: :span, class: :hint }
50
+ b.use :error, wrap_with: { tag: :span, class: :error }
51
+
52
+ ## full_messages_for
53
+ # If you want to display the full error message for the attribute, you can
54
+ # use the component :full_error, like:
55
+ #
56
+ # b.use :full_error, wrap_with: { tag: :span, class: :error }
57
+ end
58
+
59
+ # The default wrapper to be used by the FormBuilder.
60
+ config.default_wrapper = :default
61
+
62
+ # Define the way to render check boxes / radio buttons with labels.
63
+ # Defaults to :nested for bootstrap config.
64
+ # inline: input + label
65
+ # nested: label > input
66
+ config.boolean_style = :nested
67
+
68
+ # Default class for buttons
69
+ config.button_class = 'btn'
70
+
71
+ # Method used to tidy up errors. Specify any Rails Array method.
72
+ # :first lists the first message for each field.
73
+ # Use :to_sentence to list all errors for each field.
74
+ # config.error_method = :first
75
+
76
+ # Default tag used for error notification helper.
77
+ config.error_notification_tag = :div
78
+
79
+ # CSS class to add for error notification helper.
80
+ config.error_notification_class = 'error_notification'
81
+
82
+ # ID to add for error notification helper.
83
+ # config.error_notification_id = nil
84
+
85
+ # Series of attempts to detect a default label method for collection.
86
+ # config.collection_label_methods = [ :to_label, :name, :title, :to_s ]
87
+
88
+ # Series of attempts to detect a default value method for collection.
89
+ # config.collection_value_methods = [ :id, :to_s ]
90
+
91
+ # You can wrap a collection of radio/check boxes in a pre-defined tag, defaulting to none.
92
+ # config.collection_wrapper_tag = nil
93
+
94
+ # You can define the class to use on all collection wrappers. Defaulting to none.
95
+ # config.collection_wrapper_class = nil
96
+
97
+ # You can wrap each item in a collection of radio/check boxes with a tag,
98
+ # defaulting to :span.
99
+ # config.item_wrapper_tag = :span
100
+
101
+ # You can define a class to use in all item wrappers. Defaulting to none.
102
+ # config.item_wrapper_class = nil
103
+
104
+ # How the label text should be generated altogether with the required text.
105
+ # config.label_text = lambda { |label, required, explicit_label| "#{required} #{label}" }
106
+
107
+ # You can define the class to use on all labels. Default is nil.
108
+ # config.label_class = nil
109
+
110
+ # You can define the default class to be used on forms. Can be overriden
111
+ # with `html: { :class }`. Defaulting to none.
112
+ # config.default_form_class = nil
113
+
114
+ # You can define which elements should obtain additional classes
115
+ # config.generate_additional_classes_for = [:wrapper, :label, :input]
116
+
117
+ # Whether attributes are required by default (or not). Default is true.
118
+ # config.required_by_default = true
119
+
120
+ # Tell browsers whether to use the native HTML5 validations (novalidate form option).
121
+ # These validations are enabled in SimpleForm's internal config but disabled by default
122
+ # in this configuration, which is recommended due to some quirks from different browsers.
123
+ # To stop SimpleForm from generating the novalidate option, enabling the HTML5 validations,
124
+ # change this configuration to true.
125
+ config.browser_validations = false
126
+
127
+ # Collection of methods to detect if a file type was given.
128
+ # config.file_methods = [ :mounted_as, :file?, :public_filename ]
129
+
130
+ # Custom mappings for input types. This should be a hash containing a regexp
131
+ # to match as key, and the input type that will be used when the field name
132
+ # matches the regexp as value.
133
+ # config.input_mappings = { /count/ => :integer }
134
+
135
+ # Custom wrappers for input types. This should be a hash containing an input
136
+ # type as key and the wrapper that will be used for all inputs with specified type.
137
+ # config.wrapper_mappings = { string: :prepend }
138
+
139
+ # Namespaces where SimpleForm should look for custom input classes that
140
+ # override default inputs.
141
+ # config.custom_inputs_namespaces << "CustomInputs"
142
+
143
+ # Default priority for time_zone inputs.
144
+ # config.time_zone_priority = nil
145
+
146
+ # Default priority for country inputs.
147
+ # config.country_priority = nil
148
+
149
+ # When false, do not use translations for labels.
150
+ # config.translate_labels = true
151
+
152
+ # Automatically discover new inputs in Rails' autoload path.
153
+ # config.inputs_discovery = true
154
+
155
+ # Cache SimpleForm inputs discovery
156
+ # config.cache_discovery = !Rails.env.development?
157
+
158
+ # Default class for inputs
159
+ # config.input_class = nil
160
+
161
+ # Define the default class of the input wrapper of the boolean input.
162
+ config.boolean_label_class = 'checkbox'
163
+
164
+ # Defines if the default input wrapper class should be included in radio
165
+ # collection wrappers.
166
+ # config.include_default_input_wrapper_class = true
167
+
168
+ # Defines which i18n scope will be used in Simple Form.
169
+ # config.i18n_scope = 'simple_form'
170
+ end