jqr-helpers 1.0.43 → 1.0.44

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,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- MjIyZWM1MzQ1NDc3ZjVlNWYxNWYyMzZjODM3MDgzZGIyNDI0ZGMwNw==
4
+ NGYxZjI4YjA4YTA2NzQ1ODhkOTNlMTZmMTM5YmNlYTRiZWRiZjc5MQ==
5
5
  data.tar.gz: !binary |-
6
- NTI5NGMxNzdkNjlmYjI2YTUzMGRjNWU0M2M3NzRiM2RhMzU3ZWNjZg==
6
+ ZmU3YTZmZjhiZTc2MTI0ZGFmOWQxYTM0ZDM5NWRkOTBmNDQ0NzlmNA==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- ZjlmYjQ1ZDA3NDcxNzQ4NDg4ZDA3YTljZGUxNDMzZjY2NWJlMzM4NjQ2NThk
10
- MzU3ZGRhMmRiMjFlYTM1NjhlNjlkNDRmMDExMjM2Y2QzMGQ2YzNiZDQyMGMx
11
- MTUxNjIwYThiZTY1M2QzOTA4NDlkNTFhZTBkZTI0M2QzYzJmNTI=
9
+ YTUyMGU5MWI2MTExYTU5MDRiOTQyODE3NDIwZjU0Y2NlODRhODYyYWI5NGY2
10
+ MGExYjBmNjE0ZTE0NjI5ZjM2YTcyM2ZiZjFmYmI0N2EwYjAwYTFjNjNlZGFl
11
+ YzdkNjI1NDVjMjUyNTUxOGEwOTJjN2UyZGE3ZTZkN2E0ZTZiNjQ=
12
12
  data.tar.gz: !binary |-
13
- ODUzNDhiNDkzNWIwMDcyYjA4YWQ0OTEwZGRkNDAyYzg1YTIyNmRkOTE0YWYw
14
- NTA5MGNlYzFkYjg0NmQxMjA0YzM3YzdmYmQ0ZDIzODY4YWZjMjM2MzU1MTg3
15
- M2M3MzNmY2ZmMDljMTliNTRhMDRkYWU3ZTkwM2UzYjg3NDY4YzI=
13
+ ZGQ3YTc2OTAwODg2NDI2MzNmM2FmZWI2NWU5ODU0NDlhOTdmNjlmMjZiMmIw
14
+ OTdmYTExODA0MGU5NzViZWI4MTU0MWEzMTM3NDM4NzZkMTUxMmQ4YTdmZWJj
15
+ MGYzMjJiMmVhNjUyMzIwZTdjMjZmMjRmYjQ0YzY4NWZkMTkxNjk=
data/Readme.md CHANGED
@@ -164,10 +164,11 @@ other elements.
164
164
  * `:scroll_to` (Boolean) - if given, the element that was updated or inserted
165
165
  will be scrolled into view (i.e. its top will be aligned with the top of the
166
166
  page).
167
- *`:throbber` (String) - This can be `:small`, `:large`, or
168
- `:none`. By default it is `:small`, indicating a throbber that goes in front
169
- of the screen. `:small` would be a small inline throbber next to the button or
170
- link that called the dialog, and `:none` shows no throbber at all.
167
+ * `:throbber` (String) - This can be `:small`, `:large`, or
168
+ `:none`. By default for most Ajax requests it is `:small`, indicating
169
+ a small inline throbber next to the button or link. For ``link_to_dialog`` and
170
+ ``button_to_dialog``, the default is ``:large``, meaning a throbber that goes in
171
+ front of the screen.`:none` shows no throbber at all.
171
172
 
172
173
  ## Monitoring Fields ##
173
174
 
@@ -23,7 +23,6 @@
23
23
  }
24
24
 
25
25
  var ujsDialogElement = null; // the element that opened the dialog
26
- var ujsLastDialog = null; // last opened dialog
27
26
  var ujsSubmitElement = null; // the element that submitted a form
28
27
 
29
28
  // called from dialog button value
@@ -32,18 +31,19 @@
32
31
  }
33
32
 
34
33
  // called from dialog button value
34
+ // uses $.proxy to set the "this" context
35
35
  function ujsDialogClose() {
36
- if (!ujsLastDialog) return;
37
- if (ujsLastDialog.data('remote-dialog')) {
38
- ujsLastDialog.dialog('destroy').remove();
36
+ var dialog = $(this).closest('.ui-dialog-content');
37
+ if (dialog.length == 0) dialog = $(this).find('.ui-dialog-content');
38
+ if (dialog.data('remote-dialog')) {
39
+ dialog.dialog('destroy').remove();
39
40
  }
40
41
  else {
41
- ujsLastDialog.dialog('destroy').addClass('ujs-dialog-hidden');
42
+ dialog.dialog('destroy').addClass('ujs-dialog-hidden');
42
43
  }
43
44
  }
44
45
 
45
46
  function ujsDialogOpen() {
46
- ujsLastDialog = $(this);
47
47
  $(this).css('maxHeight', ($(window).height() * 0.8) + 'px');
48
48
  if ($(this).parent().height() > $(window).height()) {
49
49
  $(this).height($(window).height() * 0.8);
@@ -102,10 +102,11 @@
102
102
  dialogOptions.buttons[index].click = ujsSubmitDialogForm;
103
103
  }
104
104
  else if (element == 'close') {
105
- dialogOptions.buttons[index] = ujsDialogClose;
105
+ dialogOptions.buttons[index] = $.proxy(ujsDialogClose, dialogElement);
106
106
  }
107
107
  else if (element.click == 'close') {
108
- dialogOptions.buttons[index].click = ujsDialogClose;
108
+ dialogOptions.buttons[index].click =
109
+ $.proxy(ujsDialogClose, dialogElement);
109
110
  }
110
111
  else {
111
112
  dialogOptions.buttons[index] = eval(element);
@@ -146,7 +147,7 @@
146
147
  }
147
148
 
148
149
  function ujsDialogCloseClick() {
149
- ujsDialogClose();
150
+ ujsDialogClose.call(this);
150
151
  return false;
151
152
  }
152
153
 
@@ -231,7 +232,7 @@
231
232
  if (element.data('use-dialog-opener'))
232
233
  targetElement = ujsDialogElement;
233
234
  if (element.data('close-dialog'))
234
- ujsDialogClose();
235
+ ujsDialogClose.call(element);
235
236
  }
236
237
  if (element.data('refresh')) {
237
238
  window.location.reload();
@@ -256,7 +257,10 @@
256
257
 
257
258
  switch (element.data('result-method')) {
258
259
  case 'update':
259
- target = $(data).replaceAll(target);
260
+ // sometimes this adds text nodes
261
+ target = $(data).replaceAll(target).filter(function() {
262
+ return this.nodeType == 1;
263
+ });
260
264
  target.trigger('jqr.load');
261
265
  break;
262
266
  case 'append':
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.43'
5
- s.date = '2014-05-29'
4
+ s.version = '1.0.44'
5
+ s.date = '2014-06-13'
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.43'
4
+ VERSION = '1.0.44'
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.43
4
+ version: 1.0.44
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-05-29 00:00:00.000000000 Z
11
+ date: 2014-06-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  requirement: !ruby/object:Gem::Requirement