Permalink
Browse files

builds teacher_recommendation model, controller, form, associates wit…

…h applicant
  • Loading branch information...
1 parent 6e18f78 commit 688c8f700855db062cd8a5e4a9f249e4162b48b9 @jmabry111 committed Oct 3, 2012
@@ -0,0 +1,3 @@
+# Place all the behaviors and hooks related to the matching controller here.
+# All this logic will automatically be available in application.js.
+# You can use CoffeeScript in this file: http://jashkenas.github.com/coffee-script/
@@ -0,0 +1,3 @@
+// Place all the styles related to the Teacher_recommendations controller here.
+// They will automatically be included in application.css.
+// You can use Sass (SCSS) here: http://sass-lang.com/
@@ -0,0 +1,17 @@
+class TeacherRecommendationsController < ApplicationController
+
+ def new
+ @teacher_recommendation = TeacherRecommendation.new
+ end
+
+ def create
+ @teacher_recommendation = TeacherRecommendation.new(params[:teacher_recommendation])
+ if @teacher_recommendation.save
+ redirect_to @teacher_recommendation
+ else
+ render 'new'
+ end
+ end
+
+
+end
@@ -0,0 +1,2 @@
+module TeacherRecommendationsHelper
+end
View
@@ -3,6 +3,7 @@ class Applicant < ActiveRecord::Base
:math_teacher, :middle_name, :parent_first_name, :parent_last_name, :school_id, :science_teacher, :work_phone,
:school_phone, :counselor_name, :due_to, :date_due, :english_teacher_email, :science_teacher_email, :math_teacher_email
belongs_to :school
+ has_many :teacher_recommendations
before_save :strip_extra_characters
@@ -30,6 +31,10 @@ def strip_extra_characters
self.school_phone = remove_non_digit_characters(school_phone)
end
+ def to_s
+ "#{first_name} #{last_name}"
+ end
+
private
def remove_non_digit_characters(string)
@@ -0,0 +1,5 @@
+class TeacherRecommendation < ActiveRecord::Base
+ attr_accessible :aptitude, :date_submitted, :dedication, :desire, :inquiry_skills, :interaction, :persistence, :problem_solving, :recommendation, :self_discipline, :study_skills, :subject, :teamwork, :time_management, :work_ethic, :applicant_id
+ belongs_to :applicant
+
+end
@@ -0,0 +1,44 @@
+<h1>Teacher Recommendations</h1>
+<div class="row">
+ <div class="span10 offset1">
+ <div class="form-horizontal">
+ <%= simple_form_for @teacher_recommendation do |f| -%>
+ <%= f.association :applicant %>
+ <h3>Please rate the candidate in the following categories by checking the appropriate number based on the following rating scale.</h3>
+ <p>
+ 1 = Not observed
+ 2 = Needs improvement
+ 3 = Average
+ 4 = Above average
+ 5 = Excellent
+ </p>
+ <%= render 'shared/error_messages', object: f.object %>
+ <%= f.input :desire, :collection => ["1","2","3","4","5"], :as => :radio_buttons, :item_wrapper_class => :inline %>
+ <%= f.input :aptitude, :collection => ["1","2","3","4","5"], :as => :radio_buttons, :item_wrapper_class => :inline %>
+ <%= f.input :persistence, :collection => ["1","2","3","4","5"], :as => :radio_buttons, :item_wrapper_class => :inline %>
+ <%= f.input :self_discipline, :collection => ["1","2","3","4","5"], :as => :radio_buttons, :item_wrapper_class => :inline %>
+ <%= f.input :interaction, :collection => ["1","2","3","4","5"], :as => :radio_buttons, :item_wrapper_class => :inline %>
+ <%= f.input :problem_solving, :collection => ["1","2","3","4","5"], :as => :radio_buttons, :item_wrapper_class => :inline %>
+ <%= f.input :inquiry_skills, :collection => ["1","2","3","4","5"], :as => :radio_buttons, :item_wrapper_class => :inline %>
+ <%= f.input :study_skills, :collection => ["1","2","3","4","5"], :as => :radio_buttons, :item_wrapper_class => :inline %>
+ <%= f.input :time_management, :collection => ["1","2","3","4","5"], :as => :radio_buttons, :item_wrapper_class => :inline %>
+ <%= f.input :teamwork, :collection => ["1","2","3","4","5"], :as => :radio_buttons, :item_wrapper_class => :inline %>
+ <%= f.input :dedication, :collection => ["1","2","3","4","5"], :as => :radio_buttons, :item_wrapper_class => :inline %>
+ <%= f.input :work_ethic, :collection => ["1","2","3","4","5"], :as => :radio_buttons, :item_wrapper_class => :inline %>
+ <hr />
+ <h3>Please indicate your general recommendation for this student.</h3>
+ <p>
+ 0 = Do not recommend
+ 1 = Recommend with reservations
+ 3 = Recommend
+ 5 = Highly recommend
+ </p>
+ <%= f.input :recommendation, :collection => ["0","1","3","5"], :as => :radio_buttons, :item_wrapper_class => :inline %>
+ <hr />
+ <%= f.input :subject, :label => "Subject Area" %>
+ <hr />
+ <%= f.submit "Submit Recommendation", class: "btn btn-large btn-primary" %>
+ <% end %>
+ </div>
+ </div>
+</div>
View
@@ -1,13 +1,15 @@
GovSchoolApplication::Application.routes.draw do
+ get "teacher_recommendations/new"
+
ActiveAdmin.routes(self)
devise_for :admin_users, ActiveAdmin::Devise.config
devise_for :users
- resources :applicants, :schools
+ resources :applicants, :schools, :teacher_recommendations
get "static_pages/info"
@@ -0,0 +1,23 @@
+class CreateTeacherRecommendations < ActiveRecord::Migration
+ def change
+ create_table :teacher_recommendations do |t|
+ t.integer :desire
+ t.integer :aptitude
+ t.integer :persistence
+ t.integer :self_discipline
+ t.integer :interaction
+ t.integer :problem_solving
+ t.integer :inquiry_skills
+ t.integer :study_skills
+ t.integer :time_management
+ t.integer :teamwork
+ t.integer :dedication
+ t.integer :work_ethic
+ t.integer :recommendation
+ t.string :subject
+ t.date :date_submitted
+
+ t.timestamps
+ end
+ end
+end
@@ -0,0 +1,5 @@
+class AddApplicantIdToTeacherRecommendations < ActiveRecord::Migration
+ def change
+ add_column :teacher_recommendations, :applicant_id, :integer
+ end
+end
View
@@ -11,7 +11,7 @@
#
# It's strongly recommended to check this file into your version control system.
-ActiveRecord::Schema.define(:version => 20121002124135) do
+ActiveRecord::Schema.define(:version => 20121003151033) do
create_table "active_admin_comments", :force => true do |t|
t.string "resource_id", :null => false
@@ -80,6 +80,27 @@
t.datetime "updated_at", :null => false
end
+ create_table "teacher_recommendations", :force => true do |t|
+ t.integer "desire"
+ t.integer "aptitude"
+ t.integer "persistence"
+ t.integer "self_discipline"
+ t.integer "interaction"
+ t.integer "problem_solving"
+ t.integer "inquiry_skills"
+ t.integer "study_skills"
+ t.integer "time_management"
+ t.integer "teamwork"
+ t.integer "dedication"
+ t.integer "work_ethic"
+ t.integer "recommendation"
+ t.string "subject"
+ t.date "date_submitted"
+ t.datetime "created_at", :null => false
+ t.datetime "updated_at", :null => false
+ t.integer "applicant_id"
+ end
+
create_table "users", :force => true do |t|
t.string "email", :default => "", :null => false
t.string "encrypted_password", :default => "", :null => false
@@ -0,0 +1,5 @@
+require 'spec_helper'
+
+describe TeacherRecommendation do
+ pending "add some examples to (or delete) #{__FILE__}"
+end
@@ -1,12 +1,3 @@
require 'spec_helper'
-describe "SchoolPages" do
-
- subject { page }
-
- describe "new school page" do
- before { visit new_school_path }
-
- it { should have_selector('h1', text: 'Enter school') }
- end
-end
+
@@ -0,0 +1,11 @@
+require 'spec_helper'
+
+describe "TeacherRecommendationPages" do
+ describe "GET /teacher_recommendation_pages" do
+ it "works! (now write some real specs)" do
+ # Run the generator again with the --webrat flag if you want to use webrat methods/matchers
+ get teacher_recommendation_pages_index_path
+ response.status.should be(200)
+ end
+ end
+end

0 comments on commit 688c8f7

Please sign in to comment.