effective_bootstrap 0.3.14 → 0.3.15

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
  SHA1:
3
- metadata.gz: 1fe27ec0f7e80f2eb443ef732080279c0bda7b59
4
- data.tar.gz: 66a908a12cc17816782cdabdee51a64145702356
3
+ metadata.gz: 5bbf6bd3ec7def180b40cbcb63051fd4df9bcd34
4
+ data.tar.gz: 6a12b389a429f0172bc3c98e07f5309591a22c1d
5
5
  SHA512:
6
- metadata.gz: 72bcff10833ff251624f1d29efbc786ec4cf31890e146e14c390c3a47cebfcc17a788618c56edd3823f5b4ba717722b5fd5a2a5309749336c02745df29096c4b
7
- data.tar.gz: c341f4ce42b5d3e89bf40081768fb2e239e6e6c406287b1402402d92434f695534c4fb4225daf22e76e7e1d6fc97dfaa93ce61630c525451123ed6e74c72e4e2
6
+ metadata.gz: 5fc72b857ca9fd5b05396472c55ebd870aa4c739f749f84d96ce658e71d4a3b68ade1ad128d0d7923dfbe3d525a2d426aeb9b9050140f23cffa4534ea1a54b4f
7
+ data.tar.gz: 03b7fabea05279fb5579cbf61fbbf753234c5768547db87dc1ad3a45de917d02303e477b22834bffad17a9ad729c2e290ac5ee944be6afd8427f6e245c21a477
@@ -13,8 +13,15 @@ $(document).on('click', '[data-effective-select-or-text]', function(event) {
13
13
  $visible = $obj.children('.form-group:visible').first();
14
14
  $hidden = $obj.children('.form-group:not(:visible)').first();
15
15
 
16
- $visible.hide();
17
- $hidden.slideDown();
16
+ visible_name = $visible.find('input,textarea,select').first().attr('name');
17
+ hidden_name = $hidden.find('input,textarea,select').first().attr('name');
18
+
19
+ if(visible_name == hidden_name) { $hidden.find('input,textarea,select').removeAttr('disabled'); }
20
+
21
+ $visible.fadeOut('fast', function() {
22
+ if(visible_name == hidden_name) { $(this).find('input,textarea,select').prop('disabled', true); }
23
+ $hidden.fadeIn('fast');
24
+ });
18
25
 
19
26
  return false; // This implicitly calls event.preventDefault() to cancel the action, and prevent the link from going somewhere.
20
27
  });
@@ -7,7 +7,7 @@ module Effective
7
7
  attr_accessor :text_options
8
8
 
9
9
  VISIBLE = {}
10
- HIDDEN = { wrapper: { style: 'display: none;' } }
10
+ HIDDEN_AND_DISABLED = { wrapper: { style: 'display: none;' }, disabled: true }
11
11
 
12
12
  def initialize(name, options, builder:)
13
13
  @name_text = options.delete(:name_text) || raise('Please include a text method name')
@@ -36,13 +36,13 @@ module Effective
36
36
  return true if object.errors[name].present?
37
37
  return false if object.errors[name_text].present?
38
38
 
39
- object.send(name).present? || (object.send(name).blank? && object.send(name_text).blank?)
39
+ value = object.send(name)
40
+
41
+ (value.present? && select_collection.include?(value)) || (value.blank? && object.send(name_text).blank?)
40
42
  end
41
43
 
42
44
  def text?
43
- return false if object.errors[name].present?
44
-
45
- object.send(name_text).present? || object.errors[name_text].present?
45
+ !select?
46
46
  end
47
47
 
48
48
  def email_field?
@@ -50,11 +50,11 @@ module Effective
50
50
  end
51
51
 
52
52
  def select_options
53
- @select_options.merge(select? ? VISIBLE : HIDDEN)
53
+ @select_options.merge(select? ? VISIBLE : HIDDEN_AND_DISABLED)
54
54
  end
55
55
 
56
56
  def text_options
57
- @text_options.merge(text? ? VISIBLE : HIDDEN)
57
+ @text_options.merge(text? ? VISIBLE : HIDDEN_AND_DISABLED)
58
58
  end
59
59
 
60
60
  end
@@ -1,7 +1,7 @@
1
1
  %p These icons are a combination of #{link_to 'Feather', 'https://feathericons.com/'} and #{link_to 'FontAwesome', 'https://fontawesome.com/'} icons.
2
2
 
3
3
  .row.text-center
4
- - Dir["#{__dir__}/../../../assets/images/icons/*.svg"].map { |path| path.split('/').last.chomp('.svg') }.each do |name|
4
+ - Dir["#{__dir__}#{'/..' * 3}/assets/images/icons/*.svg"].map { |path| path.split('/').last.chomp('.svg') }.sort.each do |name|
5
5
  .col-sm-2.my-3
6
6
  = icon(name)
7
7
  %br
@@ -1,3 +1,3 @@
1
1
  module EffectiveBootstrap
2
- VERSION = '0.3.14'.freeze
2
+ VERSION = '0.3.15'.freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: effective_bootstrap
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.14
4
+ version: 0.3.15
5
5
  platform: ruby
6
6
  authors:
7
7
  - Code and Effect
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-02-22 00:00:00.000000000 Z
11
+ date: 2019-02-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails