jqr-helpers 1.0.13 → 1.0.14

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.
data/Readme.md CHANGED
@@ -78,6 +78,13 @@ button.
78
78
  Another option is `:close_x => true` - this will print a green X at the top
79
79
  right of the dialog. Generally this is used when `:title => false`.
80
80
 
81
+ Another option is `:data` - this accepts a hash of string/value pairs. When this
82
+ is given, jqr-helpers will search the dialog for input fields whose names
83
+ match the keys and populate them with the values. This is helpful when you want
84
+ to pass data to a local dialog but don't want to mess around with saving data
85
+ attributes and callbacks. When using a remote dialog it's easier to just pass
86
+ the data into the URL and have Rails populate it on the server side.
87
+
81
88
  Note about dialog ID - you can always pass in the special value `:next` for
82
89
  this. This will use whatever element is just after the clicked element
83
90
  for the dialog contents. This can be useful for printing simple dialogs inside a
@@ -50,6 +50,7 @@
50
50
  }
51
51
  var url = $(this).data('dialog-url');
52
52
  var dialogOptions = $(this).data('dialog-options');
53
+ var data = dialogOptions['data'];
53
54
  var open = dialogOptions['open'];
54
55
  dialogOptions = $.extend(dialogOptions, {
55
56
  'close': function() {
@@ -62,6 +63,11 @@
62
63
  var openFunc = eval(open);
63
64
  openFunc.call(this);
64
65
  }
66
+ if (data) {
67
+ for (var n in data) {
68
+ dialogElement.find('[name=' + n + ']').val(data[n]);
69
+ }
70
+ }
65
71
  }
66
72
  });
67
73
  if (dialogOptions.buttons) {
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.13'
5
- s.date = '2013-11-19'
4
+ s.version = '1.0.14'
5
+ s.date = '2013-12-18'
6
6
  s.summary = 'Helpers to print unobtrusive jQuery-UI tags.'
7
7
  s.description = <<-EOF
8
8
  This gem allows the use of several helper methods.
@@ -49,7 +49,7 @@ module JqrHelpers
49
49
  # 1 and the block is used as the html_content.
50
50
  # @param dialog_id [String] The ID of the element to put in the dialog.
51
51
  # @param html_content [String] Text or HTML tags to use as the link body.
52
- # @param dialog_options [Hash] See above.
52
+ # @param dialog_options [Hash] Dialog options as described in the readme.
53
53
  # @param html_options [Hash] Attributes to put on the link tag. There is
54
54
  # a special :tag_name option that can be used to change the tag being
55
55
  # created. Default is :a, but you can pass :div, :span, etc.
@@ -95,7 +95,7 @@ module JqrHelpers
95
95
  # @param dialog_id [String] The ID of the element to put in the dialog.
96
96
  # @param html_content [String] Text or HTML tags to use as the button body.
97
97
  # @param html_options [Hash] Attributes to put on the button tag.
98
- # @param dialog_options [Hash] See above.
98
+ # @param dialog_options [Hash] Dialog options as described in the readme.
99
99
  # @return [String]
100
100
  def button_to_dialog(dialog_id, html_content, dialog_options={},
101
101
  html_options={})
@@ -123,7 +123,7 @@ module JqrHelpers
123
123
  # 1 and the block is used as the html_content.
124
124
  # @param url [String] The URL to load the content from.
125
125
  # @param html_content [String] Text or HTML tags to use as the link body.
126
- # @param dialog_options [Hash] See above.
126
+ # @param dialog_options [Hash] Dialog options as described in the readme.
127
127
  # @param html_options [Hash] Attributes to put on the link tag. There is
128
128
  # a special :tag_name option that can be used to change the tag being
129
129
  # created. Default is :a, but you can pass :div, :span, etc.
@@ -146,7 +146,7 @@ module JqrHelpers
146
146
  # using content already on the page.
147
147
  # @param url [String] The URL to load the content from.
148
148
  # @param html_content [String] Text or HTML tags to use as the button body.
149
- # @param dialog_options [Hash] See above.
149
+ # @param dialog_options [Hash] Dialog options as described in the readme.
150
150
  # @param html_options [Hash] Attributes to put on the button tag.
151
151
  # @return [String]
152
152
  def button_to_remote_dialog(url, html_content, dialog_options={},
@@ -1,5 +1,5 @@
1
1
  module JqrHelpers
2
2
  module Rails
3
- VERSION = '1.0.13'
3
+ VERSION = '1.0.14'
4
4
  end
5
5
  end
metadata CHANGED
@@ -2,14 +2,14 @@
2
2
  name: jqr-helpers
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 1.0.13
5
+ version: 1.0.14
6
6
  platform: ruby
7
7
  authors:
8
8
  - Daniel Orner
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-11-19 00:00:00.000000000 Z
12
+ date: 2013-12-18 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails