Project

General

Profile

Feature #33572 » 0001-Update-tooltip-title-of-next-prev-issue-link.patch

Seiei Miyagi, 2020-07-23 09:34

View differences:

app/controllers/issues_controller.rb
108 108
        @time_entry = TimeEntry.new(:issue => @issue, :project => @issue.project)
109 109
        @time_entries = @issue.time_entries.visible.preload(:activity, :user)
110 110
        @relation = IssueRelation.new
111
        retrieve_previous_and_next_issue_ids
111
        retrieve_previous_and_next_issue
112 112
        render :template => 'issues/show'
113 113
      end
114 114
      format.api do
......
468 468

  
469 469
  private
470 470

  
471
  def retrieve_previous_and_next_issue_ids
471
  def retrieve_previous_and_next_issue
472 472
    if params[:prev_issue_id].present? || params[:next_issue_id].present?
473
      @prev_issue_id = params[:prev_issue_id].presence.try(:to_i)
474
      @next_issue_id = params[:next_issue_id].presence.try(:to_i)
473
      @prev_issue = Issue.find_by(id: params[:prev_issue_id].presence.try(:to_i))
474
      @next_issue = Issue.find_by(id: params[:next_issue_id].presence.try(:to_i))
475 475
      @issue_position = params[:issue_position].presence.try(:to_i)
476 476
      @issue_count = params[:issue_count].presence.try(:to_i)
477 477
    else
......
485 485
            @issue_position = idx + 1
486 486
            @issue_count = issue_ids.size
487 487
          end
488
          @prev_issue_id = issue_ids[idx - 1] if idx > 0
489
          @next_issue_id = issue_ids[idx + 1] if idx < (issue_ids.size - 1)
488
          @prev_issue = Issue.find_by(id: issue_ids[idx - 1]) if idx > 0
489
          @next_issue = Issue.find_by(id: issue_ids[idx + 1]) if idx < (issue_ids.size - 1)
490 490
        end
491 491
        query_params = @query.as_params
492 492
        if @issue_position
app/views/issues/_edit.html.erb
77 77
          l(:button_cancel), issue_path(id: @issue.id),
78 78
          :onclick => params[:action] == 'show' ? "$('#update').hide(); return false;" : ''
79 79
        ) %>
80
    <%= hidden_field_tag 'prev_issue_id', @prev_issue_id if @prev_issue_id %>
81
    <%= hidden_field_tag 'next_issue_id', @next_issue_id if @next_issue_id %>
80
    <%= hidden_field_tag 'prev_issue_id', @prev_issue.id if @prev_issue %>
81
    <%= hidden_field_tag 'next_issue_id', @next_issue.id if @next_issue %>
82 82
    <%= hidden_field_tag 'issue_position', @issue_position if @issue_position %>
83 83
    <%= hidden_field_tag 'issue_count', @issue_count if @issue_count %>
84 84
<% end %>
app/views/issues/show.html.erb
4 4
<%= issue_status_type_badge(@issue.status) %>
5 5

  
6 6
<div class="<%= @issue.css_classes %> details">
7
  <% if @prev_issue_id || @next_issue_id %>
7
  <% if @prev_issue || @next_issue %>
8 8
    <div class="next-prev-links contextual">
9
      <%= link_to_if @prev_issue_id,
9
      <%= link_to_if @prev_issue,
10 10
                     "\xc2\xab #{l(:label_previous)}",
11
                     (@prev_issue_id ? issue_path(@prev_issue_id) : nil),
12
                     :title => "##{@prev_issue_id}",
11
                     (@prev_issue&.id ? issue_path(@prev_issue.id) : nil),
12
                     :title => @prev_issue.to_s,
13 13
                     :accesskey => accesskey(:previous) %> |
14 14
      <% if @issue_position && @issue_count %>
15 15
        <span class="position">
......
18 18
                         @query_path %>
19 19
        </span> |
20 20
      <% end %>
21
      <%= link_to_if @next_issue_id,
21
      <%= link_to_if @next_issue,
22 22
                     "#{l(:label_next)} \xc2\xbb",
23
                     (@next_issue_id ? issue_path(@next_issue_id) : nil),
24
                     :title => "##{@next_issue_id}",
23
                     (@next_issue&.id ? issue_path(@next_issue.id) : nil),
24
                     :title => @next_issue.to_s,
25 25
                     :accesskey => accesskey(:next) %>
26 26
    </div>
27 27
  <% end %>
(4-4/4)