flash_helper 1.0.3 → 1.0.4
Sign up to get free protection for your applications and to get access to all the features.
- data/README +6 -0
- data/Rakefile +1 -1
- data/assets/stylesheets/flash_helper.css +2 -2
- data/lib/flash_helper.rb +17 -0
- metadata +1 -1
data/README
CHANGED
@@ -31,6 +31,12 @@ Then in your controllers you can use :
|
|
31
31
|
flash[:errors] = "Creation failed!"
|
32
32
|
flash[:errors] = @news.errors
|
33
33
|
flash[:warning] = "The new user has no blog associated..."
|
34
|
+
|
35
|
+
If you're using Rails >= 2.2, you can translate plugin internal messages.
|
36
|
+
For example in config/locales/fr.yml you can add :
|
37
|
+
|
38
|
+
flash_helper:
|
39
|
+
default_message: "Il y a des problèmes dans le formulaire :"
|
34
40
|
|
35
41
|
Tune display_flashes :
|
36
42
|
|
data/Rakefile
CHANGED
data/lib/flash_helper.rb
CHANGED
@@ -16,6 +16,12 @@ module Bounga
|
|
16
16
|
# flash[:errors] = "Creation failed!"
|
17
17
|
# flash[:errors] = @news.errors
|
18
18
|
# flash[:warning] = "The new user has no blog associated..."
|
19
|
+
#
|
20
|
+
# If you're using Rails >= 2.2, you can translate plugin internal messages.
|
21
|
+
# For example in config/locales/fr.yml you can add :
|
22
|
+
#
|
23
|
+
# flash_helper:
|
24
|
+
# default_message: "Il y a des problèmes dans le formulaire :"
|
19
25
|
|
20
26
|
# == Global options for helpers
|
21
27
|
#
|
@@ -38,6 +44,17 @@ module Bounga
|
|
38
44
|
}
|
39
45
|
mattr_reader :flash_options
|
40
46
|
|
47
|
+
# Enable I18n if using Rails >= 2.2
|
48
|
+
if Rails::VERSION::STRING >= '2.2'
|
49
|
+
I18n.backend.store_translations :'en', {
|
50
|
+
:flash_helper => {
|
51
|
+
:default_message => 'There are problems in your submission:'
|
52
|
+
}
|
53
|
+
}
|
54
|
+
@@flash_options.merge!(:default_message => I18n.t('flash_helper.default_message'))
|
55
|
+
end
|
56
|
+
|
57
|
+
|
41
58
|
# Display flash messages.
|
42
59
|
# You can pass an optional string as a parameter. It will be display before
|
43
60
|
# error messages.
|