app/helpers/muck_activity_helper.rb in muck-activities-0.1.14 vs app/helpers/muck_activity_helper.rb in muck-activities-0.1.15
- old
+ new
@@ -57,12 +57,15 @@
:form_class => 'comment-delete',
:delete_path => comment_path(comment, :format => 'js') }
end
# Renders an activity feed filter. Filter items come from the name of the templates used to render the activities.
- def activity_filter(activities_object)
+ # Pass in an array of templates to leave out as the second parameter
+ def activity_filter(activities_object, *dont_include)
+ dont_include = [dont_include] unless dont_include.is_a?(Array)
activity_types = activities_object.activities.all(:select => "DISTINCT activities.template")
- render :partial => 'activities/template_filter', :locals => { :activity_types => activity_types }
+ filter_types = activity_types.find_all {|activity| !dont_include.include?(activity.template)}
+ render :partial => 'activities/template_filter', :locals => { :activity_types => filter_types, :dont_include => dont_include }
end
def is_current_filter?(template)
if params[:activity_filter] == template
'current'
\ No newline at end of file