Sha256: 681a763268fd627a63719c98f29be439c4c3b18183970d7868c81e02d3abde0d
Contents?: true
Size: 1.69 KB
Versions: 1
Compression:
Stored size: 1.69 KB
Contents
module Thredded class TopicDecorator < SimpleDelegator include Rails.application.routes.url_helpers include ActionView::Helpers::UrlHelper attr_reader :topic def initialize(topic) super @topic = topic end def css_class classes = [] classes << 'locked' if locked? classes << 'sticky' if sticky? classes << 'private' if private? classes += ['category'] + categories.map(&:name) if categories.present? classes.join(' ') end def last_user_link if last_user.nil? 'Anonymous' else "<a href='/users/#{last_user}'>#{last_user}</a>".html_safe end end def original topic end def updated_at_timeago if updated_at.nil? <<-eohtml.html_safe <abbr> a little while ago </abbr> eohtml else <<-eohtml.html_safe <abbr class="timeago" title="#{updated_at_utc}"> #{updated_at_str} </abbr> eohtml end end def created_at_timeago if created_at.nil? <<-eohtml.html_safe <abbr class="started_at"> a little while ago </abbr> eohtml else <<-eohtml.html_safe <abbr class="started_at timeago" title="#{created_at_utc}"> #{created_at_str} </abbr> eohtml end end def gravatar_url super.gsub /http:/, '' end private def updated_at_str updated_at.to_s end def updated_at_utc updated_at.getutc.iso8601 end def created_at_str created_at.to_s end def created_at_utc created_at.getutc.iso8601 end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
thredded-0.0.3 | app/decorators/thredded/topic_decorator.rb |