Browse Source

display when log is completed

pull/469/head
Kat 3 years ago
parent
commit
726c3363c7
  1. 4
      app/views/case_logs/_tasklist.html.erb
  2. 5
      app/views/case_logs/edit.html.erb
  3. 6
      app/views/form/review.html.erb
  4. 16
      spec/features/form/tasklist_page_spec.rb
  5. 1
      spec/requests/form_controller_spec.rb

4
app/views/case_logs/_tasklist.html.erb

@ -24,7 +24,3 @@
</li>
<% end %>
</ol>
<h2 class="govuk-heading-m">Review and submit</h2>
<p>Review your answers and submit this log to the Department of Levelling Up, Housing & Communities.</p>
<%= govuk_button_link_to 'Review lettings log', "/logs/#{@case_log.id}/review" %>

5
app/views/case_logs/edit.html.erb

@ -24,6 +24,11 @@
</p>
<% elsif @case_log.status == "not_started" %>
<p class="govuk-body">This log has not been started.</p>
<% elsif @case_log.status == "completed" %>
<strong class="govuk-tag">Completed</strong>
<p class="govuk-body">
You can <a class="govuk-link" href="<%="/logs/#{@case_log.id}/review" %>">review and make changes to this log</a> up to 3 months after the end of the current collection year, which closes on 31 March <%= @case_log.collection_start_year.present? ? @case_log.collection_start_year + 1 : "" %>.
</p>
<% end %>
<%= render "tasklist" %>
</div>

6
app/views/form/review.html.erb

@ -10,6 +10,9 @@
<h1 class="govuk-heading-xl">
<%= content_for(:title) %>
</h1>
<p class="govuk-body">
You can review and make changes to this log up to 3 months after the end of the current collection year, which closes on 31 March <%= @case_log.collection_start_year.present? ? @case_log.collection_start_year + 1 : "" %>.
</p>
<% @case_log.form.sections.map do |section| %>
<h2 class="govuk-heading-m"><%= section.label %></h2>
<% section.subsections.map do |subsection| %>
@ -27,8 +30,5 @@
</div>
<% end %>
<% end %>
<div class="govuk-inset-text">
You can submit changes to this log until the close of the current collection year, 31 March <%= @case_log.collection_start_year.present? ? @case_log.collection_start_year + 1 : " of current collection end year" %>.
</div>
</div>
</div>

16
spec/features/form/tasklist_page_spec.rb

@ -12,6 +12,14 @@ RSpec.describe "Task List" do
managing_organisation: user.organisation,
)
end
let(:completed_case_log) do
FactoryBot.create(
:case_log,
:completed,
owning_organisation: user.organisation,
managing_organisation: user.organisation,
)
end
let(:empty_case_log) do
FactoryBot.create(
:case_log,
@ -44,9 +52,9 @@ RSpec.describe "Task List" do
end
it "has a review section which has a button that allows the data inputter to review the case log" do
visit("/logs/#{case_log.id}")
expect(page).to have_content("Review your answers and submit this log to the Department of Levelling Up, Housing & Communities.")
click_link(text: "Review lettings log")
expect(page).to have_current_path("/logs/#{case_log.id}/review")
visit("/logs/#{completed_case_log.id}")
expect(page).to have_content("review and make changes to this log")
click_link(text: "review and make changes to this log")
expect(page).to have_current_path("/logs/#{completed_case_log.id}/review")
end
end

1
spec/requests/form_controller_spec.rb

@ -23,7 +23,6 @@ RSpec.describe FormController, type: :request do
:case_log,
:about_completed,
status: 1,
year: 2021,
startdate: Time.zone.local(2021, 10, 10),
owning_organisation: organisation,
managing_organisation: organisation,

Loading…
Cancel
Save