testmycode/tmc-server

View on GitHub
app/views/feedback_questions/index.html.erb

Summary

Maintainability
Test Coverage
<h1>Feedback questions for <%= @course.title %></h1>

<% if !@questions.empty? %>
  <table class="table table-striped">
    <tr>
      <th>Question</th>
      <th>Order</th>
      <th></th>
    </tr>
    <% for question in @questions %>
      <tr>
        <td>
          <%= link_to question.question, question %>
        </td>
        <td>
          <%= link_to 'Up', feedback_question_position_path(question, direction: 'backward'), method: 'put' %>
          |
          <%= link_to 'Down', feedback_question_position_path(question, direction: 'forward'), method: 'put' %>
        </td>
        <td>
          <%= link_to 'Delete', feedback_question_path(question), method: :delete, class: 'btn btn-sm btn-danger', data: { confirm: 'Really delete question and all its answers?' } %>
        </td>
      </tr>
    <% end %>
  </table>
<% else %>
  <p>No feedback questions set. Feedback will not be collected.</p>
<% end %>

<div class="actions">
  <%= link_to 'Add question', new_organization_course_feedback_question_path %>
</div>