jqr-helpers 1.0.5 → 1.0.6

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,143 @@
1
+ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
2
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
3
+ <html>
4
+ <head>
5
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
6
+
7
+ <link rel="stylesheet" href="css/full_list.css" type="text/css" media="screen" charset="utf-8" />
8
+
9
+ <link rel="stylesheet" href="css/common.css" type="text/css" media="screen" charset="utf-8" />
10
+
11
+
12
+
13
+ <script type="text/javascript" charset="utf-8" src="js/jquery.js"></script>
14
+
15
+ <script type="text/javascript" charset="utf-8" src="js/full_list.js"></script>
16
+
17
+
18
+ <title>Method List</title>
19
+ <base id="base_target" target="_parent" />
20
+ </head>
21
+ <body>
22
+ <script type="text/javascript" charset="utf-8">
23
+ if (window.top.frames.main) {
24
+ document.getElementById('base_target').target = 'main';
25
+ document.body.className = 'frames';
26
+ }
27
+ </script>
28
+ <div id="content">
29
+ <h1 id="full_list_header">Method List</h1>
30
+ <div id="nav">
31
+
32
+ <span><a target="_self" href="class_list.html">
33
+ Classes
34
+ </a></span>
35
+
36
+ <span><a target="_self" href="method_list.html">
37
+ Methods
38
+ </a></span>
39
+
40
+ <span><a target="_self" href="file_list.html">
41
+ Files
42
+ </a></span>
43
+
44
+ </div>
45
+ <div id="search">Search: <input type="text" /></div>
46
+
47
+ <ul id="full_list" class="method">
48
+
49
+
50
+ <li class="r1 ">
51
+ <span class='object_link'><a href="JqrHelpers/Helpers.html#button_to_ajax-instance_method" title="JqrHelpers::Helpers#button_to_ajax (method)">#button_to_ajax</a></span>
52
+ <small>JqrHelpers::Helpers</small>
53
+ </li>
54
+
55
+
56
+ <li class="r2 ">
57
+ <span class='object_link'><a href="JqrHelpers/Helpers.html#button_to_dialog-instance_method" title="JqrHelpers::Helpers#button_to_dialog (method)">#button_to_dialog</a></span>
58
+ <small>JqrHelpers::Helpers</small>
59
+ </li>
60
+
61
+
62
+ <li class="r1 ">
63
+ <span class='object_link'><a href="JqrHelpers/Helpers.html#button_to_remote_dialog-instance_method" title="JqrHelpers::Helpers#button_to_remote_dialog (method)">#button_to_remote_dialog</a></span>
64
+ <small>JqrHelpers::Helpers</small>
65
+ </li>
66
+
67
+
68
+ <li class="r2 ">
69
+ <span class='object_link'><a href="JqrHelpers/Helpers.html#confirm_button-instance_method" title="JqrHelpers::Helpers#confirm_button (method)">#confirm_button</a></span>
70
+ <small>JqrHelpers::Helpers</small>
71
+ </li>
72
+
73
+
74
+ <li class="r1 ">
75
+ <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
+ <small>JqrHelpers::Generators::InstallGenerator</small>
77
+ </li>
78
+
79
+
80
+ <li class="r2 ">
81
+ <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
+ <small>JqrHelpers::Helpers</small>
83
+ </li>
84
+
85
+
86
+ <li class="r1 ">
87
+ <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
+ <small>JqrHelpers::Helpers</small>
89
+ </li>
90
+
91
+
92
+ <li class="r2 ">
93
+ <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
+ <small>JqrHelpers::Helpers</small>
95
+ </li>
96
+
97
+
98
+ <li class="r1 ">
99
+ <span class='object_link'><a href="JqrHelpers/Helpers/PanelRenderer.html#initialize-instance_method" title="JqrHelpers::Helpers::PanelRenderer#initialize (method)">#initialize</a></span>
100
+ <small>JqrHelpers::Helpers::PanelRenderer</small>
101
+ </li>
102
+
103
+
104
+ <li class="r2 ">
105
+ <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
+ <small>JqrHelpers::Helpers</small>
107
+ </li>
108
+
109
+
110
+ <li class="r1 ">
111
+ <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
+ <small>JqrHelpers::Helpers</small>
113
+ </li>
114
+
115
+
116
+ <li class="r2 ">
117
+ <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
+ <small>JqrHelpers::Helpers</small>
119
+ </li>
120
+
121
+
122
+ <li class="r1 ">
123
+ <span class='object_link'><a href="JqrHelpers/Helpers/PanelRenderer.html#panel-instance_method" title="JqrHelpers::Helpers::PanelRenderer#panel (method)">#panel</a></span>
124
+ <small>JqrHelpers::Helpers::PanelRenderer</small>
125
+ </li>
126
+
127
+
128
+ <li class="r2 ">
129
+ <span class='object_link'><a href="JqrHelpers/Helpers/PanelRenderer.html#panels-instance_method" title="JqrHelpers::Helpers::PanelRenderer#panels (method)">#panels</a></span>
130
+ <small>JqrHelpers::Helpers::PanelRenderer</small>
131
+ </li>
132
+
133
+
134
+ <li class="r1 ">
135
+ <span class='object_link'><a href="JqrHelpers/Helpers.html#tab_container-instance_method" title="JqrHelpers::Helpers#tab_container (method)">#tab_container</a></span>
136
+ <small>JqrHelpers::Helpers</small>
137
+ </li>
138
+
139
+
140
+ </ul>
141
+ </div>
142
+ </body>
143
+ </html>
@@ -0,0 +1,112 @@
1
+ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
2
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
3
+ <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
4
+ <head>
5
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
6
+ <title>
7
+ Top Level Namespace
8
+
9
+ &mdash; Documentation by YARD 0.8.7.3
10
+
11
+ </title>
12
+
13
+ <link rel="stylesheet" href="css/style.css" type="text/css" charset="utf-8" />
14
+
15
+ <link rel="stylesheet" href="css/common.css" type="text/css" charset="utf-8" />
16
+
17
+ <script type="text/javascript" charset="utf-8">
18
+ hasFrames = window.top.frames.main ? true : false;
19
+ relpath = '';
20
+ framesUrl = "frames.html#!" + escape(window.location.href);
21
+ </script>
22
+
23
+
24
+ <script type="text/javascript" charset="utf-8" src="js/jquery.js"></script>
25
+
26
+ <script type="text/javascript" charset="utf-8" src="js/app.js"></script>
27
+
28
+
29
+ </head>
30
+ <body>
31
+ <div id="header">
32
+ <div id="menu">
33
+
34
+ <a href="_index.html">Index</a> &raquo;
35
+
36
+
37
+ <span class="title">Top Level Namespace</span>
38
+
39
+
40
+ <div class="noframes"><span class="title">(</span><a href="." target="_top">no frames</a><span class="title">)</span></div>
41
+ </div>
42
+
43
+ <div id="search">
44
+
45
+ <a class="full_list_link" id="class_list_link"
46
+ href="class_list.html">
47
+ Class List
48
+ </a>
49
+
50
+ <a class="full_list_link" id="method_list_link"
51
+ href="method_list.html">
52
+ Method List
53
+ </a>
54
+
55
+ <a class="full_list_link" id="file_list_link"
56
+ href="file_list.html">
57
+ File List
58
+ </a>
59
+
60
+ </div>
61
+ <div class="clear"></div>
62
+ </div>
63
+
64
+ <iframe id="search_frame"></iframe>
65
+
66
+ <div id="content"><h1>Top Level Namespace
67
+
68
+
69
+
70
+ </h1>
71
+
72
+ <dl class="box">
73
+
74
+
75
+
76
+
77
+
78
+
79
+
80
+
81
+ </dl>
82
+ <div class="clear"></div>
83
+
84
+ <h2>Defined Under Namespace</h2>
85
+ <p class="children">
86
+
87
+
88
+ <strong class="modules">Modules:</strong> <span class='object_link'><a href="JqrHelpers.html" title="JqrHelpers (module)">JqrHelpers</a></span>
89
+
90
+
91
+
92
+
93
+ </p>
94
+
95
+
96
+
97
+
98
+
99
+
100
+
101
+
102
+
103
+ </div>
104
+
105
+ <div id="footer">
106
+ Generated on Thu Nov 28 11:14:00 2013 by
107
+ <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
108
+ 0.8.7.3 (ruby-1.9.3).
109
+ </div>
110
+
111
+ </body>
112
+ </html>
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.5'
4
+ s.version = '1.0.6'
5
5
  s.date = '2013-11-19'
6
6
  s.summary = 'Helpers to print unobtrusive jQuery-UI tags.'
7
7
  s.description = <<-EOF
@@ -18,5 +18,6 @@ EOF
18
18
  s.license = 'MIT'
19
19
 
20
20
  s.add_dependency 'rails', '>= 3.0'
21
+ s.add_development_dependency 'yard'
21
22
 
22
23
  end
@@ -263,15 +263,18 @@ module JqrHelpers
263
263
  end
264
264
 
265
265
  # Create a date picker field. The attributes given are passed to
266
- # text_field_tag. Note that Ruby and jQuery date formats are different.
267
- # You will need to format the "value" parameter to match whatever format you
268
- # are passing into the "options" parameter.
266
+ # text_field_tag. There is a special option :format - this expects a
267
+ # *Ruby* style date format. It will format both the initial display of the
268
+ # date and the jQuery date format to be the same.
269
269
  # @param name [String] the name of the form element.
270
270
  # @param value [Date] the initial value.
271
271
  # @param options [Hash] options to be passed to datepicker().
272
272
  # @param html_options [Hash] options to be passed to text_field_tag.
273
273
  # @return [String]
274
- def date_picker_tag(name, value, options={}, html_options={})
274
+ def date_picker_tag(name, value=Date.today, options={}, html_options={})
275
+ format = options.delete(:format) || '%Y-%m-%d'
276
+ value = value.strftime(format)
277
+ options[:dateFormat] = _map_date(format)
275
278
  html_options[:'data-date-options'] = options.to_json
276
279
  html_options[:class] ||= ''
277
280
  html_options[:class] << ' ujs-date-picker'
@@ -280,6 +283,48 @@ module JqrHelpers
280
283
 
281
284
  private
282
285
 
286
+ # @param format [String] the Rails date format to map
287
+ # @return [String] the jQuery date format
288
+ def _map_date(format)
289
+ format.gsub!(/'/, "''")
290
+ format_map = {
291
+ '%Y' => 'yy',
292
+ '%y' => 'y',
293
+ '%-d' => 'd',
294
+ '%d' => 'dd',
295
+ '%j' => 'oo',
296
+ '%a' => 'D',
297
+ '%A' => 'DD',
298
+ '%-m' => 'm',
299
+ '%m' => 'mm',
300
+ '%b' => 'M',
301
+ '%B' => 'MM'
302
+ }
303
+ prev_index = 0
304
+ while true do
305
+ format_expr = ''
306
+ percent = format.index('%')
307
+ break if !percent
308
+ puts "% is #{percent} prev is #{prev_index} format is #{format}"
309
+ if percent > prev_index
310
+ format.insert(percent, "'")
311
+ format.insert(prev_index, "'")
312
+ percent += 2
313
+ end
314
+ length = 2
315
+ next_char = format[percent + 1]
316
+ if next_char == '-'
317
+ length += 1
318
+ end
319
+ format_expr = format[percent, length]
320
+ new_format_expr = format_map[format_expr]
321
+ format[percent, length] = new_format_expr
322
+ prev_index = percent + new_format_expr.length
323
+ end
324
+ format
325
+
326
+ end
327
+
283
328
  # Generate a random string for IDs.
284
329
  # @return [String]
285
330
  def _random_string
@@ -1,5 +1,5 @@
1
1
  module JqrHelpers
2
2
  module Rails
3
- VERSION = '1.0.5'
3
+ VERSION = '1.0.6'
4
4
  end
5
5
  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.5
5
+ version: 1.0.6
6
6
  platform: ruby
7
7
  authors:
8
8
  - Daniel Orner
@@ -27,6 +27,22 @@ dependencies:
27
27
  version: '3.0'
28
28
  type: :runtime
29
29
  prerelease: false
30
+ - !ruby/object:Gem::Dependency
31
+ name: yard
32
+ version_requirements: !ruby/object:Gem::Requirement
33
+ none: false
34
+ requirements:
35
+ - - ! '>='
36
+ - !ruby/object:Gem::Version
37
+ version: '0'
38
+ requirement: !ruby/object:Gem::Requirement
39
+ none: false
40
+ requirements:
41
+ - - ! '>='
42
+ - !ruby/object:Gem::Version
43
+ version: '0'
44
+ type: :development
45
+ prerelease: false
30
46
  description: ! " This gem allows the use of several helper methods.\n The tags
31
47
  output contain classes and data attributes that are grabbed by\n unobtrusive
32
48
  JavaScript code and turned into jQuery UI widgets.\n Helpers include Ajax requests
@@ -37,11 +53,32 @@ executables: []
37
53
  extensions: []
38
54
  extra_rdoc_files: []
39
55
  files:
56
+ - .yardopts
40
57
  - Readme.md
41
58
  - app/assets/images/jqr-helpers/close.png
42
59
  - app/assets/images/jqr-helpers/throbber.gif
43
60
  - app/assets/javascripts/jqr-helpers.js
44
61
  - app/assets/stylesheets/jqr-helpers.css
62
+ - doc/JqrHelpers.html
63
+ - doc/JqrHelpers/Generators.html
64
+ - doc/JqrHelpers/Generators/InstallGenerator.html
65
+ - doc/JqrHelpers/Helpers.html
66
+ - doc/JqrHelpers/Helpers/PanelRenderer.html
67
+ - doc/JqrHelpers/Rails.html
68
+ - doc/JqrHelpers/Railtie.html
69
+ - doc/_index.html
70
+ - doc/class_list.html
71
+ - doc/css/common.css
72
+ - doc/css/full_list.css
73
+ - doc/css/style.css
74
+ - doc/file_list.html
75
+ - doc/frames.html
76
+ - doc/index.html
77
+ - doc/js/app.js
78
+ - doc/js/full_list.js
79
+ - doc/js/jquery.js
80
+ - doc/method_list.html
81
+ - doc/top-level-namespace.html
45
82
  - jqr-helpers.gemspec
46
83
  - lib/jqr-helpers.rb
47
84
  - lib/jqr-helpers/helpers.rb