Sha256: 7b7cc557fe91b22d02935468119c7c1e497292d0440ccce6dc40c30d204fa475

Contents?: true

Size: 879 Bytes

Versions: 7

Compression:

Stored size: 879 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

7 entries across 7 versions & 1 rubygems

Version Path
refinerycms-0.9.6.12 vendor/plugins/dashboard/app/helpers/admin/dashboard_helper.rb
refinerycms-0.9.6.11 vendor/plugins/dashboard/app/helpers/admin/dashboard_helper.rb
refinerycms-0.9.6.10 vendor/plugins/dashboard/app/helpers/admin/dashboard_helper.rb
refinerycms-0.9.6.9 vendor/plugins/dashboard/app/helpers/admin/dashboard_helper.rb
refinerycms-0.9.6.8 vendor/plugins/dashboard/app/helpers/admin/dashboard_helper.rb
refinerycms-0.9.6.7 vendor/plugins/dashboard/app/helpers/admin/dashboard_helper.rb
refinerycms-0.9.6.6 vendor/plugins/dashboard/app/helpers/admin/dashboard_helper.rb