breeze_cms 1.0.1 → 1.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (44) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/images/breeze/card_preview/faq_item.jpg +0 -0
  3. data/app/assets/images/breeze/section_preview/section_faq.jpg +0 -0
  4. data/app/assets/images/breeze/section_preview/section_half_slider.jpg +0 -0
  5. data/app/assets/stylesheets/breeze/breeze.css +396 -390
  6. data/app/assets/stylesheets/breeze/breeze.email.css +288 -283
  7. data/app/assets/stylesheets/breeze_tailwind_styles.css +5 -1
  8. data/app/controllers/breeze/images_controller.rb +29 -6
  9. data/app/controllers/breeze/pages_controller.rb +3 -10
  10. data/app/controllers/breeze/sections_controller.rb +1 -1
  11. data/app/controllers/breeze/view_controller.rb +6 -1
  12. data/app/helpers/breeze/images_helper.rb +11 -5
  13. data/app/helpers/breeze/options_helper.rb +1 -1
  14. data/app/helpers/breeze/view_helper.rb +25 -0
  15. data/app/models/breeze/active_yaml.rb +23 -0
  16. data/app/models/breeze/image.rb +30 -20
  17. data/app/models/breeze/section.rb +5 -0
  18. data/app/models/breeze/shared_base.rb +1 -1
  19. data/app/models/breeze/view_base.rb +11 -2
  20. data/app/views/breeze/images/_editor.haml +26 -14
  21. data/app/views/breeze/images/index.haml +6 -4
  22. data/app/views/breeze/images/show.haml +30 -12
  23. data/app/views/breeze/pages/show.haml +52 -62
  24. data/app/views/breeze/view/_form_section.haml +1 -1
  25. data/app/views/breeze/view/_section_faq.haml +29 -0
  26. data/app/views/breeze/view/_section_full_image.haml +1 -1
  27. data/app/views/breeze/view/_section_full_up.haml +1 -1
  28. data/app/views/breeze/view/_section_half_image.haml +1 -1
  29. data/app/views/breeze/view/_section_half_slider.haml +67 -0
  30. data/app/views/breeze/view/_section_large_image.haml +1 -1
  31. data/app/views/breeze/view/_section_slider.haml +33 -14
  32. data/app/views/breeze/view/_section_small_image.haml +1 -1
  33. data/app/views/breeze/view/cards/_card_normal_round.haml +1 -1
  34. data/app/views/breeze/view/cards/_faq_item.haml +9 -0
  35. data/app/views/breeze/view/page.haml +2 -0
  36. data/config/breeze/card_styles.yml +41 -31
  37. data/config/breeze/option_definitions.yml +14 -2
  38. data/config/breeze/page_styles.yml +5 -2
  39. data/config/breeze/section_styles.yml +50 -0
  40. data/config/initializers/simple_form_tailwind.rb +148 -0
  41. data/lib/breeze/engine.rb +3 -4
  42. data/lib/breeze/version.rb +1 -1
  43. metadata +32 -43
  44. data/config/initializers/simple_form.rb +0 -212
@@ -0,0 +1,148 @@
1
+ # frozen_string_literal: true
2
+ require "simple_form"
3
+
4
+ # Use this setup block to configure all options available in SimpleForm.
5
+ SimpleForm.setup do |config|
6
+ # Default class for buttons
7
+ config.button_class = 'my-2 bg-blue-500 hover:bg-blue-700 text-white font-bold text-sm py-2 px-4 rounded'
8
+
9
+ # Define the default class of the input wrapper of the boolean input.
10
+ config.boolean_label_class = ''
11
+
12
+ # How the label text should be generated altogether with the required text.
13
+ config.label_text = ->(label, required, _explicit_label) { "#{label} #{required}" }
14
+
15
+ # Define the way to render check boxes / radio buttons with labels.
16
+ config.boolean_style = :inline
17
+
18
+ # You can wrap each item in a collection of radio/check boxes with a tag
19
+ config.item_wrapper_tag = :div
20
+
21
+ # Defines if the default input wrapper class should be included in radio
22
+ # collection wrappers.
23
+ config.include_default_input_wrapper_class = false
24
+
25
+ # CSS class to add for error notification helper.
26
+ config.error_notification_class = 'text-white px-6 py-4 border-0 rounded relative mb-4 bg-red-400'
27
+
28
+ # Method used to tidy up errors. Specify any Rails Array method.
29
+ # :first lists the first message for each field.
30
+ # :to_sentence to list all errors for each field.
31
+ config.error_method = :to_sentence
32
+
33
+ # add validation classes to `input_field`
34
+ config.input_field_error_class = 'border-red-500'
35
+ config.input_field_valid_class = 'border-green-400'
36
+ config.label_class = 'text-sm font-medium text-gray-600'
37
+
38
+ # vertical forms
39
+ #
40
+ # vertical default_wrapper
41
+ config.wrappers :vertical_form, tag: 'div', class: 'mb-4' do |b|
42
+ b.use :html5
43
+ b.use :placeholder
44
+ b.optional :maxlength
45
+ b.optional :minlength
46
+ b.optional :pattern
47
+ b.optional :min_max
48
+ b.optional :readonly
49
+ b.use :label, class: 'block', error_class: 'text-red-500'
50
+ b.use :input,
51
+ class: 'shadow appearance-none border border-gray-300 rounded w-full py-2 px-3 bg-white focus:outline-none focus:ring-0 focus:border-blue-500 text-gray-400 leading-6 transition-colors duration-200 ease-in-out', error_class: 'border-red-500', valid_class: 'border-green-400'
52
+ b.use :full_error, wrap_with: { tag: 'p', class: 'mt-2 text-red-500 text-xs italic' }
53
+ b.use :hint, wrap_with: { tag: 'p', class: 'mt-2 text-grey-700 text-xs italic' }
54
+ end
55
+
56
+ # vertical input for boolean (aka checkboxes)
57
+ config.wrappers :vertical_boolean, tag: 'div', class: 'mb-4 flex items-start', error_class: '' do |b|
58
+ b.use :html5
59
+ b.optional :readonly
60
+ b.wrapper tag: 'div', class: 'flex items-center h-5' do |ba|
61
+ ba.use :input,
62
+ class: 'focus:ring-2 focus:ring-indigo-500 ring-offset-2 h-4 w-4 text-indigo-600 border-gray-300 rounded'
63
+ end
64
+ b.wrapper tag: 'div', class: 'ml-3 text-sm' do |bb|
65
+ bb.use :label, class: 'block', error_class: 'text-red-500'
66
+ bb.use :hint, wrap_with: { tag: 'p', class: 'block text-grey-700 text-xs italic' }
67
+ bb.use :full_error, wrap_with: { tag: 'p', class: 'block text-red-500 text-xs italic' }
68
+ end
69
+ end
70
+
71
+ # vertical input for radio buttons and check boxes
72
+ config.wrappers :vertical_collection, item_wrapper_class: 'flex items-center',
73
+ item_label_class: 'my-1 ml-3 block text-sm font-medium text-gray-400', tag: 'div', class: 'my-4' do |b|
74
+ b.use :html5
75
+ b.optional :readonly
76
+ b.wrapper :legend_tag, tag: 'legend', class: 'text-sm font-medium text-gray-600',
77
+ error_class: 'text-red-500' do |ba|
78
+ ba.use :label_text
79
+ end
80
+ b.use :input,
81
+ class: 'focus:ring-2 focus:ring-indigo-500 ring-offset-2 h-4 w-4 text-indigo-600 border-gray-300 rounded', error_class: 'text-red-500', valid_class: 'text-green-400'
82
+ b.use :full_error, wrap_with: { tag: 'p', class: 'block mt-2 text-red-500 text-xs italic' }
83
+ b.use :hint, wrap_with: { tag: 'p', class: 'mt-2 text-grey-700 text-xs italic' }
84
+ end
85
+
86
+ # vertical file input
87
+ config.wrappers :vertical_file, tag: 'div', class: '' do |b|
88
+ b.use :html5
89
+ b.use :placeholder
90
+ b.optional :maxlength
91
+ b.optional :minlength
92
+ b.optional :readonly
93
+ b.use :label, class: 'text-sm font-medium text-gray-600 block', error_class: 'text-red-500'
94
+ b.use :input, class: 'w-full text-gray-500 px-3 py-2 border rounded', error_class: 'text-red-500 border-red-500',
95
+ valid_class: 'text-green-400'
96
+ b.use :full_error, wrap_with: { tag: 'p', class: 'mt-2 text-red-500 text-xs italic' }
97
+ b.use :hint, wrap_with: { tag: 'p', class: 'mt-2 text-grey-700 text-xs italic' }
98
+ end
99
+
100
+ # vertical multi select
101
+ config.wrappers :vertical_multi_select, tag: 'div', class: 'my-4', error_class: 'f', valid_class: '' do |b|
102
+ b.use :html5
103
+ b.optional :readonly
104
+ b.wrapper :legend_tag, tag: 'legend', class: 'text-sm font-medium text-gray-600',
105
+ error_class: 'text-red-500' do |ba|
106
+ ba.use :label_text
107
+ end
108
+ b.wrapper tag: 'div', class: 'inline-flex space-x-1' do |ba|
109
+ # ba.use :input, class: 'flex w-auto w-auto text-gray-500 text-sm border-gray-300 rounded p-2', error_class: 'text-red-500', valid_class: 'text-green-400'
110
+ ba.use :input,
111
+ class: 'flex w-auto w-auto shadow appearance-none border border-gray-300 rounded w-full p-2 bg-white focus:outline-none focus:border-blue-500 text-gray-400 leading-4 transition-colors duration-200 ease-in-out'
112
+ end
113
+ b.use :full_error, wrap_with: { tag: 'p', class: 'mt-2 text-red-500 text-xs italic' }
114
+ b.use :hint, wrap_with: { tag: 'p', class: 'mt-2 text-grey-700 text-xs italic' }
115
+ end
116
+
117
+ # vertical range input
118
+ config.wrappers :vertical_range, tag: 'div', class: 'my-4', error_class: 'text-red-500',
119
+ valid_class: 'text-green-400' do |b|
120
+ b.use :html5
121
+ b.use :placeholder
122
+ b.optional :readonly
123
+ b.optional :step
124
+ b.use :label, class: 'text-sm font-medium text-gray-600 block', error_class: 'text-red-500'
125
+ b.wrapper tag: 'div', class: 'flex items-center h-5' do |ba|
126
+ ba.use :input, class: 'rounded-lg overflow-hidden appearance-none bg-gray-400 h-3 w-full text-gray-300',
127
+ error_class: 'text-red-500', valid_class: 'text-green-400'
128
+ end
129
+ b.use :full_error, wrap_with: { tag: 'p', class: 'mt-2 text-red-500 text-xs italic' }
130
+ b.use :hint, wrap_with: { tag: 'p', class: 'mt-2 text-grey-700 text-xs italic' }
131
+ end
132
+
133
+ # The default wrapper to be used by the FormBuilder.
134
+ config.default_wrapper = :vertical_form
135
+
136
+ # Custom wrappers for input types. This should be a hash containing an input
137
+ # type as key and the wrapper that will be used for all inputs with specified type.
138
+ config.wrapper_mappings = {
139
+ boolean: :vertical_boolean,
140
+ check_boxes: :vertical_collection,
141
+ date: :vertical_multi_select,
142
+ datetime: :vertical_multi_select,
143
+ file: :vertical_file,
144
+ radio_buttons: :vertical_collection,
145
+ range: :vertical_range,
146
+ time: :vertical_multi_select
147
+ }
148
+ end
data/lib/breeze/engine.rb CHANGED
@@ -4,8 +4,7 @@ require "ruby2js/filter/functions"
4
4
  require "ruby2js/haml"
5
5
  require "ruby2js/filter/vue"
6
6
  require "breeze/shared_helper"
7
- require "simple_form"
8
- require "simple_form_tailwind_css"
7
+ #require "simple_form"
9
8
  require "haml-rails"
10
9
  require "opal-rails"
11
10
  require "opal-jquery"
@@ -67,7 +66,7 @@ module ActionDispatch::Routing
67
66
  Rails.application.routes.draw do
68
67
  begin
69
68
  if options[:root]
70
- root "breeze/view#page" , id: 'index'
69
+ root "breeze/view#page" , id: 'index'
71
70
  end
72
71
  Breeze.language_strings.each do |lang|
73
72
  get "/#{lang}/:id" , to: "breeze/view#page" , lang: lang , id: :id
@@ -84,7 +83,7 @@ module ActionDispatch::Routing
84
83
 
85
84
  post "/form" , to: "breeze/form#post" , as: :post_form
86
85
  get "/news/:id" , to: "breeze/view#page" , id: :id , as: :view_blog
87
- get ":id" , to: "breeze/view#page" , id: :id , as: :view_page
86
+ get ":id" , to: "breeze/view#page" , id: :id , as: :view_page, constraints: { format: 'html' }
88
87
 
89
88
  engine_path = options[:path] || "/breeze"
90
89
  if ! Rails.env.production? or options[:production].present?
@@ -1,3 +1,3 @@
1
1
  module Breeze
2
- VERSION = "1.0.1"
2
+ VERSION = "1.0.3"
3
3
  end
metadata CHANGED
@@ -1,14 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: breeze_cms
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.1
4
+ version: 1.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Torsten
8
- autorequire:
9
8
  bindir: bin
10
9
  cert_chain: []
11
- date: 2024-08-06 00:00:00.000000000 Z
10
+ date: 2025-06-29 00:00:00.000000000 Z
12
11
  dependencies:
13
12
  - !ruby/object:Gem::Dependency
14
13
  name: rails
@@ -16,70 +15,70 @@ dependencies:
16
15
  requirements:
17
16
  - - "~>"
18
17
  - !ruby/object:Gem::Version
19
- version: '7.0'
18
+ version: '7.1'
20
19
  type: :runtime
21
20
  prerelease: false
22
21
  version_requirements: !ruby/object:Gem::Requirement
23
22
  requirements:
24
23
  - - "~>"
25
24
  - !ruby/object:Gem::Version
26
- version: '7.0'
25
+ version: '7.1'
27
26
  - !ruby/object:Gem::Dependency
28
27
  name: rake
29
28
  requirement: !ruby/object:Gem::Requirement
30
29
  requirements:
31
- - - "~>"
30
+ - - ">="
32
31
  - !ruby/object:Gem::Version
33
- version: '13.0'
32
+ version: '0'
34
33
  type: :runtime
35
34
  prerelease: false
36
35
  version_requirements: !ruby/object:Gem::Requirement
37
36
  requirements:
38
- - - "~>"
37
+ - - ">="
39
38
  - !ruby/object:Gem::Version
40
- version: '13.0'
39
+ version: '0'
41
40
  - !ruby/object:Gem::Dependency
42
41
  name: haml-rails
43
42
  requirement: !ruby/object:Gem::Requirement
44
43
  requirements:
45
44
  - - "~>"
46
45
  - !ruby/object:Gem::Version
47
- version: '2.0'
46
+ version: '2'
48
47
  type: :runtime
49
48
  prerelease: false
50
49
  version_requirements: !ruby/object:Gem::Requirement
51
50
  requirements:
52
51
  - - "~>"
53
52
  - !ruby/object:Gem::Version
54
- version: '2.0'
53
+ version: '2'
55
54
  - !ruby/object:Gem::Dependency
56
55
  name: redcarpet
57
56
  requirement: !ruby/object:Gem::Requirement
58
57
  requirements:
59
58
  - - "~>"
60
59
  - !ruby/object:Gem::Version
61
- version: '3.5'
60
+ version: '3'
62
61
  type: :runtime
63
62
  prerelease: false
64
63
  version_requirements: !ruby/object:Gem::Requirement
65
64
  requirements:
66
65
  - - "~>"
67
66
  - !ruby/object:Gem::Version
68
- version: '3.5'
67
+ version: '3'
69
68
  - !ruby/object:Gem::Dependency
70
69
  name: mini_magick
71
70
  requirement: !ruby/object:Gem::Requirement
72
71
  requirements:
73
- - - "~>"
72
+ - - ">="
74
73
  - !ruby/object:Gem::Version
75
- version: '4.0'
74
+ version: '0'
76
75
  type: :runtime
77
76
  prerelease: false
78
77
  version_requirements: !ruby/object:Gem::Requirement
79
78
  requirements:
80
- - - "~>"
79
+ - - ">="
81
80
  - !ruby/object:Gem::Version
82
- version: '4.0'
81
+ version: '0'
83
82
  - !ruby/object:Gem::Dependency
84
83
  name: ruby2js
85
84
  requirement: !ruby/object:Gem::Requirement
@@ -101,33 +100,19 @@ dependencies:
101
100
  - !ruby/object:Gem::Version
102
101
  version: '6.0'
103
102
  - !ruby/object:Gem::Dependency
104
- name: simple_form_tailwind_css
105
- requirement: !ruby/object:Gem::Requirement
106
- requirements:
107
- - - "~>"
108
- - !ruby/object:Gem::Version
109
- version: '1.0'
110
- type: :runtime
111
- prerelease: false
112
- version_requirements: !ruby/object:Gem::Requirement
113
- requirements:
114
- - - "~>"
115
- - !ruby/object:Gem::Version
116
- version: '1.0'
117
- - !ruby/object:Gem::Dependency
118
- name: simple_form
103
+ name: simple_form-tailwind
119
104
  requirement: !ruby/object:Gem::Requirement
120
105
  requirements:
121
- - - '='
106
+ - - ">="
122
107
  - !ruby/object:Gem::Version
123
- version: 5.1.0
108
+ version: '0'
124
109
  type: :runtime
125
110
  prerelease: false
126
111
  version_requirements: !ruby/object:Gem::Requirement
127
112
  requirements:
128
- - - '='
113
+ - - ">="
129
114
  - !ruby/object:Gem::Version
130
- version: 5.1.0
115
+ version: '0'
131
116
  - !ruby/object:Gem::Dependency
132
117
  name: opal-rails
133
118
  requirement: !ruby/object:Gem::Requirement
@@ -176,14 +161,14 @@ dependencies:
176
161
  requirements:
177
162
  - - "~>"
178
163
  - !ruby/object:Gem::Version
179
- version: '2.3'
164
+ version: '2.7'
180
165
  type: :runtime
181
166
  prerelease: false
182
167
  version_requirements: !ruby/object:Gem::Requirement
183
168
  requirements:
184
169
  - - "~>"
185
170
  - !ruby/object:Gem::Version
186
- version: '2.3'
171
+ version: '2.7'
187
172
  - !ruby/object:Gem::Dependency
188
173
  name: rabl
189
174
  requirement: !ruby/object:Gem::Requirement
@@ -220,15 +205,18 @@ files:
220
205
  - app/assets/images/breeze/card_preview/card_normal_round.png
221
206
  - app/assets/images/breeze/card_preview/card_normal_square.png
222
207
  - app/assets/images/breeze/card_preview/card_wide_square.png
208
+ - app/assets/images/breeze/card_preview/faq_item.jpg
223
209
  - app/assets/images/breeze/card_preview/form_field.png
224
210
  - app/assets/images/breeze/home.jpg
225
211
  - app/assets/images/breeze/section_preview/blog_header.png
226
212
  - app/assets/images/breeze/section_preview/form_section.png
227
213
  - app/assets/images/breeze/section_preview/section_cards.png
214
+ - app/assets/images/breeze/section_preview/section_faq.jpg
228
215
  - app/assets/images/breeze/section_preview/section_feature.png
229
216
  - app/assets/images/breeze/section_preview/section_full_image.png
230
217
  - app/assets/images/breeze/section_preview/section_full_up.png
231
218
  - app/assets/images/breeze/section_preview/section_half_image.png
219
+ - app/assets/images/breeze/section_preview/section_half_slider.jpg
232
220
  - app/assets/images/breeze/section_preview/section_large_image.png
233
221
  - app/assets/images/breeze/section_preview/section_news.png
234
222
  - app/assets/images/breeze/section_preview/section_slider.png
@@ -310,10 +298,12 @@ files:
310
298
  - app/views/breeze/view/_blog_header.haml
311
299
  - app/views/breeze/view/_form_section.haml
312
300
  - app/views/breeze/view/_section_cards.haml
301
+ - app/views/breeze/view/_section_faq.haml
313
302
  - app/views/breeze/view/_section_feature.haml
314
303
  - app/views/breeze/view/_section_full_image.haml
315
304
  - app/views/breeze/view/_section_full_up.haml
316
305
  - app/views/breeze/view/_section_half_image.haml
306
+ - app/views/breeze/view/_section_half_slider.haml
317
307
  - app/views/breeze/view/_section_large_image.haml
318
308
  - app/views/breeze/view/_section_news.haml
319
309
  - app/views/breeze/view/_section_slider.haml
@@ -328,6 +318,7 @@ files:
328
318
  - app/views/breeze/view/cards/_card_normal_round.haml
329
319
  - app/views/breeze/view/cards/_card_normal_square.haml
330
320
  - app/views/breeze/view/cards/_card_wide_square.haml
321
+ - app/views/breeze/view/cards/_faq_item.haml
331
322
  - app/views/breeze/view/cards/_form_field.haml
332
323
  - app/views/breeze/view/elements/_button.haml
333
324
  - app/views/breeze/view/page.haml
@@ -343,7 +334,7 @@ files:
343
334
  - config/breeze/section_styles.yml
344
335
  - config/initializers/breeze.rb
345
336
  - config/initializers/rabl.rb
346
- - config/initializers/simple_form.rb
337
+ - config/initializers/simple_form_tailwind.rb
347
338
  - config/locales/breeze_en.yml
348
339
  - config/routes.rb
349
340
  - config/tailwind.config.js
@@ -366,7 +357,6 @@ metadata:
366
357
  homepage_uri: https://breeze.codeberg.page
367
358
  source_code_uri: https://codeberg.org/breeze/breeze
368
359
  changelog_uri: https://codeberg.org/breeze/breeze/src/branch/main/CHANGELOG.md
369
- post_install_message:
370
360
  rdoc_options: []
371
361
  require_paths:
372
362
  - lib
@@ -374,15 +364,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
374
364
  requirements:
375
365
  - - ">="
376
366
  - !ruby/object:Gem::Version
377
- version: 2.7.0
367
+ version: 3.2.0
378
368
  required_rubygems_version: !ruby/object:Gem::Requirement
379
369
  requirements:
380
370
  - - ">="
381
371
  - !ruby/object:Gem::Version
382
372
  version: '0'
383
373
  requirements: []
384
- rubygems_version: 3.4.10
385
- signing_key:
374
+ rubygems_version: 3.6.2
386
375
  specification_version: 4
387
376
  summary: The tailwind based, developers CMS
388
377
  test_files: []
@@ -1,212 +0,0 @@
1
- require "simple_form"
2
-
3
- # frozen_string_literal: true
4
- #
5
- # Uncomment this and change the path if necessary to include your own
6
- # components.
7
- # See https://github.com/heartcombo/simple_form#custom-components to know
8
- # more about custom components.
9
- # Dir[Rails.root.join('lib/components/**/*.rb')].each { |f| require f }
10
- #
11
- # Use this setup block to configure all options available in SimpleForm.
12
- SimpleForm.setup do |config|
13
- # Wrappers are used by the form builder to generate a
14
- # complete input. You can remove any component from the
15
- # wrapper, change the order or even add your own to the
16
- # stack. The options given below are used to wrap the
17
- # whole input.
18
-
19
- config.wrappers :default, tag: 'div', class: 'mt-4', error_class: '', valid_class: '' do |b|
20
- b.use :html5
21
- b.use :placeholder
22
- b.optional :maxlength
23
- b.optional :minlength
24
- b.optional :pattern
25
- b.optional :min_max
26
- b.optional :readonly
27
-
28
- b.use :label, class: "block text-sm font-medium text-gray-700"
29
- b.use :input,
30
- class: 'appearance-none block w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm placeholder-gray-400 focus:outline-none focus:ring-indigo-500 focus:border-indigo-500 sm:text-sm',
31
- error_class: 'block w-full pr-10 border-red-300 text-red-900 placeholder-red-300 focus:outline-none focus:ring-red-500 focus:border-red-500 sm:text-sm rounded-md'
32
- b.use :full_error, wrap_with: { tag: 'p', class: 'mt-2 text-sm text-red-600' }
33
- b.use :hint, wrap_with: { tag: :p, class: "mt-2 text-sm text-gray-500" }
34
- end
35
-
36
- config.wrappers :prepend_string, tag: 'div', class: '', error_class: '', valid_class: '' do |b|
37
- b.use :html5
38
- b.use :placeholder
39
- b.optional :maxlength
40
- b.optional :minlength
41
- b.optional :pattern
42
- b.optional :min_max
43
- b.optional :readonly
44
-
45
- b.use :label, class: "block text-sm font-medium text-gray-700"
46
-
47
- b.wrapper tag: 'div', class: 'mt-1 flex rounded-md shadow-sm' do |d|
48
- d.use :prepend
49
- d.use :input,
50
- class: "flex-1 min-w-0 block w-full px-3 py-2 rounded-none rounded-r-md focus:ring-indigo-500 focus:border-indigo-500 sm:text-sm border-gray-300",
51
- error_class: "flex-1 min-w-0 block w-full px-3 py-2 rounded-none rounded-r-md focus:ring-red-500 focus:border-red-500 sm:text-sm border-red-300 text-red-900 placeholder-red-300"
52
- end
53
- b.use :full_error, wrap_with: { tag: "p", class: "mt-2 text-sm text-red-600" }
54
- b.use :hint, wrap_with: { tag: :p, class: "mt-2 text-sm text-gray-500" }
55
- end
56
-
57
- config.wrappers :append_string, tag: 'div', class: '', error_class: '', valid_class: '' do |b|
58
- b.use :html5
59
- b.use :placeholder
60
- b.optional :maxlength
61
- b.optional :minlength
62
- b.optional :pattern
63
- b.optional :min_max
64
- b.optional :readonly
65
-
66
- b.use :label, class: "block text-sm font-medium text-gray-700"
67
-
68
- b.wrapper tag: 'div', class: 'mt-1 flex rounded-md shadow-sm' do |d|
69
- d.use :input,
70
- class: "flex-1 min-w-0 block w-full px-3 py-2 rounded-none rounded-l-md focus:ring-indigo-500 focus:border-indigo-500 sm:text-sm border-gray-300",
71
- error_class: "flex-1 min-w-0 block w-full px-3 py-2 rounded-none rounded-l-md focus:ring-red-500 focus:border-red-500 sm:text-sm border-red-300 text-red-900 placeholder-red-300"
72
- d.use :append
73
- end
74
- b.use :full_error, wrap_with: { tag: "p", class: "mt-2 text-sm text-red-600" }
75
- b.use :hint, wrap_with: { tag: :p, class: "mt-2 text-sm text-gray-500" }
76
- end
77
-
78
- config.wrappers :corner_hint, tag: :div do |b|
79
- b.use :html5
80
- b.use :placeholder
81
- b.optional :maxlength
82
- b.optional :minlength
83
- b.optional :pattern
84
- b.optional :min_max
85
- b.optional :readonly
86
-
87
- b.wrapper tag: :div, class: "flex justify-between", error_class: nil, valid_class: nil do |c|
88
- c.use :label, class: "block text-sm font-medium text-gray-700"
89
- c.use :hint, wrap_with: { tag: :span, class: "text-sm text-gray-500" }
90
- end
91
-
92
- b.use :input,
93
- class: "appearance-none block w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm placeholder-gray-400 focus:outline-none focus:ring-indigo-500 focus:border-indigo-500 sm:text-sm",
94
- error_class: "block w-full pr-10 border-red-300 text-red-900 placeholder-red-300 focus:outline-none focus:ring-red-500 focus:border-red-500 sm:text-sm rounded-md"
95
- b.use :full_error, wrap_with: { tag: "p", class: "mt-2 text-sm text-red-600" }
96
- end
97
-
98
- # The default wrapper to be used by the FormBuilder.
99
- config.default_wrapper = :default
100
-
101
- # Define the way to render check boxes / radio buttons with labels.
102
- # Defaults to :nested for bootstrap config.
103
- # inline: input + label
104
- # nested: label > input
105
- config.boolean_style = :nested
106
-
107
- # Default class for buttons
108
- config.button_class = nil
109
-
110
- # Method used to tidy up errors. Specify any Rails Array method.
111
- # :first lists the first message for each field.
112
- # Use :to_sentence to list all errors for each field.
113
- # config.error_method = :first
114
-
115
- # Default tag used for error notification helper.
116
- config.error_notification_tag = :div
117
-
118
- # CSS class to add for error notification helper.
119
- config.error_notification_class = ''
120
-
121
- # Series of attempts to detect a default label method for collection.
122
- # config.collection_label_methods = [ :to_label, :name, :title, :to_s ]
123
-
124
- # Series of attempts to detect a default value method for collection.
125
- # config.collection_value_methods = [ :id, :to_s ]
126
-
127
- # You can wrap a collection of radio/check boxes in a pre-defined tag, defaulting to none.
128
- # config.collection_wrapper_tag = nil
129
-
130
- # You can define the class to use on all collection wrappers. Defaulting to none.
131
- # config.collection_wrapper_class = nil
132
-
133
- # You can wrap each item in a collection of radio/check boxes with a tag,
134
- # defaulting to :span.
135
- # config.item_wrapper_tag = :span
136
-
137
- # You can define a class to use in all item wrappers. Defaulting to none.
138
- # config.item_wrapper_class = nil
139
-
140
- # How the label text should be generated altogether with the required text.
141
- config.label_text = lambda { |label, required, explicit_label| "#{label}" }
142
-
143
- # You can define the class to use on all labels. Default is nil.
144
- # config.label_class = nil
145
-
146
- # You can define the default class to be used on forms. Can be overriden
147
- # with `html: { :class }`. Defaulting to none.
148
- config.default_form_class = nil
149
- config.form_class = nil
150
-
151
- # You can define which elements should obtain additional classes
152
- config.generate_additional_classes_for = []
153
-
154
- # Whether attributes are required by default (or not). Default is true.
155
- # config.required_by_default = true
156
-
157
- # Tell browsers whether to use the native HTML5 validations (novalidate form option).
158
- # These validations are enabled in SimpleForm's internal config but disabled by default
159
- # in this configuration, which is recommended due to some quirks from different browsers.
160
- # To stop SimpleForm from generating the novalidate option, enabling the HTML5 validations,
161
- # change this configuration to true.
162
- config.browser_validations = false
163
-
164
- # Custom mappings for input types. This should be a hash containing a regexp
165
- # to match as key, and the input type that will be used when the field name
166
- # matches the regexp as value.
167
- # config.input_mappings = { /count/ => :integer }
168
-
169
- # Custom wrappers for input types. This should be a hash containing an input
170
- # type as key and the wrapper that will be used for all inputs with specified type.
171
- config.wrapper_mappings = {
172
- string: :default,
173
- prepend_string: :prepend_string,
174
- append_string: :append_string,
175
- }
176
-
177
- # Namespaces where SimpleForm should look for custom input classes that
178
- # override default inputs.
179
- # config.custom_inputs_namespaces << "CustomInputs"
180
-
181
- # Default priority for time_zone inputs.
182
- # config.time_zone_priority = nil
183
-
184
- # Default priority for country inputs.
185
- # config.country_priority = nil
186
-
187
- # When false, do not use translations for labels.
188
- # config.translate_labels = true
189
-
190
- # Automatically discover new inputs in Rails' autoload path.
191
- # config.inputs_discovery = true
192
-
193
- # Cache SimpleForm inputs discovery
194
- # config.cache_discovery = !Rails.env.development?
195
-
196
- # Default class for inputs
197
- # config.input_class = nil
198
-
199
- # Define the default class of the input wrapper of the boolean input.
200
- config.boolean_label_class = 'checkbox'
201
-
202
- # Defines if the default input wrapper class should be included in radio
203
- # collection wrappers.
204
- # config.include_default_input_wrapper_class = true
205
-
206
- # Defines which i18n scope will be used in Simple Form.
207
- # config.i18n_scope = 'simple_form'
208
-
209
- # Defines validation classes to the input_field. By default it's nil.
210
- # config.input_field_valid_class = 'is-valid'
211
- # config.input_field_error_class = 'is-invalid'
212
- end