padrino-helpers 0.1.3 → 0.1.4
Sign up to get free protection for your applications and to get access to all the features.
- data/README.rdoc +193 -88
- data/Rakefile +2 -2
- data/VERSION +1 -1
- data/lib/padrino-helpers/format_helpers.rb +5 -6
- data/padrino-helpers.gemspec +5 -8
- data/test/helper.rb +1 -1
- data/test/{active_support_helpers.rb → support_helpers.rb} +0 -0
- data/test/test_format_helpers.rb +4 -4
- metadata +4 -5
data/README.rdoc
CHANGED
@@ -11,7 +11,7 @@ To install the 'full-stack' padrino framework, simply grab the latest version fr
|
|
11
11
|
$ sudo gem install padrino --source http://gemcutter.org
|
12
12
|
|
13
13
|
This will install the necessary padrino gems to get you started.
|
14
|
-
Now you are ready to use this gem to enhance your
|
14
|
+
Now you are ready to use this gem to enhance your existing Sinatra projects or build new Padrino applications.
|
15
15
|
|
16
16
|
You can also install only the padrino-helpers gem for more fine-grained use:
|
17
17
|
|
@@ -21,6 +21,51 @@ You can also install only the padrino-helpers gem for more fine-grained use:
|
|
21
21
|
|
22
22
|
=== Output Helpers
|
23
23
|
|
24
|
+
Output helpers are a collection of important methods for managing, capturing and displaying output
|
25
|
+
in various ways and is used frequently to support higher-level helper functions. There are
|
26
|
+
three output helpers worth mentioning: <tt>content_for</tt>, <tt>capture_html</tt>, and <tt>concat_content</tt>
|
27
|
+
|
28
|
+
The content_for functionality supports capturing content and then rendering this into a different place
|
29
|
+
such as within a layout. One such popular example is including assets onto the layout from a template:
|
30
|
+
|
31
|
+
# app/views/site/index.erb
|
32
|
+
...
|
33
|
+
<% content_for :assets do %>
|
34
|
+
<%= stylesheet_link_tag 'index', 'custom' %>
|
35
|
+
<% end %>
|
36
|
+
...
|
37
|
+
|
38
|
+
Added to a template, this will capture the includes from the block and allow them to be yielded into the layout:
|
39
|
+
|
40
|
+
# app/views/layout.erb
|
41
|
+
...
|
42
|
+
<head>
|
43
|
+
<title>Example</title>
|
44
|
+
<%= stylesheet_link_tag 'style' %>
|
45
|
+
<%= yield_content :assets %>
|
46
|
+
</head>
|
47
|
+
...
|
48
|
+
|
49
|
+
This will automatically insert the contents of the block (in this case a stylesheet include) into the
|
50
|
+
location the content is yielded within the layout.
|
51
|
+
|
52
|
+
The capture_html and the concat_content methods allow content to be manipulated and stored for use in building
|
53
|
+
additional helpers accepting blocks or displaying information in a template. One example is the use of
|
54
|
+
these in constructing a simplified 'form_tag' helper which accepts a block.
|
55
|
+
|
56
|
+
# form_tag '/register' do ... end
|
57
|
+
def form_tag(url, options={}, &block)
|
58
|
+
# ... truncated ...
|
59
|
+
inner_form_html = capture_html(&block)
|
60
|
+
concat_content '<form>' + inner_form_html + '</form>'
|
61
|
+
end
|
62
|
+
|
63
|
+
This will capture the template body passed into the form_tag block and then append the content
|
64
|
+
to the template through the use of <tt>concat_content</tt>. Note have been built to work for both haml and erb
|
65
|
+
templates using the same syntax.
|
66
|
+
|
67
|
+
The list of defined helpers in the 'output helpers' category:
|
68
|
+
|
24
69
|
* <tt>content_for(key, &block)</tt>
|
25
70
|
* Capture a block of content to be rendered at a later time.
|
26
71
|
* <tt>content_for(:head) { ...content... }</tt>
|
@@ -40,6 +85,24 @@ You can also install only the padrino-helpers gem for more fine-grained use:
|
|
40
85
|
|
41
86
|
=== Tag Helpers
|
42
87
|
|
88
|
+
Tag helpers are the basic building blocks used to construct html 'tags' within a view template. There
|
89
|
+
are three major functions for this category: <tt>tag</tt>, <tt>content_tag</tt> and <tt>input_tag</tt>.
|
90
|
+
|
91
|
+
The tag and content_tag are for building arbitrary html tags with a name and specified options. If
|
92
|
+
the tag contains 'content' within then <tt>content_tag</tt> is used. For example:
|
93
|
+
|
94
|
+
tag(:br, :style => ‘clear:both’) => <br style="clear:both" />
|
95
|
+
content_tag(:p, "demo", :class => ‘light’) => <p class="light">demo</p>
|
96
|
+
|
97
|
+
The input_tag is used to build tags that are related to accepting input from the user:
|
98
|
+
|
99
|
+
input_tag :text, :class => "demo" => <input type='text' class='demo' />
|
100
|
+
input_tag :password, :value => "secret", :class => "demo"
|
101
|
+
|
102
|
+
Note that all of these accept html options and result in returning a string containing html tags.
|
103
|
+
|
104
|
+
The list of defined helpers in the 'tag helpers' category:
|
105
|
+
|
43
106
|
* <tt>tag(name, options={})</tt>
|
44
107
|
* Creates an html tag with the given name and options
|
45
108
|
* <tt>tag(:br, :style => 'clear:both')</tt> => <br style="clear:both" />
|
@@ -55,6 +118,24 @@ You can also install only the padrino-helpers gem for more fine-grained use:
|
|
55
118
|
|
56
119
|
=== Asset Helpers
|
57
120
|
|
121
|
+
Asset helpers are intended to help insert useful html onto a view template such as 'flash' notices,
|
122
|
+
hyperlinks, mail_to links, images, stylesheets and javascript. An example of their uses would be on a
|
123
|
+
simple view template:
|
124
|
+
|
125
|
+
# app/views/example.haml
|
126
|
+
...
|
127
|
+
%head
|
128
|
+
= stylesheet_link_tag 'layout'
|
129
|
+
= javascript_include_tag 'application'
|
130
|
+
%body
|
131
|
+
...
|
132
|
+
= flash_tag :notice
|
133
|
+
%p= link_to 'Blog', '/blog', :class => 'example'
|
134
|
+
%p Mail me at #{mail_to 'fake@faker.com', "Fake Email Link", :cc => "test@demo.com"}
|
135
|
+
%p= image_tag 'padrino.png', :width => '35', :class => 'logo'
|
136
|
+
|
137
|
+
The list of defined helpers in the 'asset helpers' category:
|
138
|
+
|
58
139
|
* <tt>flash_tag(kind, options={})</tt>
|
59
140
|
* Creates a div to display the flash of given type if it exists
|
60
141
|
* <tt>flash_tag(:notice, :class => 'flash', :id => 'flash-notice')</tt>
|
@@ -78,6 +159,28 @@ You can also install only the padrino-helpers gem for more fine-grained use:
|
|
78
159
|
|
79
160
|
=== Form Helpers
|
80
161
|
|
162
|
+
Form helpers are the 'standard' form tag helpers you would come to expect when building forms. A simple
|
163
|
+
example of constructing a non-object form would be:
|
164
|
+
|
165
|
+
- form_tag '/destroy', :class => 'destroy-form', :method => 'delete' do
|
166
|
+
= flash_tag(:notice)
|
167
|
+
- field_set_tag do
|
168
|
+
%p
|
169
|
+
= label_tag :username, :class => 'first'
|
170
|
+
= text_field_tag :username, :value => params[:username]
|
171
|
+
%p
|
172
|
+
= label_tag :password, :class => 'first'
|
173
|
+
= password_field_tag :password, :value => params[:password]
|
174
|
+
%p
|
175
|
+
= label_tag :strategy
|
176
|
+
= select_tag :strategy, :options => ['delete', 'destroy'], :selected => 'delete'
|
177
|
+
%p
|
178
|
+
= check_box_tag :confirm_delete
|
179
|
+
- field_set_tag(:class => 'buttons') do
|
180
|
+
= submit_tag "Remove"
|
181
|
+
|
182
|
+
The list of defined helpers in the 'form helpers' category:
|
183
|
+
|
81
184
|
* <tt>form_tag(url, options={}, &block)</tt>
|
82
185
|
* Constructs a form without object based on options
|
83
186
|
* Supports form methods 'put' and 'delete' through hidden field
|
@@ -128,28 +231,40 @@ You can also install only the padrino-helpers gem for more fine-grained use:
|
|
128
231
|
* <tt>image_submit_tag(source, options={})</tt>
|
129
232
|
* Constructs an image submit button from the given options
|
130
233
|
* <tt>image_submit_tag "submit.png", :class => 'success'</tt>
|
131
|
-
|
132
|
-
A form_tag might look like:
|
133
|
-
|
134
|
-
- form_tag '/destroy', :class => 'destroy-form', :method => 'delete' do
|
135
|
-
= flash_tag(:notice)
|
136
|
-
- field_set_tag do
|
137
|
-
%p
|
138
|
-
= label_tag :username, :class => 'first'
|
139
|
-
= text_field_tag :username, :value => params[:username]
|
140
|
-
%p
|
141
|
-
= label_tag :password, :class => 'first'
|
142
|
-
= password_field_tag :password, :value => params[:password]
|
143
|
-
%p
|
144
|
-
= label_tag :strategy
|
145
|
-
= select_tag :strategy, :options => ['delete', 'destroy'], :selected => 'delete'
|
146
|
-
%p
|
147
|
-
= check_box_tag :confirm_delete
|
148
|
-
- field_set_tag(:class => 'buttons') do
|
149
|
-
= submit_tag "Remove"
|
150
234
|
|
151
235
|
=== FormBuilders
|
152
236
|
|
237
|
+
Form builders are full-featured objects allowing the construction of complex object-based forms
|
238
|
+
using a simple, intuitive syntax.
|
239
|
+
|
240
|
+
A form_for using these basic fields might look like:
|
241
|
+
|
242
|
+
- form_for @user, '/register', :id => 'register' do |f|
|
243
|
+
= f.error_messages
|
244
|
+
%p
|
245
|
+
= f.label :username, :caption => "Nickname"
|
246
|
+
= f.text_field :username
|
247
|
+
%p
|
248
|
+
= f.label :email
|
249
|
+
= f.text_field :email
|
250
|
+
%p
|
251
|
+
= f.label :password
|
252
|
+
= f.password_field :password
|
253
|
+
%p
|
254
|
+
= f.label :is_admin, :caption => "Admin User?"
|
255
|
+
= f.check_box :is_admin
|
256
|
+
%p
|
257
|
+
= f.label :color, :caption => "Favorite Color?"
|
258
|
+
= f.select :color, :options => ['red', 'black']
|
259
|
+
%p
|
260
|
+
- fields_for @user.location do |location|
|
261
|
+
= location.text_field :street
|
262
|
+
= location.text_field :city
|
263
|
+
%p
|
264
|
+
= f.submit "Create", :class => 'button'
|
265
|
+
|
266
|
+
The list of defined helpers in the 'form builders' category:
|
267
|
+
|
153
268
|
* <tt>form_for(object, url, settings={}, &block)</tt>
|
154
269
|
* Constructs a form using given or default form_builder
|
155
270
|
* Supports form methods 'put' and 'delete' through hidden field
|
@@ -193,33 +308,28 @@ The following are fields provided by AbstractFormBuilder that can be used within
|
|
193
308
|
* <tt>image_submit(source, options={})</tt>
|
194
309
|
* <tt>f.image_submit "submit.png", :class => 'long'</tt>
|
195
310
|
|
196
|
-
|
311
|
+
There is also an additional StandardFormBuilder which builds on the abstract fields that can be used within a form_for.
|
312
|
+
|
313
|
+
A form_for using these standard fields might be:
|
197
314
|
|
198
315
|
- form_for @user, '/register', :id => 'register' do |f|
|
199
316
|
= f.error_messages
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
- fields_for @user.location do |location|
|
217
|
-
= location.text_field :street
|
218
|
-
= location.text_field :city
|
219
|
-
%p
|
220
|
-
= f.submit "Create", :class => 'button'
|
221
|
-
|
222
|
-
There is also a StandardFormBuilder which builds on the abstract fields that can be used within a form_for:
|
317
|
+
= f.text_field_block :name, :caption => "Full name"
|
318
|
+
= f.text_field_block :email
|
319
|
+
= f.check_box_block :remember_me
|
320
|
+
= f.select_block :fav_color, :options => ['red', 'blue']
|
321
|
+
= f.password_field_block :password
|
322
|
+
= f.submit_block "Create", :class => 'button'
|
323
|
+
|
324
|
+
and would generate this html (with each input contained in a paragraph and containing a label):
|
325
|
+
|
326
|
+
<form id="register" action="/register" method="post">
|
327
|
+
<p><label for="user_name">Full name: </label><input type="text" id="user_name" name="user[name]"></p>
|
328
|
+
...omitted...
|
329
|
+
<p><input type="submit" value="Create" class="button"></p>
|
330
|
+
</form>
|
331
|
+
|
332
|
+
The following are fields provided by StandardFormBuilder that can be used within a form_for or fields_for:
|
223
333
|
|
224
334
|
* <tt>text_field_block(field, options={}, label_options={})</tt>
|
225
335
|
* <tt>text_field_block(:nickname, :class => 'big', :caption => "Username")</tt>
|
@@ -237,27 +347,8 @@ There is also a StandardFormBuilder which builds on the abstract fields that can
|
|
237
347
|
* <tt>submit_block(:username, :class => 'big')</tt>
|
238
348
|
* <tt>image_submit_block(source, options={})</tt>
|
239
349
|
* <tt>image_submit_block('submit.png', :class => 'big')</tt>
|
240
|
-
|
241
|
-
A form_for using these standard fields might look like:
|
242
|
-
|
243
|
-
- form_for @user, '/register', :id => 'register' do |f|
|
244
|
-
= f.error_messages
|
245
|
-
= f.text_field_block :name, :caption => "Full name"
|
246
|
-
= f.text_field_block :email
|
247
|
-
= f.check_box_block :remember_me
|
248
|
-
= f.select_block :fav_color, :options => ['red', 'blue']
|
249
|
-
= f.password_field_block :password
|
250
|
-
= f.submit_block "Create", :class => 'button'
|
251
350
|
|
252
|
-
|
253
|
-
|
254
|
-
<form id="register" action="/register" method="post">
|
255
|
-
<p><label for="user_name">Full name: </label><input type="text" id="user_name" name="user[name]"></p>
|
256
|
-
...omitted...
|
257
|
-
<p><input type="submit" value="Create" class="button"></p>
|
258
|
-
</form>
|
259
|
-
|
260
|
-
You can also easily build your own FormBuilder which allows for customized fields:
|
351
|
+
You can also easily build your own FormBuilder which allows for customized fields and behavior:
|
261
352
|
|
262
353
|
class MyCustomFormBuilder < AbstractFormBuilder
|
263
354
|
# Here we have access to a number of useful variables
|
@@ -277,14 +368,29 @@ Once a custom builder is defined, any call to form_for can use the new builder:
|
|
277
368
|
|
278
369
|
The form builder can even be made into the default builder when form_for is invoked:
|
279
370
|
|
280
|
-
# anywhere in the
|
371
|
+
# anywhere in the Padrino or Sinatra application
|
281
372
|
set :default_builder, 'MyCustomFormBuilder'
|
282
373
|
|
283
|
-
And there you have it, a fairly complete form builder solution for
|
374
|
+
And there you have it, a fairly complete form builder solution for Padrino (and Sinatra).
|
284
375
|
I hope to create or merge in an even better 'default' form_builder in the near future.
|
285
376
|
|
286
377
|
=== Format Helpers
|
287
378
|
|
379
|
+
Format helpers are several useful utilities for manipulating the format of text to achieve a goal.
|
380
|
+
The four format helpers are <tt>escape_html</tt>, <tt>relative_time_ago</tt>, <tt>time_in_words</tt>,
|
381
|
+
and <tt>js_escape_html</tt>.
|
382
|
+
|
383
|
+
The escape_html and js_escape_html function are for taking an html string and escaping certain characters.
|
384
|
+
<tt>escape_html</tt> will escape ampersands, brackets and quotes to their HTML/XML entities. This is useful
|
385
|
+
to sanitize user content before displaying this on a template. <tt>js_escape_html</tt> is used for
|
386
|
+
passing javascript information from a js template to a javascript function.
|
387
|
+
|
388
|
+
escape_html('<hello>&<goodbye>') # => <hello>&<goodbye>
|
389
|
+
|
390
|
+
There is also an alias for escape_html called <tt>h</tt> for even easier usage within templates.
|
391
|
+
|
392
|
+
The list of defined helpers in the 'format helpers' category:
|
393
|
+
|
288
394
|
* <tt>escape_html</tt> (alias <tt>h</tt> and <tt>h!</tt>)
|
289
395
|
* (from RackUtils) Escape ampersands, brackets and quotes to their HTML/XML entities.
|
290
396
|
* <tt>relative_time_ago(date)</tt>
|
@@ -297,32 +403,16 @@ I hope to create or merge in an even better 'default' form_builder in the near f
|
|
297
403
|
* <tt>time_in_words(2.days.ago)</tt> => "2 days ago"
|
298
404
|
* <tt>time_in_words(100.days.ago)</tt> => "Tuesday, July 21"
|
299
405
|
* <tt>time_in_words(1.day.from_now)</tt> => "tomorrow"
|
300
|
-
* <tt>
|
406
|
+
* <tt>js_escape_html(html_content)</tt>
|
301
407
|
* Escapes html to allow passing information to javascript. Used for passing data inside an ajax .js.erb template
|
302
|
-
* <tt>
|
408
|
+
* <tt>js_escape_html("<h1>Hey</h1>")</tt>
|
303
409
|
|
304
410
|
See the wiki article for additional information: <...WIKI...>
|
305
411
|
|
306
412
|
=== Render Helpers
|
307
413
|
|
308
|
-
This component provides a number of rendering helpers
|
309
|
-
|
310
|
-
such as partials (with support for :collection) into the templating system.
|
311
|
-
|
312
|
-
* <tt>erb_template(template_path, options={})</tt>
|
313
|
-
* Renders a erb template based on the given path
|
314
|
-
* <tt>erb_template 'users/new'</tt>
|
315
|
-
* <tt>haml_template(template_path, options={})</tt>
|
316
|
-
* Renders a haml template based on the given path
|
317
|
-
* <tt>haml_template 'users/new'</tt>
|
318
|
-
* <tt>render_template(template_path, options={})</tt>
|
319
|
-
* Renders the first detected template based on the given path
|
320
|
-
* <tt>render_template 'users/new'</tt>
|
321
|
-
* <tt>render_template 'users/index', :template_engine => 'haml'</tt>
|
322
|
-
* <tt>partial(template, *args)</tt>
|
323
|
-
* Renders the html related to the partial template for object or collection
|
324
|
-
* <tt>partial 'photo/_item', :object => @photo, :locals => { :foo => 'bar' }</tt>
|
325
|
-
* <tt>partial 'photo/_item', :collection => @photos</tt>
|
414
|
+
This component provides a number of rendering helpers making the process of displaying templates a bit easier.
|
415
|
+
This plugin also has support for useful additions such as partials (with support for :collection) for the templating system.
|
326
416
|
|
327
417
|
Using render plugin helpers is extremely simple. If you want to render an erb template in your view path:
|
328
418
|
|
@@ -336,7 +426,7 @@ There is also a method which renders the first view matching the path and remove
|
|
336
426
|
|
337
427
|
render_template 'path/to/any/template'
|
338
428
|
|
339
|
-
It is worth noting these are mostly for convenience.
|
429
|
+
It is worth noting these are mostly for convenience. With nested view file paths in Sinatra, this becomes tiresome:
|
340
430
|
|
341
431
|
haml :"the/path/to/file"
|
342
432
|
erb "/path/to/file".to_sym
|
@@ -352,7 +442,22 @@ This works as you would expect and also supports the collection counter inside t
|
|
352
442
|
# Access to collection counter with <partial_name>_counter i.e item_counter
|
353
443
|
# Access the object with the partial_name i.e item
|
354
444
|
|
355
|
-
|
445
|
+
The list of defined helpers in the 'render helpers' category:
|
446
|
+
|
447
|
+
* <tt>erb_template(template_path, options={})</tt>
|
448
|
+
* Renders a erb template based on the given path
|
449
|
+
* <tt>erb_template 'users/new'</tt>
|
450
|
+
* <tt>haml_template(template_path, options={})</tt>
|
451
|
+
* Renders a haml template based on the given path
|
452
|
+
* <tt>haml_template 'users/new'</tt>
|
453
|
+
* <tt>render_template(template_path, options={})</tt>
|
454
|
+
* Renders the first detected template based on the given path
|
455
|
+
* <tt>render_template 'users/new'</tt>
|
456
|
+
* <tt>render_template 'users/index', :template_engine => 'haml'</tt>
|
457
|
+
* <tt>partial(template, *args)</tt>
|
458
|
+
* Renders the html related to the partial template for object or collection
|
459
|
+
* <tt>partial 'photo/_item', :object => @photo, :locals => { :foo => 'bar' }</tt>
|
460
|
+
* <tt>partial 'photo/_item', :collection => @photos</tt>
|
356
461
|
|
357
462
|
See the wiki article for additional information: <...WIKI...>
|
358
463
|
|
data/Rakefile
CHANGED
@@ -8,12 +8,12 @@ begin
|
|
8
8
|
gem.summary = "Helpers for padrino"
|
9
9
|
gem.description = "Tag helpers, asset helpers, form helpers, form builders and many more helpers for padrino"
|
10
10
|
gem.email = "nesquena@gmail.com"
|
11
|
-
gem.homepage = "http://github.com/padrino/padrino-helpers"
|
11
|
+
gem.homepage = "http://github.com/padrino/padrino-framework/tree/master/padrino-helpers"
|
12
12
|
gem.authors = ["Padrino Team", "Nathan Esquenazi", "Davide D'Agostino", "Arthur Chiu"]
|
13
13
|
gem.add_runtime_dependency "sinatra", ">= 0.9.2"
|
14
14
|
gem.add_runtime_dependency "padrino-core", ">= 0.1.1"
|
15
15
|
gem.add_development_dependency "haml", ">= 2.2.1"
|
16
|
-
gem.add_development_dependency "shoulda",
|
16
|
+
gem.add_development_dependency "shoulda", ">= 0"
|
17
17
|
gem.add_development_dependency "mocha", ">= 0.9.7"
|
18
18
|
gem.add_development_dependency "rack-test", ">= 0.5.0"
|
19
19
|
gem.add_development_dependency "webrat", ">= 0.5.1"
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.1.
|
1
|
+
0.1.4
|
@@ -55,9 +55,9 @@ module Padrino
|
|
55
55
|
end
|
56
56
|
end
|
57
57
|
|
58
|
-
# Used in xxxx.js.erb files to escape html so that it can be passed to javascript from
|
59
|
-
#
|
60
|
-
def
|
58
|
+
# Used in xxxx.js.erb files to escape html so that it can be passed to javascript from Padrino
|
59
|
+
# js_escape_html("<h1>Hey</h1>")
|
60
|
+
def js_escape_html(html_content)
|
61
61
|
return '' unless html_content
|
62
62
|
javascript_mapping = { '\\' => '\\\\', '</' => '<\/', "\r\n" => '\n', "\n" => '\n' }
|
63
63
|
javascript_mapping.merge("\r" => '\n', '"' => '\\"', "'" => "\\'")
|
@@ -65,9 +65,8 @@ module Padrino
|
|
65
65
|
"\"#{escaped_string}\""
|
66
66
|
end
|
67
67
|
|
68
|
-
alias
|
69
|
-
alias js_escape_html
|
70
|
-
alias escape_for_javascript escape_javascript
|
68
|
+
alias escape_javascript js_escape_html
|
69
|
+
alias escape_for_javascript js_escape_html
|
71
70
|
|
72
71
|
end
|
73
72
|
end
|
data/padrino-helpers.gemspec
CHANGED
@@ -5,24 +5,21 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{padrino-helpers}
|
8
|
-
s.version = "0.1.
|
8
|
+
s.version = "0.1.4"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Padrino Team", "Nathan Esquenazi", "Davide D'Agostino", "Arthur Chiu"]
|
12
|
-
s.date = %q{2009-11-
|
12
|
+
s.date = %q{2009-11-23}
|
13
13
|
s.description = %q{Tag helpers, asset helpers, form helpers, form builders and many more helpers for padrino}
|
14
14
|
s.email = %q{nesquena@gmail.com}
|
15
15
|
s.extra_rdoc_files = [
|
16
|
-
"
|
17
|
-
"README.rdoc"
|
16
|
+
"README.rdoc"
|
18
17
|
]
|
19
18
|
s.files = [
|
20
19
|
".document",
|
21
20
|
".gitignore",
|
22
21
|
"LICENSE",
|
23
22
|
"README.rdoc",
|
24
|
-
"README.rdoc",
|
25
|
-
"Rakefile",
|
26
23
|
"Rakefile",
|
27
24
|
"VERSION",
|
28
25
|
"lib/padrino-helpers.rb",
|
@@ -35,7 +32,6 @@ Gem::Specification.new do |s|
|
|
35
32
|
"lib/padrino-helpers/render_helpers.rb",
|
36
33
|
"lib/padrino-helpers/tag_helpers.rb",
|
37
34
|
"padrino-helpers.gemspec",
|
38
|
-
"test/active_support_helpers.rb",
|
39
35
|
"test/fixtures/markup_app/app.rb",
|
40
36
|
"test/fixtures/markup_app/views/capture_concat.erb",
|
41
37
|
"test/fixtures/markup_app/views/capture_concat.haml",
|
@@ -60,6 +56,7 @@ Gem::Specification.new do |s|
|
|
60
56
|
"test/fixtures/render_app/views/template/haml_template.haml",
|
61
57
|
"test/fixtures/render_app/views/template/some_template.haml",
|
62
58
|
"test/helper.rb",
|
59
|
+
"test/support_helpers.rb",
|
63
60
|
"test/test_asset_tag_helpers.rb",
|
64
61
|
"test/test_form_builder.rb",
|
65
62
|
"test/test_form_helpers.rb",
|
@@ -68,7 +65,7 @@ Gem::Specification.new do |s|
|
|
68
65
|
"test/test_render_helpers.rb",
|
69
66
|
"test/test_tag_helpers.rb"
|
70
67
|
]
|
71
|
-
s.homepage = %q{http://github.com/padrino/padrino-helpers}
|
68
|
+
s.homepage = %q{http://github.com/padrino/padrino-framework/tree/master/padrino-helpers}
|
72
69
|
s.rdoc_options = ["--charset=UTF-8"]
|
73
70
|
s.require_paths = ["lib"]
|
74
71
|
s.rubygems_version = %q{1.3.5}
|
data/test/helper.rb
CHANGED
File without changes
|
data/test/test_format_helpers.rb
CHANGED
@@ -82,15 +82,15 @@ class TestFormatHelpers < Test::Unit::TestCase
|
|
82
82
|
end
|
83
83
|
end
|
84
84
|
|
85
|
-
context 'for #
|
85
|
+
context 'for #js_escape_html method' do
|
86
86
|
should "escape double quotes" do
|
87
|
-
assert_equal "\"hello\"",
|
87
|
+
assert_equal "\"hello\"", js_escape_html('"hello"')
|
88
88
|
end
|
89
89
|
should "escape single quotes" do
|
90
|
-
assert_equal "\"hello\"",
|
90
|
+
assert_equal "\"hello\"", js_escape_html("'hello'")
|
91
91
|
end
|
92
92
|
should "escape html tags and breaks" do
|
93
|
-
assert_equal "\"\\n<p>hello<\\/p>\\n\"",
|
93
|
+
assert_equal "\"\\n<p>hello<\\/p>\\n\"", js_escape_html("\n\r<p>hello</p>\r\n")
|
94
94
|
end
|
95
95
|
end
|
96
96
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: padrino-helpers
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Padrino Team
|
@@ -12,7 +12,7 @@ autorequire:
|
|
12
12
|
bindir: bin
|
13
13
|
cert_chain: []
|
14
14
|
|
15
|
-
date: 2009-11-
|
15
|
+
date: 2009-11-23 00:00:00 -08:00
|
16
16
|
default_executable:
|
17
17
|
dependencies:
|
18
18
|
- !ruby/object:Gem::Dependency
|
@@ -92,7 +92,6 @@ executables: []
|
|
92
92
|
extensions: []
|
93
93
|
|
94
94
|
extra_rdoc_files:
|
95
|
-
- LICENSE
|
96
95
|
- README.rdoc
|
97
96
|
files:
|
98
97
|
- .document
|
@@ -111,7 +110,6 @@ files:
|
|
111
110
|
- lib/padrino-helpers/render_helpers.rb
|
112
111
|
- lib/padrino-helpers/tag_helpers.rb
|
113
112
|
- padrino-helpers.gemspec
|
114
|
-
- test/active_support_helpers.rb
|
115
113
|
- test/fixtures/markup_app/app.rb
|
116
114
|
- test/fixtures/markup_app/views/capture_concat.erb
|
117
115
|
- test/fixtures/markup_app/views/capture_concat.haml
|
@@ -136,6 +134,7 @@ files:
|
|
136
134
|
- test/fixtures/render_app/views/template/haml_template.haml
|
137
135
|
- test/fixtures/render_app/views/template/some_template.haml
|
138
136
|
- test/helper.rb
|
137
|
+
- test/support_helpers.rb
|
139
138
|
- test/test_asset_tag_helpers.rb
|
140
139
|
- test/test_form_builder.rb
|
141
140
|
- test/test_form_helpers.rb
|
@@ -144,7 +143,7 @@ files:
|
|
144
143
|
- test/test_render_helpers.rb
|
145
144
|
- test/test_tag_helpers.rb
|
146
145
|
has_rdoc: true
|
147
|
-
homepage: http://github.com/padrino/padrino-helpers
|
146
|
+
homepage: http://github.com/padrino/padrino-framework/tree/master/padrino-helpers
|
148
147
|
licenses: []
|
149
148
|
|
150
149
|
post_install_message:
|