Module: MuckActivityHelper

Included in:
Muck::ActivitiesController
Defined in:
app/helpers/muck_activity_helper.rb

Instance Method Summary collapse

Instance Method Details



7
8
9
10
11
# File 'app/helpers/muck_activity_helper.rb', line 7

def activity_comment_link(activity, comment = nil)
  if GlobalConfig.enable_activity_comments
    comment_form(activity, comment = nil)
  end
end

#activity_comments(activity) ⇒ Object



3
4
5
# File 'app/helpers/muck_activity_helper.rb', line 3

def activity_comments(activity)
  render :partial => 'activities/comments', :locals => { :activity => activity }
end

#activity_feed_for(activities_object) ⇒ Object



21
22
23
24
# File 'app/helpers/muck_activity_helper.rb', line 21

def activity_feed_for(activities_object)
  activities = get_activities(activities_object)
  render :partial => 'activities/activity_feed', :locals => { :activities_object => activities_object, :activities => activities }
end

#activity_filter(activities_object) ⇒ Object



38
39
40
41
# File 'app/helpers/muck_activity_helper.rb', line 38

def activity_filter(activities_object)
  activity_types = activities_object.activities.all(:select => "DISTINCT activities.template")
  render :partial => 'activities/template_filter', :locals => { :activity_types => activity_types }
end

#all_activities_urlObject



55
56
57
# File 'app/helpers/muck_activity_helper.rb', line 55

def all_activities_url
  request.url.gsub(request.query_string, '')
end

#current_status(activities_object) ⇒ Object



30
31
32
# File 'app/helpers/muck_activity_helper.rb', line 30

def current_status(activities_object)
  render :partial => 'activities/current_status_wrapper', :locals => { :activities_object => activities_object }
end

#delete_activity(activity, button_type = :button, button_text = t("muck.activities.clear")) ⇒ Object



34
35
36
# File 'app/helpers/muck_activity_helper.rb', line 34

def delete_activity(activity, button_type = :button, button_text = t("muck.activities.clear"))
  render :partial => 'activities/delete', :locals => { :activity => activity, :button_type => button_type, :button_text => button_text }
end

#get_activities(activities_object) ⇒ Object



59
60
61
62
63
64
65
# File 'app/helpers/muck_activity_helper.rb', line 59

def get_activities(activities_object)
  if !params[:latest_activity_id].blank?
    activities_object.activities.filter_by_template(params[:activity_filter]).after(params[:latest_activity_id]).find(:all, :include => ['comments']).paginate(:page => @page, :per_page => @per_page)
  else
    activities_object.activities.filter_by_template(params[:activity_filter]).find(:all, :include => ['comments']).paginate(:page => @page, :per_page => @per_page)
  end
end

#has_comments_css(activity) ⇒ Object



13
14
15
16
17
18
19
# File 'app/helpers/muck_activity_helper.rb', line 13

def has_comments_css(activity)
  if activity.has_comments?
    'activity-has-comments'
  else
    'activity-no-comments'
  end
end

#is_current_filter?(template) ⇒ Boolean

Returns:

  • (Boolean)


43
44
45
46
47
# File 'app/helpers/muck_activity_helper.rb', line 43

def is_current_filter?(template)
  if params[:activity_filter] == template
    'current'
  end
end

#no_filter?Boolean

Returns:

  • (Boolean)


49
50
51
52
53
# File 'app/helpers/muck_activity_helper.rb', line 49

def no_filter?
  if params[:activity_filter].blank?
    'current'
  end
end

#status_update(activities_object) ⇒ Object



26
27
28
# File 'app/helpers/muck_activity_helper.rb', line 26

def status_update(activities_object)
  render :partial => 'activities/status_update', :locals => { :activities_object => activities_object }
end