jqr-helpers 1.0.30 → 1.0.31

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.
@@ -327,15 +327,27 @@
327
327
  return false;
328
328
  }
329
329
 
330
- function ujsQuickButtonClick(event) {
331
- var radio = $(event.currentTarget).prev('input');
330
+ function updateQuickButton(radio, label) {
332
331
  var form = radio[0].form;
333
332
  var name = $(radio).attr('name');
334
333
  $(form).find('input[name="' + name + '"]').each(function() {
335
334
  $(this).next('label').removeClass('ui-state-active');
336
335
  });
337
336
 
338
- $(event.currentTarget).addClass('ui-state-active');
337
+ label.addClass('ui-state-active');
338
+
339
+ }
340
+
341
+ function ujsQuickButtonChange(event) {
342
+ var radio = $(event.currentTarget);
343
+ var label = radio.next('label');
344
+ updateQuickButton(radio, label);
345
+ }
346
+
347
+ function ujsQuickButtonClick(event) {
348
+ var label = $(event.currentTarget);
349
+ var radio = label.prev('input');
350
+ updateQuickButton(radio, label);
339
351
  }
340
352
 
341
353
  function ujsQuickButtonHover(event) {
@@ -344,6 +356,8 @@
344
356
 
345
357
  function ujsLoadPlugins(event) {
346
358
 
359
+ $j('.ujs-quick-buttonset input:checked').change();
360
+
347
361
  function addHiddenField(form, name, value) {
348
362
  var input = $('<input type="hidden">');
349
363
  input.attr('name', name);
@@ -427,6 +441,8 @@
427
441
  $(document).on('ajax:success', '.ujs-ajax', ujsAjaxSuccess);
428
442
  $(document).on('ajax:error', '.ujs-ajax', ujsAjaxError);
429
443
  $(document).on('click', '[data-ujs-confirm=true]', ujsConfirmClick);
444
+ $(document).on('change', '.ujs-quick-buttonset input',
445
+ ujsQuickButtonChange);
430
446
  $(document).on('click', '.ujs-quick-buttonset label',
431
447
  ujsQuickButtonClick);
432
448
  $(document).on('mouseenter mouseleave', '.ujs-quick-buttonset label',
@@ -442,6 +458,7 @@
442
458
  $('.ujs-ajax').live('ajax:success', ujsAjaxSuccess);
443
459
  $('.ujs-ajax').live('ajax:error', ujsAjaxError);
444
460
  $('[data-ujs-confirm=true]').live('click', ujsConfirmClick);
461
+ $('.ujs-quick-buttonset input').live('change', ujsQuickButtonChange);
445
462
  $('.ujs-quick-buttonset label').live('click', ujsQuickButtonClick);
446
463
  $('.ujs-quick-buttonset label').live('mouseenter mouseleave',
447
464
  ujsQuickButtonHover);
data/jqr-helpers.gemspec CHANGED
@@ -1,7 +1,7 @@
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.30'
4
+ s.version = '1.0.31'
5
5
  s.date = '2014-02-18'
6
6
  s.summary = 'Helpers to print unobtrusive jQuery-UI tags.'
7
7
  s.description = <<-EOF
@@ -1,6 +1,6 @@
1
1
  module JqrHelpers
2
2
  # @private
3
3
  module Rails
4
- VERSION = '1.0.30'
4
+ VERSION = '1.0.31'
5
5
  end
6
6
  end
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: jqr-helpers
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 1.0.30
5
+ version: 1.0.31
6
6
  platform: ruby
7
7
  authors:
8
8
  - Daniel Orner