Browse Source

CLDC-2494: page work in progress

pull/1763/head
Aaron Spencer 3 years ago committed by Kat
parent
commit
b9a673bdb2
  1. 2
      app/controllers/form_controller.rb
  2. 5
      app/services/duplicate_log_service.rb
  3. 13
      app/views/duplicate_logs/_banner.html.erb
  4. 37
      app/views/duplicate_logs/_check_answers_summary_list.html.erb
  5. 26
      db/schema.rb

2
app/controllers/form_controller.rb

@ -50,7 +50,7 @@ class FormController < ApplicationController
@interruption_page_id = URI.parse(request.headers["HTTP_REFERER"]).path.split("/").last.underscore
@interruption_page_referrer_type = referrer_from_query
end
if DuplicateLogService.is_log_duplicate?(@log)
if @log.duplicate_logs?
redirect_to
end
if @log

5
app/services/duplicate_log_service.rb

@ -1,5 +0,0 @@
class DuplicateLogService
def is_log_duplicate? (log)
return true if log.id == 3
end
end

13
app/views/duplicate_logs/_banner.html.erb

@ -0,0 +1,13 @@
<% if question.page.routed_to?(@log, current_user) %>
<%= govuk_panel(
classes: "app-panel--interruption",
) do %>
<p class="govuk-heading-l"><%= display_title_text(title_text, lettings_log) %></p>
<% if informative_text.present? %>
<p class="govuk-body-l"><%= display_informative_text(informative_text, lettings_log) %></p>
<% end %>
<% if question.hint_text.present? %>
<p class="govuk-body-l"><%= question.hint_text&.html_safe %></p>
<% end %>
<% end %>
<% end %>

37
app/views/duplicate_logs/_check_answers_summary_list.html.erb

@ -0,0 +1,37 @@
<%= govuk_summary_list do |summary_list| %>
<% questions.each do |question| %>
<% summary_list.row do |row| %>
<% row.key { get_question_label(question) } %>
<% row.value do %>
<%= simple_format(
get_answer_label(question, @log),
wrapper_tag: "span",
class: "govuk-!-margin-right-4",
) %>
<% extra_value = question.get_extra_check_answer_value(@log) %>
<% if extra_value && question.answer_label(@log, current_user).present? %>
<%= simple_format(
extra_value,
wrapper_tag: "span",
class: "govuk-!-font-weight-regular app-!-colour-muted",
) %>
<% end %>
<% question.get_inferred_answers(@log).each do |inferred_answer| %>
<span class="govuk-!-font-weight-regular app-!-colour-muted"><%= inferred_answer %></span>
<% end %>
<% end %>
<% if @log.collection_period_open_for_editing? %>
<% row.action(
text: question.action_text(@log),
href: action_href(@log, question.page.id, referrer),
visually_hidden_text: question.check_answer_label.to_s.downcase,
) %>
<% end %>
<% end %>
<% end %>
<% end %>

26
db/schema.rb

@ -186,14 +186,14 @@ ActiveRecord::Schema[7.0].define(version: 2023_06_29_125541) do
t.integer "hb"
t.integer "hbrentshortfall"
t.integer "property_relet"
t.datetime "mrcdate", precision: nil
t.datetime "mrcdate"
t.integer "incref"
t.datetime "startdate", precision: nil
t.datetime "startdate"
t.integer "armedforces"
t.integer "first_time_property_let_as_social_housing"
t.integer "unitletas"
t.integer "builtype"
t.datetime "voiddate", precision: nil
t.datetime "voiddate"
t.bigint "owning_organisation_id"
t.bigint "managing_organisation_id"
t.integer "renttype"
@ -341,7 +341,7 @@ ActiveRecord::Schema[7.0].define(version: 2023_06_29_125541) do
t.string "old_id"
t.string "old_visible_id"
t.string "mobility_type"
t.datetime "startdate", precision: nil
t.datetime "startdate"
t.string "location_admin_district"
t.boolean "confirmed"
t.index ["old_id"], name: "index_locations_on_old_id", unique: true
@ -512,7 +512,7 @@ ActiveRecord::Schema[7.0].define(version: 2023_06_29_125541) do
t.integer "stairbought"
t.integer "stairowned"
t.decimal "mrent", precision: 10, scale: 2
t.datetime "exdate", precision: nil
t.datetime "exdate"
t.integer "exday"
t.integer "exmonth"
t.integer "exyear"
@ -548,7 +548,7 @@ ActiveRecord::Schema[7.0].define(version: 2023_06_29_125541) do
t.integer "wchair"
t.integer "income2_value_check"
t.integer "armedforcesspouse"
t.datetime "hodate", precision: nil
t.datetime "hodate"
t.integer "hoday"
t.integer "homonth"
t.integer "hoyear"
@ -601,9 +601,9 @@ ActiveRecord::Schema[7.0].define(version: 2023_06_29_125541) do
t.integer "discounted_sale_value_check"
t.integer "student_not_child_value_check"
t.integer "percentage_discount_value_check"
t.integer "combined_income_value_check"
t.integer "buyer_livein_value_check"
t.integer "status_cache", default: 0, null: false
t.integer "combined_income_value_check"
t.datetime "discarded_at"
t.integer "stairowned_value_check"
t.integer "creation_method", default: 1
@ -656,8 +656,8 @@ ActiveRecord::Schema[7.0].define(version: 2023_06_29_125541) do
t.string "name"
t.bigint "organisation_id"
t.integer "sign_in_count", default: 0, null: false
t.datetime "current_sign_in_at", precision: nil
t.datetime "last_sign_in_at", precision: nil
t.datetime "current_sign_in_at"
t.datetime "last_sign_in_at"
t.string "current_sign_in_ip"
t.string "last_sign_in_ip"
t.integer "role"
@ -665,7 +665,7 @@ ActiveRecord::Schema[7.0].define(version: 2023_06_29_125541) do
t.string "phone"
t.integer "failed_attempts", default: 0
t.string "unlock_token"
t.datetime "locked_at", precision: nil
t.datetime "locked_at"
t.boolean "is_dpo", default: false
t.boolean "is_key_contact", default: false
t.integer "second_factor_attempts_count", default: 0
@ -673,12 +673,12 @@ ActiveRecord::Schema[7.0].define(version: 2023_06_29_125541) do
t.string "encrypted_otp_secret_key_iv"
t.string "encrypted_otp_secret_key_salt"
t.string "direct_otp"
t.datetime "direct_otp_sent_at", precision: nil
t.datetime "direct_otp_sent_at"
t.datetime "totp_timestamp", precision: nil
t.boolean "active", default: true
t.string "confirmation_token"
t.datetime "confirmed_at", precision: nil
t.datetime "confirmation_sent_at", precision: nil
t.datetime "confirmed_at"
t.datetime "confirmation_sent_at"
t.string "unconfirmed_email"
t.boolean "initial_confirmation_sent"
t.index ["confirmation_token"], name: "index_users_on_confirmation_token", unique: true

Loading…
Cancel
Save