app/views/people/show.html.haml in artfully_ose-1.2.0 vs app/views/people/show.html.haml in artfully_ose-1.3.0.pre1

- old
+ new

@@ -1,26 +1,29 @@ -- content_for :custom_js do - = javascript_include_tag "relationships" - in_section :people - content_for :title do #{@person} =render "header" .row .span4 -unless @person.dummy? - %p= render :partial => 'work_with_menu', :locals => {:person => @person} - = render @person.address unless @person.address.new_record? + = render :partial => 'work_with_menu', :locals => {:person => @person} - %ul - - @person.phones.each do |phone| - %li - %span.muted= phone.kind - = phone.number + - if @person.addresses.any? + %h5 Address + = render @person.addresses + - if @person.phones.any? + %h5 Phone + %ul + - @person.phones.each do |phone| + %li + %span.muted= phone.kind + = phone.number + -with_kit(:relationships) do %section - if @person.household.present? %h5 == Household (#{link_to "view", @person.household}) @@ -29,33 +32,33 @@ %li %span.starable-spacer ✭ %span.muted = link_to(individual, polymorphic_url(individual)) - - %h5 Relationships - struct = relationships_struct(@person) - %ul - - struct[:starred].each do |relationship| - %li - %span.starred.starable{"data-person-id" => relationship.person.id, "data-type" => 'relationship', "data-action-id" => relationship.id, :class => (relationship.starred? ? "active" : "not-active") } - ✭ - %span.muted= relationship.relation.description.humanize - = link_to(relationship.other(@person), polymorphic_url(relationship.other(@person))) + -unless no_relationships_in?(struct) + %h5 Relationships + %ul + - struct[:starred].each do |relationship| + %li + %span.starred.starable{"data-person-id" => relationship.person.id, "data-type" => 'relationship', "data-action-id" => relationship.id, :class => (relationship.starred? ? "active" : "not-active") } + ✭ + %span.muted= relationship.relation.description.humanize + = link_to(relationship.other(@person), polymorphic_url(relationship.other(@person))) - - @person.relationships.unstarred.where(:relation_id => struct[:single]).each do |relationship| - %li - %span.starred.starable{"data-person-id" => relationship.person.id, "data-type" => 'relationship', "data-action-id" => relationship.id, :class => (relationship.starred? ? "active" : "not-active") } - ✭ - %span.muted= relationship.relation.description.humanize - = link_to(relationship.other(@person), polymorphic_url(relationship.other(@person))) - - struct[:grouped].each do |group| - %li - %span.starable-spacer - ✭ - %span.muted - == #{Relation.find(group[:relation]).description.titleize.pluralize} (#{group[:count]}) #{link_to("View All", polymorphic_url([@person, :relationships], :relation_id => group[:relation]))} > + - @person.relationships.unstarred.where(:relation_id => struct[:single]).each do |relationship| + %li + %span.starred.starable{"data-person-id" => relationship.person.id, "data-type" => 'relationship', "data-action-id" => relationship.id, :class => (relationship.starred? ? "active" : "not-active") } + ✭ + %span.muted= relationship.relation.description.humanize + = link_to(relationship.other(@person), polymorphic_url(relationship.other(@person))) + - struct[:grouped].each do |group| + %li + %span.starable-spacer + ✭ + %span.muted + == #{Relation.find(group[:relation]).description.humanize} (#{group[:count]}) #{link_to("View All", polymorphic_url([@person, :relationships], :relation_id => group[:relation]))} > %h5 Preferences %section#communication-preference = form_for @person do |form| .do-not-call @@ -74,13 +77,36 @@ = form_for @person do |form| .mailchimp-list - mailchimp_kit = @person.organization.kits.mailchimp = hidden_field_tag "person[subscribed_lists][]", nil, :id => "person_subscribed_lists_empty" - mailchimp_kit.attached_lists.each do |list| - = label_tag "", :class => "checkbox" do - = check_box_tag "person[subscribed_lists][]", list[:list_id], @person.subscribed_lists.include?(list[:list_id]), :class => "mail-chimp-list", :disabled => @person.do_not_email - %span= list[:list_name] + .list + = label_tag "", :class => "checkbox" do + = check_box_tag "person[subscribed_lists][]", list[:list_id], @person.subscribed_to_list?(list[:list_id]), :class => "mail-chimp-list", :disabled => mailchimp_list_disabled_for?(@person, list[:list_id]) + %span= list[:list_name] + - if @person.opted_out_of_list?(list[:list_id]) + %span.opted-out (Opted Out) + - if @person.unconfirmed_on_list?(list[:list_id]) + %span.unconfirmed (U) + - if @person.bounced_on_list?(list[:list_id]) + %span.bounced (Bounced) + - if mailchimp_show_groupings?(@person, list) + = link_to "▸".html_safe, "#", :class => "show-all" + %ul.groupings + - list.fetch(:groups, []).each do |grouping| + %li.grouping + - active_groups = mailchimp_active_groups(list, grouping, @person) + - inactive_groups = mailchimp_inactive_groups(list, grouping, @person) + .name.hidden + = grouping["name"] + %ul.active + - active_groups.each do |group| + = render 'mailchimp_group', :list => list, :grouping => grouping, :group => group + %ul.inactive + - inactive_groups.each do |group| + = render 'mailchimp_group', :list => list, :grouping => grouping, :group => group + = form.submit "Save", :class => 'btn btn-primary hidden' .span8 #notes .row-fluid @@ -140,20 +166,45 @@ = render :partial => 'actions/action', :collection => @actions = will_paginate @actions, :id => 'endless-scroll-pagination' %div{"ng-controller" => "EditPersonCtrl"} - = render 'edit_modal', :header => "Edit #{@person.possessive} Info" + - if current_user.can? :manage, @person + - @excepts = [] + - else + - @excepts = [:convert, :relationships, :households, :merge, :delete] + = render 'edit_modal', :header => "Edit #{@person.possessive} Info", :except => @excepts = render 'convert_to_company_modal' #edit-order-popup.modal -with_kit(:mailchimp) do - - if current_user.current_organization.kits.mailchimp - .modal#subscribe-modal(role="dialog") - .modal-header - %button(type="button" class="close" data-dismiss="modal" aria-hidden="true") × - %h3 MailChimp List Subscription - .modal-body - %p #{@person} will receive an email from MailChimp confirming their addition to this list - .modal-footer - %button(class="btn" data-dismiss="modal" aria-hidden="true") Cancel - %button(class="btn btn-primary") OK + .modal#subscribe-modal(role="dialog") + .modal-header + %button(type="button" class="close" data-dismiss="modal" aria-hidden="true") × + %h3 MailChimp Subscription + .modal-body + %label + = radio_button_tag "single_optin", "true", false + %b #{@person.first_name} gave me permission to be added to this list. + %p + #{@person.first_name} will not receive a confirmation email from MailChimp. Since you're adding this subscriber manually, #{@person.first_name} won't have an opt-in IP address or date in your records, so be extra sure you have permission first. Learn more at #{link_to "MailChimp", "http://kb.mailchimp.com/accounts/compliance-tips/guidelines-for-list-compliance"}. + + %p OR + + %label + = radio_button_tag "single_optin", "false", true + %b I want to send #{@person.first_name} an invitation to join this list. + + %p + #{@person.first_name} will receive an email from MailChimp to confirm that he or she would like to subscribe to this list. #{@person.first_name} will not be subscribed to this list until the invitation is accepted. + + .modal-footer + %button(class="btn btn-primary") Save + %button(class="btn" data-dismiss="modal" aria-hidden="true") Cancel + +-content_for :custom_js do + :javascript + $('#create-relationship-link').click(function(e) { + e.preventDefault(); + $('#edit-person').modal('show') + $('.tab-relationships a:first').tab('show') + })