sinatra_more 0.0.8 → 0.0.9

Sign up to get free protection for your applications and to get access to all the features.
data/README.rdoc CHANGED
@@ -53,7 +53,46 @@ This component provides a great deal of view helpers related to html markup gene
53
53
  There are helpers for generating tags, forms, links, images, and more. Most of the basic
54
54
  methods should be very familiar to anyone who has used rails view helpers.
55
55
 
56
- ...list methods here...
56
+ ==== Output Helpers
57
+
58
+ * capture_html(*args, &block)
59
+ * Captures the html from a block of template code for erb or haml
60
+ * capture_html(&block) => "...html..."
61
+ * concat_content(text="")
62
+ * Outputs the given text to the templates buffer directly
63
+ * concat_content("This will be output to the template buffer in erb or haml")
64
+
65
+ ==== Tag Helpers
66
+
67
+ * tag(name, options={})
68
+ * content_tag(name, content, options={})
69
+ * input_tag(type, options = {})
70
+
71
+ ==== Asset Helpers
72
+
73
+ * flash_tag(kind, options={})
74
+ * link_to(*args, &block)
75
+ * image_tag(url, options={})
76
+ * stylesheet_link_tag(*sources)
77
+ * javascript_include_tag(*sources)
78
+
79
+ ==== Form Helpers
80
+
81
+ * form_for(object, url, settings={}, &block)
82
+ * form_tag(url, options={}, &block)
83
+ * field_set_tag(*args, &block)
84
+ * error_messages_for(record, options={})
85
+ * label_tag(name, options={}, &block)
86
+ * text_field_tag(name, options={})
87
+ * text_area_tag(name, options={})
88
+ * password_field_tag(name, options={})
89
+ * file_field_tag(name, options={})
90
+ * submit_tag(caption, options={})
91
+
92
+ ==== Format Helpers
93
+
94
+ * relative_time_ago(date)
95
+ * escape_javascript(html_content)
57
96
 
58
97
  === RenderPlugin
59
98
 
@@ -61,7 +100,10 @@ This component provides a number of rendering helpers for sinatra, making the pr
61
100
  of displaying templates far smoother. This plugin also has support for useful additions
62
101
  such as partials (with support for :collection) into the templating system.
63
102
 
64
- ...list methods here...
103
+ * erb_template(template_path, options={})
104
+ * haml_template(template_path, options={})
105
+ * render_template(template_path, options={})
106
+ * partial(template, *args)
65
107
 
66
108
  === WardenPlugin
67
109
 
@@ -69,7 +111,12 @@ This component provides out-of-the-box support for Warden authentication. With t
69
111
  plugin registered, warden will be automatically required, configured and helpers will be
70
112
  provided to make interacting with warden dead simple.
71
113
 
72
- ...list methods here...
114
+ * current_user
115
+ * authenticate_user!
116
+ * logout_user!
117
+ * logged_in?
118
+ * authenticated?(&block)
119
+ * must_be_authorized!(failure_path=nil)
73
120
 
74
121
  == Acknowledgements
75
122
 
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.8
1
+ 0.0.9
@@ -8,7 +8,7 @@ class StandardFormBuilder < AbstractFormBuilder
8
8
  class_eval <<-EOF
9
9
  def #{field_type}_block(field, options={}, label_options={})
10
10
  label_options.reverse_merge!(:caption => options.delete(:caption)) if options[:caption]
11
- @template.content_block_tag(:p) do
11
+ @template.content_block_tag(:p, :concat => false) do
12
12
  html = label(field, label_options)
13
13
  html << #{field_type}(field, options)
14
14
  end
@@ -18,7 +18,7 @@ class StandardFormBuilder < AbstractFormBuilder
18
18
 
19
19
  # submit_block("Update")
20
20
  def submit_block(caption)
21
- @template.content_block_tag(:p) do
21
+ @template.content_block_tag(:p, :concat => false) do
22
22
  @template.submit_tag(caption)
23
23
  end
24
24
  end
@@ -6,16 +6,20 @@ module SinatraMore
6
6
  tag(:input, options)
7
7
  end
8
8
 
9
- # content_block_tag(:p, :class => 'dark') do ... end
10
- def content_block_tag(name, options={}, &block)
11
- options.merge!(:content => capture_html(&block))
12
- tag(name, options)
13
- end
14
-
15
9
  # content_tag(:p, "hello", :class => 'light')
16
- def content_tag(name, content, options={})
17
- tag(name, options.merge(:content => content))
10
+ # content_tag(:p, :class => 'dark') do ... end
11
+ # parameters: content_tag(name, content=nil, options={})
12
+ # options = { :concat => true/false }
13
+ def content_tag(*args, &block)
14
+ name = args.first
15
+ options = args.extract_options!
16
+ options.reverse_merge!(:concat => true) if block_given?
17
+ should_concat = options.delete(:concat)
18
+ tag_html = block_given? ? capture_html(&block) : args[1]
19
+ tag_result = tag(name, options.merge(:content => tag_html))
20
+ should_concat ? concat_content(tag_result) : tag_result
18
21
  end
22
+ alias content_block_tag content_tag
19
23
 
20
24
  # tag(:br, :style => 'clear:both')
21
25
  # tag(:p, :content => "hello", :class => 'large')
data/sinatra_more.gemspec CHANGED
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{sinatra_more}
8
- s.version = "0.0.8"
8
+ s.version = "0.0.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"]
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.0.8
4
+ version: 0.0.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nathan Esquenazi