app/helpers/people_helper.rb in artfully_ose-1.2.0 vs app/helpers/people_helper.rb in artfully_ose-1.3.0.pre1

- old
+ new

@@ -24,10 +24,14 @@ image_tag(full_image_url('person-default-avatar.png')) end end + def tab_class(this_tab, active_tab) + this_tab == active_tab ? "tab-pane active" : "tab-pane" + end + def full_url(address, protocol='http://') if address.include?(protocol) address else "#{protocol}#{address}".squish @@ -54,6 +58,29 @@ :button, content_tag(:span, verb.capitalize, :class => "#{type}-icon"), {:class => classes.join(' '), :type => 'button', 'data-action-type' => type, 'data-details-placeholder' => placeholder, 'data-subtypes' => Action.subtypes_by_type[type].to_json} ) end -end \ No newline at end of file + + def mailchimp_list_disabled_for?(person, list_id) + person.do_not_email || person.opted_out_of_list?(list_id) || + person.bounced_on_list?(list_id) + end + + def mailchimp_active_groups(list, grouping, person) + grouping["groups"].select do |group| + person.in_group?(list[:list_id], grouping["id"], group["name"]) + end + end + + def mailchimp_inactive_groups(list, grouping, person) + grouping["groups"].reject do |group| + person.in_group?(list[:list_id], grouping["id"], group["name"]) + end + end + + def mailchimp_show_groupings?(person, list) + @person.subscribed_to_list?(list[:list_id]) && + @person.confirmed_on_list?(list[:list_id]) && + list[:groups].present? + end +end