mongoid_form 0.0.1.1 → 0.0.1.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.md
CHANGED
@@ -17,6 +17,17 @@ It makes your life easy when you develop forms and your app use [mongoid](https:
|
|
17
17
|
...
|
18
18
|
```
|
19
19
|
|
20
|
+
### Can show flag block with each localized fields
|
21
|
+
|
22
|
+
``` ruby
|
23
|
+
# config/initializers/mongoid_form_config.rb
|
24
|
+
...
|
25
|
+
# this option add after label text "<div class=\"flag flags-en\" />" to each locale fo localized fields
|
26
|
+
# you should styling .flag > .flags-en (.flags-ru etc.) in your css.
|
27
|
+
flag_for_localized true
|
28
|
+
...
|
29
|
+
```
|
30
|
+
|
20
31
|
### Shows asterisk for required fields!
|
21
32
|
|
22
33
|
``` ruby
|
@@ -68,6 +79,7 @@ MongoidForm.setup do |config|
|
|
68
79
|
add_if_required :abbr, '*', title: I18n::t('required')
|
69
80
|
error_block :span, class: 'help-inline'
|
70
81
|
input_wrapper :div, class: 'controls'
|
82
|
+
flag_for_localized true
|
71
83
|
end
|
72
84
|
|
73
85
|
end
|
@@ -79,7 +79,7 @@ module MongoidForm
|
|
79
79
|
result = ''
|
80
80
|
I18n.available_locales.each do |locale|
|
81
81
|
field = builder.object_name.scan(/(.*)\[(.*)_translations\]/).join('.')
|
82
|
-
flag = wrapper.flag_for_localized ? wrap('', [:div, class: "flag flags-#{locale.to_s}"]) : ''
|
82
|
+
flag = wrapper.flag_for_localized.first ? wrap('', [:div, class: "flag flags-#{locale.to_s}"]) : ''
|
83
83
|
label = builder.label locale.to_sym, *wrapper.label_options do
|
84
84
|
asterisk(name) + I18n::t("mongoid.attributes.#{field}") + flag
|
85
85
|
end
|
data/lib/mongoid_form/version.rb
CHANGED