From d1cc119de6d90b013ceae8605756a8f3d5a62d8f Mon Sep 17 00:00:00 2001
From: jimi
Date: Tue, 10 Mar 2009 23:25:32 -0500
Subject: [PATCH] Update employee layout and styles
---
app/controllers/employees_controller.rb | 8 +--
app/views/employees/_form.html.erb | 4 +-
app/views/employees/edit.html.erb | 8 +--
app/views/employees/index.html.erb | 32 ++++++------
app/views/employees/new.html.erb | 4 +-
app/views/employees/show.html.erb | 2 +-
public/stylesheets/application.css | 69 ++++++++++++++++++++-----
7 files changed, 83 insertions(+), 44 deletions(-)
diff --git a/app/controllers/employees_controller.rb b/app/controllers/employees_controller.rb
index de2359f..9c5f899 100644
--- a/app/controllers/employees_controller.rb
+++ b/app/controllers/employees_controller.rb
@@ -14,8 +14,8 @@ class EmployeesController < ApplicationController
def create
@employee = Employee.new(params[:employee])
if @employee.save
- flash[:notice] = "Successfully created employee."
- redirect_to @employee
+ flash[:notice] = "Successfully created record."
+ redirect_to employees_url
else
render :action => 'new'
end
@@ -28,8 +28,8 @@ class EmployeesController < ApplicationController
def update
@employee = Employee.find(params[:id])
if @employee.update_attributes(params[:employee])
- flash[:notice] = "Successfully updated employee."
- redirect_to @employee
+ flash[:notice] = "Successfully updated record."
+ redirect_to employees_url
else
render :action => 'edit'
end
diff --git a/app/views/employees/_form.html.erb b/app/views/employees/_form.html.erb
index e8f71b7..e96ed31 100644
--- a/app/views/employees/_form.html.erb
+++ b/app/views/employees/_form.html.erb
@@ -18,11 +18,11 @@
<%= f.label :dob %>
- <%= f.date_select :dob %>
+ <%= f.date_select :dob, :start_year => Time.now.year - 70, :end_year => Time.now.year - 17, :default => Time.now - 30.years %>
<%= f.label :hired %>
- <%= f.date_select :hired %>
+ <%= f.date_select :hired, :start_year => Time.now.year - 10, :end_year => Time.now.year + 1 %>
<%= f.label :tax_status %>
diff --git a/app/views/employees/edit.html.erb b/app/views/employees/edit.html.erb
index aef5e76..746c994 100644
--- a/app/views/employees/edit.html.erb
+++ b/app/views/employees/edit.html.erb
@@ -1,8 +1,8 @@
-<% title "Edit Employee" %>
+<% title "Driver Details" %>
<%= render :partial => 'form' %>
-
- <%= link_to "Show", @employee %> |
- <%= link_to "View All", employees_path %>
+
+ <%= link_to "Delete", @employee, :confirm => 'Are you sure?', :method => :delete %> |
+ <%= link_to "View List", employees_path %>
diff --git a/app/views/employees/index.html.erb b/app/views/employees/index.html.erb
index a5d1ad8..f52283c 100644
--- a/app/views/employees/index.html.erb
+++ b/app/views/employees/index.html.erb
@@ -1,8 +1,7 @@
-<% title "Employees" %>
-
-
+<% title "Driver List" -%>
+
- Number |
+ No. |
First Name |
Last Name |
SSN |
@@ -13,19 +12,18 @@
Payrate |
<% for employee in @employees %>
-
- <%= link_to employee.number, employee %> |
- <%=h employee.firstname %> |
- <%=h employee.lastname %> |
- <%=h employee.ssn %> |
- <%= employee.dob %> |
- <%= employee.hired %> |
- <%=h employee.tax_status %> |
- <%= employee.dependents %> |
- <%= employee.payrate %> |
- <%= link_to "Edit", edit_employee_path(employee) %> |
-
+ " onclick="location.href='<%= edit_employee_path(employee) %>'">
+ <%= employee.number %> |
+ <%= employee.firstname %> |
+ <%= employee.lastname %> |
+ <%= employee.ssn %> |
+ <%= employee.dob %> |
+ <%= employee.hired %> |
+ <%= employee.tax_status %> |
+ <%= employee.dependents %> |
+ <%= employee.payrate %> |
+
<% end %>
-<%= link_to "New Employee", new_employee_path %>
+<%= link_to "New Driver", new_employee_path %>
diff --git a/app/views/employees/new.html.erb b/app/views/employees/new.html.erb
index 3e770d6..cff24de 100644
--- a/app/views/employees/new.html.erb
+++ b/app/views/employees/new.html.erb
@@ -1,5 +1,5 @@
-<% title "New Employee" %>
+<% title "New Driver" %>
<%= render :partial => 'form' %>
-<%= link_to "Back to List", employees_path %>
+<%= link_to "Back to List", employees_path %>
diff --git a/app/views/employees/show.html.erb b/app/views/employees/show.html.erb
index fcb5a7c..9058dad 100644
--- a/app/views/employees/show.html.erb
+++ b/app/views/employees/show.html.erb
@@ -37,7 +37,7 @@
<%=h @employee.payrate %>
-
+
<%= link_to "Edit", edit_employee_path(@employee) %> |
<%= link_to "Destroy", @employee, :confirm => 'Are you sure?', :method => :delete %> |
<%= link_to "View All", employees_path %>
diff --git a/public/stylesheets/application.css b/public/stylesheets/application.css
index 4e71631..a61c29d 100644
--- a/public/stylesheets/application.css
+++ b/public/stylesheets/application.css
@@ -2,7 +2,7 @@ html {
overflow-y: scroll;
}
body {
- background-color: #33FF66;
+ background-color: #ffc;
font-family: Verdana, sans-serif;
padding: 0.75em;
line-height: 1.333;
@@ -33,13 +33,17 @@ h5, h6 {
font-size: 100%;
}
+th, td {
+ font-size: 70%;
+}
+
a {
- color: #003399;
+ color: #039;
text-decoration: none;
}
a:hover {
- color: #0000FF;
+ color: #00f;
text-decoration: underline;
}
@@ -56,6 +60,12 @@ em {
font-style: italic;
}
+p.nav {
+ margin-top: 1.5em;
+ font-size: 55%;
+ text-transform: uppercase;
+}
+
.clear {
clear: both;
height: 0;
@@ -65,9 +75,9 @@ em {
#container {
width: 44em;
margin: 0.5em auto;
- background-color: #FFFFFF;
+ background-color: #fff;
padding: 0.75em 1.75em;
- border: solid 1px black;
+ border: outset 1px;
}
#flash_notice, #flash_error {
@@ -77,13 +87,13 @@ em {
}
#flash_notice {
- background-color: #CCFFCC;
- border: solid 1px #66CC66;
+ background-color: #cfc;
+ border: solid 1px #6c6;
}
#flash_error {
- background-color: #FFCCCC;
- border: solid 1px #CC6666;
+ background-color: #fcc;
+ border: solid 1px #c66;
}
.fieldWithErrors {
@@ -92,11 +102,11 @@ em {
#errorExplanation {
width: 25em;
- border: 2px solid #CF0000;
+ border: 2px solid #cf0000;
padding: 0;
padding-bottom: 0.75em;
margin-bottom: 1.25em;
- background-color: #F0F0F0;
+ background-color: #f0f0f0;
}
#errorExplanation h2 {
@@ -105,12 +115,12 @@ em {
padding: 0.375em 0.375em 0.375em 1.0em;
font-size: 75%;
margin: 0;
- background-color: #CC0000;
- color: #FFFFFF;
+ background-color: #c00;
+ color: #fff;
}
#errorExplanation p {
- color: #333333;
+ color: #333;
margin-bottom: 0;
padding: 0.5em;
}
@@ -123,3 +133,34 @@ em {
font-size: 75%;
list-style: disc;
}
+
+.light {
+ background-color: #e3e3e3;
+}
+
+.dark {
+ background-color: #dcdcdc;
+}
+
+.listing {
+ width: 100%;
+}
+
+.listing tr:hover {
+ background-color: #fc9;
+ cursor: pointer;
+}
+
+.listing th,
+.listing td {
+ border: 1px solid #fff;
+ padding: 0.125em 0.375em;
+}
+
+.listing th {
+ background-color: #d3d3d3;
+}
+
+.listing td.number {
+ width: 2.5em;
+}