Sha256: 16eac96df1ec26e24e13933bc9c9a164593ec70b87dd4d114cf978e7c48c5e11

Contents?: true

Size: 913 Bytes

Versions: 10

Compression:

Stored size: 913 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?
      # work out which action occured
      action = record.updated_at.eql?(record.created_at) ? "created" : "updated"

      # get article to define gender of model name, some languages require this for proper grammar
      article = t("plugins.#{record.class.name.pluralize.downcase}.article", :default => 'the')

      # now create a link to the notification's corresponding record.
      link_to t(".latest_activity_message",
                :what => record.send(activity.title),
                :kind => record.class.model_name.human,
                :action => t("#{action}.with_article \"#{article}\"")
               ).downcase.capitalize, eval("#{activity.url}(#{activity.nesting("record")}record)")
    end
  end

end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
refinerycms-0.9.8.9 vendor/refinerycms/dashboard/app/helpers/admin/dashboard_helper.rb
refinerycms-0.9.8.8 vendor/refinerycms/dashboard/app/helpers/admin/dashboard_helper.rb
refinerycms-0.9.8.7 vendor/refinerycms/dashboard/app/helpers/admin/dashboard_helper.rb
refinerycms-0.9.8.6 vendor/refinerycms/dashboard/app/helpers/admin/dashboard_helper.rb
refinerycms-0.9.8.5 vendor/refinerycms/dashboard/app/helpers/admin/dashboard_helper.rb
refinerycms-0.9.8.4 vendor/refinerycms/dashboard/app/helpers/admin/dashboard_helper.rb
refinerycms-0.9.8.3 vendor/refinerycms/dashboard/app/helpers/admin/dashboard_helper.rb
refinerycms-0.9.8.2 vendor/refinerycms/dashboard/app/helpers/admin/dashboard_helper.rb
refinerycms-0.9.8.1 vendor/refinerycms/dashboard/app/helpers/admin/dashboard_helper.rb
refinerycms-0.9.8 vendor/refinerycms/dashboard/app/helpers/admin/dashboard_helper.rb