lotus_admin 1.2.1 → 1.2.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 165fbfa584f3bb0cd71ea555855d2ffc49ab22129aabfde4b067cec175f73a56
4
- data.tar.gz: 94c075db3474838e53dd8ee488ca9f5f3e1cd453c9ebea1ee9f7290b7aed0b25
3
+ metadata.gz: 7da3c2c63c60b091d7fe7fccaf1b1ef3282d152aaa191b141c0192b7bb8045d8
4
+ data.tar.gz: a4c88154204fbf234e7ee29ae03866db5fed7b3a3ade921624fbe6a234a7214e
5
5
  SHA512:
6
- metadata.gz: ffd7b457deb21e99211232f9f5f3368c6456af9969b3d4f6263f30df73690a23259dcd2313b318934b41d0d2fe39b01472782c355deb3152e1cd7082097e0175
7
- data.tar.gz: '0110559a144589ca4413b57751c68742dc31838f3bb7aa59e75269fe375cb0d359181b87ebca1f7ab8edb9433b4ac16aae081ff5feb19d1b428dcd5e421099d1'
6
+ metadata.gz: 0d73ca1d470aab9dda188eeaa1352cd00e7cf079cd4d52bdc35e78543575c5ee78071210fb7af4e8f106788679e945226e7238cebb002ea98ae02bcd74dcbbea
7
+ data.tar.gz: febc6e4b7f3438873edc38507589a32539edf33bcbeee2268b2b2f192517bb38fad084cfe8ae8bb9d778e12d8aeca4855cf6db88b599de5513251dfd42cb3013
@@ -9,3 +9,7 @@
9
9
  .input-group-addon {
10
10
  border-bottom: 1px solid $input-border;
11
11
  }
12
+
13
+ label.form-control {
14
+ border-bottom: 0px;
15
+ }
@@ -1,6 +1,7 @@
1
1
  module LotusAdmin
2
2
  module FormHelpers
3
3
  def material_form_for(resource, options = {}, &block)
4
+ options[:builder] ||= LotusAdmin::FormBuilder
4
5
  options[:wrapper] = :material_form
5
6
  options[:wrapper_mappings] = {
6
7
  boolean: :material_boolean_horizontal
@@ -11,7 +11,7 @@ SimpleForm.setup do |config|
11
11
  b.optional :min_max
12
12
  b.optional :readonly
13
13
 
14
- b.use :input, class: 'form-control', wrap_with: { tag: 'div', class: 'fg-line' }
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
@@ -1,3 +1,3 @@
1
1
  module LotusAdmin
2
- VERSION = '1.2.1'
2
+ VERSION = '1.2.2'
3
3
  end
data/lib/lotus_admin.rb CHANGED
@@ -19,6 +19,7 @@ require 'kaminari'
19
19
  require 'ransack'
20
20
 
21
21
  require 'lotus_admin/configuration'
22
+ require 'lotus_admin/form_builder'
22
23
  require 'lotus_admin/router'
23
24
 
24
25
  module LotusAdmin
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.1
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