effective_bootstrap 0.9.11 → 0.9.16

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: dfccd40b53981bf152c50dbcf01e94ba572c9647f7bbdd089a458eb84c18aa6a
4
- data.tar.gz: 765eab4d79769e5a8bb970a95fcf8275dcd978ebb2aca709869590349cf8db71
3
+ metadata.gz: 78c452728aebece1992dab4818d81b5d08cde5ab1bbb97569cf247b49500a50c
4
+ data.tar.gz: 4a5325017c6b462a607f57e994c9750662210d6cab460d4675858b1dd08d4a46
5
5
  SHA512:
6
- metadata.gz: 758307b2718b798b6b5827f8628ed66c037d30612d889edb88f39b79c44028e9a29b0ed7880dc1a79f2321fb62b80bd415d0920642ba44a6e758525fb6df1cbf
7
- data.tar.gz: 9587c02c77dfbbdf5a454ff1122acca628af9a5556dcca2d6e6780b624d483560fb7f996f8c72e645f0b7beb6c50c2ccb563f16d28bc28fc2178a26384bde0c1
6
+ metadata.gz: e1c9a87e7aea55ebc70e90d63453f9b10f8f2968c76f27a8d997393392b7b71394eb913c1c4136a9a5ecbb0ea3aaf32455f83a015411c25fc6203d85821bcfa4
7
+ data.tar.gz: 60ed64109d652ac3b0e3e4284349e5d4e0d436b2dd388a137d94d303fa183fbd28857d6e046c4d692b3ddff804ae6732b937c27f43be3aacb63d0f53b4f8e48e
@@ -18,6 +18,7 @@
18
18
  //= require ./effective_has_many/input
19
19
  //= require ./effective_integer/input
20
20
  //= require ./effective_number_text/input
21
+ //= require ./effective_password/input
21
22
  //= require ./effective_percent/input
22
23
  //= require ./effective_phone/input
23
24
  //= require ./effective_price/input
@@ -2,3 +2,10 @@
2
2
  $(document).on 'cocoon:before-remove', (event, $obj) ->
3
3
  $(event.target).data('remove-timeout', 1000)
4
4
  $obj.fadeOut('slow')
5
+
6
+ # Open all external trix links in a new window.
7
+ $(document).on 'click', '.trix-content a', (event) ->
8
+ obj = event.currentTarget
9
+
10
+ if obj.host != window.location.host && !obj.isContentEditable
11
+ obj.setAttribute('target', '_blank')
@@ -48,6 +48,8 @@ $(document).on 'click', '[data-effective-form-has-many-remove]', (event) ->
48
48
  event.preventDefault()
49
49
 
50
50
  $obj = $(event.currentTarget)
51
+ return unless $obj.data('confirmed') if $obj.data('confirm')
52
+
51
53
  $hasMany = $obj.closest('.form-has-many')
52
54
  return unless $hasMany.length > 0
53
55
 
@@ -0,0 +1,9 @@
1
+ # Prevent non-currency buttons from being pressed
2
+ $(document).on 'click', 'button[data-effective-password]', (event) ->
3
+ $obj = $(event.currentTarget)
4
+ $input = $obj.closest('.input-group')
5
+
6
+ $input.find('input').attr('type', $obj.data('effective-password'))
7
+ $input.find('button[data-effective-password]').toggle()
8
+
9
+ false
@@ -0,0 +1 @@
1
+ //= require ./initialize
@@ -1,8 +1,8 @@
1
1
  module EffectiveFormBuilderHelper
2
2
  def effective_form_with(**options, &block)
3
3
  # Compute the default ID
4
- subject = Array(options[:scope] || options[:model]).last
5
- class_name = subject.class.name.parameterize.underscore
4
+ subject = Array(options[:model] || options[:scope]).last
5
+ class_name = (options[:scope] || subject.class.name.parameterize.underscore)
6
6
  unique_id = options.except(:model).hash.abs
7
7
 
8
8
  html_id = if subject.kind_of?(Symbol)
@@ -117,7 +117,7 @@ module Effective
117
117
  fields
118
118
  end
119
119
 
120
- remove += link_to_remove(resource) if remove?
120
+ remove += link_to_remove(resource) if (remove? || resource.new_record?)
121
121
 
122
122
  content_tag(:div, render_fields(content, remove), class: 'has-many-fields')
123
123
  end
@@ -3,11 +3,25 @@ module Effective
3
3
  class PasswordField < Effective::FormInput
4
4
 
5
5
  def input_html_options
6
- { class: 'form-control', id: tag_id }
6
+ { class: 'form-control effective_password', id: tag_id }
7
7
  end
8
8
 
9
9
  def input_group_options
10
- { input_group: { class: 'input-group' }, prepend: content_tag(:span, icon('lock'), class: 'input-group-text') }
10
+ { input_group: { class: 'input-group' }, append: eyes }
11
+ end
12
+
13
+ def eyes
14
+ content_tag(:button, icon('eye'),
15
+ class: 'btn input-group-text',
16
+ title: 'Show password',
17
+ 'data-effective-password': 'text'
18
+ ) +
19
+ content_tag(:button, icon('eye-off'),
20
+ class: 'btn input-group-text',
21
+ title: 'Hide password',
22
+ style: 'display: none;',
23
+ 'data-effective-password': 'password'
24
+ )
11
25
  end
12
26
 
13
27
  def feedback_options
@@ -1,6 +1,7 @@
1
1
  module Effective
2
2
  module FormInputs
3
3
  class TextField < Effective::FormInput
4
+
4
5
  end
5
6
  end
6
7
  end
@@ -1,3 +1,3 @@
1
1
  module EffectiveBootstrap
2
- VERSION = '0.9.11'.freeze
2
+ VERSION = '0.9.16'.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.9.11
4
+ version: 0.9.16
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: 2021-01-19 00:00:00.000000000 Z
11
+ date: 2021-03-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -440,6 +440,8 @@ files:
440
440
  - app/assets/javascripts/effective_integer/input.js
441
441
  - app/assets/javascripts/effective_number_text/initialize.js.coffee
442
442
  - app/assets/javascripts/effective_number_text/input.js
443
+ - app/assets/javascripts/effective_password/initialize.js.coffee
444
+ - app/assets/javascripts/effective_password/input.js
443
445
  - app/assets/javascripts/effective_percent/initialize.js.coffee
444
446
  - app/assets/javascripts/effective_percent/input.js
445
447
  - app/assets/javascripts/effective_phone/initialize.js.coffee