app/helpers/muck_activity_helper.rb in muck-activities-0.1.16 vs app/helpers/muck_activity_helper.rb in muck-activities-0.1.17

- old
+ new

@@ -4,11 +4,11 @@ render :partial => 'activities/comments', :locals => { :activity => activity } end def activity_comment_link(activity, comment = nil) if GlobalConfig.enable_activity_comments - comment_form(activity, comment = nil) + comment_form(activity, comment) end end def has_comments_css(activity) if activity.has_comments? @@ -18,11 +18,11 @@ end end # Renders an activity with only activities created by activities_object def limited_activity_feed_for(activities_object) - activities = activities_object.activities.created_by(activities_object).find(:all, :include => ['comments']).paginate(:page => @page, :per_page => @per_page) + activities = activities_object.activities.created_by(activities_object).only_public.find(:all, :include => ['comments']).paginate(:page => @page, :per_page => @per_page) render :partial => 'activities/activity_feed', :locals => { :activities_object => activities_object, :activities => activities } end # Renders a full activity feed for activities_object def activity_feed_for(activities_object) @@ -40,20 +40,20 @@ render :partial => 'activities/current_status_wrapper', :locals => { :activities_object => activities_object } end # Renders a delete button for an activity def delete_activity(activity, button_type = :button, button_text = t("muck.activities.clear")) - render :partial => 'activities/delete', :locals => { :delete_object => activity, + render :partial => 'shared/delete', :locals => { :delete_object => activity, :button_type => button_type, :button_text => button_text, :form_class => 'activity-delete', :delete_path => activity_path(activity, :format => 'js') } end # Renders a delete button for a comment inside an activity feed - def delete_comment(comment, button_type = :button, button_text = t("muck.activities.delete")) - render :partial => 'activities/delete', :locals => { :delete_object => comment, + def delete_activity_comment(comment, button_type = :button, button_text = t("muck.activities.delete")) + render :partial => 'shared/delete', :locals => { :delete_object => comment, :button_type => button_type, :button_text => button_text, :form_class => 'comment-delete', :delete_path => comment_path(comment, :format => 'js') } end @@ -81,14 +81,29 @@ def all_activities_url request.url.gsub(request.query_string, '') end + def get_profile_activities(activities_object) + if !params[:latest_activity_id].blank? + activities_object.activities.filter_by_template(params[:activity_filter]).after(params[:latest_activity_id]).only_public.created_by(activities_object).find(:all, :include => ['comments']).paginate(:page => @page, :per_page => @per_page) + else + activities_object.activities.filter_by_template(params[:activity_filter]).only_public.created_by(activities_object).find(:all, :include => ['comments']).paginate(:page => @page, :per_page => @per_page) + end + end + 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 - + + # Render an activity using a block and the given activity. + # options: + # activity_css_class - css class to attach to the given activity + def activity_for(activity, options = {}, &block) + block_to_partial('activity_templates/generic', options.merge(:activity => activity), &block) + end + end \ No newline at end of file