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 +7 -0
- data/app/assets/javascripts/jqr-helpers.js +6 -0
- data/jqr-helpers.gemspec +2 -2
- data/lib/jqr-helpers/helpers.rb +4 -4
- data/lib/jqr-helpers/version.rb +1 -1
- metadata +2 -2
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.
|
5
|
-
s.date = '2013-
|
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.
|
data/lib/jqr-helpers/helpers.rb
CHANGED
@@ -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]
|
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]
|
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]
|
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]
|
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={},
|
data/lib/jqr-helpers/version.rb
CHANGED
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.
|
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-
|
12
|
+
date: 2013-12-18 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rails
|