lotus_admin 1.2.1 → 1.2.2
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.
- checksums.yaml +4 -4
- data/app/assets/stylesheets/lotus_admin/components/_forms.scss +4 -0
- data/app/helpers/lotus_admin/form_helpers.rb +1 -0
- data/config/initializers/simple_form_material.rb +1 -1
- data/lib/lotus_admin/form_builder.rb +27 -0
- data/lib/lotus_admin/version.rb +1 -1
- data/lib/lotus_admin.rb +1 -0
- metadata +2 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7da3c2c63c60b091d7fe7fccaf1b1ef3282d152aaa191b141c0192b7bb8045d8
|
4
|
+
data.tar.gz: a4c88154204fbf234e7ee29ae03866db5fed7b3a3ade921624fbe6a234a7214e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0d73ca1d470aab9dda188eeaa1352cd00e7cf079cd4d52bdc35e78543575c5ee78071210fb7af4e8f106788679e945226e7238cebb002ea98ae02bcd74dcbbea
|
7
|
+
data.tar.gz: febc6e4b7f3438873edc38507589a32539edf33bcbeee2268b2b2f192517bb38fad084cfe8ae8bb9d778e12d8aeca4855cf6db88b599de5513251dfd42cb3013
|
@@ -11,7 +11,7 @@ SimpleForm.setup do |config|
|
|
11
11
|
b.optional :min_max
|
12
12
|
b.optional :readonly
|
13
13
|
|
14
|
-
b.use :
|
14
|
+
b.use :label_input, class: 'form-control', wrap_with: { tag: 'div', class: 'fg-line' }
|
15
15
|
b.use :error, wrap_with: { tag: 'span', class: 'help-block' }
|
16
16
|
b.use :hint, wrap_with: { tag: 'p', class: 'help-block' }
|
17
17
|
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
class LotusAdmin::FormBuilder < SimpleForm::FormBuilder
|
2
|
+
def input(attribute_name, options = {}, &block)
|
3
|
+
type = options.fetch(:as, nil) || default_input_type(
|
4
|
+
attribute_name,
|
5
|
+
find_attribute_column(attribute_name),
|
6
|
+
options
|
7
|
+
)
|
8
|
+
|
9
|
+
if type != :boolean
|
10
|
+
if options[:placeholder].nil?
|
11
|
+
options[:placeholder] ||= if object.class.respond_to?(:human_attribute_name)
|
12
|
+
object.class.human_attribute_name(attribute_name.to_s)
|
13
|
+
else
|
14
|
+
attribute_name.to_s.humanize
|
15
|
+
end
|
16
|
+
end
|
17
|
+
options[:label] = false if options[:label].nil?
|
18
|
+
end
|
19
|
+
|
20
|
+
case type
|
21
|
+
when :grouped_select, :select, :date
|
22
|
+
options[:label] = options[:placeholder]
|
23
|
+
end
|
24
|
+
|
25
|
+
super
|
26
|
+
end
|
27
|
+
end
|
data/lib/lotus_admin/version.rb
CHANGED
data/lib/lotus_admin.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: lotus_admin
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.2.
|
4
|
+
version: 1.2.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Matt Millsaps-Brewer
|
@@ -442,6 +442,7 @@ files:
|
|
442
442
|
- lib/lotus_admin.rb
|
443
443
|
- lib/lotus_admin/configuration.rb
|
444
444
|
- lib/lotus_admin/engine.rb
|
445
|
+
- lib/lotus_admin/form_builder.rb
|
445
446
|
- lib/lotus_admin/router.rb
|
446
447
|
- lib/lotus_admin/version.rb
|
447
448
|
- lib/tasks/lotus_admin_tasks.rake
|