Browse Source

Remove references to ‘case logs’ in frontend

pull/160/head
Paul Robert Lloyd 3 years ago
parent
commit
0b4722c51c
  1. 8
      app/admin/dashboard.rb
  2. 6
      app/controllers/case_logs_controller.rb
  3. 2
      app/views/case_logs/edit.html.erb
  4. 2
      app/views/case_logs/index.html.erb
  5. 2
      app/views/layouts/application.html.erb
  6. 2
      spec/controllers/admin/case_logs_controller_spec.rb
  7. 6
      spec/controllers/admin/dashboard_controller_spec.rb
  8. 4
      spec/features/form/form_navigation_spec.rb
  9. 2
      spec/requests/case_log_controller_spec.rb

8
app/admin/dashboard.rb

@ -4,7 +4,7 @@ ActiveAdmin.register_page "Dashboard" do
content title: proc { I18n.t("active_admin.dashboard") } do content title: proc { I18n.t("active_admin.dashboard") } do
columns do columns do
column do column do
panel "Recent Case Logs" do panel "Recent logs" do
table_for CaseLog.order(updated_at: :desc).limit(10) do table_for CaseLog.order(updated_at: :desc).limit(10) do
column :id column :id
column :created_at column :created_at
@ -17,13 +17,13 @@ ActiveAdmin.register_page "Dashboard" do
end end
column do column do
panel "Total case logs in progress" do panel "Total logs in progress" do
para CaseLog.in_progress.size para CaseLog.in_progress.size
end end
panel "Total case logs completed" do panel "Total logs completed" do
para CaseLog.completed.size para CaseLog.completed.size
end end
panel "Total case logs completed" do panel "Total logs completed" do
pie_chart CaseLog.group(:status).size pie_chart CaseLog.group(:status).size
end end
end end

6
app/controllers/case_logs_controller.rb

@ -31,7 +31,7 @@ class CaseLogsController < ApplicationController
render json: { errors: @case_log.errors.messages }, status: :unprocessable_entity render json: { errors: @case_log.errors.messages }, status: :unprocessable_entity
end end
else else
render_not_found_json("Case log", params[:id]) render_not_found_json("Log", params[:id])
end end
end end
@ -43,7 +43,7 @@ class CaseLogsController < ApplicationController
if @case_log if @case_log
render json: @case_log, status: :ok render json: @case_log, status: :ok
else else
render_not_found_json("Case log", params[:id]) render_not_found_json("Log", params[:id])
end end
end end
end end
@ -67,7 +67,7 @@ class CaseLogsController < ApplicationController
render json: { errors: @case_log.errors.messages }, status: :unprocessable_entity render json: { errors: @case_log.errors.messages }, status: :unprocessable_entity
end end
else else
render_not_found_json("Case log", params[:id]) render_not_found_json("Log", params[:id])
end end
end end

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

@ -1,4 +1,4 @@
<% content_for :title, "Case log #{@case_log.id}" %> <% content_for :title, "Log #{@case_log.id}" %>
<%= turbo_frame_tag "case_log_form", target: "_top" do %> <%= turbo_frame_tag "case_log_form", target: "_top" do %>
<div class="govuk-grid-row"> <div class="govuk-grid-row">

2
app/views/case_logs/index.html.erb

@ -1,4 +1,4 @@
<% content_for :title, "Case logs" %> <% content_for :title, "Your logs" %>
<div class="govuk-grid-row"> <div class="govuk-grid-row">
<div class="govuk-grid-column-two-thirds-from-desktop"> <div class="govuk-grid-column-two-thirds-from-desktop">

2
app/views/layouts/application.html.erb

@ -39,7 +39,7 @@
if current_user.nil? if current_user.nil?
component.navigation_item(text: 'Sign in', href: user_session_path) component.navigation_item(text: 'Sign in', href: user_session_path)
elsif elsif
component.navigation_item(text: 'Case logs', href: case_logs_path) component.navigation_item(text: 'Your logs', href: case_logs_path)
component.navigation_item(text: 'Your organisation', href: "/organisations/#{current_user.organisation.id}") component.navigation_item(text: 'Your organisation', href: "/organisations/#{current_user.organisation.id}")
component.navigation_item(text: 'Your account', href: user_path(current_user)) component.navigation_item(text: 'Your account', href: user_path(current_user))
component.navigation_item(text: 'Sign out', href: destroy_user_session_path, options: {:method => :delete}) component.navigation_item(text: 'Sign out', href: destroy_user_session_path, options: {:method => :delete})

2
spec/controllers/admin/case_logs_controller_spec.rb

@ -4,7 +4,7 @@ require_relative "../../support/devise"
describe Admin::CaseLogsController, type: :controller do describe Admin::CaseLogsController, type: :controller do
render_views render_views
let(:page) { Capybara::Node::Simple.new(response.body) } let(:page) { Capybara::Node::Simple.new(response.body) }
let(:resource_title) { "Case Logs" } let(:resource_title) { "Logs" }
let(:valid_session) { {} } let(:valid_session) { {} }
login_admin_user login_admin_user

6
spec/controllers/admin/dashboard_controller_spec.rb

@ -21,18 +21,18 @@ describe Admin::DashboardController, type: :controller do
end end
it "returns a panel of recent case logs" do it "returns a panel of recent case logs" do
expect(page).to have_xpath("//div[contains(@class, 'panel') and contains(//h3, 'Recent Case Logs')]") expect(page).to have_xpath("//div[contains(@class, 'panel') and contains(//h3, 'Recent logs')]")
end end
it "returns a panel of in progress case logs" do it "returns a panel of in progress case logs" do
panel_xpath = "//div[@class='panel' and .//h3[contains(., 'Total case logs in progress')]]" panel_xpath = "//div[@class='panel' and .//h3[contains(., 'Total logs in progress')]]"
panel_content_xpath = "#{panel_xpath}//div[@class='panel_contents' and .//p[contains(., 2)]]" panel_content_xpath = "#{panel_xpath}//div[@class='panel_contents' and .//p[contains(., 2)]]"
expect(page).to have_xpath(panel_xpath) expect(page).to have_xpath(panel_xpath)
expect(page).to have_xpath(panel_content_xpath) expect(page).to have_xpath(panel_content_xpath)
end end
it "returns a panel of completed case logs" do it "returns a panel of completed case logs" do
panel_xpath = "//div[@class='panel' and .//h3[contains(., 'Total case logs completed')]]" panel_xpath = "//div[@class='panel' and .//h3[contains(., 'Total logs completed')]]"
panel_content_xpath = "#{panel_xpath}//div[@class='panel_contents' and .//p[contains(., 1)]]" panel_content_xpath = "#{panel_xpath}//div[@class='panel_contents' and .//p[contains(., 1)]]"
expect(page).to have_xpath(panel_xpath) expect(page).to have_xpath(panel_xpath)
expect(page).to have_xpath(panel_content_xpath) expect(page).to have_xpath(panel_content_xpath)

4
spec/features/form/form_navigation_spec.rb

@ -31,7 +31,7 @@ RSpec.describe "Form Navigation" do
visit("/logs") visit("/logs")
click_link("Create new log") click_link("Create new log")
id = CaseLog.order(created_at: :desc).first.id id = CaseLog.order(created_at: :desc).first.id
expect(page).to have_content("Case log #{id}") expect(page).to have_content("Log #{id}")
end end
end end
@ -55,7 +55,7 @@ RSpec.describe "Form Navigation" do
visit("/logs/#{id}") visit("/logs/#{id}")
visit("/logs/#{id}/tenant-code") visit("/logs/#{id}/tenant-code")
click_link(text: "Back") click_link(text: "Back")
expect(page).to have_content("Case log #{id}") expect(page).to have_content("Log #{id}")
end end
it "go back to tenant code page from tenant age page", js: true do it "go back to tenant code page from tenant age page", js: true do

2
spec/requests/case_log_controller_spec.rb

@ -195,7 +195,7 @@ RSpec.describe CaseLogsController, type: :request do
end end
it "shows the tasklist for case logs you have access to" do it "shows the tasklist for case logs you have access to" do
expect(response.body).to match("Case log") expect(response.body).to match("Log")
expect(response.body).to match(case_log.id.to_s) expect(response.body).to match(case_log.id.to_s)
end end

Loading…
Cancel
Save