mongoid_form 0.0.1.1 → 0.0.1.2

Sign up to get free protection for your applications and to get access to all the features.
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
@@ -9,6 +9,7 @@ MongoidForm.setup do |config|
9
9
  add_if_required :abbr, '*', title: I18n::t('required')
10
10
  error_block :span, class: 'help-inline'
11
11
  input_wrapper :div, class: 'controls'
12
+ flag_for_localized true
12
13
  end
13
14
 
14
15
  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
@@ -1,3 +1,3 @@
1
1
  module MongoidForm
2
- VERSION = "0.0.1.1"
2
+ VERSION = "0.0.1.2"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mongoid_form
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1.1
4
+ version: 0.0.1.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: