volontariat/voluntary_scholarship

View on GitHub
app/views/scholarship/team_memberships/_form.html.erb

Summary

Maintainability
Test Coverage
<%= simple_form_for(@team_membership, html: { class: 'form-horizontal'}, wrapper: :horizontal_form ) do |f| %>
  <%= f.input :team_id, as: :hidden %>
  <%= render partial: 'shared/form/error_messages', locals: { resource: @team_membership } %>
  
    <% if can_update_scholarship_team_membership_roles?(@team_membership) %>
      <%= f.input :roles, as: :check_boxes, collection: Scholarship::TeamMembership::ROLES.map { |r| [r.capitalize, r] }, include_hidden: false, label: t('attributes.roles') %>
  <% else %>
    <%= render partial: 'shared/layouts/twitter_bootstrap/control_group', locals: { 
      required: true, label: t('attributes.roles'),
      field: @team_membership.roles.map(&:to_s).map(&:humanize).join(', ')
    } %>
  <% end %>
  <%= f.input :text, label: t('attributes.text'), input_html: {style: 'width: 500px; height:300px;'} %>

  <div class="form-group">
    <div class="col-sm-offset-3 col-sm-9">
      <%= f.button :submit %>
    </div>
  </div>
<% end %>