- @person = current_member.person .row .span6.offset3 #member-details.side-section %h6=member_welcome %table.table.table-condensed %tr %td Member Number %td=current_member.member_number %tr %td Member Through %td=l current_member.member_through, :format => :date unless current_member.memberships.current.empty? %tr %td Membership %td=current_member.memberships.current.first.membership_type.name unless current_member.memberships.current.empty? %tr %td Memberships %td=current_member.memberships.current.count unless current_member.memberships.current.empty? %tr %td Membership Card %td=link_to "download", current_member.download_link_for(:pdf) .side-section %h6 Member Information =current_member.person %br =current_member.email %br %br #member-address =render :partial => 'addresses/address', :locals => { :address => current_member.person.address } .controls =link_to "Update", "#edit-address-modal", :class => "btn", 'data-toggle' => 'modal' .side-section %h6 Contact Us =current_member.organization.email %br -# =current_member.organization.phone #edit-address-modal.modal.hide =render :partial => 'people/edit_modal', :locals => { :url => members_person_path(current_member.person), :header => "Edit Your Information", :except => [:convert, :relationships, :households, :social, :merge, :delete], :return_to => members_root_path} %script{:src => 'http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js'.html_safe} :javascript $(document).ready(function() { var $primary_checks_group = $("input[id^='#{@person.type.downcase}_addresses_attributes_'][id$='_is_primary']") checkPrimary($primary_checks_group); $("select[id^='#{@person.type.downcase}_addresses_attributes_'][id$='_country']").each(function() { setLocationSelector($(this).attr("id")); }); $('.tab-relationships a').click(function (e) { e.preventDefault(); $(this).tab('show'); }) $('.tab-households a').click(function (e) { e.preventDefault(); $(this).tab('show'); }) $('.tab a').click(function (e) { e.preventDefault(); $(this).tab('show'); $('#edit-person .save-person').show(); }) }); function setLocationSelector(countryId) { $(document).locationSelector({ 'countryField' : "#" + countryId, 'regionField' : "#" + countryId.replace("country", "state") }); } function onAddAddress() { setLocationSelector($("select[id^='#{@person.type.downcase}_addresses_attributes_'][id$='_country']").last().attr('id')); var $primary_checks_group = $("input[id^='#{@person.type.downcase}_addresses_attributes_'][id$='_is_primary']:visible") checkPrimary($primary_checks_group); if ($primary_checks_group.length > 1) { $primary_checks_group.each(function() { $(this).removeAttr('disabled'); }); $primary_checks_group.last().prop('checked', false); } } function onRemoveAddress() { var $primary_checks_group = $("input[id^='#{@person.type.downcase}_addresses_attributes_'][id$='_is_primary']:visible") checkPrimary($primary_checks_group); var checked_count = $("input[id^='#{@person.type.downcase}_addresses_attributes_'][id$='_is_primary']:visible:checked").length if (checked_count == 0) { $primary_checks_group.first().prop('checked', true); } } function checkPrimary($primary_checks_group) { //if single address, mark it primary and checkbox is not editable if($primary_checks_group.length == 1) { var $primary_check = $primary_checks_group.first() $primary_check.prop('checked', true); $primary_check.attr('disabled', true); $primary_check.parent().find('input:hidden:first').val(1); } // is_primary checkboxes behave like radio buttons $("input:checkbox").click(function(){ $primary_checks_group.each(function() { $(this).prop("checked",false); $(this).parent().find('input:hidden:first').val(0); }); $(this).prop("checked",true); }); } function bindMemberTickets() {}