simple_show_helper 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/lib/simple_show_helper.rb +16 -12
- metadata +11 -11
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.0.
|
1
|
+
0.0.2
|
data/lib/simple_show_helper.rb
CHANGED
@@ -54,7 +54,7 @@ module ApplicationHelper
|
|
54
54
|
value = m.attributes[d]
|
55
55
|
|
56
56
|
value = case value.class.to_s
|
57
|
-
when "Time" then
|
57
|
+
when "Time", "ActiveSupport::TimeWithZone" then
|
58
58
|
l(value, format: :long)
|
59
59
|
when "TrueClass" then
|
60
60
|
I18n.t(:true)
|
@@ -65,21 +65,25 @@ module ApplicationHelper
|
|
65
65
|
end
|
66
66
|
|
67
67
|
if assoc_keys.include?(d)
|
68
|
-
r = associations[d].where(id: value.to_i).first
|
69
|
-
can_read = can?(:read, r)
|
70
|
-
|
71
68
|
# nobody wants id
|
72
69
|
value = ""
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
70
|
+
|
71
|
+
r = associations[d].where(id: value.to_i).first
|
72
|
+
if r
|
73
|
+
can_read = can?(:read, r)
|
74
|
+
|
75
|
+
|
76
|
+
association_desc_keys.each do |ak|
|
77
|
+
if r.attributes[ak]
|
78
|
+
value = r.attributes[ak]
|
79
|
+
break
|
80
|
+
end
|
77
81
|
end
|
78
|
-
end
|
79
82
|
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
+
# if can read, link to it
|
84
|
+
if can_read
|
85
|
+
value = "<a href=\"#{url_for(r)}\">#{value}</a>"
|
86
|
+
end
|
83
87
|
end
|
84
88
|
|
85
89
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: simple_show_helper
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,11 +9,11 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-11-
|
12
|
+
date: 2012-11-16 00:00:00.000000000Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rspec
|
16
|
-
requirement: &
|
16
|
+
requirement: &24722540 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ~>
|
@@ -21,10 +21,10 @@ dependencies:
|
|
21
21
|
version: 2.3.0
|
22
22
|
type: :development
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *24722540
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: bundler
|
27
|
-
requirement: &
|
27
|
+
requirement: &24721980 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ~>
|
@@ -32,10 +32,10 @@ dependencies:
|
|
32
32
|
version: 1.0.0
|
33
33
|
type: :development
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *24721980
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: jeweler
|
38
|
-
requirement: &
|
38
|
+
requirement: &24721460 !ruby/object:Gem::Requirement
|
39
39
|
none: false
|
40
40
|
requirements:
|
41
41
|
- - ~>
|
@@ -43,10 +43,10 @@ dependencies:
|
|
43
43
|
version: 1.6.4
|
44
44
|
type: :development
|
45
45
|
prerelease: false
|
46
|
-
version_requirements: *
|
46
|
+
version_requirements: *24721460
|
47
47
|
- !ruby/object:Gem::Dependency
|
48
48
|
name: simplecov
|
49
|
-
requirement: &
|
49
|
+
requirement: &24720960 !ruby/object:Gem::Requirement
|
50
50
|
none: false
|
51
51
|
requirements:
|
52
52
|
- - ! '>='
|
@@ -54,7 +54,7 @@ dependencies:
|
|
54
54
|
version: '0'
|
55
55
|
type: :development
|
56
56
|
prerelease: false
|
57
|
-
version_requirements: *
|
57
|
+
version_requirements: *24720960
|
58
58
|
description: Simple helper to create 'show' pages easily.
|
59
59
|
email: bobikx@poczta.fm
|
60
60
|
executables: []
|
@@ -85,7 +85,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
85
85
|
version: '0'
|
86
86
|
segments:
|
87
87
|
- 0
|
88
|
-
hash:
|
88
|
+
hash: -74933958268505984
|
89
89
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
90
90
|
none: false
|
91
91
|
requirements:
|