simple_form-theme 0.1.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +2 -0
- data/config/initializers/simple_form.rb +176 -0
- data/lib/simple_form/theme/version.rb +1 -1
- data/lib/simple_form/theme.rb +7 -2
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6d934b32592b1a73bb0bc657301447d61a96ec793002ee096e700b176000120d
|
4
|
+
data.tar.gz: 3a7dcde3dea07205f7f4542d68061fca65f696ebe41c17eab3c059fb1029b8e6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4cfd8957eb26b23fa26fd3d981c28d08f21c3c9b7955feac799380f1a2f9421d8b9723c160e124544fa88f5902eb52eb237ffa91a8a0e98a476530a825c76d4c
|
7
|
+
data.tar.gz: b49bffcde5d65de881e966d0c36da9fc953ac0c09b451d517151a05fe40d7f9a23b48b7b0bc7488382395f8ec4b0899bab5742ac54ba393c123d15bef256d8b8
|
data/README.md
CHANGED
@@ -0,0 +1,176 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
#
|
3
|
+
# Uncomment this and change the path if necessary to include your own
|
4
|
+
# components.
|
5
|
+
# See https://github.com/heartcombo/simple_form#custom-components to know
|
6
|
+
# more about custom components.
|
7
|
+
# Dir[Rails.root.join('lib/components/**/*.rb')].each { |f| require f }
|
8
|
+
#
|
9
|
+
# Use this setup block to configure all options available in SimpleForm.
|
10
|
+
SimpleForm.setup do |config|
|
11
|
+
# Wrappers are used by the form builder to generate a
|
12
|
+
# complete input. You can remove any component from the
|
13
|
+
# wrapper, change the order or even add your own to the
|
14
|
+
# stack. The options given below are used to wrap the
|
15
|
+
# whole input.
|
16
|
+
config.wrappers :default, class: :input,
|
17
|
+
hint_class: :field_with_hint, error_class: :field_with_errors, valid_class: :field_without_errors do |b|
|
18
|
+
## Extensions enabled by default
|
19
|
+
# Any of these extensions can be disabled for a
|
20
|
+
# given input by passing: `f.input EXTENSION_NAME => false`.
|
21
|
+
# You can make any of these extensions optional by
|
22
|
+
# renaming `b.use` to `b.optional`.
|
23
|
+
|
24
|
+
# Determines whether to use HTML5 (:email, :url, ...)
|
25
|
+
# and required attributes
|
26
|
+
b.use :html5
|
27
|
+
|
28
|
+
# Calculates placeholders automatically from I18n
|
29
|
+
# You can also pass a string as f.input placeholder: "Placeholder"
|
30
|
+
b.use :placeholder
|
31
|
+
|
32
|
+
## Optional extensions
|
33
|
+
# They are disabled unless you pass `f.input EXTENSION_NAME => true`
|
34
|
+
# to the input. If so, they will retrieve the values from the model
|
35
|
+
# if any exists. If you want to enable any of those
|
36
|
+
# extensions by default, you can change `b.optional` to `b.use`.
|
37
|
+
|
38
|
+
# Calculates maxlength from length validations for string inputs
|
39
|
+
# and/or database column lengths
|
40
|
+
b.optional :maxlength
|
41
|
+
|
42
|
+
# Calculate minlength from length validations for string inputs
|
43
|
+
b.optional :minlength
|
44
|
+
|
45
|
+
# Calculates pattern from format validations for string inputs
|
46
|
+
b.optional :pattern
|
47
|
+
|
48
|
+
# Calculates min and max from length validations for numeric inputs
|
49
|
+
b.optional :min_max
|
50
|
+
|
51
|
+
# Calculates readonly automatically from readonly attributes
|
52
|
+
b.optional :readonly
|
53
|
+
|
54
|
+
## Inputs
|
55
|
+
# b.use :input, class: 'input', error_class: 'is-invalid', valid_class: 'is-valid'
|
56
|
+
b.use :label_input
|
57
|
+
b.use :hint, wrap_with: { tag: :span, class: :hint }
|
58
|
+
b.use :error, wrap_with: { tag: :span, class: :error }
|
59
|
+
|
60
|
+
## full_messages_for
|
61
|
+
# If you want to display the full error message for the attribute, you can
|
62
|
+
# use the component :full_error, like:
|
63
|
+
#
|
64
|
+
# b.use :full_error, wrap_with: { tag: :span, class: :error }
|
65
|
+
end
|
66
|
+
|
67
|
+
# The default wrapper to be used by the FormBuilder.
|
68
|
+
config.default_wrapper = :default
|
69
|
+
|
70
|
+
# Define the way to render check boxes / radio buttons with labels.
|
71
|
+
# Defaults to :nested for bootstrap config.
|
72
|
+
# inline: input + label
|
73
|
+
# nested: label > input
|
74
|
+
config.boolean_style = :nested
|
75
|
+
|
76
|
+
# Default class for buttons
|
77
|
+
config.button_class = 'btn'
|
78
|
+
|
79
|
+
# Method used to tidy up errors. Specify any Rails Array method.
|
80
|
+
# :first lists the first message for each field.
|
81
|
+
# Use :to_sentence to list all errors for each field.
|
82
|
+
# config.error_method = :first
|
83
|
+
|
84
|
+
# Default tag used for error notification helper.
|
85
|
+
config.error_notification_tag = :div
|
86
|
+
|
87
|
+
# CSS class to add for error notification helper.
|
88
|
+
config.error_notification_class = 'error_notification'
|
89
|
+
|
90
|
+
# Series of attempts to detect a default label method for collection.
|
91
|
+
# config.collection_label_methods = [ :to_label, :name, :title, :to_s ]
|
92
|
+
|
93
|
+
# Series of attempts to detect a default value method for collection.
|
94
|
+
# config.collection_value_methods = [ :id, :to_s ]
|
95
|
+
|
96
|
+
# You can wrap a collection of radio/check boxes in a pre-defined tag, defaulting to none.
|
97
|
+
# config.collection_wrapper_tag = nil
|
98
|
+
|
99
|
+
# You can define the class to use on all collection wrappers. Defaulting to none.
|
100
|
+
# config.collection_wrapper_class = nil
|
101
|
+
|
102
|
+
# You can wrap each item in a collection of radio/check boxes with a tag,
|
103
|
+
# defaulting to :span.
|
104
|
+
# config.item_wrapper_tag = :span
|
105
|
+
|
106
|
+
# You can define a class to use in all item wrappers. Defaulting to none.
|
107
|
+
# config.item_wrapper_class = nil
|
108
|
+
|
109
|
+
# How the label text should be generated altogether with the required text.
|
110
|
+
# config.label_text = lambda { |label, required, explicit_label| "#{required} #{label}" }
|
111
|
+
|
112
|
+
# You can define the class to use on all labels. Default is nil.
|
113
|
+
# config.label_class = nil
|
114
|
+
|
115
|
+
# You can define the default class to be used on forms. Can be overridden
|
116
|
+
# with `html: { :class }`. Defaulting to none.
|
117
|
+
# config.default_form_class = nil
|
118
|
+
|
119
|
+
# You can define which elements should obtain additional classes
|
120
|
+
# config.generate_additional_classes_for = [:wrapper, :label, :input]
|
121
|
+
|
122
|
+
# Whether attributes are required by default (or not). Default is true.
|
123
|
+
# config.required_by_default = true
|
124
|
+
|
125
|
+
# Tell browsers whether to use the native HTML5 validations (novalidate form option).
|
126
|
+
# These validations are enabled in SimpleForm's internal config but disabled by default
|
127
|
+
# in this configuration, which is recommended due to some quirks from different browsers.
|
128
|
+
# To stop SimpleForm from generating the novalidate option, enabling the HTML5 validations,
|
129
|
+
# change this configuration to true.
|
130
|
+
config.browser_validations = false
|
131
|
+
|
132
|
+
# Custom mappings for input types. This should be a hash containing a regexp
|
133
|
+
# to match as key, and the input type that will be used when the field name
|
134
|
+
# matches the regexp as value.
|
135
|
+
# config.input_mappings = { /count/ => :integer }
|
136
|
+
|
137
|
+
# Custom wrappers for input types. This should be a hash containing an input
|
138
|
+
# type as key and the wrapper that will be used for all inputs with specified type.
|
139
|
+
# config.wrapper_mappings = { string: :prepend }
|
140
|
+
|
141
|
+
# Namespaces where SimpleForm should look for custom input classes that
|
142
|
+
# override default inputs.
|
143
|
+
# config.custom_inputs_namespaces << "CustomInputs"
|
144
|
+
|
145
|
+
# Default priority for time_zone inputs.
|
146
|
+
# config.time_zone_priority = nil
|
147
|
+
|
148
|
+
# Default priority for country inputs.
|
149
|
+
# config.country_priority = nil
|
150
|
+
|
151
|
+
# When false, do not use translations for labels.
|
152
|
+
# config.translate_labels = true
|
153
|
+
|
154
|
+
# Automatically discover new inputs in Rails' autoload path.
|
155
|
+
# config.inputs_discovery = true
|
156
|
+
|
157
|
+
# Cache SimpleForm inputs discovery
|
158
|
+
# config.cache_discovery = !Rails.env.development?
|
159
|
+
|
160
|
+
# Default class for inputs
|
161
|
+
# config.input_class = nil
|
162
|
+
|
163
|
+
# Define the default class of the input wrapper of the boolean input.
|
164
|
+
config.boolean_label_class = 'checkbox'
|
165
|
+
|
166
|
+
# Defines if the default input wrapper class should be included in radio
|
167
|
+
# collection wrappers.
|
168
|
+
# config.include_default_input_wrapper_class = true
|
169
|
+
|
170
|
+
# Defines which i18n scope will be used in Simple Form.
|
171
|
+
# config.i18n_scope = 'simple_form'
|
172
|
+
|
173
|
+
# Defines validation classes to the input_field. By default it's nil.
|
174
|
+
# config.input_field_valid_class = 'is-valid'
|
175
|
+
# config.input_field_error_class = 'is-invalid'
|
176
|
+
end
|
data/lib/simple_form/theme.rb
CHANGED
@@ -1,7 +1,12 @@
|
|
1
|
-
|
2
|
-
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'simple_form/theme/version'
|
4
|
+
require 'simple_form/theme/engine'
|
5
|
+
|
6
|
+
require 'simple_form'
|
3
7
|
|
4
8
|
module SimpleForm
|
9
|
+
# SimpleFormTheme
|
5
10
|
module Theme
|
6
11
|
# Your code goes here...
|
7
12
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: simple_form-theme
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Juan Vasquez
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-06
|
11
|
+
date: 2024-07-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -62,6 +62,7 @@ files:
|
|
62
62
|
- app/mailers/simple_form/theme/application_mailer.rb
|
63
63
|
- app/models/simple_form/theme/application_record.rb
|
64
64
|
- app/views/layouts/simple_form/theme/application.html.erb
|
65
|
+
- config/initializers/simple_form.rb
|
65
66
|
- config/routes.rb
|
66
67
|
- lib/generators/simple_form/theme/bulma/USAGE
|
67
68
|
- lib/generators/simple_form/theme/bulma/bulma_generator.rb
|