basyura's blog

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

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

f:id:basyura:20150118201328p:plain

  • app/views/versions/show.html.erb
<%= form_tag({}) do -%>
  <table class="list related-issues">
    <tr>
      <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 ><%= issue.category ? issue.category.name : "" %></td>
      <td class="checkbox"><%= check_box_tag 'ids[]', issue.id, false, :id => nil %></td>
      <td class="subject"><%= link_to_issue(issue, :project => (@project != issue.project)) %></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 %>

パーキングロットチャートとか plugin を入れるのもいいのだけど、入れるたびに使い方を説明するとか、使ってもらうとかってなるとそれなりに大変。それなら既存のビューをいじって見やすくするとかした方がいいのでは無いかと思案中。