diff --git a/app/controllers/performance_controller.rb b/app/controllers/performance_controller.rb new file mode 100644 index 0000000..512e751 --- /dev/null +++ b/app/controllers/performance_controller.rb @@ -0,0 +1,7 @@ +class PerformanceController < ApplicationController + + def index + @user = current_user + end + +end diff --git a/app/helpers/performance_helper.rb b/app/helpers/performance_helper.rb new file mode 100644 index 0000000..b25da1f --- /dev/null +++ b/app/helpers/performance_helper.rb @@ -0,0 +1,2 @@ +module PerformanceHelper +end diff --git a/app/models/performance.rb b/app/models/performance.rb new file mode 100644 index 0000000..f182879 --- /dev/null +++ b/app/models/performance.rb @@ -0,0 +1,4 @@ +class Performance < ActiveRecord::Base + attr_accessible :comments, :date_submitted, :reviewer, :score + belongs_to :user +end diff --git a/app/models/user.rb b/app/models/user.rb index e11c867..3061d2a 100755 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -13,6 +13,7 @@ class User < ActiveRecord::Base has_one :retirement, :foreign_key => :user_id, :primary_key => :user_id has_one :paid_time_off, :foreign_key => :user_id, :primary_key => :user_id has_one :work_info, :foreign_key => :user_id, :primary_key => :user_id + has_one :performance, :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 a01b719..ae5162d 100755 --- a/app/views/layouts/shared/_sidebar.html.erb +++ b/app/views/layouts/shared/_sidebar.html.erb @@ -51,12 +51,12 @@ <% end %>
  • - + <%= link_to user_performance_index_path(:user_id => current_user.user_id) do %>
    Performance -
    + <% end %>
  • diff --git a/app/views/performance/index.html.erb b/app/views/performance/index.html.erb new file mode 100644 index 0000000..e69de29 diff --git a/app/views/work_info/index.html.erb b/app/views/work_info/index.html.erb index 9dce696..39fee76 100644 --- a/app/views/work_info/index.html.erb +++ b/app/views/work_info/index.html.erb @@ -49,6 +49,7 @@ function maskSSN(){ } + $(document).ready(function () { maskSSN() }); diff --git a/config/routes.rb b/config/routes.rb index 94b3c73..ac5950d 100755 --- a/config/routes.rb +++ b/config/routes.rb @@ -19,6 +19,10 @@ resources :users do resources :work_info do end + + resources :performance do + + end end diff --git a/db/migrate/20130531182058_create_performances.rb b/db/migrate/20130531182058_create_performances.rb new file mode 100644 index 0000000..a384964 --- /dev/null +++ b/db/migrate/20130531182058_create_performances.rb @@ -0,0 +1,13 @@ +class CreatePerformances < ActiveRecord::Migration + def change + create_table :performances do |t| + t.integer :user_id + t.date :date_submitted + t.integer :score + t.string :comments + t.integer :reviewer + + t.timestamps + end + end +end diff --git a/db/schema.rb b/db/schema.rb index fc50ac6..a2afef1 100755 --- a/db/schema.rb +++ b/db/schema.rb @@ -11,7 +11,7 @@ # # It's strongly recommended to check this file into your version control system. -ActiveRecord::Schema.define(:version => 20130531143853) do +ActiveRecord::Schema.define(:version => 20130531182058) do create_table "paid_time_offs", :force => true do |t| t.integer "user_id" @@ -23,6 +23,16 @@ ActiveRecord::Schema.define(:version => 20130531143853) do t.datetime "updated_at", :null => false end + create_table "performances", :force => true do |t| + t.integer "user_id" + t.date "date_submitted" + t.integer "score" + t.string "comments" + t.integer "reviewer" + 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" diff --git a/db/seeds.rb b/db/seeds.rb index e39c69c..164c529 100755 --- a/db/seeds.rb +++ b/db/seeds.rb @@ -145,7 +145,6 @@ paid_time_off = [ ] work_info = [ - { :user_id => 2, :income => "$50,000", @@ -178,6 +177,58 @@ paid_time_off = [ :SSN => "222-22-2222", :DoB => "01-01-1982" } + ] + + performance = [ + { + :user_id => 2, + :reviewer => 1, + :comments => "Great job! You are my hero", + :date_submitted => Date.new(2012, 01, 01), + :score => 5 + }, + { + :user_id => 2, + :reviewer => 1, + :comments => "Once again, you've done a great job this year. We greatly appreciate your hard work.", + :date_submitted => Date.new(2013, 01, 01), + :score => 5 + }, + { + :user_id => 3, + :reviewer => 1, + :comments => "Great worker, great attitude for this newcomer!", + :date_submitted => Date.new(2013, 01, 01), + :score => 5 + }, + { + :user_id => 4, + :reviewer => 1, + :comments => "Wow, right out of the gate we've been very impressed but unfortunately, our system doesn't allow us to give you a full 5.0 because other ppl have gotten 5.0 ratings.", + :date_submitted => Date.new(2011, 01, 01), + :score => 4 + }, + { + :user_id => 4, + :reviewer => 1, + :comments => "We highly recommend promotion for this employee! Consistent performer with proven leadership qualities.", + :date_submitted => Date.new(2012, 01, 01), + :score => 5 + }, + { + :user_id => 4, + :reviewer => 1, + :comments => "Right out of the gate, Mike has made incredible moves as a newly appointed leader. His only improvement would be more cowbell. Not enough of it.", + :date_submitted => Date.new(2013, 01, 01), + :score => 4 + }, + { + :user_id => 5, + :reviewer => 1, + :comments => "Ehh, you are okay, we will let you stay..... barely", + :date_submitted => Date.new(2013, 01, 01), + :score => 2 + } ] @@ -210,4 +261,10 @@ work_info.each do |wi| info = WorkInfo.new(wi.reject {|k| k == :user_id}) info.user_id = wi[:user_id] info.save +end + +performance.each do |perf| + p = Performance.new(perf.reject {|k| k == :user_id}) + p.user_id = perf[:user_id] + p.save end \ No newline at end of file diff --git a/test/fixtures/performances.yml b/test/fixtures/performances.yml new file mode 100644 index 0000000..74a3abb --- /dev/null +++ b/test/fixtures/performances.yml @@ -0,0 +1,15 @@ +# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/Fixtures.html + +one: + user_id: 1 + date_submitted: 2013-05-31 + score: 1 + comments: MyString + reviewer: 1 + +two: + user_id: 1 + date_submitted: 2013-05-31 + score: 1 + comments: MyString + reviewer: 1 diff --git a/test/functional/performance_controller_test.rb b/test/functional/performance_controller_test.rb new file mode 100644 index 0000000..f0de602 --- /dev/null +++ b/test/functional/performance_controller_test.rb @@ -0,0 +1,7 @@ +require 'test_helper' + +class PerformanceControllerTest < ActionController::TestCase + # test "the truth" do + # assert true + # end +end diff --git a/test/unit/helpers/performance_helper_test.rb b/test/unit/helpers/performance_helper_test.rb new file mode 100644 index 0000000..fa3612d --- /dev/null +++ b/test/unit/helpers/performance_helper_test.rb @@ -0,0 +1,4 @@ +require 'test_helper' + +class PerformanceHelperTest < ActionView::TestCase +end diff --git a/test/unit/performance_test.rb b/test/unit/performance_test.rb new file mode 100644 index 0000000..d711513 --- /dev/null +++ b/test/unit/performance_test.rb @@ -0,0 +1,7 @@ +require 'test_helper' + +class PerformanceTest < ActiveSupport::TestCase + # test "the truth" do + # assert true + # end +end