From daa563f31aeef859eb07eb6cb7c13a030954d180 Mon Sep 17 00:00:00 2001
From: Ben
Date: Tue, 30 Jan 2024 17:02:46 -0600
Subject: [PATCH] Worker Module updated and fixed to include proper styling and
page views
---
app/controllers/workers_controller.rb | 11 ++++++++---
app/views/workers/edit.html.erb | 1 -
app/views/workers/show.html.erb | 4 ++--
3 files changed, 10 insertions(+), 6 deletions(-)
diff --git a/app/controllers/workers_controller.rb b/app/controllers/workers_controller.rb
index 4c0e3c8..13f84c3 100644
--- a/app/controllers/workers_controller.rb
+++ b/app/controllers/workers_controller.rb
@@ -52,9 +52,14 @@ class WorkersController < ApplicationController
end
private
- def worker_params
- params.require(:worker).permit(:first_name, :last_name, :address, :phone, :email, :dob, :ssn, :gender)
- end
+ def worker_params
+ params.require(:worker).permit(
+ :first_name, :last_name,
+ :address_line_1, :address_line_2, :city, :state, :zip,
+ :phone, :email, :dob, :ssn, :gender
+ )
+ end
+
end
\ No newline at end of file
diff --git a/app/views/workers/edit.html.erb b/app/views/workers/edit.html.erb
index 1397f1a..c7ffe41 100644
--- a/app/views/workers/edit.html.erb
+++ b/app/views/workers/edit.html.erb
@@ -6,7 +6,6 @@
<%= render 'form', worker: @worker %>
- <%= link_to 'Cancel', worker_path(@worker), class: "btn btn-warning" %>
<%= link_to 'Back to List', workers_path, class: "btn btn-secondary" %>
<%= link_to 'Delete', @worker, method: :delete, data: { confirm: 'Are you sure?' }, class: "btn btn-danger" %>
diff --git a/app/views/workers/show.html.erb b/app/views/workers/show.html.erb
index a618d48..05ac994 100644
--- a/app/views/workers/show.html.erb
+++ b/app/views/workers/show.html.erb
@@ -11,7 +11,7 @@
Address:
- <%= [worker.address_line_1, worker.address_line_2, worker.city, worker.state, worker.zip].compact.join(', ') %>
+ <%= [@worker.address_line_1, @worker.address_line_2, @worker.city, @worker.state, @worker.zip].compact.join(', ') %>
Phone:
@@ -37,7 +37,7 @@
- <%= link_to 'Edit', edit_worker_path(@worker), class: "btn btn-primary" %>
+ <%= link_to 'Edit', edit_worker_path(@worker), class: "btn btn-dark" %>
<%= link_to 'Back to List', workers_path, class: "btn btn-secondary" %>