bootstrap_forms 1.0.1 → 1.0.2
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.markdown
CHANGED
@@ -156,6 +156,22 @@ You can add as many options to any form helper tag. If they are interpreted by B
|
|
156
156
|
</tr>
|
157
157
|
</table>
|
158
158
|
|
159
|
+
Internationalization/Custom Errors
|
160
|
+
----------------------------------
|
161
|
+
As of `1.0.2`, `bootstrap_forms` supports I18n! More support is being added, but you can change the error header and cancel button like this:
|
162
|
+
|
163
|
+
```yaml
|
164
|
+
# config/locales/en.yml
|
165
|
+
en:
|
166
|
+
bootstrap_forms:
|
167
|
+
errors:
|
168
|
+
header: 'Your %{model} is wrong!'
|
169
|
+
buttons:
|
170
|
+
cancel: 'Forget it!'
|
171
|
+
```
|
172
|
+
|
173
|
+
Obviously you can also change to a different `lang.yml` file and use the same syntax.
|
174
|
+
|
159
175
|
Contributing
|
160
176
|
------------
|
161
177
|
I'm pretty dam active on github. Fork and submit a pull request. Most of my pull requests are merged the same day. Make sure you:
|
data/bootstrap_forms.gemspec
CHANGED
@@ -3,7 +3,7 @@ $:.push File.expand_path("../lib", __FILE__)
|
|
3
3
|
|
4
4
|
Gem::Specification.new do |s|
|
5
5
|
s.name = "bootstrap_forms"
|
6
|
-
s.version = "1.0.
|
6
|
+
s.version = "1.0.2"
|
7
7
|
s.author = "Seth Vargo"
|
8
8
|
s.email = "sethvargo@gmail.com"
|
9
9
|
s.homepage = "https://github.com/sethvargo/bootstrap_forms"
|
data/lib/bootstrap_forms.rb
CHANGED
@@ -1 +1 @@
|
|
1
|
-
require 'bootstrap_forms/
|
1
|
+
require 'bootstrap_forms/engine' if defined?(Rails)
|
@@ -6,7 +6,7 @@ module BootstrapForms
|
|
6
6
|
if object.errors.full_messages.any?
|
7
7
|
content_tag(:div, :class => 'alert alert-error') do
|
8
8
|
link_to('×'.html_safe, '#', {:class => 'close', :data => { :dismiss => "alert" }}) +
|
9
|
-
content_tag(:p,
|
9
|
+
content_tag(:p, I18n.t('bootstrap_forms.errors.header', :model => object.class.model_name.humanize)) +
|
10
10
|
content_tag(:ul) do
|
11
11
|
object.errors.full_messages.map do |message|
|
12
12
|
content_tag(:li, message)
|
@@ -125,7 +125,7 @@ module BootstrapForms
|
|
125
125
|
@options[:class] = 'btn btn-primary'
|
126
126
|
|
127
127
|
content_tag(:div, :class => 'form-actions') do
|
128
|
-
super(name, *(args << @options)) + ' ' + link_to('
|
128
|
+
super(name, *(args << @options)) + ' ' + link_to(I18n.t('bootstrap_forms.buttons.cancel'), @options[:back_path] || :back, :class => 'btn cancel')
|
129
129
|
end
|
130
130
|
end
|
131
131
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bootstrap_forms
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.2
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -24,10 +24,11 @@ files:
|
|
24
24
|
- README.markdown
|
25
25
|
- Rakefile
|
26
26
|
- bootstrap_forms.gemspec
|
27
|
+
- config/locales/en.yml
|
27
28
|
- lib/bootstrap_forms.rb
|
29
|
+
- lib/bootstrap_forms/engine.rb
|
28
30
|
- lib/bootstrap_forms/form_builder.rb
|
29
31
|
- lib/bootstrap_forms/initializer.rb
|
30
|
-
- lib/bootstrap_forms/railtie.rb
|
31
32
|
homepage: https://github.com/sethvargo/bootstrap_forms
|
32
33
|
licenses: []
|
33
34
|
post_install_message:
|