Sha256: 186139b3bca5b6a5b850c59b4c82917d48b17e33278bb7129cdd607b2ae8f7d5

Contents?: true

Size: 874 Bytes

Versions: 7

Compression:

Stored size: 874 Bytes

Contents

module Admin::DashboardHelper

  def activity_message_for(record)
    unless (activity = Refinery::Plugins.active.find_activity_by_model(record.class)).nil? or activity.title.blank?
      title = record.send activity.title
      link = link_to truncate(title, :length => 45),
        eval("#{activity.url_prefix}admin_#{record.class.name.underscore.downcase}_url(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.4 vendor/plugins/dashboard/app/helpers/admin/dashboard_helper.rb
refinerycms-0.9.6.3 vendor/plugins/dashboard/app/helpers/admin/dashboard_helper.rb
refinerycms-0.9.6.2 vendor/plugins/dashboard/app/helpers/admin/dashboard_helper.rb
refinerycms-0.9.6.1 vendor/plugins/dashboard/app/helpers/admin/dashboard_helper.rb
refinerycms-0.9.6 vendor/plugins/dashboard/app/helpers/admin/dashboard_helper.rb
refinerycms-0.9.5.31 vendor/plugins/dashboard/app/helpers/admin/dashboard_helper.rb
refinerycms-0.9.5.30 vendor/plugins/dashboard/app/helpers/admin/dashboard_helper.rb