mongoid_form 0.0.1.2 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -63,6 +63,20 @@ Run installer for generate sample config:
63
63
  = f.input :visible, :checkbox # pass type of field
64
64
  ```
65
65
 
66
+ ### Types of fields supported:
67
+
68
+ * ```:text```
69
+ * ```:password```
70
+ * ```:select```
71
+ * ```:number```
72
+ * ```:text_area```
73
+ * ```:check_box```
74
+ * ```:hidden```
75
+ * ```:file```
76
+
77
+ If type is ```:hidden``` it will not be wrapped!
78
+
79
+
66
80
  ## Config
67
81
 
68
82
  All options for this time:
@@ -85,20 +99,6 @@ MongoidForm.setup do |config|
85
99
  end
86
100
  ```
87
101
 
88
- ### Types of fields supported:
89
-
90
- * ```:text```
91
- * ```:password```
92
- * ```:select```
93
- * ```:number```
94
- * ```:text_area```
95
- * ```:check_box```
96
- * ```:hidden```
97
- * ```:file```
98
-
99
- If type is ```:hidden``` it will not be wrapped!
100
-
101
-
102
102
  ## Contributing
103
103
 
104
104
  1. Fork it
@@ -79,6 +79,8 @@ module MongoidForm
79
79
  result = ''
80
80
  I18n.available_locales.each do |locale|
81
81
  field = builder.object_name.scan(/(.*)\[(.*)_translations\]/).join('.')
82
+ Rails.logger.info "$$$"*10
83
+ Rails.logger.info wrapper.flag_for_localized.inspect
82
84
  flag = wrapper.flag_for_localized.first ? wrap('', [:div, class: "flag flags-#{locale.to_s}"]) : ''
83
85
  label = builder.label locale.to_sym, *wrapper.label_options do
84
86
  asterisk(name) + I18n::t("mongoid.attributes.#{field}") + flag
@@ -101,7 +103,7 @@ module MongoidForm
101
103
  end
102
104
 
103
105
  def asterisk(name)
104
- required?(name) && wrapper.add_if_required ? @template.content_tag(*wrapper.add_if_required) + ' ' : ''
106
+ required?(name) && wrapper.add_if_required.present? ? @template.content_tag(*wrapper.add_if_required) + ' ' : ''
105
107
  end
106
108
 
107
109
  def error(name)
@@ -119,11 +121,11 @@ module MongoidForm
119
121
  end
120
122
 
121
123
  def input_wrapped(input, name)
122
- wrapper.input_wrapper ? wrap((input + error(name)), wrapper.input_wrapper) : (input + error(name))
124
+ wrapper.input_wrapper.present? ? wrap((input + error(name)), wrapper.input_wrapper) : (input + error(name))
123
125
  end
124
126
 
125
127
  def wrap_group(input, name, label)
126
- if wrapper.group_wrapper
128
+ if wrapper.group_wrapper.present?
127
129
  group_wrapper = wrapper.group_wrapper.dup
128
130
 
129
131
  if has_error?(name) && wrapper.group_error_class
@@ -1,3 +1,3 @@
1
1
  module MongoidForm
2
- VERSION = "0.0.1.2"
2
+ VERSION = "0.0.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.2
4
+ version: 0.0.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: