oneclickorgs/one-click-orgs

View on GitHub
app/views/members/association/index.html.haml

Summary

Maintainability
Test Coverage
- if current_organisation.pending? or current_organisation.proposed?  
  %h2 Members
    
  %p
    - if current_user == co.members.first
      = 'You'
    - else
      = co.members.first.name
    can invite new founding members and re-issue invitations on this page.
  
  %p
    Adding additional founding members on this page lets them view the draft constitution. Once everyone’s happy the group can hold the founding vote and form the Association. Bear in mind the law says an Association cannot be formed with fewer than three people.
  
  - unless @pending_members.empty?
    %table.pending_members
      %tr
        %th Name
        %th Email
        %th Last logged in
        - if current_organisation.proposed?
          %th Founding vote
      - for member in @pending_members
        %tr
          %td
            = member.name
          %td
            = member.email
          %td
            - if member.last_logged_in_at
              = member.last_logged_in_at.to_s(:long_date)
          - if current_organisation.proposed?
            %td
              - if !member.founding_vote.nil?
                = member.founding_vote.for_or_against
              - else
                Not yet voted
  - if @founding_member
    %h3 Invite another Founding Member
    = form_for(@founding_member) do |form|
      = render :partial => 'founding_members/form', :locals => {:form => form}

- else
  %h2 Members
  
  %p#download
    Download:
    %span.pdf.download
      = link_to 'PDF', members_path(:format => 'pdf')
    %span.csv.download
      = link_to 'CSV', members_path(:format => 'csv')
  %table.members
    %tr
      %th Name
      %th Proposals made (succeeded/failed)
      %th Votes cast
      %th Last login
      %th Role
    - for member in @members
      %tr
        %td
          = image_tag("#{member.gravatar_url(24)}", :class => 'gravatar', :alt => "#{member.name}", :width => '24', :height => '24')
          = link_to "#{member.name}", member_path(member)
        %td
          = member.proposals_count
          (
          = member.succeeded_proposals_count
          \/
          = member.failed_proposals_count
          )
        %td= member.votes_count
        %td
          - if member.last_logged_in_at
            = member.last_logged_in_at.to_s(:long_date)
        %td= member.role
  - unless @pending_members.empty?
    %h2
      Invitee Members
    %p.explanation
      People who have been voted in as members but haven’t signed into One Click Orgs to confirm their membership.
    %table.pending_members
      %tr
        %th Name
      - for member in @pending_members
        %tr
          %td
            = link_to "#{member.name}", member_path(member)