Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

school selector #3

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
source 'http://rubygems.org'
#source 'http://rubygems.org'
source 'http://ruby.taobao.org'



gem 'rails', '3.1.1'
gem 'haml'
Expand Down Expand Up @@ -45,10 +48,14 @@ gem 'thin'
group :production do
# gems specifically for Heroku go here
gem "heroku"
gem "pg"
# gem "pg"
end
gem "erb2haml", :group => :development
gem "faker"

# just for read excel file
gem "roo"

# Use unicorn as the web server
# gem 'unicorn'

Expand Down
34 changes: 31 additions & 3 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ GIT
actionpack (~> 3.0)

GEM
remote: http://rubygems.org/
remote: http://ruby.taobao.org/
specs:
actionmailer (3.1.1)
actionpack (= 3.1.1)
Expand Down Expand Up @@ -73,6 +73,7 @@ GEM
bson_ext (1.5.2)
bson (= 1.5.2)
builder (3.0.0)
choice (0.1.6)
cocaine (0.2.1)
coffee-rails (3.1.1)
coffee-script (>= 2.2.0)
Expand Down Expand Up @@ -100,9 +101,17 @@ GEM
execjs (1.2.13)
multi_json (~> 1.0)
faker (0.3.1)
faraday (0.8.0)
multipart-post (~> 1.1)
formtastic-bootstrap (1.1.2)
formtastic
rails (~> 3.1.0)
google-spreadsheet-ruby (0.3.0)
google_drive (>= 0.3.0)
google_drive (0.3.0)
nokogiri (>= 1.4.4, != 1.5.1, != 1.5.2)
oauth (>= 0.3.6)
oauth2 (>= 0.5.0)
haml (3.1.4)
heroku (2.17.0)
launchy (>= 0.3.2)
Expand All @@ -114,6 +123,7 @@ GEM
httparty (0.8.1)
multi_json
multi_xml
httpauth (0.1)
i18n (0.6.0)
jquery-rails (1.0.19)
railties (~> 3.0)
Expand All @@ -127,6 +137,7 @@ GEM
addressable (~> 2.2.6)
letter_opener (0.0.2)
launchy
log4r (1.1.10)
mail (2.3.0)
i18n (>= 0.4.0)
mime-types (~> 1.16)
Expand All @@ -147,15 +158,20 @@ GEM
unicode_utils (~> 1.0.0)
multi_json (1.0.4)
multi_xml (0.4.1)
multipart-post (1.1.5)
nifty-generators (0.4.6)
nokogiri (1.5.0)
oauth (0.4.6)
oauth2 (0.6.0)
faraday (~> 0.7)
httpauth (~> 0.1)
multi_json (~> 1.0)
orm_adapter (0.0.6)
paperclip (2.5.0)
activerecord (>= 2.3.0)
activesupport (>= 2.3.2)
cocaine (>= 0.0.2)
mime-types
pg (0.12.2)
polyglot (0.3.3)
rack (1.3.6)
rack-cache (1.1)
Expand Down Expand Up @@ -186,6 +202,14 @@ GEM
json (~> 1.4)
rest-client (1.6.7)
mime-types (>= 1.16)
roo (1.10.1)
choice (>= 0.1.4)
google-spreadsheet-ruby (>= 0.1.5)
nokogiri (>= 1.5.0)
rubyzip (>= 0.9.4)
spreadsheet (> 0.6.4)
todonotes (>= 0.1.0)
ruby-ole (1.2.11.3)
ruby_parser (2.3.1)
sexp_processor (~> 3.0)
rubyzip (0.9.5)
Expand All @@ -197,6 +221,8 @@ GEM
tilt (~> 1.3.2)
seedbank (0.0.7)
sexp_processor (3.0.10)
spreadsheet (0.7.1)
ruby-ole (>= 1.0)
sprockets (2.0.3)
hike (~> 1.2)
rack (~> 1.0)
Expand All @@ -209,6 +235,8 @@ GEM
rack (>= 1.0.0)
thor (0.14.6)
tilt (1.3.3)
todonotes (0.1.0)
log4r
treetop (1.4.10)
polyglot
polyglot (>= 0.3.1)
Expand Down Expand Up @@ -250,8 +278,8 @@ DEPENDENCIES
mongoid_fulltext
nested_form!
nifty-generators
pg
rails (= 3.1.1)
roo
sass-rails (~> 3.1.0)
seedbank
simple_enum!
Expand Down
28 changes: 28 additions & 0 deletions app/assets/javascripts/ind_users.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
var IndUsers = {
completeSchoolToEducation : function() {
// must use on() to dynamic generate element
$(document).on('keydown.autocomplete', '.autocomplete_school', function(){
$(this).autocomplete('/ind_users/school_search', {
scroll: false,
minChars: 1,
delay: 300,
selectFirst : true
}).result(function(event, item, fomatted) {
var schoolName = $(fomatted).attr("data");
$(this).closest(".span6").find(".school_field").val(schoolName);
$(this).val(schoolName);
$(this).replaceWith("<span>" + schoolName + " <a onclick='IndUsers.resetEducationSchool(this, \""+ schoolName +"\");' class='reset_school' href='javascript:;'>X</a></span>");
return false;
});
});
},

resetEducationSchool : function(el, schoolName){
$(el).parent().replaceWith("<input type='text' name='school' class='autocomplete_school' value='"+ schoolName +"'/>");
},

load : function(){
IndUsers.completeSchoolToEducation();
}

}
Loading