Skip to content

Commit 3d9d109

Browse files
committed
Render sprint goal in header
Displays the per-project goal as muted secondary text below the status badge and date range in the sprint header on the Backlog page.
1 parent 3214ba6 commit 3d9d109

3 files changed

Lines changed: 28 additions & 0 deletions

File tree

modules/backlogs/app/components/backlogs/sprint_component.html.erb

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,12 @@ See COPYRIGHT and LICENSE files for more details.
5656
<%= format_date_range([sprint.start_date, sprint.finish_date]) %>
5757
<% end %>
5858
<% end %>
59+
60+
<% if goal_text.present? %>
61+
<%= render(Primer::Beta::Text.new(color: :muted, display: :block, mt: 1)) do %>
62+
<%= goal_text %>
63+
<% end %>
64+
<% end %>
5965
<% end %>
6066

6167
<% if show_start_sprint_action? %>

modules/backlogs/app/components/backlogs/sprint_component.rb

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,10 @@ def finish_sprint_button_arguments
9191
}
9292
end
9393

94+
def goal_text
95+
sprint.goal_for(project)&.goal
96+
end
97+
9498
def story_points_total
9599
work_packages.filter_map(&:story_points).sum
96100
end

modules/backlogs/spec/components/backlogs/sprint_component_spec.rb

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -204,6 +204,24 @@ def menu_items
204204
end
205205
end
206206

207+
describe "sprint goal in header" do
208+
context "when the sprint has a goal for the project" do
209+
before do
210+
create(:sprint_goal, sprint:, project:, goal: "Ship the reporting dashboard")
211+
end
212+
213+
it "renders the goal text" do
214+
expect(rendered_component).to have_text("Ship the reporting dashboard")
215+
end
216+
end
217+
218+
context "when the sprint has no goal for the project" do
219+
it "does not render goal text" do
220+
expect(rendered_component).to have_no_css(".color-fg-muted[display='block']")
221+
end
222+
end
223+
end
224+
207225
describe "sprint actions in header" do
208226
context "when the sprint is in planning with date range set" do
209227
let(:sprint) do

0 commit comments

Comments
 (0)