class PostRunner::ActivityLink
Generates the name of an Activity
with a link to the ActivityReport. Optionally, an icon can be shown for Activities that contain a current personal record.
Public Class Methods
new(activity, show_record_icon = false)
click to toggle source
# File lib/postrunner/ActivityLink.rb, line 22 def initialize(activity, show_record_icon = false) @activity = activity @show_record_icon = show_record_icon end
Public Instance Methods
to_html(doc)
click to toggle source
Add the ActivityLink
as HTML Elements to the document. @param doc [HTMLBuilder] XML Document
# File lib/postrunner/ActivityLink.rb, line 29 def to_html(doc) doc.unique(:activitylink_style) { doc.style(style) } doc.a(@activity.name, { :class => 'activity_link', :href => @activity.html_file_name(false) }) if @show_record_icon && @activity.has_records? doc.img(nil, { :src => 'icons/record-small.png', :style => 'vertical-align:middle' }) end end
to_s()
click to toggle source
Convert the ActivityLink
into a plain text form. Return the first 20 characters of the Activity
name.
# File lib/postrunner/ActivityLink.rb, line 42 def to_s @activity.name[0..19] end
Private Instance Methods
style()
click to toggle source
# File lib/postrunner/ActivityLink.rb, line 48 def style <<EOT .activity_link { padding: 0px 3px 0px 3px; } EOT end