Skip to content

Commit cfd97b6

Browse files
committed
Only show verify/reject buttons for new schools
To prevent verified schools from being rejected and vice versa.
1 parent 9fd2b2b commit cfd97b6

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

app/views/admin/schools/show.html.erb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ as well as a link to its edit page.
3737
method: :post,
3838
style: "background-color: green; margin: 5px;",
3939
data: { confirm: t("administrate.actions.confirm_verify_school") }
40-
) unless page.resource.verified? %>
40+
) unless page.resource.verified? || page.resource.rejected? %>
4141

4242
<%= link_to(
4343
t("administrate.actions.reject_school"),
@@ -46,7 +46,7 @@ as well as a link to its edit page.
4646
method: :patch,
4747
style: "background-color: hsla(0, 88%, 33%, 1); margin: 5px 5px 5px 0;",
4848
data: { confirm: t("administrate.actions.confirm_reject_school") }
49-
) unless page.resource.rejected? %>
49+
) unless page.resource.verified? || page.resource.rejected? %>
5050
</div>
5151
</header>
5252

spec/features/admin/schools_spec.rb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,16 +46,16 @@
4646
expect(response.body).not_to include(I18n.t('administrate.actions.verify_school'))
4747
end
4848

49-
it 'includes link to reject school' do
50-
expect(response.body).to include(I18n.t('administrate.actions.reject_school'))
49+
it 'does not include a link to reject school' do
50+
expect(response.body).not_to include(I18n.t('administrate.actions.reject_school'))
5151
end
5252
end
5353

5454
describe 'when the school is rejected' do
5555
let(:rejected_at) { Time.zone.now }
5656

57-
it 'includes a link to verify school' do
58-
expect(response.body).to include(I18n.t('administrate.actions.verify_school'))
57+
it 'does not include a link to verify school' do
58+
expect(response.body).not_to include(I18n.t('administrate.actions.verify_school'))
5959
end
6060

6161
it 'does not include a link to reject school' do

0 commit comments

Comments
 (0)