I have added the performance model, controller, route and seed data, now I am working on the actual visual aspects of the page

This commit is contained in:
Ken Johnson
2013-05-31 14:45:31 -04:00
parent 2fa68be920
commit 379c442049
15 changed files with 136 additions and 4 deletions
@@ -0,0 +1,7 @@
class PerformanceController < ApplicationController
def index
@user = current_user
end
end
+2
View File
@@ -0,0 +1,2 @@
module PerformanceHelper
end
+4
View File
@@ -0,0 +1,4 @@
class Performance < ActiveRecord::Base
attr_accessible :comments, :date_submitted, :reviewer, :score
belongs_to :user
end
+1
View File
@@ -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
+2 -2
View File
@@ -51,12 +51,12 @@
<% end %>
</li>
<li>
<a href="#">
<%= link_to user_performance_index_path(:user_id => current_user.user_id) do %>
<div class="icon">
<span class="fs1" aria-hidden="true" data-icon="&#xe14a;"></span>
</div>
Performance
</a>
<% end %>
</li>
</ul>
</div>
+1
View File
@@ -49,6 +49,7 @@ function maskSSN(){
}
$(document).ready(function () {
maskSSN()
});
+4
View File
@@ -19,6 +19,10 @@ resources :users do
resources :work_info do
end
resources :performance do
end
end
@@ -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
+11 -1
View File
@@ -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"
+58 -1
View File
@@ -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
+15
View File
@@ -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
@@ -0,0 +1,7 @@
require 'test_helper'
class PerformanceControllerTest < ActionController::TestCase
# test "the truth" do
# assert true
# end
end
@@ -0,0 +1,4 @@
require 'test_helper'
class PerformanceHelperTest < ActionView::TestCase
end
+7
View File
@@ -0,0 +1,7 @@
require 'test_helper'
class PerformanceTest < ActiveSupport::TestCase
# test "the truth" do
# assert true
# end
end