sinatra_more 0.2.8 → 0.2.9
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.rdoc +6 -1
- data/TODO +1 -1
- data/VERSION +1 -1
- data/lib/sinatra_more/render_plugin/render_helpers.rb +6 -3
- data/sinatra_more.gemspec +2 -2
- data/test/fixtures/render_app/app.rb +3 -3
- data/test/fixtures/render_app/views/template/_user.haml +3 -0
- data/test/test_render_plugin.rb +9 -0
- metadata +2 -2
data/README.rdoc
CHANGED
@@ -51,7 +51,7 @@ Here is a small list of what sinatra_more contains:
|
|
51
51
|
* Generally useful formatting extensions (<tt>relative_time_ago</tt>, <tt>js_escape_html</tt>, <tt>sanitize_html</tt>)
|
52
52
|
* Simple 'mailer' support for sinatra (akin to <tt>ActionMailer</tt> but simpler and powered by <tt>pony</tt>)
|
53
53
|
* Plug and play setup for the excellent Warden authentication system
|
54
|
-
* Code generators for creating
|
54
|
+
* Code generators for creating new sinatra applications (COMING SOON)
|
55
55
|
|
56
56
|
Keep in mind, the user will be able to pull in these components seperately and leave out those that are not required.
|
57
57
|
|
@@ -557,6 +557,11 @@ or perhaps we want to have a short body without the need for a template file:
|
|
557
557
|
|
558
558
|
* No serious issues known
|
559
559
|
|
560
|
+
== Links and Resources
|
561
|
+
|
562
|
+
* EnvyCasts - <http://railsenvy.com/2009/10/28/episode-098>
|
563
|
+
* Ruby5 - <http://ruby5.envylabs.com/episodes/24-episode-23-october-30-2009/stories/183-sinatra-more>
|
564
|
+
|
560
565
|
== Note on Patches/Pull Requests
|
561
566
|
|
562
567
|
* Fork the project.
|
data/TODO
CHANGED
@@ -1,6 +1,5 @@
|
|
1
1
|
= UNFINISHED
|
2
2
|
|
3
|
-
* Add support for a MailerPlugin which will make sending emails a breeze (http://github.com/hiroshi/pony)
|
4
3
|
* Add support for fields_for tag in formbuilder
|
5
4
|
* Add support for button tag method, mail_to helper
|
6
5
|
* Add support for check_box_group, radio_button_group which create a set of checkboxes or radio buttons
|
@@ -15,6 +14,7 @@
|
|
15
14
|
|
16
15
|
= COMPLETED
|
17
16
|
|
17
|
+
* Add support for a MailerPlugin which will make sending emails a breeze (http://github.com/hiroshi/pony)
|
18
18
|
* Add support for missing formbuilder fields (select, and standard_form_builder methods i.e check_box_group)
|
19
19
|
* Add support for missing formhelpers/fields (radio_button_tag, select_tag)
|
20
20
|
* Add support for select_tag :multiple => true
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.2.
|
1
|
+
0.2.9
|
@@ -31,15 +31,18 @@ module SinatraMore
|
|
31
31
|
template_path = File.join(path)
|
32
32
|
raise 'Partial collection specified but is nil' if options.has_key?(:collection) && options[:collection].nil?
|
33
33
|
if collection = options.delete(:collection)
|
34
|
+
options.delete(:object)
|
34
35
|
counter = 0
|
35
36
|
collection.inject([]) do |buffer, member|
|
36
37
|
counter += 1
|
37
|
-
|
38
|
-
|
38
|
+
options[:locals] ||= {}
|
39
|
+
options[:locals].merge!(object_name => member, "#{object_name}_counter".to_sym => counter)
|
40
|
+
buffer << render_template(template_path, options)
|
39
41
|
end.join("\n")
|
40
42
|
else
|
41
43
|
if member = options.delete(:object)
|
42
|
-
options
|
44
|
+
options[:locals] ||= {}
|
45
|
+
options[:locals].merge!(object_name => member)
|
43
46
|
end
|
44
47
|
render_template(template_path, options)
|
45
48
|
end
|
data/sinatra_more.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{sinatra_more}
|
8
|
-
s.version = "0.2.
|
8
|
+
s.version = "0.2.9"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Nathan Esquenazi"]
|
12
|
-
s.date = %q{2009-11-
|
12
|
+
s.date = %q{2009-11-06}
|
13
13
|
s.description = %q{Expands sinatra with standard helpers and tools to allow for complex applications}
|
14
14
|
s.email = %q{nesquena@gmail.com}
|
15
15
|
s.extra_rdoc_files = [
|
@@ -39,16 +39,16 @@ class RenderDemo < Sinatra::Base
|
|
39
39
|
|
40
40
|
# partial with object
|
41
41
|
get '/partial/object' do
|
42
|
-
partial 'template/user', :object => RenderUser.new('John')
|
42
|
+
partial 'template/user', :object => RenderUser.new('John'), :locals => { :extra => "bar" }
|
43
43
|
end
|
44
44
|
|
45
45
|
# partial with collection
|
46
46
|
get '/partial/collection' do
|
47
|
-
partial 'template/user', :collection => [RenderUser.new('John'), RenderUser.new('Billy')]
|
47
|
+
partial 'template/user', :collection => [RenderUser.new('John'), RenderUser.new('Billy')], :locals => { :extra => "bar" }
|
48
48
|
end
|
49
49
|
|
50
50
|
# partial with locals
|
51
51
|
get '/partial/locals' do
|
52
|
-
partial 'template/user', :locals => { :user => RenderUser.new('John') }
|
52
|
+
partial 'template/user', :locals => { :user => RenderUser.new('John'), :extra => "bar" }
|
53
53
|
end
|
54
54
|
end
|
data/test/test_render_plugin.rb
CHANGED
@@ -42,6 +42,9 @@ class TestRenderPlugin < Test::Unit::TestCase
|
|
42
42
|
should "have no counter index for single item" do
|
43
43
|
assert_have_no_selector "p", :content => "My counter is 1", :count => 1
|
44
44
|
end
|
45
|
+
should "include extra locals information" do
|
46
|
+
assert_have_selector 'p', :content => "Extra is bar"
|
47
|
+
end
|
45
48
|
end
|
46
49
|
|
47
50
|
context 'for #partial method and collection' do
|
@@ -54,6 +57,9 @@ class TestRenderPlugin < Test::Unit::TestCase
|
|
54
57
|
assert_have_selector "p", :content => "My counter is 1"
|
55
58
|
assert_have_selector "p", :content => "My counter is 2"
|
56
59
|
end
|
60
|
+
should "include extra locals information" do
|
61
|
+
assert_have_selector 'p', :content => "Extra is bar"
|
62
|
+
end
|
57
63
|
end
|
58
64
|
|
59
65
|
context 'for #partial method and locals' do
|
@@ -64,6 +70,9 @@ class TestRenderPlugin < Test::Unit::TestCase
|
|
64
70
|
should "have no counter index for single item" do
|
65
71
|
assert_have_no_selector "p", :content => "My counter is 1", :count => 1
|
66
72
|
end
|
73
|
+
should "include extra locals information" do
|
74
|
+
assert_have_selector 'p', :content => "Extra is bar"
|
75
|
+
end
|
67
76
|
end
|
68
77
|
|
69
78
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sinatra_more
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.9
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Nathan Esquenazi
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-11-
|
12
|
+
date: 2009-11-06 00:00:00 -08:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|