diff --git a/Gemfile b/Gemfile index 4acc528..0a2f8bd 100644 --- a/Gemfile +++ b/Gemfile @@ -23,6 +23,7 @@ group :assets do gem 'angularjs-rails' end gem 'jquery-tokeninput-rails' + gem 'angular-ui-bootstrap-rails' group :development do gem "better_errors" diff --git a/Gemfile.lock b/Gemfile.lock index 4183176..c23b6eb 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -38,6 +38,7 @@ GEM activesupport (3.2.12) i18n (~> 0.6) multi_json (~> 1.0) + angular-ui-bootstrap-rails (0.3.0.1) angularjs-rails (1.0.7) arel (3.0.2) bcrypt-ruby (3.1.0) @@ -150,6 +151,7 @@ PLATFORMS ruby DEPENDENCIES + angular-ui-bootstrap-rails angularjs-rails better_errors coffee-rails (~> 3.2.1) diff --git a/app/assets/javascripts/call_lists.js.coffee b/app/assets/javascripts/call_lists.js.coffee new file mode 100644 index 0000000..7615679 --- /dev/null +++ b/app/assets/javascripts/call_lists.js.coffee @@ -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/ diff --git a/app/assets/javascripts/search/application.js b/app/assets/javascripts/search/application.js index bea3fce..a9ae7de 100644 --- a/app/assets/javascripts/search/application.js +++ b/app/assets/javascripts/search/application.js @@ -1,5 +1,6 @@ //= require jquery //= require angular //= require angular-resource +//= require angular-ui-bootstrap //= require jquery_ujs //= require jquery.tokeninput diff --git a/app/assets/javascripts/search/search.js.coffee b/app/assets/javascripts/search/search.js.coffee index db82c50..79c87d4 100644 --- a/app/assets/javascripts/search/search.js.coffee +++ b/app/assets/javascripts/search/search.js.coffee @@ -1,10 +1,5 @@ - $(document).ready -> - checked = true - $("#selectAll").click () -> - if(checked) - $("#search_result input[type=checkbox]").attr("checked","checked") - else - $("#search_result input[type=checkbox]:checked").removeAttr("checked") - checked= !checked - false - +$(document).ready -> + $("#keywords").tokenInput(window.tags,theme:"facebook", preventDuplicates:true) + $("#keywords").change () -> + $("#keywords").trigger('input'); + diff --git a/app/assets/javascripts/shortlists.js.coffee b/app/assets/javascripts/shortlists.js.coffee new file mode 100644 index 0000000..7615679 --- /dev/null +++ b/app/assets/javascripts/shortlists.js.coffee @@ -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/ diff --git a/app/assets/stylesheets/call_lists.css.scss b/app/assets/stylesheets/call_lists.css.scss new file mode 100644 index 0000000..db3c884 --- /dev/null +++ b/app/assets/stylesheets/call_lists.css.scss @@ -0,0 +1,3 @@ +// Place all the styles related to the call_lists controller here. +// They will automatically be included in application.css. +// You can use Sass (SCSS) here: http://sass-lang.com/ diff --git a/app/assets/stylesheets/search/custom.css b/app/assets/stylesheets/search/custom.css index e5a408d..64a0ae7 100644 --- a/app/assets/stylesheets/search/custom.css +++ b/app/assets/stylesheets/search/custom.css @@ -40,7 +40,6 @@ line-height: 18px; .key-search{ margin-top: 100px; margin-bottom: 10px; - padd } .display_result{ background: #ddd; @@ -67,10 +66,9 @@ font-size: 14px; height: 500px; outline: #eee solid 1px; margin-left: 5px; - width: 315px; height: 500px; - overflow-y: scroll; - overflow-x: hidden; + overflow-y: auto; + overflow-x:hidden; } .candidate-list-box span,.candidate-list span,.NameDiv span{ display: block; @@ -122,12 +120,12 @@ font-size: 14px; outline: #eee solid 1px; } .QV-content,.edit-content{ - margin: 10px 0px 25px 0px; + padding: 20px 15px 25px 15px; position: relative; } .innerDiv{ - padding:5px 0px 0px 0px; - display: block; +padding: 0px 0px 0px 15px; + } .bold{ font-weight: bold; @@ -159,4 +157,10 @@ filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#8cc1d3', end width: auto !important; } .new-note-form{ display: none; -} \ No newline at end of file +} + +.notes_date{color: #0088cc; +margin-bottom: 0px;} + +.notes_note{text-indent: 20px; +margin-bottom: 15px;} \ No newline at end of file diff --git a/app/assets/stylesheets/shortlists.css.scss b/app/assets/stylesheets/shortlists.css.scss new file mode 100644 index 0000000..3920be3 --- /dev/null +++ b/app/assets/stylesheets/shortlists.css.scss @@ -0,0 +1,3 @@ +// Place all the styles related to the shortlists controller here. +// They will automatically be included in application.css. +// You can use Sass (SCSS) here: http://sass-lang.com/ diff --git a/app/controllers/call_lists_controller.rb b/app/controllers/call_lists_controller.rb new file mode 100644 index 0000000..c043260 --- /dev/null +++ b/app/controllers/call_lists_controller.rb @@ -0,0 +1,4 @@ +class CallListsController < ApplicationController + def index + end +end diff --git a/app/controllers/candidates_controller.rb b/app/controllers/candidates_controller.rb index c88a9c3..2d8d473 100644 --- a/app/controllers/candidates_controller.rb +++ b/app/controllers/candidates_controller.rb @@ -31,7 +31,7 @@ def show def search @result = [] - @candidates = current_team.candidates + @candidates = current_team.candidates.order("first_name") if params[:query] tag_ids = params[:query].split(",").map{ |t| t.to_i }.uniq @tags = Tag.includes(:candidates).where(:id=> tag_ids) diff --git a/app/controllers/shortlists_controller.rb b/app/controllers/shortlists_controller.rb new file mode 100644 index 0000000..9202397 --- /dev/null +++ b/app/controllers/shortlists_controller.rb @@ -0,0 +1,27 @@ +class ShortlistsController < ApplicationController + def create + @call_list = params[:call_list_id] ? CallList.find(params[:call_list_id]) : current_user.call_lists.create(:name=>params[:name]) + candidate_ids = params[:candidate_ids].split(",").map{|id| id.to_i} + candidate_ids.each do |id| + @call_list.shortlists.create(:candidate_id=>id) + end + respond_to do |f| + f.html + f.json { render :json=> @call_list.to_json} + end + end + + def bulk_update + @call_list = CallList.find(params[:call_list_id]) + candidate_ids = params[:candidate_ids].split(",").map{|id| id.to_i} + call_list_ids = @call_list.shortlists.map(&:id) + remaining_ids = candidate_ids - call_list_ids + remaining_ids.each do |id| + @call_list.shortlists.create(:candidate_id=>id) + end + respond_to do |f| + f.html + f.json { render :json=> {"count"=>remaining_ids.count}.to_json} + end + end +end diff --git a/app/helpers/call_lists_helper.rb b/app/helpers/call_lists_helper.rb new file mode 100644 index 0000000..43b5b8a --- /dev/null +++ b/app/helpers/call_lists_helper.rb @@ -0,0 +1,2 @@ +module CallListsHelper +end diff --git a/app/helpers/candidates_helper.rb b/app/helpers/candidates_helper.rb index 0e89039..6f38f47 100644 --- a/app/helpers/candidates_helper.rb +++ b/app/helpers/candidates_helper.rb @@ -3,4 +3,7 @@ def get_tags tags = Tag.all.map{|tag| { "id"=>tag.id,"name"=>tag.name} } raw tags.to_json end + def get_call_list + raw current_user.call_lists.to_json + end end diff --git a/app/helpers/shortlists_helper.rb b/app/helpers/shortlists_helper.rb new file mode 100644 index 0000000..d27ad50 --- /dev/null +++ b/app/helpers/shortlists_helper.rb @@ -0,0 +1,2 @@ +module ShortlistsHelper +end diff --git a/app/models/candidate.rb b/app/models/candidate.rb index a902b3e..3ed50fa 100644 --- a/app/models/candidate.rb +++ b/app/models/candidate.rb @@ -15,6 +15,8 @@ class Candidate < ActiveRecord::Base has_many :notes belongs_to :user belongs_to :team + has_many :shortlists + delegate :name, :to=>:user, :prefix=>true has_and_belongs_to_many :tags attr_reader :get_tags, :profile_pic_url,:get_notes def as_json options={} @@ -36,7 +38,9 @@ def as_json options={} linked_in: self.linked_in, facebook: self.facebook, twitter: self.twitter, - notes: self.get_notes + notes: self.get_notes, + resume: self.resume, + added_by: self.user_name } # options ||= {} # options[:methods] = ((options[:methods] || []) + [:get_tags,:profile_pic_url]) diff --git a/app/models/note.rb b/app/models/note.rb index acfb8fc..f8d02c9 100644 --- a/app/models/note.rb +++ b/app/models/note.rb @@ -2,4 +2,12 @@ class Note < ActiveRecord::Base attr_accessible :creater_id, :candidate_note, :candidate_id belongs_to :candidate belongs_to :creater, :class_name=>"User", :foreign_key=>"creater_id" + def as_json(options={}) + { + id: self.id, + date: self.created_at.strftime("%m/%d/%Y"), + candidate_note: self.candidate_note, + candidate_id: self.candidate_id + } + end end diff --git a/app/models/shortlist.rb b/app/models/shortlist.rb index 8538db6..f946110 100644 --- a/app/models/shortlist.rb +++ b/app/models/shortlist.rb @@ -1,4 +1,5 @@ class Shortlist < ActiveRecord::Base attr_accessible :candidate_id, :status, :call_list_id belongs_to :call_list + belongs_to :candidate end diff --git a/app/models/user.rb b/app/models/user.rb index 986c74d..6b290b6 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -7,8 +7,11 @@ class User < ActiveRecord::Base # Setup accessible (or protected) attributes for your model attr_accessible :email, :password, :password_confirmation, :remember_me, :first_name, :last_name, :company, - :user_type, :status, :team_id, :plan_id, :register_type - attr_accessor :plan_id, :register_type + :user_type, :status, :team_id, :plan_id, :register_type,:name + attr_accessor :plan_id, :register_type, :name + def name + "#{first_name.to_s} #{last_name.to_s}" + end after_create :create_team # attr_accessible :title, :body belongs_to :team diff --git a/app/views/candidates/search.html.erb b/app/views/candidates/search.html.erb index 4217ef5..9628cdd 100644 --- a/app/views/candidates/search.html.erb +++ b/app/views/candidates/search.html.erb @@ -1,204 +1,241 @@
-