Commit 051aedb1 authored by Illya Klymov's avatar Illya Klymov

Merge branch 'tomquirk-jira-issues-show-breadcrumb' into 'master'

Add custom breadcrumb for Jira issues show

See merge request gitlab-org/gitlab!52874
parents ce643b54 6d0d3bfe
...@@ -128,6 +128,13 @@ module ServicesHelper ...@@ -128,6 +128,13 @@ module ServicesHelper
!Gitlab.com? !Gitlab.com?
end end
def jira_issue_breadcrumb_link(issue_reference)
link_to '', { class: 'gl-display-flex gl-align-items-center gl-white-space-nowrap' } do
icon = image_tag image_path('illustrations/logos/jira.svg'), width: 15, height: 15, class: 'gl-mr-2'
[icon, issue_reference].join.html_safe
end
end
extend self extend self
private private
......
...@@ -38,7 +38,9 @@ module Projects ...@@ -38,7 +38,9 @@ module Projects
def show def show
respond_to do |format| respond_to do |format|
format.html format.html do
@issue_json = issue_json
end
format.json do format.json do
render json: issue_json render json: issue_json
end end
......
- add_to_breadcrumbs _('Jira Issues'), project_integrations_jira_issues_path(@project) - add_to_breadcrumbs _('Jira Issues'), project_integrations_jira_issues_path(@project)
- page_title 'Jira issue' - breadcrumb_title jira_issue_breadcrumb_link(@issue_json[:references][:relative])
- page_title @issue_json[:title]
.js-jira-issues-show-app{ data: jira_issues_show_data } .js-jira-issues-show-app{ data: jira_issues_show_data }
...@@ -195,29 +195,33 @@ RSpec.describe Projects::Integrations::Jira::IssuesController do ...@@ -195,29 +195,33 @@ RSpec.describe Projects::Integrations::Jira::IssuesController do
end end
context 'when `jira_issues_show_integration` feature is enabled' do context 'when `jira_issues_show_integration` feature is enabled' do
let(:jira_issue) { {} } let(:jira_issue) { { 'from' => 'jira' } }
let(:issue_json) { { 'from' => 'backend' } }
before do before do
stub_feature_flags(jira_issues_show_integration: true) stub_feature_flags(jira_issues_show_integration: true)
expect_next_found_instance_of(JiraService) do |service|
expect(service).to receive(:find_issue).with('1', rendered_fields: true).and_return(jira_issue)
end
expect_next_instance_of(Integrations::Jira::IssueDetailSerializer) do |serializer|
expect(serializer).to receive(:represent).with(jira_issue, project: project).and_return(issue_json)
end
end end
it 'renders `show` template' do it 'renders `show` template' do
get :show, params: { namespace_id: project.namespace, project_id: project, id: 1 } get :show, params: { namespace_id: project.namespace, project_id: project, id: 1 }
expect(assigns(:issue_json)).to eq(issue_json)
expect(response).to have_gitlab_http_status(:ok) expect(response).to have_gitlab_http_status(:ok)
expect(response).to render_template(:show) expect(response).to render_template(:show)
end end
it 'returns JSON response' do it 'returns JSON response' do
expect_next_found_instance_of(JiraService) do |service|
expect(service).to receive(:find_issue).with('1', rendered_fields: true).and_return(jira_issue)
end
expect_next_instance_of(Integrations::Jira::IssueDetailSerializer) do |serializer|
expect(serializer).to receive(:represent).with(jira_issue, project: project)
end
get :show, params: { namespace_id: project.namespace, project_id: project, id: 1, format: :json } get :show, params: { namespace_id: project.namespace, project_id: project, id: 1, format: :json }
expect(json_response).to eq(issue_json)
end end
end end
end end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment