-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathdashboard_helpers.rb
More file actions
32 lines (28 loc) · 883 Bytes
/
dashboard_helpers.rb
File metadata and controls
32 lines (28 loc) · 883 Bytes
1
2
3
4
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
module DashboardHelpers
def licence_image(url)
if url.include?('https://creativecommons.org/licenses/')
image_name = url.gsub('https://creativecommons.org/licenses/', '').split('/').first
else
image_name = 'licence'
end
return '<img class="licence-image" alt="'+ image_name +'" src="/images/'+ image_name +'.png">'
end
def availability_indicator(availability,url)
if availability[url].nil?
'<span title="Unknown" class="gray-light"></span> Unknown'
elsif availability[url]
'<span class="green-light"></span>Up'
else
'<span class="red-light"></span>Down'
end
end
def yesno_indicator(indicator)
if indicator.nil?
'<span title="Unknown" class="gray-light"></span>'
elsif indicator
'<span class="green-light"></span>Yes'
else
'<span class="red-light"></span>No'
end
end
end