awesome_form_attributes 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3930f76f028727104a329fdfb0b4fe2307d27ee8
|
4
|
+
data.tar.gz: c6f537cf775ef060de8cbd4c9e3e3bf536ad93aa
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fb1d4eba245c48caf90e7b56d229b742de0d7d0cdc55261ecd0ef5722372ca8cbf33eda5c4459f3aced05d8b4c346b9ddee5d823aa4f3442c26e4abd047f5b4b
|
7
|
+
data.tar.gz: 5ea01fa6348d31e49edfe537c0fe10dc453e301bedc63a0e3898ad025b9b2a93a048893fce6bc1e5588614a3453232cb3f2ee28c2b0b40d1f2f4b67bffeeb027
|
@@ -4,11 +4,18 @@ module ActionView
|
|
4
4
|
[["是", 1], ["否", 0]]
|
5
5
|
end
|
6
6
|
|
7
|
-
def
|
8
|
-
|
7
|
+
def klass
|
8
|
+
controller_name.classify.constantize
|
9
|
+
end
|
10
|
+
|
11
|
+
def has_displayed_names?
|
12
|
+
I18n.t(klass.displayed_columns_local_path).is_a?Hash
|
13
|
+
end
|
14
|
+
|
15
|
+
def localize_attr(sym)
|
9
16
|
displayed_name = I18n.t("#{klass.displayed_columns_local_path}.#{sym.to_s}")
|
10
17
|
basic_name = I18n.t("#{klass.default_local_path}.#{sym.to_s}")
|
11
|
-
return displayed_name
|
18
|
+
return displayed_name if has_displayed_names? && !(displayed_name =~ /translation missing/)
|
12
19
|
basic_name
|
13
20
|
end
|
14
21
|
end
|
@@ -3,14 +3,13 @@ module UsedAttrColumns
|
|
3
3
|
extend ActiveSupport::Concern
|
4
4
|
|
5
5
|
module ClassMethods
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
base_clos = I18n.t(self.class.displayed_columns_local_path).try(:keys) || used_attrs[0, 5]
|
6
|
+
def used_attrs
|
7
|
+
I18n.t(self.default_local_path).try(:keys) || []
|
8
|
+
end
|
9
|
+
|
10
|
+
def short_used_attrs
|
11
|
+
I18n.t(self.displayed_columns_local_path).try(:keys) || used_attrs[0, 5]
|
12
|
+
end
|
13
|
+
alias :displayed_columns :short_used_attrs
|
15
14
|
end
|
16
15
|
end
|