jqr-helpers 1.0.7 → 1.0.8
Sign up to get free protection for your applications and to get access to all the features.
- data/Readme.md +1 -0
- data/app/assets/javascripts/jqr-helpers.js +4 -1
- data/doc/JqrHelpers/Generators/InstallGenerator.html +1 -1
- data/doc/JqrHelpers/Generators.html +1 -1
- data/doc/JqrHelpers/Helpers/PanelRenderer.html +1 -1
- data/doc/JqrHelpers/Helpers.html +151 -1
- data/doc/JqrHelpers/Rails.html +2 -2
- data/doc/JqrHelpers/Railtie.html +1 -1
- data/doc/JqrHelpers.html +1 -1
- data/doc/_index.html +1 -1
- data/doc/index.html +1 -1
- data/doc/method_list.html +17 -11
- data/doc/top-level-namespace.html +1 -1
- data/jqr-helpers.gemspec +1 -1
- data/lib/jqr-helpers/helpers.rb +17 -0
- data/lib/jqr-helpers/version.rb +1 -1
- metadata +1 -1
data/Readme.md
CHANGED
@@ -48,6 +48,7 @@ the dialog content from a remote route)
|
|
48
48
|
* `form_for_ajax` - ditto but using Rails's `form_for` helper
|
49
49
|
* `tab_container` - create a tab container
|
50
50
|
* `date_picker_tag` - create a date picker
|
51
|
+
* `buttonset` - create a radio button set
|
51
52
|
|
52
53
|
There are two sets of options that recur throughout the methods here:
|
53
54
|
|
@@ -207,6 +207,9 @@
|
|
207
207
|
var options = $(this).data('date-options');
|
208
208
|
$(this).datepicker(options);
|
209
209
|
});
|
210
|
+
$('.ujs-button-set', event.target).each(function() {
|
211
|
+
$(this).buttonset();
|
212
|
+
});
|
210
213
|
$('.ujs-tab-container', event.target).each(function() {
|
211
214
|
var options = $(this).data('tab-options');
|
212
215
|
options = $.extend(options, {
|
@@ -240,7 +243,7 @@
|
|
240
243
|
$(document).on('click', '[data-ujs-confirm=true]', ujsConfirmClick);
|
241
244
|
}
|
242
245
|
else {
|
243
|
-
$(
|
246
|
+
$('body').live('jqr.load', ujsLoadPlugins);
|
244
247
|
$('.ujs-dialog').live('click', ujsDialogClick);
|
245
248
|
$('.ujs-dialog-close, .ujs-dialog-x').live('click', ujsDialogCloseClick);
|
246
249
|
$('.ujs-ajax').live('ajax:beforeSend', ujsAjaxBeforeSend);
|
@@ -201,7 +201,7 @@
|
|
201
201
|
</div>
|
202
202
|
|
203
203
|
<div id="footer">
|
204
|
-
Generated on
|
204
|
+
Generated on Tue Dec 3 10:46:07 2013 by
|
205
205
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
206
206
|
0.8.7.3 (ruby-1.9.3).
|
207
207
|
</div>
|
@@ -106,7 +106,7 @@
|
|
106
106
|
</div>
|
107
107
|
|
108
108
|
<div id="footer">
|
109
|
-
Generated on
|
109
|
+
Generated on Tue Dec 3 10:46:07 2013 by
|
110
110
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
111
111
|
0.8.7.3 (ruby-1.9.3).
|
112
112
|
</div>
|
@@ -452,7 +452,7 @@ be passed as is into the HTML <li> tag.</p>
|
|
452
452
|
</div>
|
453
453
|
|
454
454
|
<div id="footer">
|
455
|
-
Generated on
|
455
|
+
Generated on Tue Dec 3 10:46:07 2013 by
|
456
456
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
457
457
|
0.8.7.3 (ruby-1.9.3).
|
458
458
|
</div>
|
data/doc/JqrHelpers/Helpers.html
CHANGED
@@ -179,6 +179,30 @@
|
|
179
179
|
using content already on the page.</p>
|
180
180
|
</div></span>
|
181
181
|
|
182
|
+
</li>
|
183
|
+
|
184
|
+
|
185
|
+
<li class="public ">
|
186
|
+
<span class="summary_signature">
|
187
|
+
|
188
|
+
<a href="#buttonset-instance_method" title="#buttonset (instance method)">- (Object) <strong>buttonset</strong>(name, values, selected = nil, html_options = {}) </a>
|
189
|
+
|
190
|
+
|
191
|
+
|
192
|
+
</span>
|
193
|
+
|
194
|
+
|
195
|
+
|
196
|
+
|
197
|
+
|
198
|
+
|
199
|
+
|
200
|
+
|
201
|
+
|
202
|
+
<span class="summary_desc"><div class='inline'>
|
203
|
+
<p>Print a button set.</p>
|
204
|
+
</div></span>
|
205
|
+
|
182
206
|
</li>
|
183
207
|
|
184
208
|
|
@@ -764,6 +788,132 @@ using content already on the page.</p>
|
|
764
788
|
</td>
|
765
789
|
</tr>
|
766
790
|
</table>
|
791
|
+
</div>
|
792
|
+
|
793
|
+
<div class="method_details ">
|
794
|
+
<h3 class="signature " id="buttonset-instance_method">
|
795
|
+
|
796
|
+
- (<tt>Object</tt>) <strong>buttonset</strong>(name, values, selected = nil, html_options = {})
|
797
|
+
|
798
|
+
|
799
|
+
|
800
|
+
|
801
|
+
|
802
|
+
</h3><div class="docstring">
|
803
|
+
<div class="discussion">
|
804
|
+
|
805
|
+
<p>Print a button set. Each button will be a radio button, and the group will
|
806
|
+
then be passed into jQuery's buttonset() method.</p>
|
807
|
+
|
808
|
+
|
809
|
+
</div>
|
810
|
+
</div>
|
811
|
+
<div class="tags">
|
812
|
+
<p class="tag_title">Parameters:</p>
|
813
|
+
<ul class="param">
|
814
|
+
|
815
|
+
<li>
|
816
|
+
|
817
|
+
<span class='name'>name</span>
|
818
|
+
|
819
|
+
|
820
|
+
<span class='type'>(<tt>String</tt>)</span>
|
821
|
+
|
822
|
+
|
823
|
+
|
824
|
+
—
|
825
|
+
<div class='inline'>
|
826
|
+
<p>the name of the form element.</p>
|
827
|
+
</div>
|
828
|
+
|
829
|
+
</li>
|
830
|
+
|
831
|
+
<li>
|
832
|
+
|
833
|
+
<span class='name'>values</span>
|
834
|
+
|
835
|
+
|
836
|
+
<span class='type'>(<tt>Hash<String, String></tt>)</span>
|
837
|
+
|
838
|
+
|
839
|
+
|
840
|
+
—
|
841
|
+
<div class='inline'>
|
842
|
+
<p>a hash of value => label.</p>
|
843
|
+
</div>
|
844
|
+
|
845
|
+
</li>
|
846
|
+
|
847
|
+
<li>
|
848
|
+
|
849
|
+
<span class='name'>selected</span>
|
850
|
+
|
851
|
+
|
852
|
+
<span class='type'>(<tt>String</tt>)</span>
|
853
|
+
|
854
|
+
|
855
|
+
<em class="default">(defaults to: <tt>nil</tt>)</em>
|
856
|
+
|
857
|
+
|
858
|
+
—
|
859
|
+
<div class='inline'>
|
860
|
+
<p>the selected value, if any.</p>
|
861
|
+
</div>
|
862
|
+
|
863
|
+
</li>
|
864
|
+
|
865
|
+
<li>
|
866
|
+
|
867
|
+
<span class='name'>html_options</span>
|
868
|
+
|
869
|
+
|
870
|
+
<span class='type'>(<tt>Hash</tt>)</span>
|
871
|
+
|
872
|
+
|
873
|
+
<em class="default">(defaults to: <tt>{}</tt>)</em>
|
874
|
+
|
875
|
+
|
876
|
+
—
|
877
|
+
<div class='inline'>
|
878
|
+
<p>a set of options that will be passed into the parent div tag.</p>
|
879
|
+
</div>
|
880
|
+
|
881
|
+
</li>
|
882
|
+
|
883
|
+
</ul>
|
884
|
+
|
885
|
+
|
886
|
+
</div><table class="source_code">
|
887
|
+
<tr>
|
888
|
+
<td>
|
889
|
+
<pre class="lines">
|
890
|
+
|
891
|
+
|
892
|
+
291
|
893
|
+
292
|
894
|
+
293
|
895
|
+
294
|
896
|
+
295
|
897
|
+
296
|
898
|
+
297
|
899
|
+
298
|
900
|
+
299</pre>
|
901
|
+
</td>
|
902
|
+
<td>
|
903
|
+
<pre class="code"><span class="info file"># File 'lib/jqr-helpers/helpers.rb', line 291</span>
|
904
|
+
|
905
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_buttonset'>buttonset</span><span class='lparen'>(</span><span class='id identifier rubyid_name'>name</span><span class='comma'>,</span> <span class='id identifier rubyid_values'>values</span><span class='comma'>,</span> <span class='id identifier rubyid_selected'>selected</span><span class='op'>=</span><span class='kw'>nil</span><span class='comma'>,</span> <span class='id identifier rubyid_html_options'>html_options</span><span class='op'>=</span><span class='lbrace'>{</span><span class='rbrace'>}</span><span class='rparen'>)</span>
|
906
|
+
<span class='id identifier rubyid_html_options'>html_options</span><span class='lbracket'>[</span><span class='symbol'>:class</span><span class='rbracket'>]</span> <span class='op'>||=</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_end'>'</span></span>
|
907
|
+
<span class='id identifier rubyid_html_options'>html_options</span><span class='lbracket'>[</span><span class='symbol'>:class</span><span class='rbracket'>]</span> <span class='op'><<</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'> ujs-button-set</span><span class='tstring_end'>'</span></span>
|
908
|
+
<span class='id identifier rubyid_content'>content</span> <span class='op'>=</span> <span class='id identifier rubyid_values'>values</span><span class='period'>.</span><span class='id identifier rubyid_inject'>inject</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_end'>'</span></span><span class='rparen'>)</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_sum'>sum</span><span class='comma'>,</span> <span class='lparen'>(</span><span class='id identifier rubyid_value'>value</span><span class='comma'>,</span> <span class='id identifier rubyid_label'>label</span><span class='rparen'>)</span><span class='op'>|</span>
|
909
|
+
<span class='id identifier rubyid_sum'>sum</span> <span class='op'>+=</span> <span class='id identifier rubyid_radio_button_tag'>radio_button_tag</span><span class='lparen'>(</span><span class='id identifier rubyid_name'>name</span><span class='comma'>,</span> <span class='id identifier rubyid_value'>value</span><span class='comma'>,</span> <span class='id identifier rubyid_selected'>selected</span> <span class='op'>==</span> <span class='id identifier rubyid_value'>value</span><span class='rparen'>)</span> <span class='op'>+</span>
|
910
|
+
<span class='id identifier rubyid_label_tag'>label_tag</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>"</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_name'>name</span><span class='rbrace'>}</span><span class='tstring_content'>_</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_value'>value</span><span class='rbrace'>}</span><span class='tstring_end'>"</span></span><span class='comma'>,</span> <span class='id identifier rubyid_label'>label</span><span class='rparen'>)</span>
|
911
|
+
<span class='kw'>end</span>
|
912
|
+
<span class='id identifier rubyid_content_tag'>content_tag</span><span class='lparen'>(</span><span class='symbol'>:div</span><span class='comma'>,</span> <span class='id identifier rubyid_raw'>raw</span><span class='lparen'>(</span><span class='id identifier rubyid_content'>content</span><span class='rparen'>)</span><span class='comma'>,</span> <span class='id identifier rubyid_html_options'>html_options</span><span class='rparen'>)</span>
|
913
|
+
<span class='kw'>end</span></pre>
|
914
|
+
</td>
|
915
|
+
</tr>
|
916
|
+
</table>
|
767
917
|
</div>
|
768
918
|
|
769
919
|
<div class="method_details ">
|
@@ -1853,7 +2003,7 @@ URL).</p>
|
|
1853
2003
|
</div>
|
1854
2004
|
|
1855
2005
|
<div id="footer">
|
1856
|
-
Generated on
|
2006
|
+
Generated on Tue Dec 3 10:46:07 2013 by
|
1857
2007
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
1858
2008
|
0.8.7.3 (ruby-1.9.3).
|
1859
2009
|
</div>
|
data/doc/JqrHelpers/Rails.html
CHANGED
@@ -92,7 +92,7 @@
|
|
92
92
|
<dt id="VERSION-constant" class="">VERSION =
|
93
93
|
|
94
94
|
</dt>
|
95
|
-
<dd><pre class="code"><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>1.0.
|
95
|
+
<dd><pre class="code"><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>1.0.8</span><span class='tstring_end'>'</span></span></pre></dd>
|
96
96
|
|
97
97
|
</dl>
|
98
98
|
|
@@ -108,7 +108,7 @@
|
|
108
108
|
</div>
|
109
109
|
|
110
110
|
<div id="footer">
|
111
|
-
Generated on
|
111
|
+
Generated on Tue Dec 3 10:46:07 2013 by
|
112
112
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
113
113
|
0.8.7.3 (ruby-1.9.3).
|
114
114
|
</div>
|
data/doc/JqrHelpers/Railtie.html
CHANGED
@@ -114,7 +114,7 @@
|
|
114
114
|
</div>
|
115
115
|
|
116
116
|
<div id="footer">
|
117
|
-
Generated on
|
117
|
+
Generated on Tue Dec 3 10:46:07 2013 by
|
118
118
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
119
119
|
0.8.7.3 (ruby-1.9.3).
|
120
120
|
</div>
|
data/doc/JqrHelpers.html
CHANGED
@@ -110,7 +110,7 @@
|
|
110
110
|
</div>
|
111
111
|
|
112
112
|
<div id="footer">
|
113
|
-
Generated on
|
113
|
+
Generated on Tue Dec 3 10:46:06 2013 by
|
114
114
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
115
115
|
0.8.7.3 (ruby-1.9.3).
|
116
116
|
</div>
|
data/doc/_index.html
CHANGED
@@ -174,7 +174,7 @@
|
|
174
174
|
</div>
|
175
175
|
|
176
176
|
<div id="footer">
|
177
|
-
Generated on
|
177
|
+
Generated on Tue Dec 3 10:46:06 2013 by
|
178
178
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
179
179
|
0.8.7.3 (ruby-1.9.3).
|
180
180
|
</div>
|
data/doc/index.html
CHANGED
@@ -174,7 +174,7 @@
|
|
174
174
|
</div>
|
175
175
|
|
176
176
|
<div id="footer">
|
177
|
-
Generated on
|
177
|
+
Generated on Tue Dec 3 10:46:06 2013 by
|
178
178
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
179
179
|
0.8.7.3 (ruby-1.9.3).
|
180
180
|
</div>
|
data/doc/method_list.html
CHANGED
@@ -66,72 +66,78 @@
|
|
66
66
|
|
67
67
|
|
68
68
|
<li class="r2 ">
|
69
|
-
<span class='object_link'><a href="JqrHelpers/Helpers.html#
|
69
|
+
<span class='object_link'><a href="JqrHelpers/Helpers.html#buttonset-instance_method" title="JqrHelpers::Helpers#buttonset (method)">#buttonset</a></span>
|
70
70
|
<small>JqrHelpers::Helpers</small>
|
71
71
|
</li>
|
72
72
|
|
73
73
|
|
74
74
|
<li class="r1 ">
|
75
|
+
<span class='object_link'><a href="JqrHelpers/Helpers.html#confirm_button-instance_method" title="JqrHelpers::Helpers#confirm_button (method)">#confirm_button</a></span>
|
76
|
+
<small>JqrHelpers::Helpers</small>
|
77
|
+
</li>
|
78
|
+
|
79
|
+
|
80
|
+
<li class="r2 ">
|
75
81
|
<span class='object_link'><a href="JqrHelpers/Generators/InstallGenerator.html#copy_files-instance_method" title="JqrHelpers::Generators::InstallGenerator#copy_files (method)">#copy_files</a></span>
|
76
82
|
<small>JqrHelpers::Generators::InstallGenerator</small>
|
77
83
|
</li>
|
78
84
|
|
79
85
|
|
80
|
-
<li class="
|
86
|
+
<li class="r1 ">
|
81
87
|
<span class='object_link'><a href="JqrHelpers/Helpers.html#date_picker_tag-instance_method" title="JqrHelpers::Helpers#date_picker_tag (method)">#date_picker_tag</a></span>
|
82
88
|
<small>JqrHelpers::Helpers</small>
|
83
89
|
</li>
|
84
90
|
|
85
91
|
|
86
|
-
<li class="
|
92
|
+
<li class="r2 ">
|
87
93
|
<span class='object_link'><a href="JqrHelpers/Helpers.html#form_for_ajax-instance_method" title="JqrHelpers::Helpers#form_for_ajax (method)">#form_for_ajax</a></span>
|
88
94
|
<small>JqrHelpers::Helpers</small>
|
89
95
|
</li>
|
90
96
|
|
91
97
|
|
92
|
-
<li class="
|
98
|
+
<li class="r1 ">
|
93
99
|
<span class='object_link'><a href="JqrHelpers/Helpers.html#form_tag_ajax-instance_method" title="JqrHelpers::Helpers#form_tag_ajax (method)">#form_tag_ajax</a></span>
|
94
100
|
<small>JqrHelpers::Helpers</small>
|
95
101
|
</li>
|
96
102
|
|
97
103
|
|
98
|
-
<li class="
|
104
|
+
<li class="r2 ">
|
99
105
|
<span class='object_link'><a href="JqrHelpers/Helpers/PanelRenderer.html#initialize-instance_method" title="JqrHelpers::Helpers::PanelRenderer#initialize (method)">#initialize</a></span>
|
100
106
|
<small>JqrHelpers::Helpers::PanelRenderer</small>
|
101
107
|
</li>
|
102
108
|
|
103
109
|
|
104
|
-
<li class="
|
110
|
+
<li class="r1 ">
|
105
111
|
<span class='object_link'><a href="JqrHelpers/Helpers.html#link_to_ajax-instance_method" title="JqrHelpers::Helpers#link_to_ajax (method)">#link_to_ajax</a></span>
|
106
112
|
<small>JqrHelpers::Helpers</small>
|
107
113
|
</li>
|
108
114
|
|
109
115
|
|
110
|
-
<li class="
|
116
|
+
<li class="r2 ">
|
111
117
|
<span class='object_link'><a href="JqrHelpers/Helpers.html#link_to_dialog-instance_method" title="JqrHelpers::Helpers#link_to_dialog (method)">#link_to_dialog</a></span>
|
112
118
|
<small>JqrHelpers::Helpers</small>
|
113
119
|
</li>
|
114
120
|
|
115
121
|
|
116
|
-
<li class="
|
122
|
+
<li class="r1 ">
|
117
123
|
<span class='object_link'><a href="JqrHelpers/Helpers.html#link_to_remote_dialog-instance_method" title="JqrHelpers::Helpers#link_to_remote_dialog (method)">#link_to_remote_dialog</a></span>
|
118
124
|
<small>JqrHelpers::Helpers</small>
|
119
125
|
</li>
|
120
126
|
|
121
127
|
|
122
|
-
<li class="
|
128
|
+
<li class="r2 ">
|
123
129
|
<span class='object_link'><a href="JqrHelpers/Helpers/PanelRenderer.html#panel-instance_method" title="JqrHelpers::Helpers::PanelRenderer#panel (method)">#panel</a></span>
|
124
130
|
<small>JqrHelpers::Helpers::PanelRenderer</small>
|
125
131
|
</li>
|
126
132
|
|
127
133
|
|
128
|
-
<li class="
|
134
|
+
<li class="r1 ">
|
129
135
|
<span class='object_link'><a href="JqrHelpers/Helpers/PanelRenderer.html#panels-instance_method" title="JqrHelpers::Helpers::PanelRenderer#panels (method)">#panels</a></span>
|
130
136
|
<small>JqrHelpers::Helpers::PanelRenderer</small>
|
131
137
|
</li>
|
132
138
|
|
133
139
|
|
134
|
-
<li class="
|
140
|
+
<li class="r2 ">
|
135
141
|
<span class='object_link'><a href="JqrHelpers/Helpers.html#tab_container-instance_method" title="JqrHelpers::Helpers#tab_container (method)">#tab_container</a></span>
|
136
142
|
<small>JqrHelpers::Helpers</small>
|
137
143
|
</li>
|
@@ -103,7 +103,7 @@
|
|
103
103
|
</div>
|
104
104
|
|
105
105
|
<div id="footer">
|
106
|
-
Generated on
|
106
|
+
Generated on Tue Dec 3 10:46:06 2013 by
|
107
107
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
108
108
|
0.8.7.3 (ruby-1.9.3).
|
109
109
|
</div>
|
data/jqr-helpers.gemspec
CHANGED
data/lib/jqr-helpers/helpers.rb
CHANGED
@@ -281,6 +281,23 @@ module JqrHelpers
|
|
281
281
|
text_field_tag(name, value, html_options)
|
282
282
|
end
|
283
283
|
|
284
|
+
# Print a button set. Each button will be a radio button, and the group
|
285
|
+
# will then be passed into jQuery's buttonset() method.
|
286
|
+
# @param name [String] the name of the form element.
|
287
|
+
# @param values [Hash<String, String>] a hash of value => label.
|
288
|
+
# @param selected [String] the selected value, if any.
|
289
|
+
# @param html_options [Hash] a set of options that will be passed into
|
290
|
+
# the parent div tag.
|
291
|
+
def buttonset(name, values, selected=nil, html_options={})
|
292
|
+
html_options[:class] ||= ''
|
293
|
+
html_options[:class] << ' ujs-button-set'
|
294
|
+
content = values.inject('') do |sum, (value, label)|
|
295
|
+
sum += radio_button_tag(name, value, selected == value) +
|
296
|
+
label_tag("#{name}_#{value}", label)
|
297
|
+
end
|
298
|
+
content_tag(:div, raw(content), html_options)
|
299
|
+
end
|
300
|
+
|
284
301
|
private
|
285
302
|
|
286
303
|
# @param format [String] the Rails date format to map
|
data/lib/jqr-helpers/version.rb
CHANGED