Sha256: f27c4960aecd371aa9f2cefe68e2fa262d20dd9a8d0692448de1eb84836028d8

Contents?: true

Size: 899 Bytes

Versions: 5

Compression:

Stored size: 899 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 = eval "record.#{activity.title}"
      link = link_to truncate(title, :length => 60), 
        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("#{eval("activity.#{action}_image")}")}</td>"
      message << "<td>#{link} #{record.class.name.titleize.downcase} was #{action}</td>"
      message << "<td class='time_ago'>#{time_ago_in_words(eval("record.#{action}_at")).gsub("about ", "")} ago</td>"
    end
  end
  
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
refinerycms-0.9.5.18 vendor/plugins/dashboard/app/helpers/admin/dashboard_helper.rb
refinerycms-0.9.5.17 vendor/plugins/dashboard/app/helpers/admin/dashboard_helper.rb
refinerycms-0.9.5.16 vendor/plugins/dashboard/app/helpers/admin/dashboard_helper.rb
refinerycms-0.9.5.15 vendor/plugins/dashboard/app/helpers/admin/dashboard_helper.rb
refinerycms-0.9.5.14 vendor/plugins/dashboard/app/helpers/admin/dashboard_helper.rb