added the PTO section
This commit is contained in:
@@ -0,0 +1,5 @@
|
||||
class PaidTimeOffController < ApplicationController
|
||||
|
||||
def index
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,2 @@
|
||||
module PaidTimeOffHelper
|
||||
end
|
||||
@@ -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
|
||||
@@ -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
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -35,12 +35,12 @@
|
||||
<% end %>
|
||||
</li>
|
||||
<li>
|
||||
<a href="#">
|
||||
<%= link_to user_paid_time_off_index_path(:user_id => current_user.user_id) do %>
|
||||
<div class="icon">
|
||||
<span class="fs1" aria-hidden="true" data-icon=""></span>
|
||||
</div>
|
||||
PTO
|
||||
</a>
|
||||
<% end %>
|
||||
</li>
|
||||
<li>
|
||||
<a href="#">
|
||||
|
||||
+3
-1
@@ -12,7 +12,9 @@ resources :users do
|
||||
get "account_settings"
|
||||
|
||||
resources :retirement do
|
||||
|
||||
end
|
||||
|
||||
resources :paid_time_off do
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
@@ -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
|
||||
+13
-3
@@ -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
|
||||
|
||||
+42
-6
@@ -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
|
||||
end
|
||||
|
||||
paid_time_off.each do |pto|
|
||||
PaidTimeOff.create!(pto)
|
||||
end
|
||||
Vendored
+15
@@ -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
|
||||
@@ -0,0 +1,7 @@
|
||||
require 'test_helper'
|
||||
|
||||
class PaidTimeOffControllerTest < ActionController::TestCase
|
||||
# test "the truth" do
|
||||
# assert true
|
||||
# end
|
||||
end
|
||||
@@ -0,0 +1,4 @@
|
||||
require 'test_helper'
|
||||
|
||||
class PaidTimeOffHelperTest < ActionView::TestCase
|
||||
end
|
||||
@@ -0,0 +1,7 @@
|
||||
require 'test_helper'
|
||||
|
||||
class PaidTimeOffTest < ActiveSupport::TestCase
|
||||
# test "the truth" do
|
||||
# assert true
|
||||
# end
|
||||
end
|
||||
Reference in New Issue
Block a user