Skip to content

Commit

Permalink
Quick view and select the candidates
Browse files Browse the repository at this point in the history
  • Loading branch information
thamizh committed Jul 12, 2013
1 parent edc6c0a commit 66cfc60
Show file tree
Hide file tree
Showing 13 changed files with 275 additions and 129 deletions.
3 changes: 3 additions & 0 deletions app/assets/javascripts/notes.js.coffee
Original file line number Diff line number Diff line change
@@ -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/
3 changes: 3 additions & 0 deletions app/assets/stylesheets/notes.css.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
// Place all the styles related to the notes controller here.
// They will automatically be included in application.css.
// You can use Sass (SCSS) here: http://sass-lang.com/
24 changes: 22 additions & 2 deletions app/assets/stylesheets/search/custom.css
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,18 @@ line-height: 18px;

.key-search{
margin-top: 100px;
margin-bottom: 50px;
margin-bottom: 10px;
padd
}
.display_result{
background: #ddd;
margin-bottom: 10px;
color: green;
padding: 10px;
font-size: 14px;
}
.error{
color:red;
}
.search-input{
width:75%;
Expand Down Expand Up @@ -110,7 +121,7 @@ line-height: 18px;
padding: 5px 0px 5px 10px;
outline: #eee solid 1px;
}
.QV-content{
.QV-content,.edit-content{
margin: 10px 0px 25px 0px;
position: relative;
}
Expand Down Expand Up @@ -139,4 +150,13 @@ background: -ms-linear-gradient(top, #8cc1d3 0%,#65afc8 100%);
background: linear-gradient(to bottom, #8cc1d3 0%,#65afc8 100%);
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#8cc1d3', endColorstr='#65afc8',GradientType=0 );

}
.edit-content{
display: none;
padding-left:20px;
}
.edit-content input {display: inline;
width: auto !important; }
.new-note-form{
display: none;
}
9 changes: 9 additions & 0 deletions app/controllers/candidates_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,15 @@ def search

end

def update
@candidate = Candidate.find(params[:id])
@candidate.update_attributes(params[:candidate].except(:id, :profile_pic_url, :get_tags,:notes))
respond_to do |f|
f.html { redirect_to candidates_path }
f.json { render :json => @candidate.to_json}
end
end

def edit

end
Expand Down
17 changes: 17 additions & 0 deletions app/controllers/notes_controller.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
class NotesController < ApplicationController
def update
end
def create
@note = current_user.notes.create(params[:note])
respond_to do |f|
f.html
f.json{ render :json=>@note.to_json }
end
end
def new
end
def show
end
def index
end
end
2 changes: 2 additions & 0 deletions app/helpers/notes_helper.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
module NotesHelper
end
37 changes: 30 additions & 7 deletions app/models/candidate.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,18 +12,41 @@ class Candidate < ActiveRecord::Base

validates :email, :first_name, :presence => true
validates :email, :uniqueness=>true

has_many :notes
belongs_to :user
belongs_to :team
has_and_belongs_to_many :tags
attr_reader :get_tags, :profile_pic_url
def as_json options=nil
options ||= {}
options[:methods] = ((options[:methods] || []) + [:get_tags,:profile_pic_url])
super options
end
attr_reader :get_tags, :profile_pic_url,:get_notes
def as_json options={}
{
id: self.id,
company: self.company,
experience: self.experience,
first_name: self.first_name,
last_name: self.last_name,
profile_pic_url: self.profile_pic_url,
get_tags: self.get_tags,
position: self.position,
email: self.email,
address: self.address,
state: self.state,
zip: self.zip,
contact_number: self.contact_number,
added_from: self.added_from,
linked_in: self.linked_in,
facebook: self.facebook,
twitter: self.twitter,
notes: self.get_notes
}
# options ||= {}
# options[:methods] = ((options[:methods] || []) + [:get_tags,:profile_pic_url])
# super options
end
def get_tags
self.tags.select(:name).map(&:name).join(",")
end
def get_notes
self.notes
end
def profile_pic_url
self.profile_pic(:small)
Expand Down
3 changes: 1 addition & 2 deletions app/models/note.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
class Note < ActiveRecord::Base
attr_accessible :creater_id, :candidate_note, :candidate_id
belongs_to :candidate
belongs_to :creater, :class_name => 'User', :foreign_key => "user_id"

belongs_to :creater, :class_name=>"User", :foreign_key=>"creater_id"
end
2 changes: 1 addition & 1 deletion app/models/user.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class User < ActiveRecord::Base
# attr_accessible :title, :body
belongs_to :team
has_many :call_lists
has_many :notes
has_many :notes ,:foreign_key=>"creater_id"

def create_team
if register_type.blank?
Expand Down
Loading

0 comments on commit 66cfc60

Please sign in to comment.