Project

General

Profile

Patch #32951 » issue_statuses_sortable.diff

issues sortable patch file - Anas Al Salah, 2020-02-04 21:12

View differences:

app/controllers/issue_statuses_controller.rb
23 23
  before_action :require_admin_or_api_request, :only => :index
24 24
  accept_api_auth :index
25 25

  
26
  helper :sort
27
  include SortHelper
28

  
26 29
  def index
27
    @issue_statuses = IssueStatus.sorted.to_a
30
    sort_init 'name', 'asc'
31
    sort_update %w(name position)
32

  
33
    @issue_statuses = IssueStatus.order(sort_clause).to_a
28 34
    respond_to do |format|
29 35
      format.html { render :layout => false if request.xhr? }
30 36
      format.api
app/views/issue_statuses/index.html.erb
12 12
  <th><%=l(:field_done_ratio)%></th>
13 13
  <% end %>
14 14
  <th><%=l(:field_is_closed)%></th>
15
  <th><%=l(:field_position)%></th>
15 16
  <th></th>
16 17
  </tr></thead>
17 18
  <tbody>
......
22 23
  <td><%= status.default_done_ratio %></td>
23 24
  <% end %>
24 25
  <td><%= checked_image status.is_closed? %></td>
26
  <td><%= status.position %></td>
25 27
  <td class="buttons">
26 28
    <%= reorder_handle(status) %>
27 29
    <%= delete_link issue_status_path(status) %>
app/views/issue_statuses/index.html.erb
7 7

  
8 8
<table class="list issue_statuses">
9 9
  <thead><tr>
10
  <th><%=l(:field_status)%></th>
10
  <%= sort_header_tag('name', :caption => l(:field_name)) %>
11 11
  <% if Issue.use_status_for_done_ratio? %>
12 12
  <th><%=l(:field_done_ratio)%></th>
13 13
  <% end %>
14 14
  <th><%=l(:field_is_closed)%></th>
15
  <th><%=l(:field_position)%></th>
15
  <%= sort_header_tag('position', :caption => l(:field_position)) %>
16 16
  <th></th>
17 17
  </tr></thead>
18 18
  <tbody>
(1-1/2)