mirror of
https://github.com/opf/openproject.git
synced 2026-06-14 03:30:14 +00:00
remove hover card fallback for the case when phase is absent or not active
This commit is contained in:
@@ -28,39 +28,31 @@ See COPYRIGHT and LICENSE files for more details.
|
||||
++#%>
|
||||
|
||||
<%=
|
||||
if @phase&.active?
|
||||
flex_layout(classes: "op-phase-gate-hover-card", data: { test_selector: "phase-gate-hover-card-#{phase.id}" }) do |flex|
|
||||
flex.with_row do
|
||||
flex_layout(classes: "op-phase-gate-hover-card--info", justify_content: :space_between) do |f|
|
||||
f.with_column(classes: "op-phase-gate-hover-card--name flex-self-start") do
|
||||
flex_layout do |fl|
|
||||
fl.with_column(classes: icon_color_class, mr: 1) do
|
||||
render Primer::Beta::Octicon.new(icon: gate_icon)
|
||||
end
|
||||
fl.with_column do
|
||||
render(Primer::Beta::Text.new(data: { test_selector: "phase-gate-hover-card-name" })) { phase_gate_name }
|
||||
end
|
||||
flex_layout(classes: "op-phase-gate-hover-card", data: { test_selector: "phase-gate-hover-card-#{phase.id}" }) do |flex|
|
||||
flex.with_row do
|
||||
flex_layout(classes: "op-phase-gate-hover-card--info", justify_content: :space_between) do |f|
|
||||
f.with_column(classes: "op-phase-gate-hover-card--name flex-self-start") do
|
||||
flex_layout do |fl|
|
||||
fl.with_column(classes: icon_color_class, mr: 1) do
|
||||
render Primer::Beta::Octicon.new(icon: gate_icon)
|
||||
end
|
||||
fl.with_column do
|
||||
render(Primer::Beta::Text.new(data: { test_selector: "phase-gate-hover-card-name" })) { phase_gate_name }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
f.with_column(classes: "op-phase-gate-hover-card--date flex-self-end") do
|
||||
flex_layout do |fl|
|
||||
fl.with_column(mr: 1) do
|
||||
render Primer::Beta::Octicon.new(icon: :calendar, color: :muted)
|
||||
end
|
||||
fl.with_column do
|
||||
render(Primer::Beta::Text.new(data: { test_selector: "phase-gate-hover-card-date" })) { phase_gate_date }
|
||||
end
|
||||
f.with_column(classes: "op-phase-gate-hover-card--date flex-self-end") do
|
||||
flex_layout do |fl|
|
||||
fl.with_column(mr: 1) do
|
||||
render Primer::Beta::Octicon.new(icon: :calendar, color: :muted)
|
||||
end
|
||||
fl.with_column do
|
||||
render(Primer::Beta::Text.new(data: { test_selector: "phase-gate-hover-card-date" })) { phase_gate_date }
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
else
|
||||
render Primer::Beta::Blankslate.new(border: false, narrow: true) do |component|
|
||||
component.with_visual_icon(icon: "x-circle")
|
||||
# Show a generic error message to avoid leaking information
|
||||
component.with_heading(tag: :h3).with_content(I18n.t("http.response.unexpected"))
|
||||
end
|
||||
end
|
||||
%>
|
||||
|
||||
@@ -76,20 +76,4 @@ RSpec.describe Projects::Phases::HoverCardComponent, type: :component do
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
context "when inactive" do
|
||||
let(:phase) { build_stubbed(:project_phase, active: false) }
|
||||
|
||||
it "renders a generic error message" do
|
||||
expect(page).to have_text(I18n.t("http.response.unexpected"))
|
||||
end
|
||||
end
|
||||
|
||||
context "when phase cannot be found in database" do
|
||||
let(:phase) { nil }
|
||||
|
||||
it "renders a generic error message" do
|
||||
expect(page).to have_text(I18n.t("http.response.unexpected"))
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user