Module: ActivitiesHelper
- Defined in:
- app/helpers/activities_helper.rb
Instance Method Summary collapse
- #activity_css_classes(activity) ⇒ Object
- #activity_datetime(activity, short = false) ⇒ Object
-
#activity_object_edit_url(activity) ⇒ Object
t(:‘adva.activity.from_to’, :from => from, :to => to) end.
-
#link_to_activity_user(activity) ⇒ Object
FIXME not used anywhere? def link_to_activity_commentable(activity) link_to truncate(activity.commentable_title, 100), activity_commentable_url(activity) end.
- #render_activities(activities, recent = false) ⇒ Object
Instance Method Details
#activity_css_classes(activity) ⇒ Object
14 15 16 17 18 |
# File 'app/helpers/activities_helper.rb', line 14 def activity_css_classes(activity) type = activity.object_attributes['type'] || activity.object_type "#{type}_#{activity.all_actions.last}".downcase # activity.all_actions.collect {|action| "#{type}-#{action}".downcase }.uniq * ' ' end |
#activity_datetime(activity, short = false) ⇒ Object
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'app/helpers/activities_helper.rb', line 20 def activity_datetime(activity, short = false) if activity.from and short from = activity.from.to_s(:time_only) to = activity.to.to_s(:time_only) "#{from} - #{to}" elsif activity.from and activity.from.to_date != activity.to.to_date from = activity.from.to_ordinalized_s(:plain) to = activity.to.to_ordinalized_s(:plain) "#{from} - #{to}" elsif activity.from from = activity.from.to_ordinalized_s(:plain) to = activity.to.to_ordinalized_s(:time_only) "#{from} - #{to}" else activity.created_at.send *(short ? [:to_s, :time_only] : [:to_ordinalized_s, :plain]) end end |
#activity_object_edit_url(activity) ⇒ Object
t(:‘adva.activity.from_to’, :from => from, :to => to) end
50 51 52 53 |
# File 'app/helpers/activities_helper.rb', line 50 def activity_object_edit_url(activity) type = activity.object_attributes['type'] || activity.object_type send "edit_admin_#{type}_path".downcase, activity.site_id, activity.section_id, activity.object_id end |
#link_to_activity_user(activity) ⇒ Object
FIXME not used anywhere? def link_to_activity_commentable(activity)
link_to truncate(activity.commentable_title, 100), activity_commentable_url(activity)
end
66 67 68 69 70 71 72 |
# File 'app/helpers/activities_helper.rb', line 66 def link_to_activity_user(activity) if activity..registered? link_to activity., admin_site_user_path(activity.site, activity.) else activity.(:include_email => true) end end |
#render_activities(activities, recent = false) ⇒ Object
2 3 4 5 6 7 8 9 10 11 12 |
# File 'app/helpers/activities_helper.rb', line 2 def render_activities(activities, recent = false) if activities.present? html = activities.collect do |activity| render :partial => "admin/activities/#{activity.object_type.downcase}", :locals => { :activity => activity, :recent => recent } end.join else html = %(<li class="empty shade">#{I18n.t(:'adva.activity.none')}.</li>) end raw %(<ul class="activities">#{html}</ul>) end |