Skip to content

OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub

remove hover card fallback for the case when phase is absent or not active

Ivan Kuchin831f750cd34b
diff --git a/app/components/projects/phases/hover_card_component.html.erb b/app/components/projects/phases/hover_card_component.html.erb
index 085db25eec6..b5cc2c84a3d 100644
--- a/app/components/projects/phases/hover_card_component.html.erb
+++ b/app/components/projects/phases/hover_card_component.html.erb
@@ -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
%>
diff --git a/spec/components/projects/phases/hover_card_component_spec.rb b/spec/components/projects/phases/hover_card_component_spec.rb
index 6f46fb674bd..117d67da0f7 100644
--- a/spec/components/projects/phases/hover_card_component_spec.rb
+++ b/spec/components/projects/phases/hover_card_component_spec.rb
@@ -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