effective_bootstrap 0.4.6 → 0.4.7

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 001fe5fbf1a05352d82ae59be2b0181078e391f2
4
- data.tar.gz: 24d5ec77cc725518659bcde94d09e80a37209395
3
+ metadata.gz: 8a416000ffb3b4e11e0fd61842b003ac41fba8c6
4
+ data.tar.gz: 5dfca3d53a870ed1e2d2bfb7b9b970c1089198d1
5
5
  SHA512:
6
- metadata.gz: 95d57accc1d088e060bfb7c1d66deb5625dca51f627e1c0f7cdb7d68f80589d68f192cc22bbd33efe6c17b9260e045d3c14bbd3e72b27bfbe44df30a1a9a81d6
7
- data.tar.gz: 5ab5aa1dfd214b0ff47935425f9839ab55c888f8c9a6beb072845bee00c5a586261d7df3e8da7db9d05d1dcdb6c224dda15406ef0a073cff88ca0e3bf80766d5
6
+ metadata.gz: a24a2ae5bb0f5dc9dc3e45e268ed9e254596dfc64b4cdd9c91269c6c79279448ee9b88fcda9a447aa9e13db4bb8e129412257cf89fc73963a53544a32a0444d3
7
+ data.tar.gz: 631c95b4ecd4af1e60c7f9913c9e0d6b9087a8072c1e9f0eca62585836117fa65bc6b72063d6173333f36c7615e60d6b3fa19f9c52a22596f18dd4c2b849d263
@@ -1,6 +1,8 @@
1
1
  //= require ./effective_bootstrap/base
2
+ //= require ./effective_bootstrap/confirm
2
3
  //= require ./effective_bootstrap/form
3
4
  //= require ./effective_bootstrap/logic
5
+ //= require ./effective_bootstrap/other
4
6
 
5
7
  //= require ./effective_datetime/input
6
8
  //= require ./effective_date/input
@@ -18,29 +18,3 @@ $ -> EffectiveBootstrap.initialize()
18
18
  $(document).on 'turbolinks:load', -> EffectiveBootstrap.initialize()
19
19
  $(document).on 'cocoon:after-insert', -> EffectiveBootstrap.initialize()
20
20
  $(document).on 'effective-bootstrap:initialize', (event) -> EffectiveBootstrap.initialize(event.currentTarget)
21
-
22
- # These next three methods hijack jquery_ujs data-confirm and do it our own way with a double click confirm
23
- $(document).on 'confirm', (event) ->
24
- $obj = $(event.target)
25
-
26
- if $obj.data('confirmed')
27
- true
28
- else
29
- $obj.data('confirm-original', $obj.html())
30
- $obj.html($obj.data('confirm'))
31
- $obj.data('confirmed', true)
32
- setTimeout(
33
- (->
34
- $obj.data('confirmed', false)
35
- $obj.html($obj.data('confirm-original'))
36
- )
37
- , 4000)
38
- false # don't show the confirmation dialog
39
-
40
- $.rails.confirm = (message) -> true if $.rails
41
- $(document).on 'confirm:complete', (event) -> $(event.target).data('confirmed')
42
-
43
- # Fade out cocoon remove.
44
- $(document).on 'cocoon:before-remove', (event, $obj) ->
45
- $(event.target).data('remove-timeout', 1000)
46
- $obj.fadeOut('slow')
@@ -0,0 +1,22 @@
1
+ # These next three methods hijack jquery_ujs data-confirm and do it our own way with a double click confirm
2
+
3
+ if <%= !!EffectiveBootstrap.use_custom_data_confirm %> && $.rails
4
+ $(document).on 'confirm', (event) ->
5
+ $obj = $(event.target)
6
+
7
+ if $obj.data('confirmed')
8
+ true
9
+ else
10
+ $obj.data('confirm-original', $obj.html())
11
+ $obj.html($obj.data('confirm'))
12
+ $obj.data('confirmed', true)
13
+ setTimeout(
14
+ (->
15
+ $obj.data('confirmed', false)
16
+ $obj.html($obj.data('confirm-original'))
17
+ )
18
+ , 4000)
19
+ false # don't show the confirmation dialog
20
+
21
+ $.rails.confirm = (message) -> true
22
+ $(document).on 'confirm:complete', (event) -> $(event.target).data('confirmed')
@@ -0,0 +1,4 @@
1
+ # Fade out cocoon remove.
2
+ $(document).on 'cocoon:before-remove', (event, $obj) ->
3
+ $(event.target).data('remove-timeout', 1000)
4
+ $obj.fadeOut('slow')
@@ -33,7 +33,7 @@ module EffectiveFormBuilderHelper
33
33
  end
34
34
 
35
35
  # Assign default ID
36
- options[:id] ||= options[:html].delete(:id) || html_id
36
+ options[:id] ||= (options[:html].delete(:id) || html_id) unless options.key?(:id)
37
37
 
38
38
  without_error_proc do
39
39
  form_with(**options.merge(builder: Effective::FormBuilder), &block)
@@ -21,4 +21,7 @@ EffectiveBootstrap.setup do |config|
21
21
  # end
22
22
  config.authorization_method = Proc.new { |controller, action, resource| authorize!(action, resource) }
23
23
 
24
+ # Replaces rails_ujs data-confirm with a custom inline implementation.
25
+ # You will need to recompile assets (or "rm -rf tmp/") if you change this.
26
+ config.use_custom_data_confirm = true
24
27
  end
@@ -7,6 +7,8 @@ module EffectiveBootstrap
7
7
  # The following are all valid config keys
8
8
  mattr_accessor :authorization_method
9
9
 
10
+ mattr_accessor :use_custom_data_confirm
11
+
10
12
  def self.setup
11
13
  yield self
12
14
  end
@@ -1,3 +1,3 @@
1
1
  module EffectiveBootstrap
2
- VERSION = '0.4.6'.freeze
2
+ VERSION = '0.4.7'.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.4.6
4
+ version: 0.4.7
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-04-19 00:00:00.000000000 Z
11
+ date: 2019-04-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -371,8 +371,10 @@ files:
371
371
  - app/assets/images/icons/zoom-out.svg
372
372
  - app/assets/javascripts/effective_bootstrap.js
373
373
  - app/assets/javascripts/effective_bootstrap/base.js.coffee
374
+ - app/assets/javascripts/effective_bootstrap/confirm.js.coffee.erb
374
375
  - app/assets/javascripts/effective_bootstrap/form.js.coffee
375
376
  - app/assets/javascripts/effective_bootstrap/logic.js.coffee
377
+ - app/assets/javascripts/effective_bootstrap/other.js.coffee
376
378
  - app/assets/javascripts/effective_checks/initialize.js.coffee
377
379
  - app/assets/javascripts/effective_checks/input.js
378
380
  - app/assets/javascripts/effective_ck_editor/initialize.js.coffee