formtastic 2.0.2 → 2.1.0.beta1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (116) hide show
  1. data/.gitignore +4 -1
  2. data/Appraisals +11 -0
  3. data/CHANGELOG +2 -2
  4. data/Gemfile +0 -2
  5. data/README.textile +183 -151
  6. data/Rakefile +9 -5
  7. data/app/assets/stylesheets/formtastic.css +16 -3
  8. data/formtastic.gemspec +6 -2
  9. data/gemfiles/rails-3.0.gemfile +7 -0
  10. data/gemfiles/rails-3.1.gemfile +7 -0
  11. data/gemfiles/rails-3.2.gemfile +7 -0
  12. data/lib/formtastic.rb +10 -2
  13. data/lib/formtastic/actions.rb +11 -0
  14. data/lib/formtastic/actions/base.rb +156 -0
  15. data/lib/formtastic/actions/button_action.rb +72 -0
  16. data/lib/formtastic/actions/buttonish.rb +17 -0
  17. data/lib/formtastic/actions/input_action.rb +68 -0
  18. data/lib/formtastic/actions/link_action.rb +87 -0
  19. data/lib/formtastic/engine.rb +5 -1
  20. data/lib/formtastic/form_builder.rb +3 -0
  21. data/lib/formtastic/helpers.rb +2 -1
  22. data/lib/formtastic/helpers/action_helper.rb +109 -0
  23. data/lib/formtastic/helpers/actions_helper.rb +168 -0
  24. data/lib/formtastic/helpers/buttons_helper.rb +22 -9
  25. data/lib/formtastic/helpers/errors_helper.rb +0 -54
  26. data/lib/formtastic/helpers/fieldset_wrapper.rb +10 -5
  27. data/lib/formtastic/helpers/form_helper.rb +2 -2
  28. data/lib/formtastic/helpers/input_helper.rb +1 -10
  29. data/lib/formtastic/helpers/inputs_helper.rb +6 -3
  30. data/lib/formtastic/i18n.rb +3 -2
  31. data/lib/formtastic/inputs/base.rb +11 -3
  32. data/lib/formtastic/inputs/base/choices.rb +6 -1
  33. data/lib/formtastic/inputs/base/collections.rb +36 -13
  34. data/lib/formtastic/inputs/base/grouped_collections.rb +1 -1
  35. data/lib/formtastic/inputs/base/numeric.rb +50 -0
  36. data/lib/formtastic/inputs/base/options.rb +1 -1
  37. data/lib/formtastic/inputs/base/placeholder.rb +17 -0
  38. data/lib/formtastic/inputs/base/stringish.rb +2 -7
  39. data/lib/formtastic/inputs/base/timeish.rb +21 -5
  40. data/lib/formtastic/inputs/base/validations.rb +1 -1
  41. data/lib/formtastic/inputs/base/wrapping.rb +10 -3
  42. data/lib/formtastic/inputs/boolean_input.rb +10 -2
  43. data/lib/formtastic/inputs/check_boxes_input.rb +18 -9
  44. data/lib/formtastic/inputs/country_input.rb +2 -2
  45. data/lib/formtastic/inputs/date_input.rb +19 -1
  46. data/lib/formtastic/inputs/datetime_input.rb +1 -1
  47. data/lib/formtastic/inputs/email_input.rb +2 -1
  48. data/lib/formtastic/inputs/file_input.rb +1 -1
  49. data/lib/formtastic/inputs/hidden_input.rb +1 -1
  50. data/lib/formtastic/inputs/number_input.rb +6 -36
  51. data/lib/formtastic/inputs/password_input.rb +2 -1
  52. data/lib/formtastic/inputs/phone_input.rb +3 -2
  53. data/lib/formtastic/inputs/radio_input.rb +1 -1
  54. data/lib/formtastic/inputs/range_input.rb +8 -32
  55. data/lib/formtastic/inputs/search_input.rb +2 -1
  56. data/lib/formtastic/inputs/select_input.rb +56 -28
  57. data/lib/formtastic/inputs/string_input.rb +3 -1
  58. data/lib/formtastic/inputs/text_input.rb +5 -4
  59. data/lib/formtastic/inputs/time_input.rb +4 -8
  60. data/lib/formtastic/inputs/time_zone_input.rb +1 -1
  61. data/lib/formtastic/inputs/url_input.rb +2 -1
  62. data/lib/formtastic/localized_string.rb +6 -94
  63. data/lib/formtastic/localizer.rb +110 -0
  64. data/lib/formtastic/version.rb +1 -1
  65. data/lib/generators/formtastic/form/form_generator.rb +105 -0
  66. data/lib/generators/templates/_form.html.erb +2 -2
  67. data/lib/generators/templates/_form.html.haml +4 -4
  68. data/lib/generators/templates/_form.html.slim +2 -2
  69. data/lib/generators/templates/formtastic.rb +4 -0
  70. data/lib/locale/en.yml +2 -0
  71. data/sample/basic_inputs.html +22 -0
  72. data/spec/actions/button_action_spec.rb +63 -0
  73. data/spec/actions/generic_action_spec.rb +484 -0
  74. data/spec/actions/input_action_spec.rb +59 -0
  75. data/spec/actions/link_action_spec.rb +92 -0
  76. data/spec/builder/semantic_fields_for_spec.rb +14 -0
  77. data/spec/generators/formtastic/form/form_generator_spec.rb +118 -0
  78. data/spec/generators/formtastic/install/install_generator_spec.rb +47 -0
  79. data/spec/helpers/action_helper_spec.rb +365 -0
  80. data/spec/helpers/actions_helper_spec.rb +143 -0
  81. data/spec/helpers/buttons_helper_spec.rb +39 -23
  82. data/spec/helpers/commit_button_helper_spec.rb +153 -93
  83. data/spec/helpers/inputs_helper_spec.rb +14 -0
  84. data/spec/i18n_spec.rb +11 -0
  85. data/spec/inputs/boolean_input_spec.rb +31 -2
  86. data/spec/inputs/check_boxes_input_spec.rb +29 -1
  87. data/spec/inputs/date_input_spec.rb +95 -0
  88. data/spec/inputs/datetime_input_spec.rb +49 -0
  89. data/spec/inputs/email_input_spec.rb +28 -0
  90. data/spec/inputs/file_input_spec.rb +28 -0
  91. data/spec/inputs/hidden_input_spec.rb +28 -0
  92. data/spec/inputs/include_blank_spec.rb +53 -45
  93. data/spec/inputs/number_input_spec.rb +34 -4
  94. data/spec/inputs/password_input_spec.rb +28 -0
  95. data/spec/inputs/phone_input_spec.rb +28 -0
  96. data/spec/inputs/placeholder_spec.rb +10 -10
  97. data/spec/inputs/radio_input_spec.rb +51 -6
  98. data/spec/inputs/range_input_spec.rb +30 -2
  99. data/spec/inputs/search_input_spec.rb +27 -0
  100. data/spec/inputs/select_input_spec.rb +52 -6
  101. data/spec/inputs/string_input_spec.rb +28 -0
  102. data/spec/inputs/text_input_spec.rb +27 -0
  103. data/spec/inputs/time_input_spec.rb +67 -1
  104. data/spec/inputs/time_zone_input_spec.rb +28 -0
  105. data/spec/inputs/url_input_spec.rb +28 -0
  106. data/spec/inputs/with_options_spec.rb +43 -0
  107. data/spec/spec_helper.rb +22 -6
  108. data/spec/support/custom_macros.rb +6 -134
  109. data/spec/support/test_environment.rb +0 -1
  110. metadata +104 -17
  111. data/lib/formtastic/helpers/semantic_form_helper.rb +0 -11
  112. data/lib/formtastic/inputs/numeric_input.rb +0 -21
  113. data/lib/formtastic/railtie.rb +0 -12
  114. data/lib/formtastic/semantic_form_builder.rb +0 -11
  115. data/spec/builder/errors_spec.rb +0 -203
  116. data/spec/inputs/numeric_input_spec.rb +0 -41
data/Rakefile CHANGED
@@ -1,15 +1,19 @@
1
1
  # encoding: utf-8
2
- require 'rubygems'
3
- require 'rake'
4
- require 'rake/rdoctask'
2
+ require 'bundler/setup'
3
+ require 'appraisal'
4
+ require 'rdoc/task'
5
5
  require 'rspec/core/rake_task'
6
6
  require 'tasks/verify_rcov'
7
- require 'bundler'
8
7
 
9
8
  Bundler::GemHelper.install_tasks
10
9
 
11
10
  desc 'Default: run unit specs.'
12
- task :default => :spec_and_verify_coverage
11
+ task :default => :all
12
+
13
+ desc 'Test formtastic with all supported Rails versions.'
14
+ task :all => ["appraisal:install"] do
15
+ exec('rake appraisal spec')
16
+ end
13
17
 
14
18
  desc 'Generate documentation for the formtastic plugin.'
15
19
  Rake::RDocTask.new(:rdoc) do |rdoc|
@@ -18,6 +18,7 @@ This stylesheet forms part of the Formtastic Rails Plugin
18
18
  .formtastic fieldset,
19
19
  .formtastic legend,
20
20
  .formtastic input,
21
+ .formtastic button,
21
22
  .formtastic textarea,
22
23
  .formtastic select,
23
24
  .formtastic p {
@@ -47,6 +48,7 @@ This stylesheet forms part of the Formtastic Rails Plugin
47
48
  }
48
49
 
49
50
  .formtastic input,
51
+ .formtastic button,
50
52
  .formtastic textarea {
51
53
  font-family:sans-serif;
52
54
  font-size:inherit;
@@ -80,18 +82,29 @@ This stylesheet forms part of the Formtastic Rails Plugin
80
82
  }
81
83
 
82
84
 
83
- /* BUTTONS
85
+ /* BUTTONS & ACTIONS
84
86
  --------------------------------------------------------------------------------------------------*/
85
- .formtastic .buttons {
87
+ .formtastic .buttons,
88
+ .formtastic .actions {
86
89
  overflow:hidden; /* clear containing floats */
87
90
  padding-left:25%;
88
91
  }
89
92
 
90
- .formtastic .button {
93
+ .formtastic .button,
94
+ .formtastic .action {
91
95
  float:left;
92
96
  padding-right:0.5em;
93
97
  }
94
98
 
99
+ .formtastic .button_action button {
100
+ padding:3px 8px;
101
+ }
102
+
103
+ .formtastic .link_action a {
104
+ display:block;
105
+ padding:3px 0;
106
+ }
107
+
95
108
 
96
109
  /* INPUTS
97
110
  --------------------------------------------------------------------------------------------------*/
data/formtastic.gemspec CHANGED
@@ -23,13 +23,17 @@ Gem::Specification.new do |s|
23
23
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
24
24
  s.rubygems_version = %q{1.3.6}
25
25
 
26
- s.add_dependency(%q<rails>, ["~> 3.0"])
26
+ s.add_dependency(%q<actionpack>, ["~> 3.0"])
27
27
 
28
- s.add_development_dependency(%q<rspec-rails>, ["~> 2.5"])
28
+ s.add_development_dependency(%q<rspec-rails>, ["~> 2.8.0"])
29
29
  s.add_development_dependency(%q<rspec_tag_matchers>, [">= 1.0.0"])
30
30
  s.add_development_dependency(%q<hpricot>, ["~> 0.8.3"])
31
31
  s.add_development_dependency(%q<BlueCloth>) # for YARD
32
32
  s.add_development_dependency(%q<yard>, ["~> 0.6"])
33
33
  s.add_development_dependency(%q<rcov>, ["~> 0.9.9"])
34
34
  s.add_development_dependency(%q<colored>)
35
+ s.add_development_dependency(%q<tzinfo>)
36
+ s.add_development_dependency(%q<ammeter>, ["~> 0.2.2"])
37
+ s.add_development_dependency(%q<appraisal>)
38
+ s.add_development_dependency(%q<rake>)
35
39
  end
@@ -0,0 +1,7 @@
1
+ # This file was generated by Appraisal
2
+
3
+ source :rubygems
4
+
5
+ gem "rails", "~> 3.0.0"
6
+
7
+ gemspec :path=>"../"
@@ -0,0 +1,7 @@
1
+ # This file was generated by Appraisal
2
+
3
+ source :rubygems
4
+
5
+ gem "rails", "~> 3.1.0"
6
+
7
+ gemspec :path=>"../"
@@ -0,0 +1,7 @@
1
+ # This file was generated by Appraisal
2
+
3
+ source :rubygems
4
+
5
+ gem "rails", "~> 3.2.0.rc2"
6
+
7
+ gemspec :path=>"../"
data/lib/formtastic.rb CHANGED
@@ -1,25 +1,33 @@
1
1
  # encoding: utf-8
2
- require 'formtastic/railtie' if defined?(::Rails)
3
2
  require 'formtastic/engine' if defined?(::Rails)
4
3
 
5
4
  module Formtastic
6
5
  extend ActiveSupport::Autoload
7
6
 
8
7
  autoload :FormBuilder
9
- autoload :SemanticFormBuilder
10
8
  autoload :Helpers
11
9
  autoload :HtmlAttributes
12
10
  autoload :I18n
13
11
  autoload :Inputs
12
+ autoload :Actions
14
13
  autoload :LocalizedString
14
+ autoload :Localizer
15
15
  autoload :Util
16
16
 
17
17
  # @private
18
18
  class UnknownInputError < NameError
19
19
  end
20
20
 
21
+ # @private
22
+ class UnknownActionError < NameError
23
+ end
24
+
21
25
  # @private
22
26
  class PolymorphicInputWithoutCollectionError < ArgumentError
23
27
  end
24
28
 
29
+ # @private
30
+ class UnsupportedMethodForAction < ArgumentError
31
+ end
32
+
25
33
  end
@@ -0,0 +1,11 @@
1
+ module Formtastic
2
+ module Actions
3
+ extend ActiveSupport::Autoload
4
+
5
+ autoload :Base
6
+ autoload :Buttonish
7
+ autoload :InputAction
8
+ autoload :LinkAction
9
+ autoload :ButtonAction
10
+ end
11
+ end
@@ -0,0 +1,156 @@
1
+ module Formtastic
2
+ module Actions
3
+ module Base
4
+ include Formtastic::LocalizedString
5
+
6
+ attr_accessor :builder, :template, :object, :object_name, :method, :options
7
+
8
+ def initialize(builder, template, object, object_name, method, options)
9
+ @builder = builder
10
+ @template = template
11
+ @object = object
12
+ @object_name = object_name
13
+ @method = method
14
+ @options = options.dup
15
+
16
+ check_supported_methods!
17
+ end
18
+
19
+ def to_html
20
+ raise NotImplementedError
21
+ end
22
+
23
+ def wrapper(&block)
24
+ template.content_tag(:li,
25
+ template.capture(&block),
26
+ wrapper_html_options
27
+ )
28
+ end
29
+
30
+ def wrapper_html_options
31
+ wrapper_html_options_from_options.merge(default_wrapper_html_options)
32
+ end
33
+
34
+ def wrapper_html_options_from_options
35
+ options[:wrapper_html] || {}
36
+ end
37
+
38
+ def default_wrapper_html_options
39
+ {
40
+ :class => wrapper_class,
41
+ :id => wrapper_id
42
+ }
43
+ end
44
+
45
+ def wrapper_class
46
+ (default_wrapper_classes << wrapper_classes_from_options).join(" ")
47
+ end
48
+
49
+ def default_wrapper_classes
50
+ ["action", "#{options[:as]}_action"]
51
+ end
52
+
53
+ def wrapper_classes_from_options
54
+ classes = wrapper_html_options_from_options[:class] || []
55
+ classes = classes.split(" ") if classes.is_a? String
56
+ classes
57
+ end
58
+
59
+ def wrapper_html_options_from_options
60
+ options[:wrapper_html] || {}
61
+ end
62
+
63
+ def wrapper_id
64
+ wrapper_id_from_options || default_wrapper_id
65
+ end
66
+
67
+ def wrapper_id_from_options
68
+ wrapper_html_options_from_options[:id]
69
+ end
70
+
71
+ def default_wrapper_id
72
+ "#{object_name}_#{method}_action"
73
+ end
74
+
75
+ def supported_methods
76
+ raise NotImplementedError
77
+ end
78
+
79
+ def text
80
+ text = options[:label]
81
+ text = (localized_string(i18n_key, text, :action, :model => sanitized_object_name) ||
82
+ Formtastic::I18n.t(i18n_key, :model => sanitized_object_name)) unless text.is_a?(::String)
83
+ text
84
+ end
85
+
86
+ def button_html
87
+ default_button_html.merge(button_html_from_options || {}).merge(extra_button_html_options)
88
+ end
89
+
90
+ def button_html_from_options
91
+ options[:button_html]
92
+ end
93
+
94
+ def extra_button_html_options
95
+ {}
96
+ end
97
+
98
+ def default_button_html
99
+ { :accesskey => accesskey }
100
+ end
101
+
102
+ def accesskey
103
+ # TODO could be cleaner and separated, remember that nil is an allowed value for all of these
104
+ return options[:accesskey] if options.key?(:accesskey)
105
+ return options[:button_html][:accesskey] if options.key?(:button_html) && options[:button_html].key?(:accesskey)
106
+ # TODO might be different for cancel, etc?
107
+ return builder.default_commit_button_accesskey
108
+ end
109
+
110
+
111
+ protected
112
+
113
+ def check_supported_methods!
114
+ raise Formtastic::UnsupportedMethodForAction unless supported_methods.include?(method)
115
+ end
116
+
117
+ def i18n_key
118
+ return submit_i18n_key if method == :submit
119
+ method
120
+ end
121
+
122
+ def submit_i18n_key
123
+ if new_or_persisted_object?
124
+ key = @object.persisted? ? :update : :create
125
+ else
126
+ key = :submit
127
+ end
128
+ end
129
+
130
+ def new_or_persisted_object?
131
+ object && (object.respond_to?(:persisted?) || object.respond_to?(:new_record?))
132
+ end
133
+
134
+ def sanitized_object_name
135
+ if new_or_persisted_object?
136
+ # Deal with some complications with ActiveRecord::Base.human_name and two name models (eg UserPost)
137
+ # ActiveRecord::Base.human_name falls back to ActiveRecord::Base.name.humanize ("Userpost")
138
+ # if there's no i18n, which is pretty crappy. In this circumstance we want to detect this
139
+ # fall back (human_name == name.humanize) and do our own thing name.underscore.humanize ("User Post")
140
+ if object.class.model_name.respond_to?(:human)
141
+ sanitized_object_name = object.class.model_name.human
142
+ else
143
+ object_human_name = @object.class.human_name # default is UserPost => "Userpost", but i18n may do better ("User post")
144
+ crappy_human_name = @object.class.name.humanize # UserPost => "Userpost"
145
+ decent_human_name = @object.class.name.underscore.humanize # UserPost => "User post"
146
+ sanitized_object_name = (object_human_name == crappy_human_name) ? decent_human_name : object_human_name
147
+ end
148
+ else
149
+ sanitized_object_name = object_name.to_s.send(builder.label_str_method)
150
+ end
151
+ sanitized_object_name
152
+ end
153
+
154
+ end
155
+ end
156
+ end
@@ -0,0 +1,72 @@
1
+ # Outputs a `<button type="submit">` or `<button type="reset">` wrapped in the standard `<li>`
2
+ # wrapper. This is an alternative choice for `:submit` and `:reset` actions, which render with
3
+ # `<input type="submit">` and `<input type="reset">` by default.
4
+ #
5
+ # @example Full form context and output
6
+ #
7
+ # <%= semantic_form_for(@post) do |f| %>
8
+ # <%= f.actions do %>
9
+ # <%= f.action :reset, :as => :button %>
10
+ # <%= f.action :submit, :as => :button %>
11
+ # <% end %>
12
+ # <% end %>
13
+ #
14
+ # <form...>
15
+ # <fieldset class="actions">
16
+ # <ol>
17
+ # <li class="action button_action" id="post_submit_action">
18
+ # <button type="reset" value="Reset">
19
+ # </li>
20
+ # <li class="action button_action" id="post_reset_action">
21
+ # <button type="submit" value="Create Post">
22
+ # </li>
23
+ # </ol>
24
+ # </fieldset>
25
+ # </form>
26
+ #
27
+ # @example Specifying a label with a String
28
+ # <%= f.action :submit, :as => :button, :label => "Go" %>
29
+ #
30
+ # @example Pass HTML attributes down to the `<button>`
31
+ # <%= f.action :submit, :as => :button, :button_html => { :class => 'pretty', :accesskey => 'g', :disable_with => "Wait..." } %>
32
+ #
33
+ # @example Access key can also be set as a top-level option
34
+ # <%= f.action :submit, :as => :button, :accesskey => 'g' %>
35
+ #
36
+ # @example Pass HTML attributes down to the `<li>` wrapper (classes are appended to the existing classes)
37
+ # <%= f.action :submit, :as => :button, :wrapper_html => { :class => 'special', :id => 'whatever' } %>
38
+ # <%= f.action :submit, :as => :button, :wrapper_html => { :class => ['extra', 'special'], :id => 'whatever' } %>
39
+ #
40
+ # @option *args :label [String, Symbol]
41
+ # Override the label text with a String or a symbol for an i18n translation key
42
+ #
43
+ # @option *args :button_html [Hash]
44
+ # Override or add to the HTML attributes to be passed down to the `<input>` tag
45
+ #
46
+ # @option *args :wrapper_html [Hash]
47
+ # Override or add to the HTML attributes to be passed down to the wrapping `<li>` tag
48
+ #
49
+ # @todo document i18n keys
50
+ # @todo document i18n translation with :label (?)
51
+ module Formtastic
52
+ module Actions
53
+ class ButtonAction
54
+ include Base
55
+ include Buttonish
56
+
57
+ # TODO absolutely horrible hack to work-around Rails < 3.1 missing button_tag, need
58
+ # to figure out something more appropriate.
59
+ #
60
+ # TODO reset_action class?
61
+ def to_html
62
+ wrapper do
63
+ if template.respond_to?(:button_tag)
64
+ template.button_tag(text, button_html)
65
+ else
66
+ template.content_tag(:button, text, button_html)
67
+ end
68
+ end
69
+ end
70
+ end
71
+ end
72
+ end
@@ -0,0 +1,17 @@
1
+ module Formtastic
2
+ module Actions
3
+ module Buttonish
4
+
5
+ def supported_methods
6
+ [:submit, :reset]
7
+ end
8
+
9
+ def extra_button_html_options
10
+ {
11
+ :type => method
12
+ }
13
+ end
14
+
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,68 @@
1
+ # Outputs an `<input type="submit">` or `<input type="reset">` wrapped in the standard `<li>`
2
+ # wrapper. This the default for `:submit` and `:reset` actions, but `:as => :button` is also
3
+ # available as an alternative.
4
+ #
5
+ # @example The `:as` can be ommitted, these are functionally equivalent
6
+ # <%= f.action :submit, :as => :input %>
7
+ # <%= f.action :submit %>
8
+ #
9
+ # @example Full form context and output
10
+ #
11
+ # <%= semantic_form_for(@post) do |f| %>
12
+ # <%= f.actions do %>
13
+ # <%= f.action :reset, :as => :input %>
14
+ # <%= f.action :submit, :as => :input %>
15
+ # <% end %>
16
+ # <% end %>
17
+ #
18
+ # <form...>
19
+ # <fieldset class="actions">
20
+ # <ol>
21
+ # <li class="action input_action" id="post_submit_action">
22
+ # <input type="reset" value="Reset">
23
+ # </li>
24
+ # <li class="action input_action" id="post_reset_action">
25
+ # <input type="submit" value="Create Post">
26
+ # </li>
27
+ # </ol>
28
+ # </fieldset>
29
+ # </form>
30
+ #
31
+ # @example Specifying a label with a String
32
+ # <%= f.action :submit, :as => :input, :label => "Go" %>
33
+ #
34
+ # @example Pass HTML attributes down to the `<input>`
35
+ # <%= f.action :submit, :as => :input, :button_html => { :class => 'pretty', :accesskey => 'g', :disable_with => "Wait..." } %>
36
+ #
37
+ # @example Access key can also be set as a top-level option
38
+ # <%= f.action :submit, :as => :input, :accesskey => 'g' %>
39
+ #
40
+ # @example Pass HTML attributes down to the `<li>` wrapper (classes are appended to the existing classes)
41
+ # <%= f.action :submit, :as => :input, :wrapper_html => { :class => 'special', :id => 'whatever' } %>
42
+ # <%= f.action :submit, :as => :input, :wrapper_html => { :class => ['extra', 'special'], :id => 'whatever' } %>
43
+ #
44
+ # @option *args :label [String, Symbol]
45
+ # Override the label text with a String or a symbol for an i18n translation key
46
+ #
47
+ # @option *args :button_html [Hash]
48
+ # Override or add to the HTML attributes to be passed down to the `<input>` tag
49
+ #
50
+ # @option *args :wrapper_html [Hash]
51
+ # Override or add to the HTML attributes to be passed down to the wrapping `<li>` tag
52
+ #
53
+ # @todo document i18n keys
54
+ # @todo document i18n translation with :label (?)
55
+ module Formtastic
56
+ module Actions
57
+ class InputAction
58
+ include Base
59
+ include Buttonish
60
+
61
+ def to_html
62
+ wrapper do
63
+ builder.submit(text, button_html)
64
+ end
65
+ end
66
+ end
67
+ end
68
+ end