Module: Refinery::Admin::DashboardHelper
- Defined in:
- dashboard/app/helpers/refinery/admin/dashboard_helper.rb
Instance Method Summary (collapse)
Instance Method Details
- (Object) activity_message_for(record)
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'dashboard/app/helpers/refinery/admin/dashboard_helper.rb', line 5 def (record) if (plugin = Refinery::Plugins.active.find_by_model(record.class)) && (activity = plugin.activity_by_class_name(record.class.name).first) # 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 => "refinery.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 => "refinery.#{action}") ).downcase.capitalize, eval("#{activity.url}(#{activity.nesting("record")}record)") end end |