Module: ApplicationHelper

Defined in:
app/helpers/application_helper.rb

Instance Method Summary collapse

Instance Method Details

#admin_imageObject



29
30
31
# File 'app/helpers/application_helper.rb', line 29

def admin_image
  image_tag("admin.jpg", :size => "50x50", :border => "0", :alt => "These fields can be edited by an admin role", :title => "Admin role")
end

#current_semesterObject

Do we need this, used on welcome page



34
35
36
# File 'app/helpers/application_helper.rb', line 34

def current_semester
  AcademicCalendar.current_semester()
end

#display_timestamp(timestamp, options = {}) ⇒ Object



49
50
51
52
53
54
# File 'app/helpers/application_helper.rb', line 49

def display_timestamp(timestamp, options = {})

  return "" if timestamp.nil?
  (:span, "#{timestamp.in_time_zone('Pacific Time (US & Canada)').strftime('%a %b %d %Y, %I:%M %p (Pacific)')}", options)

end

#format_timestamp(timestamp) ⇒ Object



38
39
40
41
# File 'app/helpers/application_helper.rb', line 38

def format_timestamp(timestamp)
  return "" if timestamp.nil?
  (:span, "#{time_ago_in_words(timestamp)} ago", :class => 'timestamp', :title => timestamp.in_time_zone('Pacific Time (US & Canada)').strftime('%a %b %d %Y, %I:%M %p Pacific Time'))
end

#image_spacer(width) ⇒ Object



17
18
19
# File 'app/helpers/application_helper.rb', line 17

def image_spacer(width)
  image_tag("/cmu_sv/spacer.gif", :border => "0", :height => "1", :width => width, :alt => "")
end

#monthname(monthnumber) ⇒ Object



43
44
45
46
47
# File 'app/helpers/application_helper.rb', line 43

def monthname(monthnumber)
  if monthnumber
    Date::MONTHNAMES[monthnumber]
  end
end

#professor_imageObject

def left_nav_current_semester_courses

current_semester() + " " + Date.today.year

end



25
26
27
# File 'app/helpers/application_helper.rb', line 25

def professor_image
  image_tag("professor.jpg", :size => "50x50", :border => "0", :alt => "These fields can be edited by a faculty role", :title => "Faculty role")
end

#sanitize_trusted(html) ⇒ Object



4
5
6
# File 'app/helpers/application_helper.rb', line 4

def sanitize_trusted(html)
  return sanitize html, :tags => %w(a b blockquote br div em h1 h2 h3 h4 hr i img span p pre strong strike table tbody thead th tr td u ul ol li), :attributes => %w(align bgcolor border colspan cellpadding cellspacing class href id name padding rowspan scope src start style valign width)
end

#scotty_dog_landscapeObject



9
10
11
# File 'app/helpers/application_helper.rb', line 9

def scotty_dog_landscape
  image_tag("ScottyDogLandscape.jpg", :class => "bevel", :size => "236x69")
end

#scotty_dog_portraitObject



13
14
15
# File 'app/helpers/application_helper.rb', line 13

def scotty_dog_portrait
  image_tag("ScottyDog.jpg", :class => "bevel", :size => "214x234")
end