Project

General

Profile

Feature #44552 » 0002-Show-the-history-tab-when-the-journal-linked-from-an.patch

Go MAEDA, 2026-10-03 11:16

View differences:

app/javascript/controllers/issue_journal_link_controller.js
1
import { Controller } from "@hotwired/stimulus";
2

  
3
export default class extends Controller {
4
  // Shows the history tab if the target note is hidden by the selected tab,
5
  // so that the browser can jump to the note
6
  show() {
7
    const note = document.getElementById(this.element.hash.slice(1));
8
    if (!note || note.getClientRects().length > 0) return;
9

  
10
    const historyTab = document.getElementById("tab-history");
11
    if (!historyTab) return;
12

  
13
    showIssueHistory("history", historyTab.href);
14
  }
15
}
app/views/attachments/_links.html.erb
27 27
          <% anchor = "#note-#{journal.indice}" %>
28 28
          <%= link_to sprite_icon('chevrons-down', anchor), anchor,
29 29
                      :title => anchor,
30
                      :class => 'icon-only icon-chevrons-down' %>
30
                      :class => 'icon-only icon-chevrons-down',
31
                      :data => {:controller => 'issue-journal-link', :action => 'issue-journal-link#show'} %>
31 32
        <% end %>
32 33
      </span>
33 34
    <% end %>
test/system/issues_test.rb
718 718
    assert page.has_no_css?('#add_notes')
719 719
  end
720
  def test_attachment_note_link_should_show_history_tab_if_note_is_hidden
721
    # Journal 3 added attachment 4 to issue 2. Without notes, it is hidden in the notes tab
722
    Journal.find(3).update_column(:notes, '')
723
    Journal.create!(:journalized => Issue.find(2), :user_id => 2, :notes => 'A note')
724

  
725
    log_user('jsmith', 'jsmith')
726
    visit '/issues/2?tab=notes'
727

  
728
    assert_selector '#tab-notes.selected'
729
    assert_no_selector '#note-1'
730

  
731
    find('div.attachments span.attachment-journal a').click
732

  
733
    assert_selector '#tab-history.selected'
734
    assert_selector '#note-1'
735
  end
736

  
720 737
  def test_preview_custom_field_on_bulk_edit_across_projects
721 738
    field = IssueCustomField.create!(
722 739
      :field_format => 'text',
(3-3/3)