oneclickorgs/one-click-orgs

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

Summary

Maintainability
Test Coverage
%h2 Directors

.section
  %input{:type => 'button', :value => 'Add a new director', :class => 'button-form-show', 'data-form-id' => 'new_director_form'}
  
  %br.clear
  
  %div#new_director_form.form-to-hide
    = form_for(@director) do |director_form|
      = render :partial => 'directors/form', :locals => {:form => director_form}

%table.members
  %tr
    %th Name
    %th Last login
    %th
  - for member in @members
    = content_tag_for(:tr, member) do
      %td
        = image_tag("#{member.gravatar_url(24)}", :class => 'gravatar', :alt => "#{member.name}", :width => '24', :height => '24')
        = member.name
      %td
        - if member.last_logged_in_at
          = member.last_logged_in_at.to_s(:short)
      %td
        %input{:type => 'button', :value => 'Stand down', :class => 'button-form-show', 'data-form-id' => "stand_down_director_#{member.id}_form"}
    %tr.form-to-hide{:id => "stand_down_director_#{member.id}_form"}
      %td{:colspan => 3}
        = form_for(member, :url => stand_down_director_path(:id => member.id), :html => {:method => :post}) do |f|
          %p.date
            = f.label(:stood_down_on, "Date appointment ended")
            = f.date_select(:stood_down_on)
          %p.checkbox
            = f.check_box :certification
            = f.label :certification, "I certify this individual duly ceased to be a Director on this date"
          %p
            = f.submit "Stand this director down"