Sha256: 6919af34b8c5de4b60e61cdaaf909171e188999c1f569be719011695ec554e13

Contents?: true

Size: 954 Bytes

Versions: 32

Compression:

Stored size: 954 Bytes

Contents

module Admin
  module DashboardHelper

    def activity_message_for(record)
      plugin = Refinery::Plugins.active.find_by_model(record.class)

      if (activity = plugin.activity.first).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('article', :scope => "plugins.#{plugin.name}.", :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("with_article \"#{article}\"", :scope =>  action)
                 ).downcase.capitalize, eval("#{activity.url}(#{activity.nesting("record")}record)")
      end
    end

  end
end

Version data entries

32 entries across 32 versions & 2 rubygems

Version Path
refinerycms-dashboard-1.0.11 app/helpers/admin/dashboard_helper.rb
refinerycms-dashboard-1.0.10 app/helpers/admin/dashboard_helper.rb
refinerycms-dashboard-1.0.9 app/helpers/admin/dashboard_helper.rb
refinerycms-dashboard-1.0.8 app/helpers/admin/dashboard_helper.rb
refinerycms-dashboard-1.0.7 app/helpers/admin/dashboard_helper.rb
refinerycms-dashboard-1.0.5 app/helpers/admin/dashboard_helper.rb
refinerycms-dashboard-1.0.4 app/helpers/admin/dashboard_helper.rb
refinerycms-dashboard-1.0.3 app/helpers/admin/dashboard_helper.rb
refinerycms-dashboard-1.0.1 app/helpers/admin/dashboard_helper.rb
refinerycms-dashboard-1.0.0 app/helpers/admin/dashboard_helper.rb
refinerycms-dashboard-0.9.9.22 app/helpers/admin/dashboard_helper.rb
refinerycms-dashboard-0.9.9.21 app/helpers/admin/dashboard_helper.rb
refinerycms-dashboard-0.9.9.20 app/helpers/admin/dashboard_helper.rb
refinerycms-dashboard-0.9.9.19 app/helpers/admin/dashboard_helper.rb
refinerycms-dashboard-0.9.9.18 app/helpers/admin/dashboard_helper.rb
refinerycms-dashboard-0.9.9.17 app/helpers/admin/dashboard_helper.rb
refinerycms-dashboard-0.9.9.16 app/helpers/admin/dashboard_helper.rb
refinerycms-dashboard-0.9.9.15 app/helpers/admin/dashboard_helper.rb
refinerycms-dashboard-0.9.9.14 app/helpers/admin/dashboard_helper.rb
refinerycms-dashboard-0.9.9.13 app/helpers/admin/dashboard_helper.rb