Codeminer42/cm42-central

View on GitHub
app/views/projects/_form.html.erb

Summary

Maintainability
Test Coverage
<%= form_for(project) do |f| %>
  <%= render 'form_errors', object: project if project.errors.any? %>

  <div class="form-group">
    <%= f.label :name, class: 'control-label' %>
    <%= f.text_field :name, class: 'form-control auth-form-control' %>
  </div>

  <div class="form-group">
    <%= f.label :point_scale %>
    <%= f.select :point_scale, point_scale_options, {}, { class: 'form-control auth-form-control' } %>
  </div>

  <div class="form-group">
    <%= f.label :default_velocity, class: 'control-label' %>
    <%= f.text_field :default_velocity, length: 2, size: 3, class: 'form-control auth-form-control' %>
  </div>

  <div class="form-group">
    <%= f.label :velocity_strategy %>
    <%= f.select :velocity_strategy,
                 velocity_strategy_options,
                 {},
                 { class:'form-control auth-form-control' }
    %>
  </div>

  <div class="form-group date-form-group">
    <%= f.label :start_date, class: 'control-label' %> <br>
    <%= f.date_select :start_date, {}, { class: 'form-control auth-form-control' } %>
  </div>

  <div class="form-group ">
    <%= f.label :iteration_start_day, class: 'control-label' %>
    <%= f.select :iteration_start_day, day_name_options, {}, { class: 'form-control auth-form-control' } %>
  </div>

  <div class="form-group">
    <%= f.label :iteration_length, class: 'control-label' %>
    <%= f.select :iteration_length, iteration_length_options, {}, { class: 'form-control auth-form-control' } %>
  </div>

  <div class="form-group">
    <%= f.label :tag_group, class: 'control-label' %>
    <div class="tag-group-select">
      <%= f.select :tag_group_id, tag_group_options, {include_blank: true}, { class: 'form-control auth-form-control' } %>
      <span class="input-group-btn add_button">
          <button id="submit_tag_group" type="button" class="btn btn-success btn-number" data-type="plus" data-toggle="modal" data-target="#tag-group-modal">
            <span class="glyphicon glyphicon-plus"></span>
          </button>
      </span>
    </div>
  </div>

  <div class="form-group">
    <%= f.label t('private'), class: 'control-label' %>
    <%= f.check_box :disallow_join %>
  </div>

  <div class="form-group">
    <%= f.label :mail_reports, class: 'control-label' %>
    <%= f.check_box :mail_reports %>
  </div>

  <div class="btn-group actions pull-right clearfix">
    <%= f.submit nil, class: 'btn btn-primary btn-form' %>

    <% if policy(project).archive? %>
      <%= link_to(
        t('projects.archive'),
        [:archive, project],
        data: { confirm: t('projects.index.are you sure you want to archive this project') },
        method: :patch,
        class: 'btn btn-warning btn-form'
      ) %>
    <% end %>

    <% if policy(project).unarchive? %>
      <%= link_to(
        t('projects.unarchive'),
        [:unarchive, project],
        data: { confirm: t('projects.index.are you sure you want to unarchive this project') },
        method: :patch,
        class: 'btn btn-warning btn-form'
      ) %>
    <% end %>

    <% if policy(project).destroy? %>
      <span id="delete-project-confirm" type="button" class='btn btn-danger btn-form' data-toggle="modal" data-target="#delete-confirmation-modal">
        <%= t('delete') %>
      </span>
    <% end %>
  </div>
<% end %>

<!-- Tag Group Modal -->
<div class="modal fade" id="tag-group-modal" role="dialog">
  <div class="modal-dialog">
    <div class="modal-content">
      <div class="modal-header">
        <button type="button" class="close" data-dismiss="modal">&times;</button>
        <h4 class="modal-title"><%= t('tag_group.new tag_group') %></h4>
      </div>
      <div class="modal-body">
        <%= render 'tag_groups/form', remote: true, tag_group: current_team.tag_groups.new %>
        <div class="clearfix">&nbsp;</div>
      </div>
    </div>
  </div>
</div>

<!-- Project Delete Modal -->
<div class="modal fade" id="delete-confirmation-modal" role="dialog">
  <%= render partial: 'delete_confirmation', locals: {project: project} %>
</div>