Sha256: 9af8635e317f492fbdc9f8e5d3101c3a4a3c99ad60f5d91416a8dcc4af62f4a4

Contents?: true

Size: 878 Bytes

Versions: 1

Compression:

Stored size: 878 Bytes

Contents

module Admin::DashboardHelper

  def activity_message_for(record)
    if (activity = Refinery::Plugins.active.find_activity_by_model(record.class)).present? and activity.title.present?
      title = record.send activity.title
      link = link_to  truncate(title, :length => 45),
                      eval("#{activity.url}(#{activity.nesting("record")}record)"),
                      :title => "See '#{title}'"

      # next work out which action occured and how long ago it happened
      action = record.updated_at.eql?(record.created_at) ? "created" : "updated"

      message = "<td>#{refinery_icon_tag("#{activity.send "#{action}_image"}")}</td>"
      message << "<td>#{link} #{record.class.name.titleize.downcase} was #{action}</td>"
      message << "<td class='time_ago'>#{time_ago_in_words(record.send "#{action}_at").gsub("about ", "")} ago</td>"
    end
  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
refinerycms-0.9.6.5 vendor/plugins/dashboard/app/helpers/admin/dashboard_helper.rb