5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
|
# File 'lib/badges/view_helpers.rb', line 5
def list_badges(obj, options={})
return if obj.response.blank?
if !options[:codeschool_badges].blank? && !obj.badges.blank?
html = Markaby::Builder.new
html.send :ul, ({id: options[:id]} if options[:id]), ({class: options[:class]} if options[:class]) do
obj.badges.each do |course|
li do
if options[:codeschool_badges][:link]
a href: course['course_url'] do
img src: course['badge'] if options[:codeschool_badges][:image]
span course['name'] if options[:codeschool_badges][:text]
end
else
img src: course['badge'] if options[:codeschool_badges][:image]
span course['name'] if options[:codeschool_badges][:text]
end
end
end
end
return html.to_s.html_safe
end
if !options[:codeschool_courses_completed].blank? && !obj.courses_completed.blank?
html = Markaby::Builder.new
html.send :ul, ({id: options[:id]} if options[:id]), ({class: options[:class]} if options[:class]) do
obj.courses_completed.each do |course|
li do
if options[:codeschool_courses_completed][:link]
a href: course['url'] do
img src: course['badge'] if options[:codeschool_courses_completed][:image]
span course['title'] if options[:codeschool_courses_completed][:text]
end
else
img src: course['badge'] if options[:codeschool_courses_completed][:image]
span course['title'] if options[:codeschool_courses_completed][:text]
end
end
end
end
return html.to_s.html_safe
end
if !options[:codeschool_courses_in_progress].blank? && !obj.courses_in_progress.blank?
html = Markaby::Builder.new
html.send :ul, ({id: options[:id]} if options[:id]), ({class: options[:class]} if options[:class]) do
obj.courses_in_progress.each do |course|
li do
if options[:codeschool_courses_in_progress][:link]
a href: course['url'] do
img src: course['badge'] if options[:codeschool_courses_in_progress][:image]
span course['title'] if options[:codeschool_courses_in_progress][:text]
end
else
img src: course['badge'] if options[:codeschool_courses_in_progress][:image]
span course['title'] if options[:codeschool_courses_in_progress][:text]
end
end
end
end
return html.to_s.html_safe
end
if !options[:treehouse_badges].blank? && !obj.badges.blank?
html = Markaby::Builder.new
html.send :ul, ({id: options[:id]} if options[:id]), ({class: options[:class]} if options[:class]) do
obj.badges.each do |course|
li do
if options[:treehouse_badges][:link]
a href: course['url'] do
img src: course['icon_url'] if options[:treehouse_badges][:image]
span course['name'] if options[:treehouse_badges][:text]
end
else
img src: course['icon_url'] if options[:treehouse_badges][:image]
span course['name'] if options[:treehouse_badges][:text]
end
end
end
end
return html.to_s.html_safe
end
end
|