basyura's blog

あしたになったらほんきだす。

Redmine - バージョンを見やすくする その2

f:id:basyura:20150121215545p:plain

こんなところか。

  • app/views/versions/show.html.erb
<%= form_tag({}) do -%>
  <table class="list related-issues">
    <tr>
      <th>#</th><th><%= l(:field_project) %></th><th><%= l(:field_category) %></th><th><%= l(:field_subject) %></th><th><%= l(:field_status) %></th><th><%= l(:field_assigned_to) %></th>
    </tr>
  <caption><%= l(:label_related_issues) %></caption>
  <%- @issues.sort do |a, b|
      if a.closed? == b.closed?
        a.priority == b.priority ? b.id <=> a.id : b.priority <=> a.priority
      else
        b.closed? ? -1 : 1
      end
    end.each_with_index do |issue, index| -%>
    <tr class="issue hascontextmenu <%= index % 2 == 0 ? 'even' : 'odd' %> <%= issue.closed? ? '' : issue.css_classes %>"
        style="<%= issue.closed? ? 'background-color:#e0e0e0' : '' %>">
      <td class="checkbox"><%= check_box_tag 'ids[]', issue.id, false, :id => nil %></td>
      <td ><%= link_to(issue.id, issue_path(issue)) %></td>
      <td class="subject"><%= issue.project %></td>
      <td class="subject"><%= issue.category ? issue.category.name : "" %></td>
      <td class="subject"><%= link_to(issue.subject, issue_path(issue)) %></td>
      <td ><%= issue.status %></td>
      <td style="<%= issue.assigned_to == User.current ? 'border-right: 4px solid orange' : ''  %>"><%= issue.assigned_to ? issue.assigned_to.lastname : '' %></td>
    </tr>
  <% end %>
  </table>
<% end %>