diff --git a/app/controllers/paid_time_off_controller.rb b/app/controllers/paid_time_off_controller.rb
new file mode 100644
index 0000000..84c0d84
--- /dev/null
+++ b/app/controllers/paid_time_off_controller.rb
@@ -0,0 +1,5 @@
+class PaidTimeOffController < ApplicationController
+
+ def index
+ end
+end
diff --git a/app/helpers/paid_time_off_helper.rb b/app/helpers/paid_time_off_helper.rb
new file mode 100644
index 0000000..2b35141
--- /dev/null
+++ b/app/helpers/paid_time_off_helper.rb
@@ -0,0 +1,2 @@
+module PaidTimeOffHelper
+end
diff --git a/app/models/paid_time_off.rb b/app/models/paid_time_off.rb
new file mode 100644
index 0000000..28497b1
--- /dev/null
+++ b/app/models/paid_time_off.rb
@@ -0,0 +1,5 @@
+class PaidTimeOff < ActiveRecord::Base
+ attr_accessible :pto_earned, :pto_taken, :sick_days_earned, :sick_days_taken, :user_id
+ belongs_to :user
+
+end
diff --git a/app/models/user.rb b/app/models/user.rb
index d41967f..ee4c086 100755
--- a/app/models/user.rb
+++ b/app/models/user.rb
@@ -11,6 +11,7 @@ class User < ActiveRecord::Base
attr_accessor :skip_user_id_assign
before_save :assign_user_id, :on => :create
has_one :retirement, :foreign_key => :user_id, :primary_key => :user_id
+ has_one :paid_time_off, :foreign_key => :user_id, :primary_key => :user_id
diff --git a/app/views/layouts/shared/_sidebar.html.erb b/app/views/layouts/shared/_sidebar.html.erb
index 0be4bcd..d1de4c5 100755
--- a/app/views/layouts/shared/_sidebar.html.erb
+++ b/app/views/layouts/shared/_sidebar.html.erb
@@ -35,12 +35,12 @@
<% end %>
-
+ <%= link_to user_paid_time_off_index_path(:user_id => current_user.user_id) do %>
PTO
-
+ <% end %>
diff --git a/app/views/paid_time_off/index.html.erb b/app/views/paid_time_off/index.html.erb
new file mode 100644
index 0000000..e69de29
diff --git a/config/routes.rb b/config/routes.rb
index c622a41..fbb0567 100755
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -12,7 +12,9 @@ resources :users do
get "account_settings"
resources :retirement do
-
+ end
+
+ resources :paid_time_off do
end
end
diff --git a/db/migrate/20130525001150_create_paid_time_offs.rb b/db/migrate/20130525001150_create_paid_time_offs.rb
new file mode 100644
index 0000000..26d9844
--- /dev/null
+++ b/db/migrate/20130525001150_create_paid_time_offs.rb
@@ -0,0 +1,13 @@
+class CreatePaidTimeOffs < ActiveRecord::Migration
+ def change
+ create_table :paid_time_offs do |t|
+ t.integer :user_id
+ t.integer :sick_days_taken
+ t.integer :sick_days_earned
+ t.integer :pto_taken
+ t.integer :pto_earned
+
+ t.timestamps
+ end
+ end
+end
diff --git a/db/schema.rb b/db/schema.rb
index 4d7b5c8..2cc64f3 100755
--- a/db/schema.rb
+++ b/db/schema.rb
@@ -11,13 +11,23 @@
#
# It's strongly recommended to check this file into your version control system.
-ActiveRecord::Schema.define(:version => 20130524222129) do
+ActiveRecord::Schema.define(:version => 20130525001150) do
+
+ create_table "paid_time_offs", :force => true do |t|
+ t.integer "user_id"
+ t.integer "sick_days_taken"
+ t.integer "sick_days_earned"
+ t.integer "pto_taken"
+ t.integer "pto_earned"
+ t.datetime "created_at", :null => false
+ t.datetime "updated_at", :null => false
+ end
create_table "retirements", :force => true do |t|
t.string "total"
t.string "employee_contrib"
t.string "employer_contrib"
- t.integer "user_id"
+ t.integer "user_id"
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
end
@@ -28,7 +38,7 @@ ActiveRecord::Schema.define(:version => 20130524222129) do
t.boolean "admin"
t.string "first_name"
t.string "last_name"
- t.integer "user_id"
+ t.integer "user_id"
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
end
diff --git a/db/seeds.rb b/db/seeds.rb
index aa646b8..27ecd8b 100755
--- a/db/seeds.rb
+++ b/db/seeds.rb
@@ -47,32 +47,64 @@ users = [
retirements = [
{
- :user_id => "2",
+ :user_id => 2,
:employee_contrib => "1000",
:employer_contrib => "2000",
:total => "4500"
},
{
- :user_id => "3",
+ :user_id => 3,
:employee_contrib => "8000",
:employer_contrib => "16000",
:total => "30000"
},
{
- :user_id => "4",
+ :user_id => 4,
:employee_contrib => "10000",
:employer_contrib => "20000",
:total => "40000"
},
{
- :user_id => "5",
+ :user_id => 5,
:employee_contrib => "3000",
:employer_contrib => "6000",
:total => "12500"
- },
+ }
]
+paid_time_off = [
+ {
+ :user_id => 2,
+ :sick_days_taken => 2,
+ :sick_days_earned => 5,
+ :pto_taken => 5,
+ :pto_earned => 30
+ },
+ {
+ :user_id => 3,
+ :sick_days_taken => 3,
+ :sick_days_earned => 6,
+ :pto_taken => 3,
+ :pto_earned => 20
+ },
+ {
+ :user_id => 4,
+ :sick_days_taken => 2,
+ :sick_days_earned => 5,
+ :pto_taken => 5,
+ :pto_earned => 30
+ },
+ {
+ :user_id => 5,
+ :sick_days_taken => 1,
+ :sick_days_earned => 5,
+ :pto_taken => 10,
+ :pto_earned => 30
+ }
+
+ ]
+
users.each do |user_info|
User.create!(user_info)
@@ -80,4 +112,8 @@ end
retirements.each do |r|
Retirement.create!(r)
-end
\ No newline at end of file
+end
+
+paid_time_off.each do |pto|
+ PaidTimeOff.create!(pto)
+end
\ No newline at end of file
diff --git a/test/fixtures/paid_time_offs.yml b/test/fixtures/paid_time_offs.yml
new file mode 100644
index 0000000..b5d4bd1
--- /dev/null
+++ b/test/fixtures/paid_time_offs.yml
@@ -0,0 +1,15 @@
+# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/Fixtures.html
+
+one:
+ user_id: 1
+ sick_days_taken: 1
+ sick_days_earned: 1
+ pto_taken: 1
+ pto_earned: 1
+
+two:
+ user_id: 1
+ sick_days_taken: 1
+ sick_days_earned: 1
+ pto_taken: 1
+ pto_earned: 1
diff --git a/test/functional/paid_time_off_controller_test.rb b/test/functional/paid_time_off_controller_test.rb
new file mode 100644
index 0000000..992d400
--- /dev/null
+++ b/test/functional/paid_time_off_controller_test.rb
@@ -0,0 +1,7 @@
+require 'test_helper'
+
+class PaidTimeOffControllerTest < ActionController::TestCase
+ # test "the truth" do
+ # assert true
+ # end
+end
diff --git a/test/unit/helpers/paid_time_off_helper_test.rb b/test/unit/helpers/paid_time_off_helper_test.rb
new file mode 100644
index 0000000..6950bb8
--- /dev/null
+++ b/test/unit/helpers/paid_time_off_helper_test.rb
@@ -0,0 +1,4 @@
+require 'test_helper'
+
+class PaidTimeOffHelperTest < ActionView::TestCase
+end
diff --git a/test/unit/paid_time_off_test.rb b/test/unit/paid_time_off_test.rb
new file mode 100644
index 0000000..44aa6d8
--- /dev/null
+++ b/test/unit/paid_time_off_test.rb
@@ -0,0 +1,7 @@
+require 'test_helper'
+
+class PaidTimeOffTest < ActiveSupport::TestCase
+ # test "the truth" do
+ # assert true
+ # end
+end