jqr-helpers 1.0.63 → 1.0.64

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- NDNkN2UwMWI2MGNlM2Q3YjU2ODQwY2Y0MjNjZTFlMmQwNWMxYmM3YQ==
4
+ YmVjMDIxZGU2OTY0Mjc4ZGQwZDc5MWU1ZGY1NDkyNDM3YTdhOTdmZQ==
5
5
  data.tar.gz: !binary |-
6
- NjIzMGMxNGMxMTk1NDZiZDEwZGI5MzkxMDg1NmFjMDNjNTBhNDgxNQ==
6
+ ZGY0NGJiYmYxYTdlZWM3ZDczOGY3ZThlOGVlMDRmOWY5ZGEyMmViNA==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- YTFiYTk0MTk4NDM0MDQwNjY0ZGU2OTE0ZGE4N2ZkOGVhOTA3Mjc0OWM2NGY4
10
- OGYzNGEwMTkwZWMxM2I3NzlkZWViMmYwYTI5MDVmMDcyMTE3NjJiZjZiYTc4
11
- NDI3OGVmYmVmODE2NmRkOWViNTc0YzMyNjRjYTdlNmY0ZWI2ODc=
9
+ NWI1OWM1YTIyOGMzMDkwN2U0YjI3MWM1Yjg1NWJiYmY2MWFkMGUzMjA5ZWU3
10
+ ZDMzMmJkYjhhZmNlMjQ2ZTNmNmY5YmYxNDczYjAyMDIyM2IxNTFjMTBkODMx
11
+ ZTZjYTFmNTA4NzhkNmQyYjk4NjM4M2RmY2NmNTg0ZmUwMTI0NmU=
12
12
  data.tar.gz: !binary |-
13
- Y2QyZDcwYmZiOTI1ZTc1ZGFmNDQ4NTQwMTVlOWIwMjUyNWE0MDI5MTBiM2Fm
14
- Y2VlZGE4YzA5ZGFkN2E4NDE4ZjViODczY2JlNDRjMzA1ZGZkMDA2NzY3MmVi
15
- ZGIzYWRmYTk2MDZiYjc2YjUzZWNlOTQ4YTZhMDMzMzYwYTk1YWU=
13
+ YTk0N2VjNjFhNDU3MDhmOGVmMmEyZTVmYzI2ZjM0ZGMxODgxMGY2NzUxYThj
14
+ YTQwZTAxNTZjOGFhZjIyZWNkYTFkNjgzNTExYmM5ZDA5NjQ5OWNmYzk0NDk0
15
+ YmU1MTI0YTBjNTQ2ODEzZTY4MDZjY2YxMTliMDNiMDM1MjJiMTI=
data/Readme.md CHANGED
@@ -167,11 +167,18 @@ other elements.
167
167
  will be scrolled into view (i.e. its top will be aligned with the top of the
168
168
  page).
169
169
  * `:throbber` (String) - This can be `:small`, `:large`, or
170
- `:none`. By default for most Ajax requests it is `:small`, indicating
170
+ `:none`. By default for most Ajax requests it is `:small`, indicating
171
171
  a small inline throbber next to the button or link. For ``link_to_dialog`` and
172
- ``button_to_dialog``, the default is ``:large``, meaning a throbber that goes in
172
+ ``button_to_dialog``, the default is ``:large``, meaning a throbber that goes in
173
173
  front of the screen.`:none` shows no throbber at all.
174
174
 
175
+ ## Render Responses ##
176
+
177
+ For Ajax options, `update` and `append` expect HTML responses. Generally
178
+ you would do this in your Rails controller by rendering a partial, or a view
179
+ with `:layout => false`. Conversely, when using `delete`, the JS expects a
180
+ simple text response of `success` since there it is simply deleting a row.
181
+
175
182
  ## Monitoring Fields ##
176
183
 
177
184
  You can monitor a field for changes using the ``ajax_change`` method:
@@ -497,10 +497,30 @@
497
497
  element.removeAttr('data-' + val);
498
498
  });
499
499
  element.removeClass('ujs-ajax');
500
- // we have to set a data-remote attribute because Rails uses [data-remote]
501
- // as a selector rather than checking the actual data in the element
502
- $(this).find('input, select').data(dataMap).addClass('ujs-ajax').
503
- attr('data-remote', 'true');
500
+ $(this).find('input, select').data(dataMap).change(function() {
501
+ // unchecked checkboxes would not be included. We'll replace it
502
+ // with a checked one and value 0.
503
+ $('body').remove('.jqr-hidden-checkbox');
504
+ if ($(this).is(':checkbox:not(:checked)')) {
505
+ $(this).uniqueId();
506
+ element = $(this).clone();
507
+ element.data($(this).data());
508
+ element.data('real-element', $(this).attr('id'));
509
+ element.prop('value', '0');
510
+ element.prop('checked', true);
511
+ element.hide();
512
+ element.addClass('jqr-hidden-checkbox').addClass('ujs-ajax');
513
+ element.attr('data-remote', true);
514
+ $('body').append(element);
515
+ $.rails.handleRemote(element);
516
+ }
517
+ else {
518
+ // Rails checks the attribute, not the data
519
+ $(this).attr('data-remote', true).addClass('ujs-ajax');
520
+ $.rails.handleRemote($(this));
521
+ $(this).removeAttr('data-remote');
522
+ }
523
+ });
504
524
  });
505
525
  $(event.target).trigger('jqr.afterload');
506
526
  }
data/jqr-helpers.gemspec CHANGED
@@ -1,8 +1,8 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = 'jqr-helpers'
3
3
  s.require_paths = %w(. lib lib/jqr-helpers)
4
- s.version = '1.0.63'
5
- s.date = '2014-10-27'
4
+ s.version = '1.0.64'
5
+ s.date = '2014-11-27'
6
6
  s.summary = 'Helpers to print unobtrusive jQuery-UI tags.'
7
7
  s.description = <<-EOF
8
8
  This gem adds helper methods to create unobtrusive jQuery code. It outputs
@@ -1,6 +1,6 @@
1
1
  module JqrHelpers
2
2
  # @private
3
3
  module Rails
4
- VERSION = '1.0.63'
4
+ VERSION = '1.0.64'
5
5
  end
6
6
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jqr-helpers
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.63
4
+ version: 1.0.64
5
5
  platform: ruby
6
6
  authors:
7
7
  - Daniel Orner
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-10-27 00:00:00.000000000 Z
11
+ date: 2014-11-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  requirement: !ruby/object:Gem::Requirement