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 %> +
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" %> - -Number | +No. | First Name | Last Name | SSN | @@ -13,19 +12,18 @@Payrate | ||||
---|---|---|---|---|---|---|---|---|---|
<%= 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) %> | -
<%= employee.number %> | +<%= employee.firstname %> | +<%= employee.lastname %> | +<%= employee.ssn %> | +<%= employee.dob %> | +<%= employee.hired %> | +<%= employee.tax_status %> | +<%= employee.dependents %> | +<%= employee.payrate %> | +
<%= link_to "New Employee", 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 %>
+ 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 %> -+