Skip to content

Commit cf10667

Browse files
authored
Merge pull request #579 from alphagov/add-stopped-to-admin-state-dropdown
Add 'Stopped' to the admin filter menu
2 parents fcbcc8a + aaffb38 commit cf10667

3 files changed

Lines changed: 19 additions & 10 deletions

File tree

app/models/petition.rb

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,10 @@ def sponsored_state
146146
where(state: SPONSORED_STATE)
147147
end
148148

149+
def stopped_state
150+
where(state: STOPPED_STATE)
151+
end
152+
149153
def awaiting_debate
150154
where(debate_state: %w[awaiting scheduled])
151155
end

config/locales/petitions.en-GB.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ en-GB:
6565
- :closed
6666
- :rejected
6767
- :hidden
68+
- :stopped
6869
- :awaiting_response
6970
- :with_response
7071
- :awaiting_debate_date
@@ -79,6 +80,7 @@ en-GB:
7980
closed: "Closed (%{quantity})"
8081
rejected: "Rejected (%{quantity})"
8182
hidden: "Hidden (%{quantity})"
83+
stopped: "Stopped (%{quantity})"
8284
awaiting_response: "Awaiting a government response (%{quantity})"
8385
with_response: "With a government response (%{quantity})"
8486
awaiting_debate_date: "Awaiting a debate in parliament (%{quantity})"

spec/helpers/admin_helper_spec.rb

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,17 +6,16 @@
66

77
let(:facets) do
88
{
9-
all: 1, collecting_sponsors: 2, in_moderation: 3, open: 4,
10-
closed: 5, rejected: 6, hidden: 7, awaiting_response: 8,
11-
with_response: 9, awaiting_debate_date: 10,
12-
with_debate_outcome: 11, in_debate_queue: 12
9+
all: 1, collecting_sponsors: 2, in_moderation: 3, open: 4, closed: 5,
10+
rejected: 6, hidden: 7, stopped: 8, awaiting_response: 9, with_response: 10,
11+
awaiting_debate_date: 11, with_debate_outcome: 12, in_debate_queue: 13
1312
}
1413
end
1514

1615
subject { helper.admin_petition_facets_for_select(facets, selected) }
1716

1817
it "generates the correct number of options" do
19-
expect(subject).to have_css("option", count: 12)
18+
expect(subject).to have_css("option", count: 13)
2019
end
2120

2221
it "generates the correct option for 'all'" do
@@ -47,24 +46,28 @@
4746
expect(subject).to have_css("option:nth-of-type(7)[value='hidden']", text: "Hidden (7)")
4847
end
4948

49+
it "generates the correct option for 'hidden'" do
50+
expect(subject).to have_css("option:nth-of-type(8)[value='stopped']", text: "Stopped (8)")
51+
end
52+
5053
it "generates the correct option for 'awaiting_response'" do
51-
expect(subject).to have_css("option:nth-of-type(8)[value='awaiting_response']", text: "Awaiting a government response (8)")
54+
expect(subject).to have_css("option:nth-of-type(9)[value='awaiting_response']", text: "Awaiting a government response (9)")
5255
end
5356

5457
it "generates the correct option for 'with_response'" do
55-
expect(subject).to have_css("option:nth-of-type(9)[value='with_response']", text: "With a government response (9)")
58+
expect(subject).to have_css("option:nth-of-type(10)[value='with_response']", text: "With a government response (10)")
5659
end
5760

5861
it "generates the correct option for 'awaiting_debate_date'" do
59-
expect(subject).to have_css("option:nth-of-type(10)[value='awaiting_debate_date']", text: "Awaiting a debate in parliament (10)")
62+
expect(subject).to have_css("option:nth-of-type(11)[value='awaiting_debate_date']", text: "Awaiting a debate in parliament (11)")
6063
end
6164

6265
it "generates the correct option for 'with_debate_outcome'" do
63-
expect(subject).to have_css("option:nth-of-type(11)[value='with_debate_outcome']", text: "Has been debated in parliament (11)")
66+
expect(subject).to have_css("option:nth-of-type(12)[value='with_debate_outcome']", text: "Has been debated in parliament (12)")
6467
end
6568

6669
it "generates the correct option for 'in_debate_queue'" do
67-
expect(subject).to have_css("option:nth-of-type(12)[value='in_debate_queue']", text: "In debate queue (12)")
70+
expect(subject).to have_css("option:nth-of-type(13)[value='in_debate_queue']", text: "In debate queue (13)")
6871
end
6972

7073
it "marks the correct option as selected" do

0 commit comments

Comments
 (0)