formula 0.1.7 → 0.1.8

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 CHANGED
@@ -15,17 +15,20 @@ The gem has only been tested with Ruby 1.9.2 and Rails 3.0.3 but may well work w
15
15
  <% formula_form_for @user do |f| %>
16
16
  <%= f.input :email %>
17
17
  <%= f.input :password %>
18
+ <%= f.button :submit %>
18
19
  <% end %>
19
20
 
20
21
  <% formula_form_for @user do |f| %>
21
22
  <%= f.input :email, :label => "Email:", :hint => "We promise never to bother you." %>
22
23
  <%= f.input :password, :label => "Password:", :hint => "Must be at least six characters." %>
24
+ <%= f.button :submit %>
23
25
  <% end %>
24
26
 
25
27
  <% formula_form_for @company do |f|
26
28
  <%= f.input :url, :container => { :class => 'grid-04' } %>
27
29
  <%= f.input :phone, :container => { :class => 'grid-04' } %>
28
30
  <%= f.input :email, :container => { :class => 'grid-04' } %>
31
+ <%= f.button :submit %>
29
32
  <% end %>
30
33
 
31
34
  <% formula_form_for @user do |f| %>
@@ -35,6 +38,7 @@ The gem has only been tested with Ruby 1.9.2 and Rails 3.0.3 but may well work w
35
38
  <%= payment_f.input :credit_card_number, :label => 'Number:' %>
36
39
  <%= payment_f.input :credit_card_expiration, :label => 'Expiration:' %>
37
40
  <% end %>
41
+ <%= f.button :submit %>
38
42
  <% end %>
39
43
 
40
44
  <% formula_form_for @user do |f| %>
@@ -43,6 +47,7 @@ The gem has only been tested with Ruby 1.9.2 and Rails 3.0.3 but may well work w
43
47
  ...
44
48
  <% end %>
45
49
  <% end %>
50
+ <%= f.button :submit %>
46
51
  <% end %>
47
52
 
48
53
  == Copyright
data/lib/formula.rb CHANGED
@@ -48,6 +48,36 @@ module Formula
48
48
  class FormulaFormBuilder < ActionView::Helpers::FormBuilder
49
49
 
50
50
 
51
+ # Generate a form button.
52
+ #
53
+ # Options:
54
+ #
55
+ # * :container - add custom options to the container
56
+ # * :button - add custom options to the button
57
+ #
58
+ # Usage:
59
+ #
60
+ # f.button(:name)
61
+ #
62
+ # Equivalent:
63
+ #
64
+ # <div class="block">
65
+ # <%= f.submit(:name)
66
+ # </div>
67
+
68
+ def button(value, options = {})
69
+ options[:button] ||= {}
70
+
71
+ options[:container] ||= {}
72
+ options[:container][:class] = arrayorize(options[:container][:class]) << ::Formula.block_class
73
+
74
+
75
+ @template.content_tag(::Formula.block_tag, options[:container]) do
76
+ submit value, options[:button]
77
+ end
78
+ end
79
+
80
+
51
81
  # Basic container generator for use with blocks.
52
82
  #
53
83
  # Options:
@@ -64,7 +94,7 @@ module Formula
64
94
  #
65
95
  # Equivalent:
66
96
  #
67
- # <div class='fill'>
97
+ # <div class='block fill'>
68
98
  # <%= f.label(:name, "Name:") %>
69
99
  # ...
70
100
  # <div class="hint">Please use your full name.</div>
@@ -1,3 +1,3 @@
1
1
  module Formula
2
- VERSION = "0.1.7"
2
+ VERSION = "0.1.8"
3
3
  end
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 1
8
- - 7
9
- version: 0.1.7
8
+ - 8
9
+ version: 0.1.8
10
10
  platform: ruby
11
11
  authors:
12
12
  - Kevin Sylvestre
@@ -14,7 +14,7 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2010-12-27 00:00:00 -05:00
17
+ date: 2010-12-30 00:00:00 -05:00
18
18
  default_executable:
19
19
  dependencies: []
20
20