-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathteacher_helper.rb
More file actions
35 lines (31 loc) · 1.25 KB
/
teacher_helper.rb
File metadata and controls
35 lines (31 loc) · 1.25 KB
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
33
34
35
# frozen_string_literal: true
module TeacherHelper
SNAP_USER_PAGE = "https://snap.berkeley.edu/user?username="
def snap_link(teacher)
return "-" if ["N/A", "None", "", nil].include?(teacher.snap)
link_to(teacher.snap, "#{SNAP_USER_PAGE}#{teacher.snap}", target: "_blank")
end
def ip_history_display(teacher)
return "-" if teacher.ip_history.nil? || teacher.ip_history.empty?
teacher.ip_history.to_sentence
end
def email_address_label(email)
labels = []
labels << '<span class="primary-email-dot" data-toggle="tooltip" data-placement="top" title="Primary email"></span>' if email.primary?
labels << '<span class="bounced-email-dot" data-toggle="tooltip" data-placement="top" title="Bounced email"></span>' if email.bounced?
return nil if labels.empty?
labels.join("").html_safe
end
def mailbluster_sync_status(teacher)
if teacher.mailbluster_synced?
url = teacher.mailbluster_profile_url
if url
link_to('<span class="badge badge-success">Synced</span>'.html_safe, url, target: "_blank", title: "View in MailBluster")
else
'<span class="badge badge-success">Synced</span>'.html_safe
end
else
'<span class="badge badge-secondary">Not Synced</span>'.html_safe
end
end
end