Sha256: 4f11e869aaf08ce2be1b83c860b930e6faf2590af8d8a2bf32abd2b09f816b38

Contents?: true

Size: 965 Bytes

Versions: 13

Compression:

Stored size: 965 Bytes

Contents

module Admin::DashboardHelper

  def activity_message_for(record)
    #TODO Update translation & translate message properly
    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.human_name,
                :action => t("#{action}.with_article \"#{article}\"")
               ).downcase.capitalize, eval("#{activity.url}(#{activity.nesting("record")}record)")
    end
  end

end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
refinerycms-0.9.7.15 vendor/plugins/dashboard/app/helpers/admin/dashboard_helper.rb
refinerycms-0.9.7.14 vendor/plugins/dashboard/app/helpers/admin/dashboard_helper.rb
refinerycms-0.9.7.13 vendor/plugins/dashboard/app/helpers/admin/dashboard_helper.rb
refinerycms-0.9.7.11 vendor/plugins/dashboard/app/helpers/admin/dashboard_helper.rb
refinerycms-0.9.7.10 vendor/plugins/dashboard/app/helpers/admin/dashboard_helper.rb
refinerycms-0.9.7.9 vendor/plugins/dashboard/app/helpers/admin/dashboard_helper.rb
refinerycms-0.9.7.8 vendor/plugins/dashboard/app/helpers/admin/dashboard_helper.rb
refinerycms-0.9.7.7 vendor/plugins/dashboard/app/helpers/admin/dashboard_helper.rb
refinerycms-0.9.7.6 vendor/plugins/dashboard/app/helpers/admin/dashboard_helper.rb
refinerycms-0.9.7.5 vendor/plugins/dashboard/app/helpers/admin/dashboard_helper.rb
refinerycms-0.9.7.4 vendor/plugins/dashboard/app/helpers/admin/dashboard_helper.rb
refinerycms-0.9.7.3 vendor/plugins/dashboard/app/helpers/admin/dashboard_helper.rb
refinerycms-0.9.7.2 vendor/plugins/dashboard/app/helpers/admin/dashboard_helper.rb