effective_bootstrap 0.0.16 → 0.0.17

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: b7fa96dba4c20705dcf039d7c1eabb04f29f1212
4
- data.tar.gz: 53207e5edb6761cc8b989532576b9b630c8a840d
3
+ metadata.gz: 814a8b4e6bdf2467b24d3da74f3bb1e9087498a2
4
+ data.tar.gz: d4cb17d21b10ad278917c6ccca0c7b74917b6633
5
5
  SHA512:
6
- metadata.gz: 5bfe93d73ca753ff390ea0f0d2970de2941130a10226cea030c413169fc174bdd1470ca5368df18cbd70e40c0eaa8cc45540f07e88e499a89332eb6361a393dc
7
- data.tar.gz: fbaf93f9765338f90e1d6795d54c3fc9ba9282cb953da2d62b498d765f729f9c9b65e45859c395f4df29b13e3e33b4ff7ae0a02872d9a977de1f1d47dc1c0858
6
+ metadata.gz: e22c354653c0d974664697e82bd28d4de6d43e7c1bc9da020c8d621efa3038f688f1c4c06b145101f7f7bdbfdc0f944fead4d3b01e632dd47a586ab7bb712702
7
+ data.tar.gz: 83d363deff4e780b5605a052fd6d70294d29fb7be34e23393222e6003cd5f3ef2c5ff4d3b39ea706cac6d66fe3f68e815df91fe63d9f154c03363cc484db11f0
@@ -5,6 +5,7 @@
5
5
  //= require ./effective_date/input
6
6
  //= require ./effective_time/input
7
7
 
8
+ //= require ./effective_checks/input
8
9
  //= require ./effective_file/input
9
10
  //= require ./effective_phone/input
10
11
  //= require ./effective_price/input
@@ -1,3 +1,4 @@
1
+ # This initializes all the effective_* form inputs also in this gem
1
2
  this.EffectiveBootstrap ||= new class
2
3
  initialize: (target) ->
3
4
  $(target || document).find('[data-input-js-options]:not(.initialized)').each (i, element) ->
@@ -36,7 +37,7 @@ $(document).on 'confirm', (event) ->
36
37
  , 4000)
37
38
  false # don't show the confirmation dialog
38
39
 
39
- $.rails.confirm = (message) -> true
40
+ $.rails.confirm = (message) -> true if $.rails
40
41
  $(document).on 'confirm:complete', (event) -> $(event.target).data('confirmed')
41
42
 
42
43
  # Fade out cocoon remove.
@@ -1,6 +1,6 @@
1
1
  this.EffectiveForm ||= new class
2
2
  current_submit: '' # The $(.form-actions) that clicked
3
- remote_form_payload: '' # A fresh form
3
+ remote_form_payload: '' # String containing html from server side render of this form
4
4
  remote_form_flash: '' # Array of Arrays
5
5
 
6
6
  validate: (form) ->
@@ -62,10 +62,11 @@ this.EffectiveForm ||= new class
62
62
  $form = ''
63
63
 
64
64
  if @remote_form_payload.length > 0
65
- $form = @remote_form_payload.find("form[data-remote-index='#{$target.data('remote-index')}']")
66
- $form = @remote_form_payload.find('form').first() if $form.length == 0
65
+ $payload = $("<div>#{@remote_form_payload}</div>")
66
+ $form = $payload.find("form[data-remote-index='#{$target.data('remote-index')}']")
67
+ $form = $payload.find('form').first() if $form.length == 0
67
68
 
68
- return if @remote_form_payload.length == 0 || $form.length == 0
69
+ return if $form.length == 0
69
70
 
70
71
  EffectiveBootstrap.initialize($form)
71
72
  $target.replaceWith($form)
@@ -79,9 +80,7 @@ this.EffectiveForm ||= new class
79
80
  @current_submit = $form.find("##{@current_submit.attr('id')}.form-actions")
80
81
 
81
82
  if @remote_form_flash.length > 0
82
- for flash in @remote_form_flash
83
- @flash($form, flash[0], flash[1], true)
84
-
83
+ @flash($form, flash[0], flash[1], true) for flash in @remote_form_flash
85
84
  @remote_form_flash = ''
86
85
 
87
86
  flash: ($form, status, message, skip_success = false) ->
@@ -0,0 +1,7 @@
1
+ $(document).on 'click', '[data-effective-checks-all]', (event) ->
2
+ $(event.currentTarget).closest('.effective-checks').find('input:checkbox').prop('checked', true)
3
+ false
4
+
5
+ $(document).on 'click', '[data-effective-checks-none]', (event) ->
6
+ $(event.currentTarget).closest('.effective-checks').find('input:checkbox').prop('checked', false)
7
+ false
@@ -0,0 +1 @@
1
+ //= require ./initialize
@@ -48,7 +48,11 @@ module Effective
48
48
 
49
49
  text = (options[:label].delete(:text) || (object.class.human_attribute_name(name) if object) || BLANK).html_safe
50
50
 
51
- content_tag((inline? ? :label : :legend), text, options[:label])
51
+ content_tag((inline? ? :label : :legend), options[:label]) do
52
+ text + content_tag(:small, class: 'effective-checks-actions text-muted ml-1') do
53
+ link_to('All', '#', 'data-effective-checks-all': true) + ' - ' + link_to('None', '#', 'data-effective-checks-none': true)
54
+ end
55
+ end
52
56
  end
53
57
 
54
58
  def build_item(builder)
@@ -1,3 +1,3 @@
1
1
  module EffectiveBootstrap
2
- VERSION = '0.0.16'.freeze
2
+ VERSION = '0.0.17'.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.0.16
4
+ version: 0.0.17
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: 2018-05-10 00:00:00.000000000 Z
11
+ date: 2018-05-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -370,6 +370,8 @@ files:
370
370
  - app/assets/javascripts/effective_bootstrap.js
371
371
  - app/assets/javascripts/effective_bootstrap/base.js.coffee
372
372
  - app/assets/javascripts/effective_bootstrap/form.js.coffee
373
+ - app/assets/javascripts/effective_checks/initialize.js.coffee
374
+ - app/assets/javascripts/effective_checks/input.js
373
375
  - app/assets/javascripts/effective_date/initialize.js.coffee
374
376
  - app/assets/javascripts/effective_date/input.js
375
377
  - app/assets/javascripts/effective_datetime/bootstrap-datetimepicker.js