From 9745f00825920a930198331f48bfaa8038ba006a Mon Sep 17 00:00:00 2001 From: Justin Grevich Date: Thu, 18 Apr 2013 00:11:43 -0700 Subject: [PATCH] initial import from svn --- .gitignore | 15 +- .ruby-gemset | 1 + .ruby-version | 1 + Capfile | 4 + Gemfile | 68 ++ Gemfile.lock | 221 +++++ README.md | 4 +- Rakefile | 7 + app/assets/images/rails.png | Bin 0 -> 6646 bytes .../javascripts/academic_records.js.coffee | 0 app/assets/javascripts/application.js | 18 + .../javascripts/recommendations.js.coffee | 3 + .../javascripts/registrations.js.coffee | 36 + .../stylesheets/academic_records.css.scss | 3 + app/assets/stylesheets/application.css | 14 + .../stylesheets/recommendations.css.scss | 3 + app/assets/stylesheets/reuman.css.scss | 78 ++ .../applicants/academic_records_controller.rb | 19 + .../applicants/confirmations_controller.rb | 43 + .../applicants/recommendations_controller.rb | 18 + .../applicants/recommenders_controller.rb | 20 + .../applicants/registrations_controller.rb | 128 +++ .../applicants/sessions_controller.rb | 40 + app/controllers/application_controller.rb | 21 + app/controllers/users/sessions_controller.rb | 17 + app/controllers/welcome_controller.rb | 7 + app/helpers/academic_records_helper.rb | 10 + app/helpers/application_helper.rb | 115 +++ app/helpers/recommendations_helper.rb | 2 + app/mailers/.gitkeep | 0 app/models/.gitkeep | 0 app/models/academic_record.rb | 11 + app/models/address.rb | 10 + app/models/applicant.rb | 44 + app/models/award.rb | 8 + app/models/recommendation.rb | 6 + app/models/recommender.rb | 15 + app/models/user.rb | 11 + .../academic_records/_award_fields.html.erb | 32 + .../academic_records/_record_fields.html.erb | 67 ++ .../applicants/academic_records/edit.html.erb | 82 ++ .../applicants/confirmations/new.html.erb | 16 + app/views/applicants/passwords/edit.html.erb | 18 + .../recommenders/_recommender_fields.html.erb | 66 ++ .../applicants/recommenders/edit.html.erb | 57 ++ .../registrations/_address_fields.html.erb | 52 ++ .../applicants/registrations/edit.html.erb | 139 +++ .../applicants/registrations/new.html.erb | 37 + .../applicants/registrations/status.html.erb | 46 + app/views/applicants/sessions/new.html.erb | 18 + app/views/applicants/shared/_links.erb | 27 + app/views/applicants/unlocks/new.html.erb | 14 + .../mailer/confirmation_instructions.html.erb | 5 + .../reset_password_instructions.html.erb | 8 + .../mailer/unlock_instructions.html.erb | 7 + app/views/devise/passwords/new.html.erb | 14 + app/views/devise/sessions/new.html.erb | 20 + app/views/layouts/_flash.html.haml | 0 app/views/layouts/_footer_text.html.erb | 7 + app/views/layouts/_footer_text_long.html.erb | 6 + app/views/layouts/_header.html.haml | 4 + app/views/layouts/_navbar.html.haml | 64 ++ app/views/layouts/application.html.haml | 22 + app/views/recommendations/edit.html.erb | 2 + app/views/users/sessions/new.html.erb | 25 + app/views/welcome/_aside_text.html.erb | 15 + app/views/welcome/closed.html.erb | 4 + app/views/welcome/index.html.haml | 15 + config.ru | 4 + config/application.rb | 67 ++ config/boot.rb | 6 + config/deploy.rb | 35 + config/environment.rb | 5 + config/environments/development.rb | 39 + config/environments/production.rb | 71 ++ config/environments/test.rb | 39 + config/initializers/backtrace_silencers.rb | 7 + config/initializers/devise.rb | 232 +++++ config/initializers/inflections.rb | 15 + config/initializers/mime_types.rb | 5 + config/initializers/rails_admin.rb | 179 ++++ config/initializers/rails_admin.rb.example | 164 ++++ config/initializers/secret_token.rb | 7 + config/initializers/session_store.rb | 8 + config/initializers/trusted_proxies.rb | 1 + config/initializers/wrap_parameters.rb | 14 + config/locales/devise.en.yml | 59 ++ config/locales/en.yml | 5 + config/routes.rb | 83 ++ config/setup_load_paths.rb | 14 + .../20120923015412_devise_create_users.rb | 46 + ...20120923015419_devise_create_applicants.rb | 69 ++ ...5827_create_rails_admin_histories_table.rb | 18 + db/migrate/20121122074515_create_addresses.rb | 17 + .../20121126032545_create_academic_records.rb | 17 + db/migrate/20121126220714_create_awards.rb | 12 + .../20121217005021_create_recommenders.rb | 17 + .../20121217025345_create_recommendations.rb | 15 + db/schema.rb | 163 ++++ db/seeds.rb | 13 + doc/README_FOR_APP | 2 + lib/assets/.gitkeep | 0 lib/tasks/.gitkeep | 0 public/404.html | 26 + public/422.html | 26 + public/500.html | 25 + public/favicon.ico | 0 public/robots.txt | 5 + script/rails | 6 + .../academic_records_controller_spec.rb | 5 + .../confirmations_controller_spec.rb | 5 + .../recommendations_controller_spec.rb | 5 + .../registrations_controller_spec.rb | 5 + .../applicants/sessions_controller_spec.rb | 5 + .../application_controller_spec.rb | 5 + .../users/sessions_controller_spec.rb | 5 + spec/controllers/welcome_controller_spec.rb | 5 + spec/helpers/academic_records_helper_spec.rb | 5 + spec/helpers/application_helper_spec.rb | 5 + spec/helpers/recommendations_helper_spec.rb | 5 + spec/models/academic_record_spec.rb | 6 + spec/models/address_spec.rb | 5 + spec/models/applicant_spec.rb | 5 + spec/models/award_spec.rb | 5 + spec/models/recommendation_spec.rb | 5 + spec/models/recommender_spec.rb | 5 + spec/models/user_spec.rb | 5 + spec/requests/pages_spec.rb | 22 + vendor/assets/javascripts/.gitkeep | 0 .../javascripts/bootstrap-datepicker.js | 850 ++++++++++++++++++ vendor/assets/stylesheets/.gitkeep | 0 vendor/plugins/.gitkeep | 0 132 files changed, 4400 insertions(+), 9 deletions(-) create mode 100644 .ruby-gemset create mode 100644 .ruby-version create mode 100644 Capfile create mode 100644 Gemfile create mode 100644 Gemfile.lock create mode 100644 Rakefile create mode 100644 app/assets/images/rails.png create mode 100644 app/assets/javascripts/academic_records.js.coffee create mode 100644 app/assets/javascripts/application.js create mode 100644 app/assets/javascripts/recommendations.js.coffee create mode 100644 app/assets/javascripts/registrations.js.coffee create mode 100644 app/assets/stylesheets/academic_records.css.scss create mode 100644 app/assets/stylesheets/application.css create mode 100644 app/assets/stylesheets/recommendations.css.scss create mode 100644 app/assets/stylesheets/reuman.css.scss create mode 100644 app/controllers/applicants/academic_records_controller.rb create mode 100644 app/controllers/applicants/confirmations_controller.rb create mode 100644 app/controllers/applicants/recommendations_controller.rb create mode 100644 app/controllers/applicants/recommenders_controller.rb create mode 100644 app/controllers/applicants/registrations_controller.rb create mode 100644 app/controllers/applicants/sessions_controller.rb create mode 100644 app/controllers/application_controller.rb create mode 100644 app/controllers/users/sessions_controller.rb create mode 100644 app/controllers/welcome_controller.rb create mode 100644 app/helpers/academic_records_helper.rb create mode 100644 app/helpers/application_helper.rb create mode 100644 app/helpers/recommendations_helper.rb create mode 100644 app/mailers/.gitkeep create mode 100644 app/models/.gitkeep create mode 100644 app/models/academic_record.rb create mode 100644 app/models/address.rb create mode 100644 app/models/applicant.rb create mode 100644 app/models/award.rb create mode 100644 app/models/recommendation.rb create mode 100644 app/models/recommender.rb create mode 100644 app/models/user.rb create mode 100644 app/views/applicants/academic_records/_award_fields.html.erb create mode 100644 app/views/applicants/academic_records/_record_fields.html.erb create mode 100644 app/views/applicants/academic_records/edit.html.erb create mode 100644 app/views/applicants/confirmations/new.html.erb create mode 100644 app/views/applicants/passwords/edit.html.erb create mode 100644 app/views/applicants/recommenders/_recommender_fields.html.erb create mode 100644 app/views/applicants/recommenders/edit.html.erb create mode 100644 app/views/applicants/registrations/_address_fields.html.erb create mode 100644 app/views/applicants/registrations/edit.html.erb create mode 100644 app/views/applicants/registrations/new.html.erb create mode 100644 app/views/applicants/registrations/status.html.erb create mode 100644 app/views/applicants/sessions/new.html.erb create mode 100644 app/views/applicants/shared/_links.erb create mode 100644 app/views/applicants/unlocks/new.html.erb create mode 100644 app/views/devise/mailer/confirmation_instructions.html.erb create mode 100644 app/views/devise/mailer/reset_password_instructions.html.erb create mode 100644 app/views/devise/mailer/unlock_instructions.html.erb create mode 100644 app/views/devise/passwords/new.html.erb create mode 100644 app/views/devise/sessions/new.html.erb create mode 100644 app/views/layouts/_flash.html.haml create mode 100644 app/views/layouts/_footer_text.html.erb create mode 100644 app/views/layouts/_footer_text_long.html.erb create mode 100644 app/views/layouts/_header.html.haml create mode 100644 app/views/layouts/_navbar.html.haml create mode 100644 app/views/layouts/application.html.haml create mode 100644 app/views/recommendations/edit.html.erb create mode 100644 app/views/users/sessions/new.html.erb create mode 100644 app/views/welcome/_aside_text.html.erb create mode 100644 app/views/welcome/closed.html.erb create mode 100644 app/views/welcome/index.html.haml create mode 100644 config.ru create mode 100644 config/application.rb create mode 100644 config/boot.rb create mode 100644 config/deploy.rb create mode 100644 config/environment.rb create mode 100644 config/environments/development.rb create mode 100644 config/environments/production.rb create mode 100644 config/environments/test.rb create mode 100644 config/initializers/backtrace_silencers.rb create mode 100644 config/initializers/devise.rb create mode 100644 config/initializers/inflections.rb create mode 100644 config/initializers/mime_types.rb create mode 100644 config/initializers/rails_admin.rb create mode 100644 config/initializers/rails_admin.rb.example create mode 100644 config/initializers/secret_token.rb create mode 100644 config/initializers/session_store.rb create mode 100644 config/initializers/trusted_proxies.rb create mode 100644 config/initializers/wrap_parameters.rb create mode 100644 config/locales/devise.en.yml create mode 100644 config/locales/en.yml create mode 100644 config/routes.rb create mode 100644 config/setup_load_paths.rb create mode 100644 db/migrate/20120923015412_devise_create_users.rb create mode 100644 db/migrate/20120923015419_devise_create_applicants.rb create mode 100644 db/migrate/20120923015827_create_rails_admin_histories_table.rb create mode 100644 db/migrate/20121122074515_create_addresses.rb create mode 100644 db/migrate/20121126032545_create_academic_records.rb create mode 100644 db/migrate/20121126220714_create_awards.rb create mode 100644 db/migrate/20121217005021_create_recommenders.rb create mode 100644 db/migrate/20121217025345_create_recommendations.rb create mode 100644 db/schema.rb create mode 100644 db/seeds.rb create mode 100644 doc/README_FOR_APP create mode 100644 lib/assets/.gitkeep create mode 100644 lib/tasks/.gitkeep create mode 100644 public/404.html create mode 100644 public/422.html create mode 100644 public/500.html create mode 100644 public/favicon.ico create mode 100644 public/robots.txt create mode 100755 script/rails create mode 100644 spec/controllers/applicants/academic_records_controller_spec.rb create mode 100644 spec/controllers/applicants/confirmations_controller_spec.rb create mode 100644 spec/controllers/applicants/recommendations_controller_spec.rb create mode 100644 spec/controllers/applicants/registrations_controller_spec.rb create mode 100644 spec/controllers/applicants/sessions_controller_spec.rb create mode 100644 spec/controllers/application_controller_spec.rb create mode 100644 spec/controllers/users/sessions_controller_spec.rb create mode 100644 spec/controllers/welcome_controller_spec.rb create mode 100644 spec/helpers/academic_records_helper_spec.rb create mode 100644 spec/helpers/application_helper_spec.rb create mode 100644 spec/helpers/recommendations_helper_spec.rb create mode 100644 spec/models/academic_record_spec.rb create mode 100644 spec/models/address_spec.rb create mode 100644 spec/models/applicant_spec.rb create mode 100644 spec/models/award_spec.rb create mode 100644 spec/models/recommendation_spec.rb create mode 100644 spec/models/recommender_spec.rb create mode 100644 spec/models/user_spec.rb create mode 100644 spec/requests/pages_spec.rb create mode 100644 vendor/assets/javascripts/.gitkeep create mode 100644 vendor/assets/javascripts/bootstrap-datepicker.js create mode 100644 vendor/assets/stylesheets/.gitkeep create mode 100644 vendor/plugins/.gitkeep diff --git a/.gitignore b/.gitignore index 54cb8bbb..b6f67370 100644 --- a/.gitignore +++ b/.gitignore @@ -1,16 +1,17 @@ *.rbc *.sassc +.rvmrc .sass-cache capybara-*.html .rspec + /.bundle -/vendor/bundle -/log/* -/tmp/* +/config/application.yml +/config/database.yml +/coverage/ /db/*.sqlite3 +/log /public/system/* -/coverage/ /spec/tmp/* -**.orig -rerun.txt -pickle-email-*.html \ No newline at end of file +/tmp/* +/vendor/bundle \ No newline at end of file diff --git a/.ruby-gemset b/.ruby-gemset new file mode 100644 index 00000000..949e5cf7 --- /dev/null +++ b/.ruby-gemset @@ -0,0 +1 @@ +reu3 diff --git a/.ruby-version b/.ruby-version new file mode 100644 index 00000000..2aaf2528 --- /dev/null +++ b/.ruby-version @@ -0,0 +1 @@ +ruby-1.9.3-p392 diff --git a/Capfile b/Capfile new file mode 100644 index 00000000..b46fd05d --- /dev/null +++ b/Capfile @@ -0,0 +1,4 @@ +load 'deploy' +# Uncomment if you are using Rails' asset pipeline +load 'deploy/assets' +load 'config/deploy' # remove this line to skip loading any of the default tasks \ No newline at end of file diff --git a/Gemfile b/Gemfile new file mode 100644 index 00000000..479c3cb5 --- /dev/null +++ b/Gemfile @@ -0,0 +1,68 @@ +if RUBY_VERSION =~ /1.9/ + Encoding.default_external = Encoding::UTF_8 + Encoding.default_internal = Encoding::UTF_8 +end + +source 'http://rubygems.org' +source 'http://gems.github.com' + +gem 'rails', '~>3.2.12' + +gem 'aasm' +gem 'carmen' +gem 'capistrano' +# gem 'capistrano-database', :git => "git://github.com/jgrevich/capistrano-database.git" +gem 'rvm-capistrano' + +gem 'devise' +#gem 'exception_notification', :require => 'exception_notifier' +gem 'figaro' +gem 'formtastic' +gem 'haml' +gem 'jquery-rails' +gem 'kaminari' +gem 'mysql2' +gem 'paperclip' +gem 'rails_admin' + +# Use unicorn as the web server +# gem 'unicorn' + +# To use debugger (ruby-debug for Ruby 1.8.7+, ruby-debug19 for Ruby 1.9.2+) +# gem 'ruby-debug' +# gem 'ruby-debug19', :require => 'ruby-debug' + +# Bundle the extra gems: +# gem 'bj' +# gem 'nokogiri' +# gem 'sqlite3-ruby', :require => 'sqlite3' +# gem 'aws-s3', :require => 'aws/s3' + +# Bundle gems for the local environment. Make sure to +# put test-only gems in this group so their generators +# and rake tasks are available in development mode: +# group :development, :test do +# gem 'webrat' +# end + +group :development, :test do +# gem 'bond' + gem 'bundler' + gem 'map_by_method' +# gem 'mocha' + gem 'what_methods' + gem 'wirble' +end + +# Gems used only for assets and not required +# in production environments by default. +group :assets do + gem 'bootstrap-sass', '~> 2.1.0.0' + gem 'bootstrap-datepicker-rails', :require => 'bootstrap-datepicker-rails', :git => 'git://github.com/Nerian/bootstrap-datepicker-rails.git' + gem 'coffee-rails', " ~> 3.2.0" + gem 'libv8', '~> 3.11.8' + gem 'sass-rails', " ~> 3.2.0" + gem 'font-awesome-sass-rails' + gem 'uglifier' + gem 'therubyracer' +end diff --git a/Gemfile.lock b/Gemfile.lock new file mode 100644 index 00000000..7fdc20c7 --- /dev/null +++ b/Gemfile.lock @@ -0,0 +1,221 @@ +GIT + remote: git://github.com/Nerian/bootstrap-datepicker-rails.git + revision: 4dbdbc405229725ab800daa14b2a74878214f58b + specs: + bootstrap-datepicker-rails (1.0.0.4) + railties (>= 3.0) + +GEM + remote: http://rubygems.org/ + remote: http://gems.github.com/ + specs: + aasm (3.0.16) + actionmailer (3.2.13) + actionpack (= 3.2.13) + mail (~> 2.5.3) + actionpack (3.2.13) + activemodel (= 3.2.13) + activesupport (= 3.2.13) + builder (~> 3.0.0) + erubis (~> 2.7.0) + journey (~> 1.0.4) + rack (~> 1.4.5) + rack-cache (~> 1.2) + rack-test (~> 0.6.1) + sprockets (~> 2.2.1) + activemodel (3.2.13) + activesupport (= 3.2.13) + builder (~> 3.0.0) + activerecord (3.2.13) + activemodel (= 3.2.13) + activesupport (= 3.2.13) + arel (~> 3.0.2) + tzinfo (~> 0.3.29) + activeresource (3.2.13) + activemodel (= 3.2.13) + activesupport (= 3.2.13) + activesupport (3.2.13) + i18n (= 0.6.1) + multi_json (~> 1.0) + arel (3.0.2) + bcrypt-ruby (3.0.1) + bootstrap-sass (2.1.0.1) + builder (3.0.4) + capistrano (2.14.2) + highline + net-scp (>= 1.0.0) + net-sftp (>= 2.0.0) + net-ssh (>= 2.0.14) + net-ssh-gateway (>= 1.1.0) + carmen (0.2.13) + climate_control (0.0.3) + activesupport (>= 3.0) + cocaine (0.5.1) + climate_control (>= 0.0.3, < 1.0) + coffee-rails (3.2.2) + coffee-script (>= 2.2.0) + railties (~> 3.2.0) + coffee-script (2.2.0) + coffee-script-source + execjs + coffee-script-source (1.6.2) + devise (2.2.3) + bcrypt-ruby (~> 3.0) + orm_adapter (~> 0.1) + railties (~> 3.1) + warden (~> 1.2.1) + erubis (2.7.0) + execjs (1.4.0) + multi_json (~> 1.0) + figaro (0.6.3) + bundler (~> 1.0) + rails (>= 3, < 5) + font-awesome-sass-rails (3.0.2.2) + railties (>= 3.1.1) + sass-rails (>= 3.1.1) + formtastic (2.2.1) + actionpack (>= 3.0) + haml (3.1.8) + highline (1.6.18) + hike (1.2.2) + i18n (0.6.1) + journey (1.0.4) + jquery-rails (2.2.1) + railties (>= 3.0, < 5.0) + thor (>= 0.14, < 2.0) + jquery-ui-rails (3.0.1) + jquery-rails + railties (>= 3.1.0) + json (1.7.7) + kaminari (0.14.1) + actionpack (>= 3.0.0) + activesupport (>= 3.0.0) + libv8 (3.11.8.17) + mail (2.5.3) + i18n (>= 0.4.0) + mime-types (~> 1.16) + treetop (~> 1.4.8) + map_by_method (0.8.3) + mime-types (1.22) + multi_json (1.7.2) + mysql2 (0.3.11) + nested_form (0.3.2) + net-scp (1.1.0) + net-ssh (>= 2.6.5) + net-sftp (2.1.1) + net-ssh (>= 2.6.5) + net-ssh (2.6.7) + net-ssh-gateway (1.2.0) + net-ssh (>= 2.6.5) + nokogiri (1.5.9) + orm_adapter (0.4.0) + paperclip (3.4.1) + activemodel (>= 3.0.0) + activerecord (>= 3.0.0) + activesupport (>= 3.0.0) + cocaine (~> 0.5.0) + mime-types + polyglot (0.3.3) + rack (1.4.5) + rack-cache (1.2) + rack (>= 0.4) + rack-pjax (0.7.0) + nokogiri (~> 1.5) + rack (~> 1.3) + rack-ssl (1.3.3) + rack + rack-test (0.6.2) + rack (>= 1.0) + rails (3.2.13) + actionmailer (= 3.2.13) + actionpack (= 3.2.13) + activerecord (= 3.2.13) + activeresource (= 3.2.13) + activesupport (= 3.2.13) + bundler (~> 1.0) + railties (= 3.2.13) + rails_admin (0.4.2) + bootstrap-sass (~> 2.1) + builder (~> 3.0) + coffee-rails (~> 3.1) + font-awesome-sass-rails (~> 3.0, >= 3.0.0.1) + haml (~> 3.1) + jquery-rails (~> 2.1) + jquery-ui-rails (~> 3.0) + kaminari (~> 0.14) + nested_form (~> 0.2) + rack-pjax (~> 0.6) + rails (~> 3.1) + remotipart (~> 1.0) + sass-rails (~> 3.1) + railties (3.2.13) + actionpack (= 3.2.13) + activesupport (= 3.2.13) + rack-ssl (~> 1.3.2) + rake (>= 0.8.7) + rdoc (~> 3.4) + thor (>= 0.14.6, < 2.0) + rake (10.0.4) + rdoc (3.12.2) + json (~> 1.4) + ref (1.0.4) + remotipart (1.0.5) + rvm-capistrano (1.3.0) + capistrano (>= 2.0.0) + sass (3.2.7) + sass-rails (3.2.6) + railties (~> 3.2.0) + sass (>= 3.1.10) + tilt (~> 1.3) + sprockets (2.2.2) + hike (~> 1.2) + multi_json (~> 1.0) + rack (~> 1.0) + tilt (~> 1.1, != 1.3.0) + therubyracer (0.11.4) + libv8 (~> 3.11.8.12) + ref + thor (0.18.1) + tilt (1.3.7) + treetop (1.4.12) + polyglot + polyglot (>= 0.3.1) + tzinfo (0.3.37) + uglifier (2.0.1) + execjs (>= 0.3.0) + multi_json (~> 1.0, >= 1.0.2) + warden (1.2.1) + rack (>= 1.0) + what_methods (1.0.1) + wirble (0.1.3) + +PLATFORMS + ruby + +DEPENDENCIES + aasm + bootstrap-datepicker-rails! + bootstrap-sass (~> 2.1.0.0) + bundler + capistrano + carmen + coffee-rails (~> 3.2.0) + devise + figaro + font-awesome-sass-rails + formtastic + haml + jquery-rails + kaminari + libv8 (~> 3.11.8) + map_by_method + mysql2 + paperclip + rails (~> 3.2.12) + rails_admin + rvm-capistrano + sass-rails (~> 3.2.0) + therubyracer + uglifier + what_methods + wirble diff --git a/README.md b/README.md index 4ed780fa..c5262d7b 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,8 @@ REU Manager ========== -This program facilitates the application process for science oriented NSF REU programs and is developed by the IT staff of the "UC San Diego Institute of Engineering in Medicine":https://iem.ucsd.edu/ . +This program facilitates the application process for science oriented [NSF REU programs](http://www.nsf.gov/crssprgm/reu/) and is developed by the IT staff of the [UC San Diego Institute of Engineering in Medicine](https://iem.ucsd.edu/). -"REU Manager":https://reumanager.com is built with "Ruby on Rails":http://rubyonrails.org/ and is completely free to host/maintain yourself. You can see a demonstration of the site at: https://reumanager.com/demo . You may login as the administrative user with the email *admin@reumanager.com* and password *DemoApp*. +[REU Manager](https://reumanager.com) is built with [Ruby on Rails](http://rubyonrails.org/) and is completely free to host/maintain yourself. You can see a demonstration of the site at: https://reumanager.com/demo . You may login as the administrative user with the email admin@reumanager.com and the password DemoApp. Below are instructions for those who wish to install and maintain the application using their own equipment. \ No newline at end of file diff --git a/Rakefile b/Rakefile new file mode 100644 index 00000000..fa0bac88 --- /dev/null +++ b/Rakefile @@ -0,0 +1,7 @@ +#!/usr/bin/env rake +# Add your own tasks in files placed in lib/tasks ending in .rake, +# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake. + +require File.expand_path('../config/application', __FILE__) + +Reuman::Application.load_tasks diff --git a/app/assets/images/rails.png b/app/assets/images/rails.png new file mode 100644 index 0000000000000000000000000000000000000000..d5edc04e65f555e3ba4dcdaad39dc352e75b575e GIT binary patch literal 6646 zcmVpVcQya!6@Dsmj@#jv7C*qh zIhOJ6_K0n?*d`*T7TDuW-}m`9Kz3~>+7`DUkbAraU%yi+R{N~~XA2B%zt-4=tLimUer9!2M~N{G5bftFij_O&)a zsHnOppFIzebQ`RA0$!yUM-lg#*o@_O2wf422iLnM6cU(ktYU8#;*G!QGhIy9+ZfzKjLuZo%@a z-i@9A`X%J{^;2q&ZHY3C(B%gqCPW!8{9C0PMcNZccefK){s|V5-xxtHQc@uf>XqhD z7#N^siWqetgq29aX>G^olMf=bbRF6@Y(}zYxw6o!9WBdG1unP}<(V;zKlcR2p86fq zYjaqB^;Ycq>Wy@5T1xOzG3tucG3e%nPvajaN{CrFbnzv^9&K3$NrDm*eQe4`BGQ2bI;dFEwyt>hK%X!L6)82aOZp zsrGcJ#7PoX7)s|~t6is?FfX*7vWdREi58tiY4S)t6u*|kv?J)d_$r+CH#eZ?Ef+I_ z(eVlX8dh~4QP?o*E`_MgaNFIKj*rtN(0Raj3ECjSXcWfd#27NYs&~?t`QZFT}!Zaf=ldZIhi}LhQlqLo+o5(Pvui&{7PD__^53f9j>HW`Q z_V8X5j~$|GP9qXu0C#!@RX2}lXD35@3N5{BkUi%jtaPQ*H6OX2zIz4QPuqmTv3`vG{zc>l3t0B9E75h< z8&twGh%dp7WPNI+tRl%#gf2}Epg8st+~O4GjtwJsXfN;EjAmyr6z5dnaFU(;IV~QK zW62fogF~zA``(Q>_SmD!izc6Y4zq*97|NAPHp1j5X7Op2%;GLYm>^HEMyObo6s7l) zE3n|aOHi5~B84!}b^b*-aL2E)>OEJX_tJ~t<#VJ?bT?lDwyDB&5SZ$_1aUhmAY}#* zs@V1I+c5md9%R-o#_DUfqVtRk>59{+Opd5Yu%dAU#VQW}^m}x-30ftBx#527{^pI4 z6l2C6C7QBG$~NLYb3rVdLD#Z{+SleOp`(Lg5J}`kxdTHe(nV5BdpLrD=l|)e$gEqA zwI6vuX-PFCtcDIH>bGY2dwq&^tf+&R?)nY-@7_j%4CMRAF}C9w%p86W<2!aSY$p+k zrkFtG=cGo38RnrG28;?PNk%7a@faaXq&MS*&?1Z`7Ojw7(#>}ZG4nMAs3VXxfdW>i zY4VX02c5;f7jDPY_7@Oa)CHH}cH<3y#}_!nng^W+h1e-RL*YFYOteC@h?BtJZ+?sE zy)P5^8Mregx{nQaw1NY-|3>{Z)|0`?zc?G2-acYiSU`tj#sSGfm7k86ZQ0SQgPevcklHxM9<~4yW zR796sisf1|!#{Z=e^)0;_8iUhL8g(;j$l=02FTPZ(dZV@s#aQ`DHkLM6=YsbE4iQ!b#*374l0Jw5;jD%J;vQayq=nD8-kHI~f9Ux|32SJUM`> zGp2UGK*4t?cRKi!2he`zI#j0f${I#f-jeT?u_C7S4WsA0)ryi-1L0(@%pa^&g5x=e z=KW9+Nn(=)1T&S8g_ug%dgk*~l2O-$r9#zEGBdQsweO%t*6F4c8JC36JtTizCyy+E4h%G(+ z5>y$%0txMuQ$e~wjFgN(xrAndHQo`Za+K*?gUVDTBV&Ap^}|{w#CIq{DRe}+l@(Ec zCCV6f_?dY_{+f{}6XGn!pL_up?}@>KijT^$w#Lb6iHW&^8RP~g6y=vZBXx~B9nI^i zGexaPjcd(%)zGw!DG_dDwh-7x6+ST#R^${iz_M$uM!da8SxgB_;Z0G%Y*HpvLjKw; zX=ir7i1O$-T|*TBoH$dlW+TLf5j5sep^DlDtkox;Kg{Q%EXWedJq@J@%VAcK)j3y1 zShM!CS#qax;D@RND%2t3W6kv+#Ky0F9<3YKDbV^XJ=^$s(Vtza8V72YY)577nnldI zHMA0PUo!F3j(ubV*CM@PiK<^|RM2(DuCbG7`W}Rg(xdYC>C~ z;1KJGLN&$cRxSZunjXcntykmpFJ7;dk>shY(DdK&3K_JDJ6R%D`e~6Qv67@Rwu+q9 z*|NG{r}4F8f{Dfzt0+cZMd$fvlX3Q`dzM46@r?ISxr;9gBTG2rmfiGOD*#c*3f)cc zF+PFZobY$-^}J8 z%n=h4;x2}cP!@SiVd!v;^Wwo0(N??-ygDr7gG^NKxDjSo{5T{?$|Qo5;8V!~D6O;F*I zuY!gd@+2j_8Rn=UWDa#*4E2auWoGYDddMW7t0=yuC(xLWky?vLimM~!$3fgu!dR>p z?L?!8z>6v$|MsLb&dU?ob)Zd!B)!a*Z2eTE7 zKCzP&e}XO>CT%=o(v+WUY`Az*`9inbTG& z_9_*oQKw;sc8{ipoBC`S4Tb7a%tUE)1fE+~ib$;|(`|4QbXc2>VzFi%1nX%ti;^s3~NIL0R}!!a{0A zyCRp0F7Y&vcP&3`&Dzv5!&#h}F2R-h&QhIfq*ts&qO13{_CP}1*sLz!hI9VoTSzTu zok5pV0+~jrGymE~{TgbS#nN5+*rF7ij)cnSLQw0Ltc70zmk|O!O(kM<3zw-sUvkx~ z2`y+{xAwKSa-0}n7{$I@Zop7CWy%_xIeN1e-7&OjQ6vZZPbZ^3_ z(~=;ZSP98S2oB#35b1~_x`2gWiPdIVddEf`AD9<@c_s)TM;3J$T_l?pr{<7PTgdiy zBc5IGx)g~n=s+Z$RzYCmv8PlJu%gkh^;%mTGMc)UwRINVD~K;`Rl!5@hhGg;y>5qj zq|u-Yf0q_~Y+Mbivkkfa0nAOzB1acnytogsj_m7FB(-FjihMek#GAU4M!iXCgdK8a zjoKm?*|iz7;dHm4$^hh(`Ufl>yb>$hjIA-;>{>C}G0Di%bGvUsJkfLAV|xq32c>RqJqTBJ3Dx zYC;*Dt|S$b6)aCJFnK(Eey$M1DpVV~_MIhwK> zygo(jWC|_IRw|456`roEyXtkNLWNAt-4N1qyN$I@DvBzt;e|?g<*HK1%~cq|^u*}C zmMrwh>{QAq?Ar~4l^DqT%SQ)w)FA(#7#u+N;>E975rYML>)LgE`2<7nN=C1pC{IkV zVw}_&v6j&S?QVh*)wF3#XmE@0($^BVl1969csLKUBNer{suVd!a~B!0MxWY?=(GD6 zy$G&ERFR#i6G4=2F?R4}Mz3B?3tnpoX3)qFF2sh9-Jn*e%9F>i{WG7$_~XyOO2!+@ z6k+38KyD@-0=uee54D0!Z1@B^ilj~StchdOn(*qvg~s5QJpWGc!6U^Aj!xt-HZn_V zS%|fyQ5YS@EP2lBIodXCLjG_+a)%En+7jzngk@J>6D~^xbxKkvf-R0-c%mX+o{?&j zZZ%RxFeav8Y0gkwtdtrwUb-i0Egd2C=ADu%w5VV-hNJvl)GZ?M;y$!?b=S+wKRK7Q zcOjPT!p<*#8m;TsBih=@Xc&c)?Vy`Ys>IvK@|1%N+M6J-^RCRaZcPP2eQh9DEGZr+ z?8B~wF14mk4Xkuen{wY^CWwS1PI<8gikY*)3?RSo5l8es4*J z43k_BIwc}of=6Pfs%xIxlMDGOJN zvl!a>G)52XMqA%fbgkZi%)%bN*ZzZw2!rn4@+J)2eK#kWuEW{)W~-`y1vhA5-7p%R z&f5N!a9f8cK1Xa=O}=9{wg%}Ur^+8Y(!UCeqw>%wj@|bYHD-bZO~mk3L$9_^MmF3G zvCiK^e@q6G?tHkM8%GqsBMZaB20W$UEt_5r~jc#WlR>Bv{6W>A=!#InoY zLOd04@Rz?*7PpW8u|+}bt`?+Z(GsX{Br4A2$ZZ(26Degmr9`O=t2KgHTL*==R3xcP z&Y(J7hC@6_x8zVz!CX3l4Xtss6i7r#E6kXMNN1~>9KTRzewfp))ij%)SBBl0fZdYP zd!zzQD5u8yk-u|41|Rqz7_tCFUMThZJVj)yQf6^Cwtn|Ew6cm5J|u1Bq>MWX-AfB&NE;C z62@=-0le`E6-CurMKjoIy)BuUmhMGJb}pPx!@GLWMT+wH2R?wA=MEy)o57~feFp8P zY@YXAyt4<1FD<|iw{FGQu~GEI<4C64)V*QiVk+VzOV^9GWf4ir#oYgHJz!wq>iZV#_6@_{)&lum)4x z_Of*CLVQ7wdT#XT-(h0qH%mcIF7yzMIvvTN3bPceK>PpJi(=3Nny zbSn}p$dGKQUlX&-t~RR)#F7I<8NCD^yke(vdf#4^aAh}M-{tS9-&^tC4`KU_pToXy z+|K8sx}a)Kh{h{;*V1#hs1xB%(?j>)g~`Wv(9F)f=Qn)(daVB7hZtcp^#LrEr1T1J zZSJ*lVyVVjhy)mkex9Whn=EinKDHe@KlfQI-Fl7M?-c~HnW0;C;+MbUY8?FToy;A+ zs&Nc7VZ=Of+e!G6s#+S5WBU)kgQq_I1@!uH74GJ-+O|%0HXm9Mqlvp|j%0`T>fr9^ zK;qo>XdwZW<>%tTA+<(1^6(>=-2N;hRgBnjvEjN;VbKMbFg--WrGy|XESoH1p|M4` z86(gC^vB4qScASZ&cdpT{~QDN-jC|GJ(RYoW1VW4!SSn- zhQds9&RBKn6M&GVK_Aayt(Hekbnw=tr>f z^o@v9_*iQO1*zeOrts9Q-$pc@!StS&kz$cF`s@pM`rmJXTP&h5G)A74!0e%ZJbl}( zssI|_!%~_hZFypv*S^JE5N&Kvmx7KiG<|fGMO=WrH+@Yhuj+KwiS#l4>@%2nl zS)mDikfmokO4q2A)hRVZBq2-5q&XC>%HOLkOYxZ66(s86?=0s4z5xbiOV)}L-&6b)h6(~CIaR#JNw~46+WBiU7IhB zq!NuR4!TsYnyBg>@G=Ib*cMq^k<}AMpCeYEf&dzfiGI-wOQ7hb+nA zkN7_){y&c3xC0 AQ~&?~ literal 0 HcmV?d00001 diff --git a/app/assets/javascripts/academic_records.js.coffee b/app/assets/javascripts/academic_records.js.coffee new file mode 100644 index 00000000..e69de29b diff --git a/app/assets/javascripts/application.js b/app/assets/javascripts/application.js new file mode 100644 index 00000000..60399b55 --- /dev/null +++ b/app/assets/javascripts/application.js @@ -0,0 +1,18 @@ +// This is a manifest file that'll be compiled into application.js, which will include all the files +// listed below. +// +// Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts, +// or vendor/assets/javascripts of plugins, if any, can be referenced here using a relative path. +// +// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the +// the compiled file. +// +// WARNING: THE FIRST BLANK LINE MARKS THE END OF WHAT'S TO BE PROCESSED, ANY BLANK LINE SHOULD +// GO AFTER THE REQUIRES BELOW. +// +//= require jquery +//= require jquery_ujs +//= require bootstrap +//= require bootstrap-datepicker +//= require_tree . + diff --git a/app/assets/javascripts/recommendations.js.coffee b/app/assets/javascripts/recommendations.js.coffee new file mode 100644 index 00000000..76156794 --- /dev/null +++ b/app/assets/javascripts/recommendations.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/registrations.js.coffee b/app/assets/javascripts/registrations.js.coffee new file mode 100644 index 00000000..df1427b4 --- /dev/null +++ b/app/assets/javascripts/registrations.js.coffee @@ -0,0 +1,36 @@ +jQuery -> + $('form').on 'click', '.remove_fields', (event) -> + $(this).prev('input[type=hidden]').val('1') + $(this).closest('fieldset').hide() + event.preventDefault() + + $('form').on 'click', '.add_fields', (event) -> + time = new Date().getTime() + regexp = new RegExp($(this).data('id'), 'g') + $(this).parent().before($(this).data('fields').replace(regexp, time)) + $("[data-behaviour~='datepicker']").datepicker({ "format": "yyyy-mm-dd" }); + event.preventDefault() + + $("[data-behaviour~='datepicker']").datepicker({ "format": "yyyy-mm-dd" }); + + myInput = "
Please specify
" + mySelect = '' + + observe_select = (id) -> + $(id).change( -> + if ( $(this).val() == 'Yes' ) + $(this).after(myInput); + $(this).remove(); + observe_input('#disability_cancel'); + ) + + observe_input = (id) -> + $(id).click( -> + $('#disability_container').before(mySelect); + $('#disability_container').remove(); + observe_select('#applicant_disability'); + ); + + observe_select('#applicant_disability'); + observe_input('#disability_cancel'); + \ No newline at end of file diff --git a/app/assets/stylesheets/academic_records.css.scss b/app/assets/stylesheets/academic_records.css.scss new file mode 100644 index 00000000..6c15b2f9 --- /dev/null +++ b/app/assets/stylesheets/academic_records.css.scss @@ -0,0 +1,3 @@ +// Place all the styles related to the academic_records 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/application.css b/app/assets/stylesheets/application.css new file mode 100644 index 00000000..e08e293e --- /dev/null +++ b/app/assets/stylesheets/application.css @@ -0,0 +1,14 @@ +/* + * This is a manifest file that'll be compiled into application.css, which will include all the files + * listed below. + * + * Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets, + * or vendor/assets/stylesheets of plugins, if any, can be referenced here using a relative path. + * + * You're free to add application-wide styles to this file and they'll appear at the top of the + * compiled file, but it's generally better to create a new file per style scope. + * + *= require_self + *= require bootstrap-datepicker + *= require_tree . +*/ diff --git a/app/assets/stylesheets/recommendations.css.scss b/app/assets/stylesheets/recommendations.css.scss new file mode 100644 index 00000000..5c75dfcf --- /dev/null +++ b/app/assets/stylesheets/recommendations.css.scss @@ -0,0 +1,3 @@ +// Place all the styles related to the recommendations 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/reuman.css.scss b/app/assets/stylesheets/reuman.css.scss new file mode 100644 index 00000000..89e6d264 --- /dev/null +++ b/app/assets/stylesheets/reuman.css.scss @@ -0,0 +1,78 @@ +@import "bootstrap"; +@import "bootstrap-responsive"; +@import "font-awesome"; + +input.text, input.title, input[type="email"], input[type="text"], input[type="password"] { } + +body { background-color:#eee; padding:0 0 4em; } +body,h1,h2,h3,h4,h5,h6,p,li {color:#2C4056; font-weight:300;} + +i { width:inherit; } +.clear {clear:both;} +.navbar .nav > li > a:hover { } +nav.navbar-inner { -moz-border-radius: 0; -webkit-border-radius: 0; border-radius: 0; border-top:0; padding:0; + a:hover { }} + +.navbar .nav > li > a:focus, .navbar .nav > li > a:hover { background-color:#f6f6f6;} + +header { background-color:#507AAA; + .header-inner { padding:0 20px; + h1 { color:#eee; font-size:2em; font-weight: normal; } + h2 { color:#eee; font-size:1.6em; font-weight: normal; }}} + +div.content { background-color:#fff; border: 1px solid #D4D4D4; margin:10px auto 0; background-image: -moz-linear-gradient(top, white, #F2F2F2); + background-image: -webkit-gradient(linear, 0 0, 0 100%, from(white), to(#F2F2F2)); + background-image: -webkit-linear-gradient(top, white, #F2F2F2); + background-image: -o-linear-gradient(top, white, #F2F2F2); + background-image: linear-gradient(to bottom, white, #F2F2F2); + background-repeat: repeat-x; + filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#FFFFFFFF', endColorstr='#FFF2F2F2', GradientType=0); + border: 1px solid #D4D4D4; + -webkit-box-shadow: 0 1px 4px rgba(0, 0, 0, 0.065); + -moz-box-shadow: 0 1px 4px rgba(0, 0, 0, 0.065); + box-shadow: 0 1px 4px rgba(0, 0, 0, 0.065); + .inner { padding:20px; } + hr.inner { padding:0 20px 0 20px; margin:1em 0 1em 20px; }} + +.app_button { padding:2em; text-align: center;} + +div.container.devise { background-color:#fff; border:1px solid #aaa; border-radius:4px; margin:34px auto 0; padding:0; width:590px; + #status { padding:20px; } + h2 { background-color:#2C4056; color:#fff; padding:0 20px; } + h3.alert { border:0; padding:0; margin:0;} + h3.success { border:0; padding:0; margin:0; + a {font-style:none;}} + form {padding:20px; + label { font-size:1.3em; } + input {font-size:1.2em; } + #submit { margin-right:68px; text-align:right; } + .inline label { display:inline-block; margin-right:10px; text-align:right; width:200px; }} + #error_explanation { width:932px; + ul li { float:left; padding:0 34px 0 0; }}} + +form { + .dropdown { top:4em; } + small { position:relative; top:1.4em; } + select.state_select { width:100%; } + .field_with_errors { + select {background-color:#FBC2C4;} + } + .row { + .inner { padding:0 20px; }}} + + +.application_nav { + .dropdown-menu { display:block; }} + +footer.container { font-size:0.8em; + .footer-inner { padding:0 20px; }} + +.field_with_errors { color:#8A1F11; display:inline; + input { background-color:#FBC2C4; }} + +#error_explanation { background-color:#FBC2C4; border:2px solid #8A1F11; font-weight:200; margin:10px 0; padding:7px; text-align:left; + h2 { text-align:left; font-weight:normal; margin:2px -7px 10px -7px; padding:5px 5px 5px 15px; font-size:1.6em; background-color:#FBC2C4; color:#8A1F11; } + p { color:#333; font-size:1.4em; font-weight:bold; margin-bottom:0; padding:5px; } + ul { margin:1em 3em; } + ul li { font-size:1.2em; list-style:square; } + p:first-letter { font-size:1.8em; }} diff --git a/app/controllers/applicants/academic_records_controller.rb b/app/controllers/applicants/academic_records_controller.rb new file mode 100644 index 00000000..cbd75a01 --- /dev/null +++ b/app/controllers/applicants/academic_records_controller.rb @@ -0,0 +1,19 @@ +class Applicants::AcademicRecordsController < ApplicationController + before_filter :authenticate_applicant! + + def edit + current_applicant.records.build unless current_applicant.records.count > 0 + current_applicant.awards.build unless current_applicant.awards.count > 0 + + render :edit + end + + def update + if current_applicant.update_attributes params[:applicant] + redirect_to applicants_recommenders_url + else + render :edit + end + end + +end diff --git a/app/controllers/applicants/confirmations_controller.rb b/app/controllers/applicants/confirmations_controller.rb new file mode 100644 index 00000000..84b58f54 --- /dev/null +++ b/app/controllers/applicants/confirmations_controller.rb @@ -0,0 +1,43 @@ +class Applicants::ConfirmationsController < Devise::ConfirmationsController + # GET /resource/confirmation/new + def new + build_resource({}) + end + + # POST /resource/confirmation + def create + self.resource = resource_class.send_confirmation_instructions(resource_params) + + if successfully_sent?(resource) + respond_with({}, :location => after_resending_confirmation_instructions_path_for(resource_name)) + else + respond_with(resource) + end + end + + # GET /resource/confirmation?confirmation_token=abcdef + def show + self.resource = resource_class.confirm_by_token(params[:confirmation_token]) + + if resource.errors.empty? + set_flash_message(:notice, :confirmed) if is_navigational_format? + sign_in(resource_name, resource) + respond_with_navigational(resource){ redirect_to after_confirmation_path_for(resource_name, resource) } + else + respond_with_navigational(resource.errors, :status => :unprocessable_entity){ render :new } + end + end + + protected + + # The path used after resending confirmation instructions. + def after_resending_confirmation_instructions_path_for(resource_name) + new_session_path(resource_name) + end + + # The path used after confirmation. + def after_confirmation_path_for(resource_name, resource) + edit_applicant_registration_path + end + +end \ No newline at end of file diff --git a/app/controllers/applicants/recommendations_controller.rb b/app/controllers/applicants/recommendations_controller.rb new file mode 100644 index 00000000..387dbaca --- /dev/null +++ b/app/controllers/applicants/recommendations_controller.rb @@ -0,0 +1,18 @@ +class Applicants::RecommendationsController < ApplicationController + before_filter :authenticate_applicant! + + def edit + current_applicant.recommenders.build unless current_applicant.recommenders.count > 0 + + render :edit + end + + def update + if current_applicant.update_attributes params[:applicant] + + else + render :edit + end + end + +end diff --git a/app/controllers/applicants/recommenders_controller.rb b/app/controllers/applicants/recommenders_controller.rb new file mode 100644 index 00000000..066f1282 --- /dev/null +++ b/app/controllers/applicants/recommenders_controller.rb @@ -0,0 +1,20 @@ +class Applicants::RecommendersController < ApplicationController + before_filter :authenticate_applicant! + + def edit + if current_applicant.recommendations.count == 0 + r = current_applicant.recommendations.build + end + + render :edit + end + + def update + if current_applicant.update_attributes params[:applicant] + redirect_to applicant_status_url + else + render :edit + end + end + +end diff --git a/app/controllers/applicants/registrations_controller.rb b/app/controllers/applicants/registrations_controller.rb new file mode 100644 index 00000000..22f76ac2 --- /dev/null +++ b/app/controllers/applicants/registrations_controller.rb @@ -0,0 +1,128 @@ +class Applicants::RegistrationsController < Devise::RegistrationsController + prepend_before_filter :require_no_authentication, :only => [ :new, :create, :cancel ] + prepend_before_filter :authenticate_scope!, :only => [:edit, :update, :destroy] + + + # before_filter :set_null_params, :only => [:update, :create] + + # GET /resource/sign_up + def new + resource = build_resource({}) + resource.addresses.build + + respond_with resource + end + + # POST /resource + def create + build_resource + + if resource.save + if resource.active_for_authentication? + set_flash_message :notice, :signed_up if is_navigational_format? + sign_in(resource_name, resource) + respond_with resource, :location => after_sign_up_path_for(resource) + else + set_flash_message :notice, :"signed_up_but_#{resource.inactive_message}" if is_navigational_format? + expire_session_data_after_sign_in! + respond_with resource, :location => after_inactive_sign_up_path_for(resource) + end + else + clean_up_passwords resource + respond_with resource + end + end + + # GET /resource/edit + def edit + resource.addresses.build unless resource.addresses.count > 0 + + render :edit + end + + # PUT /resource + # We need to use a copy of the resource because we don't want to change + # the current user in place. + def update + self.resource = resource_class.to_adapter.get!(send(:"current_#{resource_name}").to_key) + prev_unconfirmed_email = resource.unconfirmed_email if resource.respond_to?(:unconfirmed_email) + if resource.update_without_password(resource_params) + if is_navigational_format? + flash_key = update_needs_confirmation?(resource, prev_unconfirmed_email) ? + :update_needs_confirmation : :updated + set_flash_message :notice, flash_key + end + sign_in resource_name, resource, :bypass => true + respond_with resource, :location => after_update_path_for(resource) + else + clean_up_passwords resource + respond_with resource + end + end + + # DELETE /resource + def destroy + resource.destroy + Devise.sign_out_all_scopes ? sign_out : sign_out(resource_name) + set_flash_message :notice, :destroyed if is_navigational_format? + respond_with_navigational(resource){ redirect_to after_sign_out_path_for(resource_name) } + end + + # GET /resource/cancel + # Forces the session data which is usually expired after sign + # in to be expired now. This is useful if the user wants to + # cancel oauth signing in/up in the middle of the process, + # removing all OAuth session data. + def cancel + expire_session_data_after_sign_in! + redirect_to new_registration_path(resource_name) + end + + # GET /resource/status + # Show view of profile + def status + @user = current_applicant + @user.validates_application_completeness if @user + end + + protected + + def update_needs_confirmation?(resource, previous) + resource.respond_to?(:pending_reconfirmation?) && + resource.pending_reconfirmation? && + previous != resource.unconfirmed_email + end + + # Build a devise resource passing in the session. Useful to move + # temporary session data to the newly created user. + def build_resource(hash=nil) + hash ||= resource_params || {} + self.resource = resource_class.new_with_session(hash, session) + end + + # The path used after sign up. You need to overwrite this method + # in your own RegistrationsController. + def after_sign_up_path_for(resource) + after_sign_in_path_for(resource) + end + + # The path used after sign up for inactive accounts. You need to overwrite + # this method in your own RegistrationsController. + def after_inactive_sign_up_path_for(resource) + respond_to?(:root_path) ? root_path : "/" + end + + # The default url to be used after updating a resource. You need to overwrite + # this method in your own RegistrationsController. + def after_update_path_for(resource) + #applicant_status_path + applicants_records_path + end + + # Authenticates the current scope and gets the current resource from the session. + def authenticate_scope! + send(:"authenticate_#{resource_name}!", :force => true) + self.resource = send(:"current_#{resource_name}") + end + +end \ No newline at end of file diff --git a/app/controllers/applicants/sessions_controller.rb b/app/controllers/applicants/sessions_controller.rb new file mode 100644 index 00000000..db8d20ea --- /dev/null +++ b/app/controllers/applicants/sessions_controller.rb @@ -0,0 +1,40 @@ +class Applicants::SessionsController < Devise::SessionsController + before_filter :check_deadline + + # GET /resource/sign_in + def new + resource = build_resource(nil, :unsafe => true) + clean_up_passwords(resource) + respond_with(resource, serialize_options(resource)) + end + + # POST /resource/sign_in + def create + resource = warden.authenticate!(auth_options) + set_flash_message(:notice, :signed_in) if is_navigational_format? + sign_in(resource_name, resource) + respond_with resource, :location => after_sign_in_path_for(resource) + end + + # DELETE /resource/sign_out + def destroy + redirect_path = after_sign_out_path_for(resource_name) + signed_out = (Devise.sign_out_all_scopes ? sign_out : sign_out(resource_name)) + set_flash_message :notice, :signed_out if signed_out && is_navigational_format? + + # We actually need to hardcode this as Rails default responder doesn't + # support returning empty response on GET request + respond_to do |format| + format.any(*navigational_formats) { redirect_to redirect_path } + format.all do + head :no_content + end + end + end + + protected + + def after_sign_in_path_for(resource) + applicant_status_path + end +end \ No newline at end of file diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb new file mode 100644 index 00000000..03ba5fdd --- /dev/null +++ b/app/controllers/application_controller.rb @@ -0,0 +1,21 @@ +class ApplicationController < ActionController::Base + protect_from_forgery + + before_filter :log_x_forwarded_by + + protected + + def check_deadline + if Date.today > Date.new(2013,10,5) && Date.today < Date.new(2013,9,14) + redirect_to closed_url + end + end + + def log_x_forwarded_by + if request.env["HTTP_X_FORWARDED_FOR"].nil? + Rails.logger.info "NO HTTP_X_FORWARDED_FOR" + else + Rails.logger.info "REMOTE IP: " + request.env["HTTP_X_FORWARDED_FOR"].split(',').first + end + end +end diff --git a/app/controllers/users/sessions_controller.rb b/app/controllers/users/sessions_controller.rb new file mode 100644 index 00000000..2154d249 --- /dev/null +++ b/app/controllers/users/sessions_controller.rb @@ -0,0 +1,17 @@ +class Users::SessionsController < Devise::SessionsController + + # GET /resource/sign_in + def new + resource = build_resource + clean_up_passwords(resource) + respond_with_navigational(resource, stub_options(resource)){ render_with_scope :new } + end + + # POST /resource/sign_in + def create + resource = warden.authenticate!(:scope => resource_name, :recall => "#{controller_path}#new") + set_flash_message(:notice, :signed_in) if is_navigational_format? + sign_in(resource_name, resource) + redirect_to rails_admin_path + end +end \ No newline at end of file diff --git a/app/controllers/welcome_controller.rb b/app/controllers/welcome_controller.rb new file mode 100644 index 00000000..51a6f7bd --- /dev/null +++ b/app/controllers/welcome_controller.rb @@ -0,0 +1,7 @@ +class WelcomeController < ApplicationController + def index + end + + def thanks + end +end diff --git a/app/helpers/academic_records_helper.rb b/app/helpers/academic_records_helper.rb new file mode 100644 index 00000000..4f0b9f46 --- /dev/null +++ b/app/helpers/academic_records_helper.rb @@ -0,0 +1,10 @@ +module AcademicRecordsHelper + + def gpa_range + gpa_range = ["2.0"] + float = 2.0 + gpa_range << sprintf("%.1f", float += 0.1) while float < 9.9 + return gpa_range + end + +end diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb new file mode 100644 index 00000000..68846aa9 --- /dev/null +++ b/app/helpers/application_helper.rb @@ -0,0 +1,115 @@ +module ApplicationHelper + + def errors_for(object, message=nil) + html = "" + unless object.errors.blank? + html << "
\n" + if message.blank? + if object.new_record? + html << "\t\t

There was a problem creating the #{object.class.name.humanize.downcase}

\n" + else + html << "\t\t

There was a problem updating the #{object.class.name.humanize.downcase}

\n" + end + else + html << "

#{message}

" + end + html << "\t\t
    \n" + object.errors.full_messages.each do |error| + html << "\t\t\t
  • #{error}
  • \n" + end + html << "\t\t
\n" + html << "\t
\n" + end + raw html + end + + + def link_to_add_fields(name, f, association) + new_object = f.object.send(association).klass.new + id = new_object.object_id + fields = f.fields_for(association, new_object, child_index: id) do |builder| + render(association.to_s.singularize + "_fields", f: builder) + end + link_to(name, '#', class: "add_fields btn btn-mini btn-success", data: {id: id, fields: fields.gsub("\n", "")}) + end + + def microsloth_sucks + html = '' + end + + def gpa_range + grades = [['', nil], + ["AP Credit",10.0], + ["A+",4.0], + ["A",4.0], + ["A-",3.7], + ["B+",3.3], + ["B",3.0], + ["B-",2.7], + ["C+",2.3], + ["C",2.0], + ["C-",1.7], + ["D+",1.3], + ["D",1.0], + ["D-",0.7], + ["F",0.0]] + return grades + end + + def custom_error_messages! + return "" if resource.errors.empty? + + messages = resource.errors.full_messages.map { |msg| content_tag(:li, msg) }.join + sentence = I18n.t("errors.messages.not_saved", + :count => resource.errors.count, + :resource => resource.class.model_name.human.downcase) + + html = <<-HTML +
+

#{sentence}

+
    #{messages}
+
+ HTML + + html.html_safe + end + + def status_error_messages! + return "" if current_applicant.errors.empty? + + messages = current_applicant.errors.full_messages.map { |msg| content_tag(:li, msg) }.join + sentence = I18n.t("errors.messages.not_saved_status", + :count => current_applicant.errors.count) + + html = <<-HTML +
+

#{sentence}

+
    #{messages}
+
+ HTML + + html.html_safe + end + + + def application_status + if current_applicant.errors.empty? + status = "Complete" + message = "

Your application is complete. Please review your data and #{link_to "logout", destroy_applicant_session_path, :method => :delete} when finished. You will also recieve an email confirming that your application was submitted.

" + else + status = "Incomplete" + message = "

Your application is incomplete due to the errors mentioned above. It will not be accepted until all of the necessary data has been added.

" + message += "

Please go back and #{link_to 'edit', edit_applicant_registration_path } your application.

" + end + + html = <<-HTML +
+

#{status.upcase}

+ #{message} +
+ HTML + + html.html_safe + end + +end diff --git a/app/helpers/recommendations_helper.rb b/app/helpers/recommendations_helper.rb new file mode 100644 index 00000000..76909321 --- /dev/null +++ b/app/helpers/recommendations_helper.rb @@ -0,0 +1,2 @@ +module RecommendationsHelper +end diff --git a/app/mailers/.gitkeep b/app/mailers/.gitkeep new file mode 100644 index 00000000..e69de29b diff --git a/app/models/.gitkeep b/app/models/.gitkeep new file mode 100644 index 00000000..e69de29b diff --git a/app/models/academic_record.rb b/app/models/academic_record.rb new file mode 100644 index 00000000..6498a6d6 --- /dev/null +++ b/app/models/academic_record.rb @@ -0,0 +1,11 @@ +class AcademicRecord < ActiveRecord::Base + attr_accessible :academic_level, :degree, :finish, :gpa, :gpa_comment, :gpa_range, :start, :university + belongs_to :applicant, :class_name => "Applicant", :foreign_key => "applicant_id" + + validates :university, :presence => true + validates :degree, :presence => true + validates :start, :presence => true + validates :finish, :presence => true + validates :gpa, :presence => true + validates :gpa_range, :presence => true +end diff --git a/app/models/address.rb b/app/models/address.rb new file mode 100644 index 00000000..a8a0e144 --- /dev/null +++ b/app/models/address.rb @@ -0,0 +1,10 @@ +class Address < ActiveRecord::Base + attr_accessible :address, :address2, :city, :country, :label, :permanent, :state, :zip + belongs_to :applicant, :class_name => "Applicant", :foreign_key => "applicant_id" + + validates :label, :inclusion => { :in => %w( Home School Other ) } + validates :city, :presence => true + validates :state, :presence => true + validates :zip, :presence => true + validates :permanent, :inclusion => { :in => ["Yes", "No"] } +end diff --git a/app/models/applicant.rb b/app/models/applicant.rb new file mode 100644 index 00000000..b7207470 --- /dev/null +++ b/app/models/applicant.rb @@ -0,0 +1,44 @@ +class Applicant < ActiveRecord::Base + # Include default devise modules. Others available are: + # :token_authenticatable, and :omniauthable + + devise :database_authenticatable, :registerable, :recoverable, :rememberable, :trackable, :validatable, :lockable, :timeoutable, :confirmable + attr_accessible :email, :password, :password_confirmation, :remember_me, :first_name, :last_name, :phone, :dob, :citizenship, :disability, :gender, :ethnicity, :race, :cpu_skills, :gpa_comment, :lab_skills, :addresses_attributes, :awards_attributes, :records_attributes, :recommendations_attributes, :recommenders_attributes, :statement + + has_many :addresses, :class_name => "Address", :dependent => :destroy + has_many :records, :class_name => "AcademicRecord", :dependent => :destroy + has_many :awards, :class_name => "Award", :dependent => :destroy + has_many :recommendations + has_many :recommenders, :through => :recommendations + + + validates_associated :addresses, :awards, :records, :recommenders +# validates_presence_of :records, :if => :academic_records_controller? + +# validate :must_have_academic_record, :if => :academic_records_controller? + + accepts_nested_attributes_for :addresses, :allow_destroy => true, :reject_if => proc { |obj| obj.blank? } + accepts_nested_attributes_for :awards, :allow_destroy => true, :reject_if => proc { |obj| obj.blank? } + accepts_nested_attributes_for :records, :allow_destroy => true, :reject_if => proc { |obj| obj.blank? } + accepts_nested_attributes_for :recommendations, :allow_destroy => true, :reject_if => proc { |obj| obj.blank? } + accepts_nested_attributes_for :recommenders, :allow_destroy => true, :reject_if => proc { |obj| obj.blank? } + + + rails_admin do + label "List of applicants" + end + + + def validates_application_completeness + validates_presence_of :phone, :on => :update, :message => "can't be blank" + end + + def must_have_academic_record + + end + + def academic_records_controller? + + end + +end diff --git a/app/models/award.rb b/app/models/award.rb new file mode 100644 index 00000000..7ac8ec19 --- /dev/null +++ b/app/models/award.rb @@ -0,0 +1,8 @@ +class Award < ActiveRecord::Base + attr_accessible :date, :description, :title + + belongs_to :applicant, :class_name => "Applicant", :foreign_key => "applicant_id" + + validates :title, :presence => true + +end diff --git a/app/models/recommendation.rb b/app/models/recommendation.rb new file mode 100644 index 00000000..97871f5a --- /dev/null +++ b/app/models/recommendation.rb @@ -0,0 +1,6 @@ +class Recommendation < ActiveRecord::Base + attr_accessible :applicant_id, :body, :known_applicant_for, :known_capacity, :overall_promise, :recommender_id, :undergraduate_institution? + + belongs_to :applicant, :class_name => "Applicant" + belongs_to :recommender, :class_name => "Recommender" +end diff --git a/app/models/recommender.rb b/app/models/recommender.rb new file mode 100644 index 00000000..8683bb2e --- /dev/null +++ b/app/models/recommender.rb @@ -0,0 +1,15 @@ +class Recommender < ActiveRecord::Base + attr_accessible :department, :email, :first_name, :last_name, :organization, :phone, :title, :url + + has_many :recommendations + has_many :applicants, :through => :recommendations + + validates :first_name, :presence => true + validates :last_name, :presence => true + validates :email, :presence => true + validates :organization, :presence => true + validates :department, :presence => true + validates :title, :presence => true + + +end diff --git a/app/models/user.rb b/app/models/user.rb new file mode 100644 index 00000000..164bc7eb --- /dev/null +++ b/app/models/user.rb @@ -0,0 +1,11 @@ +class User < ActiveRecord::Base + # Include default devise modules. Others available are: + # :token_authenticatable, :confirmable, + # :lockable, :timeoutable and :omniauthable + devise :database_authenticatable, :recoverable, :rememberable, :trackable, :validatable, :lockable, :timeoutable, :confirmable + + + # Setup accessible (or protected) attributes for your model + attr_accessible :email, :password, :password_confirmation, :remember_me + # attr_accessible :title, :body +end diff --git a/app/views/applicants/academic_records/_award_fields.html.erb b/app/views/applicants/academic_records/_award_fields.html.erb new file mode 100644 index 00000000..ab95982d --- /dev/null +++ b/app/views/applicants/academic_records/_award_fields.html.erb @@ -0,0 +1,32 @@ +
+
+ +
+
+ <%= f.text_field :title, :placeholder => :Title %> +
+
+ +
+
+ <%= f.text_field :date, 'data-behaviour' => 'datepicker', :placeholder => "Date" %> +
+
+ +
+
+ <%= f.text_area :description, :class => 'span8', :rows => 2, :placeholder => "Award Description (Optional)" %> +
+
+ +
+
+ <%= f.hidden_field :_destroy %> + <%= link_to "remove this record", '#', class: "remove_fields btn btn-mini btn-danger" %> +
+
+ +
+ +
+
\ No newline at end of file diff --git a/app/views/applicants/academic_records/_record_fields.html.erb b/app/views/applicants/academic_records/_record_fields.html.erb new file mode 100644 index 00000000..930d5871 --- /dev/null +++ b/app/views/applicants/academic_records/_record_fields.html.erb @@ -0,0 +1,67 @@ +
+
+ Academic Record +
+
+ +
+
+ <%= f.text_field :university, :placeholder => :University %> +
+
+ +
+
+ <%= f.text_field :degree, :placeholder => :Degree %> +
+
+ + +
+
+ <%= f.text_field :start, 'data-behaviour' => 'datepicker', :placeholder => 'Start' %> +
+
+ +
+
+ <%= f.text_field :finish, 'data-behaviour' => 'datepicker', :placeholder => 'Finish' %> +
+
+ +
+
+ <%= f.select :gpa, gpa_range, {:include_blank => 'GPA'}, {:class => :span1} %> + <%= f.select :gpa_range, gpa_range, {:include_blank => 'GPA Range'}, {:class => :span2} %> +
+
+ +
+
+ <%= f.select :academic_level, options_for_select(%w{ Freshman Sophomore Junior Senior }), :include_blank => 'Current Academic Level'%> +
+
+ +
+
+
+

GPA Comments

+ <%= f.text_area :gpa_comment, :class => 'span8', :rows => 2, :placeholder => "Do you feel your GPA accurately reflects your academic abilities? Please comment on why or why not in the space provided." %> +
+
+
+ + +
+
+ <%= f.hidden_field :_destroy %> + <%= link_to "remove this record", '#', class: "remove_fields btn btn-mini btn-danger" %> +
+
+ + +
+ +
+ +
\ No newline at end of file diff --git a/app/views/applicants/academic_records/edit.html.erb b/app/views/applicants/academic_records/edit.html.erb new file mode 100644 index 00000000..df479c3b --- /dev/null +++ b/app/views/applicants/academic_records/edit.html.erb @@ -0,0 +1,82 @@ +<%= form_for(current_applicant, :url => applicants_records_url, :html => { :method => :put }) do |f| %> + + <%= errors_for current_applicant %> + +
+
+ +
+
+
+

Academic Info

+
+
+ +
+
+ <%= f.fields_for :records do |builder| %> + <%= render 'record_fields', f: builder %> + <% end %> +
<%= link_to_add_fields "Add academic record", f, :records %>
+
+
+ +
+
+
+

Awards

+
+ <%= f.fields_for :awards do |builder| %> + <%= render 'award_fields', f: builder %> + <% end %> +
<%= link_to_add_fields "Add award", f, :awards %>
+
+
+ +
+
+
+

Computer Skills

+ <%= f.text_area :cpu_skills, :class => 'span8', :rows => 2, :placeholder => "Please list any computer related skills (e.g. Application experience, programming ability, etc.)" %> +
+
+
+ +
+
+
+

Laboratory Skills

+ <%= f.text_area :lab_skills, :class => 'span8', :rows => 2, :placeholder => "Please list any laboratory related skills" %> +
+
+ + +
+
+ + + +
+
+
+

<%= f.submit "Update Academic Info", :class => "btn btn-success" %>   Changed your mind? <%= link_to "Delete your application", registration_path(current_applicant), :confirm => "Are you sure?", :method => :delete, :class => "btn btn-mini btn-danger" %>

+ You can <%= link_to "logout", destroy_applicant_session_path, :method => :delete %> and continue you application at anytime, however, it will not be accepted until all the above data has been submitted. +
+
+ + +
+ + + +<% end %> \ No newline at end of file diff --git a/app/views/applicants/confirmations/new.html.erb b/app/views/applicants/confirmations/new.html.erb new file mode 100644 index 00000000..e92a0064 --- /dev/null +++ b/app/views/applicants/confirmations/new.html.erb @@ -0,0 +1,16 @@ +
+

Resend confirmation instructions

+ + <%= form_for(resource, :as => resource_name, :url => confirmation_path(resource_name), :html => { :method => :post }) do |f| %> + <%= custom_error_messages! %> + + <%= f.label :email %> + <%= f.email_field :email %> + +
+ + <%= f.submit "Resend confirmation instructions", :class => 'btn' %> + <% end %> + + <%= render :partial => "devise/shared/links" %> +
\ No newline at end of file diff --git a/app/views/applicants/passwords/edit.html.erb b/app/views/applicants/passwords/edit.html.erb new file mode 100644 index 00000000..7cceeac5 --- /dev/null +++ b/app/views/applicants/passwords/edit.html.erb @@ -0,0 +1,18 @@ +
+

Change your password

+ + <%= form_for(resource, :as => resource_name, :url => password_path(resource_name), :html => { :method => :put }) do |f| %> + <%= devise_error_messages! %> + <%= f.hidden_field :reset_password_token %> + +

<%= f.label :password, "New password" %>
+ <%= f.password_field :password %>

+ +

<%= f.label :password_confirmation, "Confirm new password" %>
+ <%= f.password_field :password_confirmation %>

+ +

<%= f.submit "Change my password", :class => 'btn' %>

+ <%= render :partial => "devise/shared/links" %> + <% end %> + +
\ No newline at end of file diff --git a/app/views/applicants/recommenders/_recommender_fields.html.erb b/app/views/applicants/recommenders/_recommender_fields.html.erb new file mode 100644 index 00000000..4bd7a02b --- /dev/null +++ b/app/views/applicants/recommenders/_recommender_fields.html.erb @@ -0,0 +1,66 @@ +
+
+ Recommender +
+
+ +
+
+ <%= f.text_field :first_name, :placeholder => 'First Name' %> +
+
+ +
+
+ <%= f.text_field :last_name, :placeholder => 'Last Name' %> +
+
+ +
+
+ <%= f.text_field :email, :placeholder => :Email %> +
+
+ +
+
+ <%= f.text_field :phone, :placeholder => :Phone %> +
+
+ +
+
+ <%= f.text_field :url, :placeholder => :URL %> +
+
+ + +
+
+ <%= f.text_field :organization, :placeholder => 'Organization or University' %> +
+
+ +
+
+ <%= f.text_field :department, :placeholder => :Department %> +
+
+ + +
+
+ <%= f.text_field :title, :placeholder => :Title %> +
+
+ +
+
+ <%= f.hidden_field :_destroy %> + <%= link_to "remove this recommender", '#', class: "remove_fields btn btn-mini btn-danger" %> +
+
+ +
+
+
diff --git a/app/views/applicants/recommenders/edit.html.erb b/app/views/applicants/recommenders/edit.html.erb new file mode 100644 index 00000000..7a5eb9a3 --- /dev/null +++ b/app/views/applicants/recommenders/edit.html.erb @@ -0,0 +1,57 @@ +<%= form_for(current_applicant, :url => applicants_recommenders_url, :html => { :method => :put }) do |f| %> + + <%= errors_for current_applicant %> + +
+
+
+

Recommenders

+
+ The recommendation request is not sent until you submit a complete application. +
+
+
+ + +
+ +
+ +
+
+ <%= f.fields_for :recommenders do |builder| %> + <%= render 'recommender_fields', f: builder %> + <% end %> +
+ <%= link_to_add_fields "Add recommender", f, :recommenders %> +
+
+
+
+ +
+
+ + + +
+
+
+

<%= f.submit "Update Recommendation Info", :class => "btn btn-success" %>   Changed your mind? <%= link_to "Delete your application", registration_path(current_applicant), :confirm => "Are you sure?", :method => :delete, :class => "btn btn-mini btn-danger" %>

+ You can <%= link_to "logout", destroy_applicant_session_path, :method => :delete %> and continue you application at anytime, however, it will not be accepted until all the above data has been submitted. +
+
+ + +
+<%- end -%> \ No newline at end of file diff --git a/app/views/applicants/registrations/_address_fields.html.erb b/app/views/applicants/registrations/_address_fields.html.erb new file mode 100644 index 00000000..21b3afba --- /dev/null +++ b/app/views/applicants/registrations/_address_fields.html.erb @@ -0,0 +1,52 @@ +
+
+ Location +
+
+
+
+ <%= f.label :label %> + <%= f.select :label, options_for_select(%w( Home School Other)), :prompt => "Location Label" %> +
+
+
+
+ <%= f.label 'Permanent Address' %> + <%= f.select :permanent, options_for_select(["Yes", "No"]), :prompt => 'Permanent Address?' %> +
+
+ +
+
+ <%= f.text_field :address, :placeholder => :Address %> +
+
+ <%= f.text_field :address2, :placeholder => 'Address Line 2' %> +
+
+ +
+
+ <%= f.text_field :city, :placeholder => :City %> +
+
+
+
+ <%= f.select :state, options_for_select(Carmen.state_codes, f.object.state), {}, {:class => 'state_select'} %> +
+
+
+
+ <%= f.text_field :zip, :placeholder => "Zip Code" %> +
+
+
+ +
+ <%= f.hidden_field :_destroy %> + <%= link_to "remove this location", '#', class: "remove_fields btn btn-mini btn-danger" %> +
+ +
+ +
\ No newline at end of file diff --git a/app/views/applicants/registrations/edit.html.erb b/app/views/applicants/registrations/edit.html.erb new file mode 100644 index 00000000..db2c8864 --- /dev/null +++ b/app/views/applicants/registrations/edit.html.erb @@ -0,0 +1,139 @@ +<%= form_for(resource, :as => resource_name, :url => registration_path(resource_name), :html => { :method => :put }) do |f| %> + + <%= custom_error_messages! %> + <%= application_status if @user %> + +
+
+ +
+
+
+

Contact Info

+
+
+ +
+
+ <%= f.text_field :first_name, :placeholder => "First Name" %> +
+
+
+
+ <%= f.text_field :last_name, :placeholer => "Last Name" %> +
+
+ +
+
+ <%= f.email_field :email, :placeholder => :Email %> +
+
+
+
+ <%= f.text_field :phone, :placeholder => :Phone %> +
+
+ +
+
+ <%= f.fields_for :addresses do |builder| %> + <%= render 'address_fields', f: builder %> + <% end %> +
<%= link_to_add_fields "Add Location", f, :addresses %>
+ +
+
+ +
+
+

Personal Info

+
+
+ +
+
+ <%= f.label :dob, "Date of Birth" %> + <%= f.text_field :dob, 'data-behaviour' => 'datepicker' %> +
+
+
+
+ <%= f.label :gender %> + <%= f.select :gender, options_for_select(%w{Male Female}), :include_blank => "Prefer to not respond" %> +
+
+ +
+
+ <%= f.label :ethnicity %> + <%= f.select :ethnicity, options_for_select(%w{ Hispanic\ or\ Latino Not\ Hispanic\ or\ Latino }), :include_blank => "Prefer to not respond" %> +
+
+
+
+ <%= f.label :race %> + <%= f.select :race, options_for_select(%w{ American\ Indian\ or\ Alaskan\ Native Asian Black\ or\ African\ American Native\ Hawaiian\ or\ Pacific\ Islander }), :include_blank => "Prefer to not respond" %> +
+
+ +
+
+ <%= f.label :citizenship %> + <%= f.select :citizenship, options_for_select([['United States','US']] + Carmen.countries), :include_blank => "Prefer to not respond" %> +
+
+
+
+ <%= f.label :disability %> + <%- if current_applicant.disability && current_applicant.disability != '' -%> +
+ <%= f.text_field :disability %> + Please specify + +
+ <%- else -%> + <%= f.select :disability, options_for_select(%w{No Yes}), :include_blank => "Prefer to not respond" %> + <%- end -%> +
+
+ + +
+
+
+

Personal Statement

+ <%= f.text_area :statement, :class => 'span8', :rows => 6, :placeholder => "Please Complete a brief essay (up to 250 words) explaining why you are interested in our program and how the experience may help you achieve your future goals." %> +
+
+
+ + +
+ + +
+ + + +
+
+
+

<%= f.submit "Update Profile Data", :class => "btn btn-success" %>   Changed your mind? <%= link_to "Delete your application", registration_path(resource_name), :confirm => "Are you sure?", :method => :delete, :class => "btn btn-mini btn-danger" %>

+ You can <%= link_to "logout", destroy_applicant_session_path, :method => :delete %> and continue you application at anytime, however, it will not be accepted until all the above data has been submitted. +
+
+ +
+ +<% end %> \ No newline at end of file diff --git a/app/views/applicants/registrations/new.html.erb b/app/views/applicants/registrations/new.html.erb new file mode 100644 index 00000000..ac646d15 --- /dev/null +++ b/app/views/applicants/registrations/new.html.erb @@ -0,0 +1,37 @@ +
+

Sign up

+

Please fill out the form below to begin the application process.

+
+ + <%= form_for(resource, :as => resource_name, :url => registration_path(resource_name)) do |f| %> + <%= custom_error_messages! %> + +
+
+ <%= f.label :first_name, "First Name" %> <%= f.text_field :first_name %> +
+
+ <%= f.label :last_name, "Last Name" %> <%= f.text_field :last_name %> +
+
+ <%= f.label :email %> <%= f.email_field :email %> +
+
+ <%= f.label :phone, "Phone" %> <%= f.text_field :phone %> +
+
+ <%= f.label :password %> <%= f.password_field :password %> +
+
+ <%= f.label :password_confirmation %> <%= f.password_field :password_confirmation %> +
+ +
+ +
+

<%= f.submit "Sign up", :class => 'btn' %>

+ <%= render :partial => "applicants/shared/links" %> +
+
+ <% end %> +
\ No newline at end of file diff --git a/app/views/applicants/registrations/status.html.erb b/app/views/applicants/registrations/status.html.erb new file mode 100644 index 00000000..bf681c92 --- /dev/null +++ b/app/views/applicants/registrations/status.html.erb @@ -0,0 +1,46 @@ +
+
+
+ +
+
+

Current Application Status

+ <%= status_error_messages! %> + <%= application_status %> + +

<%= "#{@user.first_name} #{@user.last_name} / #{@user.email} / #{@user.phone == '' || @user.phone == nil ? "No Value" : @user.phone }" %>

+
+
+ +
+
+

Courses Completed and Grades Assigned

+
+
+ +
+ +
+
+

<%= link_to "Edit Application Data", edit_applicant_registration_path(current_applicant), :class => "btn btn-success" %>   Changed your mind? <%= link_to "Delete your aapplication", registration_path(resource_name), :confirm => "Are you sure?", :method => :delete, :class => "btn btn-mini btn-danger" %>.

+ + You can <%= link_to "logout", destroy_applicant_session_path, :method => :delete %> and continue you application at anytime, however, it will not be accepted until all the above data has been submitted. +
+
+
+
+ + + +
+ diff --git a/app/views/applicants/sessions/new.html.erb b/app/views/applicants/sessions/new.html.erb new file mode 100644 index 00000000..6a66b26f --- /dev/null +++ b/app/views/applicants/sessions/new.html.erb @@ -0,0 +1,18 @@ +
+

Sign in

+ + <%= form_for(resource, :as => resource_name, :url => session_path(resource_name)) do |f| %> +
+

<%= f.email_field :email, :placeholder => :Email %>

+

<%= f.password_field :password, :placeholder => :Password %> + <% if devise_mapping.rememberable? -%> + + <%= f.label :remember_me, :class => :checkbox do %>Remember Me <%= f.check_box :remember_me %><%- end -%> + <% end -%> +

+
+ +

<%= f.submit "Sign in", :class => 'btn' %>

+ <%= render :partial => "applicants/shared/links" %> + <% end %> +
\ No newline at end of file diff --git a/app/views/applicants/shared/_links.erb b/app/views/applicants/shared/_links.erb new file mode 100644 index 00000000..7242ba07 --- /dev/null +++ b/app/views/applicants/shared/_links.erb @@ -0,0 +1,27 @@ + +<%- if controller_name != 'sessions' %> + <%= link_to "Sign in", new_session_path(resource_name) %> | +<% end -%> + +<%- if devise_mapping.registerable? && controller_name != 'registrations' %> +  <%= link_to "Sign up", new_registration_path(resource_name) %> | +<% end -%> + +<%- if devise_mapping.recoverable? && controller_name != 'passwords' %> +  <%= link_to "Forgot your password?", new_password_path(resource_name) %> +<% end -%> + +<%- if devise_mapping.confirmable? && controller_name != 'confirmations' %> +  | <%= link_to "Didn't receive confirmation?", new_confirmation_path(resource_name) %> | +<% end -%> + +<%- if devise_mapping.lockable? && resource_class.unlock_strategy_enabled?(:email) && controller_name != 'unlocks' %> + <%= link_to "Didn't receive unlock instructions?", new_unlock_path(resource_name) %> +<% end -%> + +<%- if devise_mapping.omniauthable? %> + <%- resource_class.omniauth_providers.each do |provider| %> + <%= link_to "Sign in with #{provider.to_s.titleize}", omniauth_authorize_path(resource_name, provider) %> + <% end -%> +<% end -%> + \ No newline at end of file diff --git a/app/views/applicants/unlocks/new.html.erb b/app/views/applicants/unlocks/new.html.erb new file mode 100644 index 00000000..ece6bec7 --- /dev/null +++ b/app/views/applicants/unlocks/new.html.erb @@ -0,0 +1,14 @@ +
+

Resend unlock instructions

+ + <%= form_for(resource, :as => resource_name, :url => unlock_path(resource_name), :html => { :method => :post }) do |f| %> + <%= devise_error_messages! %> + +

<%= f.label :email %>
+ <%= f.email_field :email %>

+ +

<%= f.submit "Resend unlock instructions", :class => 'btn' %>

+ <% end %> + + <%= render :partial => "devise/shared/links" %> +
\ No newline at end of file diff --git a/app/views/devise/mailer/confirmation_instructions.html.erb b/app/views/devise/mailer/confirmation_instructions.html.erb new file mode 100644 index 00000000..957af839 --- /dev/null +++ b/app/views/devise/mailer/confirmation_instructions.html.erb @@ -0,0 +1,5 @@ +

Welcome <%= @resource.email %>!

+ +

You can confirm the creation of your application through the link below:

+ +

<%= link_to 'Confirm my account', confirmation_url(@resource, :confirmation_token => @resource.confirmation_token).gsub("applicants","applicants") %>

\ No newline at end of file diff --git a/app/views/devise/mailer/reset_password_instructions.html.erb b/app/views/devise/mailer/reset_password_instructions.html.erb new file mode 100644 index 00000000..d3eea741 --- /dev/null +++ b/app/views/devise/mailer/reset_password_instructions.html.erb @@ -0,0 +1,8 @@ +

Hello <%= @resource.email %>!

+ +

Someone has requested a link to change your password, and you can do this through the link below.

+ +

<%= link_to 'Change my password', edit_password_url(@resource, :reset_password_token => @resource.reset_password_token).gsub("applicants","applicants") %>

+ +

If you didn't request this, please ignore this email.

+

Your password won't change until you access the link above and create a new one.

diff --git a/app/views/devise/mailer/unlock_instructions.html.erb b/app/views/devise/mailer/unlock_instructions.html.erb new file mode 100644 index 00000000..031362a9 --- /dev/null +++ b/app/views/devise/mailer/unlock_instructions.html.erb @@ -0,0 +1,7 @@ +

Hello <%= @resource.email %>!

+ +

Your account has been locked due to an excessive amount of unsuccessful sign in attempts.

+ +

Click the link below to unlock your account:

+ +

<%= link_to 'Unlock my account', unlock_url(@resource, :unlock_token => @resource.unlock_token).gsub("applicants","applicants") %>

diff --git a/app/views/devise/passwords/new.html.erb b/app/views/devise/passwords/new.html.erb new file mode 100644 index 00000000..a04097c7 --- /dev/null +++ b/app/views/devise/passwords/new.html.erb @@ -0,0 +1,14 @@ +
+

Forgot your password?

+ + <%= form_for(resource, :as => resource_name, :url => password_path(resource_name), :html => { :method => :post }) do |f| %> + <%= devise_error_messages! %> + + <%= f.label :email %> + <%= f.email_field :email %> + +

<%= f.submit "Send me reset password instructions", :class => 'btn' %>

+ <% end %> + + <%= render :partial => "devise/shared/links" %> +
\ No newline at end of file diff --git a/app/views/devise/sessions/new.html.erb b/app/views/devise/sessions/new.html.erb new file mode 100644 index 00000000..41af0ed1 --- /dev/null +++ b/app/views/devise/sessions/new.html.erb @@ -0,0 +1,20 @@ +
+

Sign in

+ + <%= form_for(resource, :as => resource_name, :url => session_path(resource_name)) do |f| %> + <%= f.label :email %> + <%= f.email_field :email, :autofocus => true %> + + <%= f.label :password %> + <%= f.password_field :password %> + + <% if devise_mapping.rememberable? -%> + <%= f.label :remember_me %><%= f.check_box :remember_me %> + <% end -%> + +
+ <%= f.submit "Sign in", :class => "btn btn-large" %> + <% end %> + + <%= render "devise/shared/links" %> +
\ No newline at end of file diff --git a/app/views/layouts/_flash.html.haml b/app/views/layouts/_flash.html.haml new file mode 100644 index 00000000..e69de29b diff --git a/app/views/layouts/_footer_text.html.erb b/app/views/layouts/_footer_text.html.erb new file mode 100644 index 00000000..b645b08e --- /dev/null +++ b/app/views/layouts/_footer_text.html.erb @@ -0,0 +1,7 @@ +Copyright © <%= Time.now.year %> +<%= link_to "Regents of the University of California", "http://www.universityofcalifornia.edu/regents/" %>. +All Rights Reserved | +<%= link_to 'HTML5', '' %>, <%= link_to 'CSS3', '' %>, <%= link_to 'S508', '' %> valid.
+<%= link_to CONFIG[:department], CONFIG[:department_url] %>, +<%= CONFIG[:department_mailing_address] %>
+Please contact <%= mail_to CONFIG[:mail_from] %> if you have any questions. \ No newline at end of file diff --git a/app/views/layouts/_footer_text_long.html.erb b/app/views/layouts/_footer_text_long.html.erb new file mode 100644 index 00000000..c739a712 --- /dev/null +++ b/app/views/layouts/_footer_text_long.html.erb @@ -0,0 +1,6 @@ +Copyright © <%= Time.now.year %> +<%= link_to "Regents of the University of California", "http://www.universityofcalifornia.edu/regents/" %>. +All Rights Reserved. +<%= link_to "Department of Bioengineering", 'http://be.ucsd.edu' %>, 9500 Gilman Drive, La Jolla, California 92093-0412 | +<%= link_to 'HTML5', '' %>, +<%= link_to 'CSS3', '' %>, <%= link_to 'S508', '' %> valid. \ No newline at end of file diff --git a/app/views/layouts/_header.html.haml b/app/views/layouts/_header.html.haml new file mode 100644 index 00000000..4e67ef70 --- /dev/null +++ b/app/views/layouts/_header.html.haml @@ -0,0 +1,4 @@ +%header.container + .header-inner + %h1= "#{CONFIG[:university]} #{CONFIG[:department]}" + %h2= CONFIG[:app_title] \ No newline at end of file diff --git a/app/views/layouts/_navbar.html.haml b/app/views/layouts/_navbar.html.haml new file mode 100644 index 00000000..a94e4378 --- /dev/null +++ b/app/views/layouts/_navbar.html.haml @@ -0,0 +1,64 @@ +.navbar.container + %nav.navbar-inner + %ul.nav + - if params[:controller] == 'welcome' + %li.active + =link_to "Welcome", root_path, :class => 'active' + - else + %li + =link_to "Welcome", root_path, :class => 'active' + - if params[:controller] == 'applicants/registrations' && params[:action] != 'status' + %li.active + - if applicant_signed_in? + =link_to "Edit Profile", edit_applicant_registration_path, :class => 'active' + - else + =link_to "Apply Now", new_applicant_registration_url, :class => 'active' + - else + %li + - if applicant_signed_in? + =link_to "Edit Profile", edit_applicant_registration_path, :class => 'active' + - else + =link_to "Apply Now", new_applicant_registration_url, :class => 'active' + + - if params[:controller] == 'applicants/academic_records' + %li.active + - if applicant_signed_in? + =link_to "Academic Records", applicants_records_url, :class => 'active' + - else + %li + - if applicant_signed_in? + =link_to "Academic Records", applicants_records_url, :class => 'active' + + + - if params[:controller] == 'applicants/recommenders' + %li.active + - if applicant_signed_in? + =link_to "Recommendation", applicants_recommenders_url, :class => 'active' + - else + %li + - if applicant_signed_in? + =link_to "Recommendation", applicants_recommenders_url, :class => 'active' + + + - if params[:controller] == 'applicants/registrations' && params[:action] == 'status' + %li.active + - if applicant_signed_in? + =link_to "Status", applicant_status_url, :class => 'active' + - else + %li + - if applicant_signed_in? + =link_to "Status", applicant_status_url, :class => 'active' + + - if params[:controller] == 'applicants/sessions' + %li.active + - if applicant_signed_in? || user_signed_in? #|| user_signed_in? + = user_signed_in? ? link_to("Logout1", destroy_user_session_path, :method => :delete) : link_to("Logout2", destroy_applicant_session_path, :method => :delete) + - else + = link_to "Login", new_applicant_session_url, :class => 'active' + - else + %li + - if applicant_signed_in? || user_signed_in? #|| user_signed_in? + = user_signed_in? ? link_to("Logout", destroy_user_session_path, :method => :delete) : link_to("Logout", destroy_applicant_session_path, :method => :delete) + - else + = link_to "Login", new_applicant_session_url, :class => 'active' + =content_tag :li, link_to('Admin', rails_admin_path) if current_user diff --git a/app/views/layouts/application.html.haml b/app/views/layouts/application.html.haml new file mode 100644 index 00000000..da01dd3d --- /dev/null +++ b/app/views/layouts/application.html.haml @@ -0,0 +1,22 @@ +!!! +%html + %head + %title= CONFIG[:app_title] + = csrf_meta_tag + = stylesheet_link_tag :application + = javascript_include_tag :application + /[if lt IE 9] + =raw microsloth_sucks + %body + #flash + = content_tag 'div', (flash[:alert]), :class => 'alert', :id => 'alert', :onclick => "$(this).slideUp();" if flash[:alert] + = content_tag 'div', (flash[:error]), :class => 'alert alert-error', :id => 'error', :onclick => "$(this).slideUp();" if flash[:error] + = content_tag 'div', (flash[:notice]), :class => 'alert alert-notice', :id => 'notice', :onclick => "$(this).slideUp();" if flash[:notice] + = content_tag 'div', (flash[:success]), :class => 'alert alert-success', :id => 'success', :onclick => "$(this).slideUp();" if flash[:success] + =render "layouts/header" + =render "layouts/navbar" + .container.content + = yield + %footer.container + .footer-inner + =render "layouts/footer_text" \ No newline at end of file diff --git a/app/views/recommendations/edit.html.erb b/app/views/recommendations/edit.html.erb new file mode 100644 index 00000000..60262714 --- /dev/null +++ b/app/views/recommendations/edit.html.erb @@ -0,0 +1,2 @@ +

Recommendations#edit

+

Find me in app/views/recommendations/edit.html.erb

diff --git a/app/views/users/sessions/new.html.erb b/app/views/users/sessions/new.html.erb new file mode 100644 index 00000000..71140beb --- /dev/null +++ b/app/views/users/sessions/new.html.erb @@ -0,0 +1,25 @@ +
+

Login

+ + <%= form_for(resource, :as => resource_name, :url => session_path(resource_name)) do |f| %> + +
+

<%= f.label :email %>
+ <%= f.email_field :email %>

+
+ +
+

<%= f.label :password %>
+ <%= f.password_field :password %>

+
+ +

+ <% if devise_mapping.rememberable? -%> +

<%= f.check_box :remember_me %> <%= f.label :remember_me %>

+ <% end -%> +
+ +
+

<%= f.submit "Login" %> | <%= render :partial => "devise/shared/links" %>

+ <% end %> +
\ No newline at end of file diff --git a/app/views/welcome/_aside_text.html.erb b/app/views/welcome/_aside_text.html.erb new file mode 100644 index 00000000..a0cd4dd1 --- /dev/null +++ b/app/views/welcome/_aside_text.html.erb @@ -0,0 +1,15 @@ +
+

Program Highlights

+ <%= CONFIG[:highlights] %> +
+ +
+

Eligibility Requirements

+ <%= CONFIG[:eligibility_requirements] %> +
+ +
+

Application Information

+ <%= CONFIG[:application_information] %> +
+ diff --git a/app/views/welcome/closed.html.erb b/app/views/welcome/closed.html.erb new file mode 100644 index 00000000..8fd1d859 --- /dev/null +++ b/app/views/welcome/closed.html.erb @@ -0,0 +1,4 @@ +
+

Registration Closed

+

The 2012 application process is now closed and applicants will be notified shortly. If you are interested in applying for the 2013 academic year, please check back in early september.

+
\ No newline at end of file diff --git a/app/views/welcome/index.html.haml b/app/views/welcome/index.html.haml new file mode 100644 index 00000000..d9cf2c4b --- /dev/null +++ b/app/views/welcome/index.html.haml @@ -0,0 +1,15 @@ +.row + .span8 + .inner + %h3 General Info + = CONFIG[:general_description] + + .app_button + - if applicant_signed_in? + = link_to "Finish Application", edit_applicant_registration_path, :class => "btn btn-large btn-success" + - else + = link_to "Apply Now", new_applicant_registration_path, :class => "btn btn-large btn-success" + + %aside.span4 + .inner + =render :partial => "aside_text" diff --git a/config.ru b/config.ru new file mode 100644 index 00000000..e14f3ee4 --- /dev/null +++ b/config.ru @@ -0,0 +1,4 @@ +# This file is used by Rack-based servers to start the application. + +require ::File.expand_path('../config/environment', __FILE__) +run Reuman::Application diff --git a/config/application.rb b/config/application.rb new file mode 100644 index 00000000..b620b95c --- /dev/null +++ b/config/application.rb @@ -0,0 +1,67 @@ +require File.expand_path('../boot', __FILE__) + +require 'rails/all' + +if defined?(Bundler) + # If you precompile assets before deploying to production, use this line + Bundler.require(*Rails.groups(:assets => %w(development test))) + # If you want your assets lazily compiled in production, use this line + # Bundler.require(:default, :assets, Rails.env) +end + + +module Reuman + class Application < Rails::Application + # Settings in config/environments/* take precedence over those specified here. + # Application configuration should go into files in config/initializers + # -- all .rb files in that directory are automatically loaded. + + # Custom directories with classes and modules you want to be autoloadable. + # config.autoload_paths += %W(#{config.root}/extras) + + # Only load the plugins named here, in the order given (default is alphabetical). + # :all can be used as a placeholder for all plugins not explicitly named. + # config.plugins = [ :exception_notification, :ssl_requirement, :all ] + + # Activate observers that should always be running. + # config.active_record.observers = :cacher, :garbage_collector, :forum_observer + + # Set Time.zone default to the specified zone and make Active Record auto-convert to this zone. + # Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC. + # config.time_zone = 'Central Time (US & Canada)' + + # The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded. + # config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s] + # config.i18n.default_locale = :de + + # Configure the default encoding used in templates for Ruby 1.9. + config.encoding = "utf-8" + + # Configure sensitive parameters which will be filtered from the log file. + config.filter_parameters += [:password] + + # Enable escaping HTML in JSON. + config.active_support.escape_html_entities_in_json = true + + # Use SQL instead of Active Record's schema dumper when creating the database. + # This is necessary if your schema can't be completely dumped by the schema dumper, + # like if you have constraints or database-specific column types + # config.active_record.schema_format = :sql + + # Enforce whitelist mode for mass assignment. + # This will create an empty whitelist of attributes available for mass-assignment for all models + # in your app. As such, your models will need to explicitly whitelist or blacklist accessible + # parameters by using an attr_accessible or attr_protected declaration. + config.active_record.whitelist_attributes = true + + # Enable the asset pipeline + config.assets.enabled = true + + # Version of your assets, change this if you want to expire all your assets + config.assets.version = '1.0' + end +end + +CONFIG = YAML.load(File.read(File.expand_path('../application.yml', __FILE__))) +CONFIG.merge! CONFIG.fetch(Rails.env, {}) +CONFIG.symbolize_keys! \ No newline at end of file diff --git a/config/boot.rb b/config/boot.rb new file mode 100644 index 00000000..4489e586 --- /dev/null +++ b/config/boot.rb @@ -0,0 +1,6 @@ +require 'rubygems' + +# Set up gems listed in the Gemfile. +ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__) + +require 'bundler/setup' if File.exists?(ENV['BUNDLE_GEMFILE']) diff --git a/config/deploy.rb b/config/deploy.rb new file mode 100644 index 00000000..d075ef9f --- /dev/null +++ b/config/deploy.rb @@ -0,0 +1,35 @@ +require "bundler/capistrano" +require "rvm/capistrano" +require 'capistrano/ext/database' + +set :rvm_ruby_string, "1.9.3@reu" +set :rvm_type, :system + +default_run_options[:pty] = true + +set :application, "reu3" #matches names used in smf_template.erb +set :deploy_to, "/var/www/#{application}" # I like this location +set :domain, "192.168.10.103" +set :keep_releases, 2 +set :repository, "https://vishnu.ucsd.edu/svn/nsfreu/branches/#{application}" +set :scm, :subversion +set :user, 'ubuntu' +set :use_sudo, false + +role :app, domain +role :web, domain +role :db, domain, :primary => true + +namespace :deploy do + task :start do ; end + task :stop do ; end + task :restart, :roles => :app, :except => { :no_release => true } do + run "#{try_sudo} touch #{File.join(current_path,'tmp','restart.txt')}" + end + + desc "chown & chmod to www-data" + task :chown do + sudo "chown -R ubuntu:www-data #{deploy_to}" + sudo "chmod -R 775 #{deploy_to}" + end +end diff --git a/config/environment.rb b/config/environment.rb new file mode 100644 index 00000000..25b5accd --- /dev/null +++ b/config/environment.rb @@ -0,0 +1,5 @@ +# Load the rails application +require File.expand_path('../application', __FILE__) + +# Initialize the rails application +Reuman::Application.initialize! diff --git a/config/environments/development.rb b/config/environments/development.rb new file mode 100644 index 00000000..0e906d40 --- /dev/null +++ b/config/environments/development.rb @@ -0,0 +1,39 @@ +Reuman::Application.configure do + # Settings specified here will take precedence over those in config/application.rb + + # In the development environment your application's code is reloaded on + # every request. This slows down response time but is perfect for development + # since you don't have to restart the web server when you make code changes. + config.cache_classes = false + + # Log error messages when you accidentally call methods on nil. + config.whiny_nils = true + + # Show full error reports and disable caching + config.consider_all_requests_local = true + config.action_controller.perform_caching = false + + # Don't care if the mailer can't send + config.action_mailer.raise_delivery_errors = false + + # Print deprecation notices to the Rails logger + config.active_support.deprecation = :log + + # Only use best-standards-support built into browsers + config.action_dispatch.best_standards_support = :builtin + + # Raise exception on mass assignment protection for Active Record models + config.active_record.mass_assignment_sanitizer = :strict + + # Log the query plan for queries taking more than this (works + # with SQLite, MySQL, and PostgreSQL) + config.active_record.auto_explain_threshold_in_seconds = 0.5 + + # Do not compress assets + config.assets.compress = false + + # Expands the lines which load the assets + config.assets.debug = true + + config.action_mailer.default_url_options = { :host => 'localhost:3000' } +end diff --git a/config/environments/production.rb b/config/environments/production.rb new file mode 100644 index 00000000..897caefb --- /dev/null +++ b/config/environments/production.rb @@ -0,0 +1,71 @@ +Reuman::Application.configure do + # Settings specified here will take precedence over those in config/application.rb + + # Code is not reloaded between requests + config.cache_classes = true + + # Full error reports are disabled and caching is turned on + config.consider_all_requests_local = false + config.action_controller.perform_caching = true + + # Disable Rails's static asset server (Apache or nginx will already do this) + config.serve_static_assets = false + + # Compress JavaScripts and CSS + config.assets.compress = true + + # Don't fallback to assets pipeline if a precompiled asset is missed + config.assets.compile = false + + # Generate digests for assets URLs + config.assets.digest = true + + # Defaults to nil and saved in location specified by config.assets.prefix + # config.assets.manifest = YOUR_PATH + + # Specifies the header that your server uses for sending files + # config.action_dispatch.x_sendfile_header = "X-Sendfile" # for apache + # config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for nginx + + # Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies. + config.force_ssl = true + + # See everything in the log (default is :info) + # config.log_level = :debug + + # Prepend all log lines with the following tags + # config.log_tags = [ :subdomain, :uuid ] + + # Use a different logger for distributed setups + # config.logger = ActiveSupport::TaggedLogging.new(SyslogLogger.new) + + # Use a different cache store in production + # config.cache_store = :mem_cache_store + + # Enable serving of images, stylesheets, and JavaScripts from an asset server + # config.action_controller.asset_host = "http://assets.example.com" + + # Precompile additional assets (application.js, application.css, and all non-JS/CSS are already added) + config.assets.precompile += ['rails_admin/rails_admin.css', 'rails_admin/rails_admin.js'] + + # Disable delivery errors, bad email addresses will be ignored + # config.action_mailer.raise_delivery_errors = false + + # Enable threaded mode + # config.threadsafe! + + # Enable locale fallbacks for I18n (makes lookups for any locale fall back to + # the I18n.default_locale when a translation can not be found) + config.i18n.fallbacks = true + + # Send deprecation notices to registered listeners + config.active_support.deprecation = :notify + + # Log the query plan for queries taking more than this (works + # with SQLite, MySQL, and PostgreSQL) + # config.active_record.auto_explain_threshold_in_seconds = 0.5 + + config.action_mailer.default_url_options = { :protocol => 'https', :host => 'www.be.ucsd.edu' } + + config.action_mailer.smtp_settings = { :enable_starttls_auto => false, :host => 'localhost' } +end diff --git a/config/environments/test.rb b/config/environments/test.rb new file mode 100644 index 00000000..0ceb2344 --- /dev/null +++ b/config/environments/test.rb @@ -0,0 +1,39 @@ +Reuman::Application.configure do + # Settings specified here will take precedence over those in config/application.rb + + # The test environment is used exclusively to run your application's + # test suite. You never need to work with it otherwise. Remember that + # your test database is "scratch space" for the test suite and is wiped + # and recreated between test runs. Don't rely on the data there! + config.cache_classes = true + + # Configure static asset server for tests with Cache-Control for performance + config.serve_static_assets = true + config.static_cache_control = "public, max-age=3600" + + # Log error messages when you accidentally call methods on nil + config.whiny_nils = true + + # Show full error reports and disable caching + config.consider_all_requests_local = true + config.action_controller.perform_caching = false + + # Raise exceptions instead of rendering exception templates + config.action_dispatch.show_exceptions = false + + # Disable request forgery protection in test environment + config.action_controller.allow_forgery_protection = false + + # Tell Action Mailer not to deliver emails to the real world. + # The :test delivery method accumulates sent emails in the + # ActionMailer::Base.deliveries array. + config.action_mailer.delivery_method = :test + + # Raise exception on mass assignment protection for Active Record models + config.active_record.mass_assignment_sanitizer = :strict + + # Print deprecation notices to the stderr + config.active_support.deprecation = :stderr + + config.action_mailer.default_url_options = { :host => 'localhost:3000' } +end diff --git a/config/initializers/backtrace_silencers.rb b/config/initializers/backtrace_silencers.rb new file mode 100644 index 00000000..59385cdf --- /dev/null +++ b/config/initializers/backtrace_silencers.rb @@ -0,0 +1,7 @@ +# Be sure to restart your server when you modify this file. + +# You can add backtrace silencers for libraries that you're using but don't wish to see in your backtraces. +# Rails.backtrace_cleaner.add_silencer { |line| line =~ /my_noisy_library/ } + +# You can also remove all the silencers if you're trying to debug a problem that might stem from framework code. +# Rails.backtrace_cleaner.remove_silencers! diff --git a/config/initializers/devise.rb b/config/initializers/devise.rb new file mode 100644 index 00000000..34b46aed --- /dev/null +++ b/config/initializers/devise.rb @@ -0,0 +1,232 @@ +# Use this hook to configure devise mailer, warden hooks and so forth. +# Many of these configuration options can be set straight in your model. +Devise.setup do |config| + # ==> Mailer Configuration + # Configure the e-mail address which will be shown in Devise::Mailer, + # note that it will be overwritten if you use your own mailer class with default "from" parameter. + config.mailer_sender = "be-uginfo@bioeng.ucsd.edu" + + # Configure the class responsible to send e-mails. + # config.mailer = "Devise::Mailer" + + # ==> ORM configuration + # Load and configure the ORM. Supports :active_record (default) and + # :mongoid (bson_ext recommended) by default. Other ORMs may be + # available as additional gems. + require 'devise/orm/active_record' + + # ==> Configuration for any authentication mechanism + # Configure which keys are used when authenticating a user. The default is + # just :email. You can configure it to use [:username, :subdomain], so for + # authenticating a user, both parameters are required. Remember that those + # parameters are used only when authenticating and not when retrieving from + # session. If you need permissions, you should implement that in a before filter. + # You can also supply a hash where the value is a boolean determining whether + # or not authentication should be aborted when the value is not present. + # config.authentication_keys = [ :email ] + + # Configure parameters from the request object used for authentication. Each entry + # given should be a request method and it will automatically be passed to the + # find_for_authentication method and considered in your model lookup. For instance, + # if you set :request_keys to [:subdomain], :subdomain will be used on authentication. + # The same considerations mentioned for authentication_keys also apply to request_keys. + # config.request_keys = [] + + # Configure which authentication keys should be case-insensitive. + # These keys will be downcased upon creating or modifying a user and when used + # to authenticate or find a user. Default is :email. + config.case_insensitive_keys = [ :email ] + + # Configure which authentication keys should have whitespace stripped. + # These keys will have whitespace before and after removed upon creating or + # modifying a user and when used to authenticate or find a user. Default is :email. + config.strip_whitespace_keys = [ :email ] + + # Tell if authentication through request.params is enabled. True by default. + # It can be set to an array that will enable params authentication only for the + # given strategies, for example, `config.params_authenticatable = [:database]` will + # enable it only for database (email + password) authentication. + # config.params_authenticatable = true + + # Tell if authentication through HTTP Basic Auth is enabled. False by default. + # It can be set to an array that will enable http authentication only for the + # given strategies, for example, `config.http_authenticatable = [:token]` will + # enable it only for token authentication. + # config.http_authenticatable = false + + # If http headers should be returned for AJAX requests. True by default. + # config.http_authenticatable_on_xhr = true + + # The realm used in Http Basic Authentication. "Application" by default. + # config.http_authentication_realm = "Application" + + # It will change confirmation, password recovery and other workflows + # to behave the same regardless if the e-mail provided was right or wrong. + # Does not affect registerable. + # config.paranoid = true + + # By default Devise will store the user in session. You can skip storage for + # :http_auth and :token_auth by adding those symbols to the array below. + # Notice that if you are skipping storage for all authentication paths, you + # may want to disable generating routes to Devise's sessions controller by + # passing :skip => :sessions to `devise_for` in your config/routes.rb + config.skip_session_storage = [:http_auth] + + # ==> Configuration for :database_authenticatable + # For bcrypt, this is the cost for hashing the password and defaults to 10. If + # using other encryptors, it sets how many times you want the password re-encrypted. + # + # Limiting the stretches to just one in testing will increase the performance of + # your test suite dramatically. However, it is STRONGLY RECOMMENDED to not use + # a value less than 10 in other environments. + config.stretches = Rails.env.test? ? 1 : 10 + + # Setup a pepper to generate the encrypted password. + # config.pepper = "3620a1e87e7a01ecef2d5535cf4a13f94b174888c8be54b41dca05afbc127ed818f84f20aa0d3a970576cfa70e6c0f6f411102ac0a931145477c65b6211deca9" + + # ==> Configuration for :confirmable + # A period that the user is allowed to access the website even without + # confirming his account. For instance, if set to 2.days, the user will be + # able to access the website for two days without confirming his account, + # access will be blocked just in the third day. Default is 0.days, meaning + # the user cannot access the website without confirming his account. + # config.allow_unconfirmed_access_for = 2.days + + # If true, requires any email changes to be confirmed (exactly the same way as + # initial account confirmation) to be applied. Requires additional unconfirmed_email + # db field (see migrations). Until confirmed new email is stored in + # unconfirmed email column, and copied to email column on successful confirmation. + config.reconfirmable = false + + # Defines which key will be used when confirming an account + # config.confirmation_keys = [ :email ] + + # ==> Configuration for :rememberable + # The time the user will be remembered without asking for credentials again. + # config.remember_for = 2.weeks + + # If true, extends the user's remember period when remembered via cookie. + # config.extend_remember_period = false + + # Options to be passed to the created cookie. For instance, you can set + # :secure => true in order to force SSL only cookies. + # config.rememberable_options = {} + + # ==> Configuration for :validatable + # Range for password length. Default is 6..128. + # config.password_length = 6..128 + + # Email regex used to validate email formats. It simply asserts that + # an one (and only one) @ exists in the given string. This is mainly + # to give user feedback and not to assert the e-mail validity. + # config.email_regexp = /\A[^@]+@[^@]+\z/ + + # ==> Configuration for :timeoutable + # The time you want to timeout the user session without activity. After this + # time the user will be asked for credentials again. Default is 30 minutes. + # config.timeout_in = 30.minutes + + # If true, expires auth token on session timeout. + # config.expire_auth_token_on_timeout = false + + # ==> Configuration for :lockable + # Defines which strategy will be used to lock an account. + # :failed_attempts = Locks an account after a number of failed attempts to sign in. + # :none = No lock strategy. You should handle locking by yourself. + # config.lock_strategy = :failed_attempts + + # Defines which key will be used when locking and unlocking an account + # config.unlock_keys = [ :email ] + + # Defines which strategy will be used to unlock an account. + # :email = Sends an unlock link to the user email + # :time = Re-enables login after a certain amount of time (see :unlock_in below) + # :both = Enables both strategies + # :none = No unlock strategy. You should handle unlocking by yourself. + # config.unlock_strategy = :both + + # Number of authentication tries before locking an account if lock_strategy + # is failed attempts. + # config.maximum_attempts = 20 + + # Time interval to unlock the account if :time is enabled as unlock_strategy. + # config.unlock_in = 1.hour + + # ==> Configuration for :recoverable + # + # Defines which key will be used when recovering the password for an account + # config.reset_password_keys = [ :email ] + + # Time interval you can reset your password with a reset password key. + # Don't put a too small interval or your users won't have the time to + # change their passwords. + config.reset_password_within = 6.hours + + # ==> Configuration for :encryptable + # Allow you to use another encryption algorithm besides bcrypt (default). You can use + # :sha1, :sha512 or encryptors from others authentication tools as :clearance_sha1, + # :authlogic_sha512 (then you should set stretches above to 20 for default behavior) + # and :restful_authentication_sha1 (then you should set stretches to 10, and copy + # REST_AUTH_SITE_KEY to pepper) + # config.encryptor = :sha512 + + # ==> Configuration for :token_authenticatable + # Defines name of the authentication token params key + # config.token_authentication_key = :auth_token + + # ==> Scopes configuration + # Turn scoped views on. Before rendering "sessions/new", it will first check for + # "users/sessions/new". It's turned off by default because it's slower if you + # are using only default views. + # config.scoped_views = false + + # Configure the default scope given to Warden. By default it's the first + # devise role declared in your routes (usually :user). + # config.default_scope = :user + + # Set this configuration to false if you want /users/sign_out to sign out + # only the current scope. By default, Devise signs out all scopes. + # config.sign_out_all_scopes = true + + # ==> Navigation configuration + # Lists the formats that should be treated as navigational. Formats like + # :html, should redirect to the sign in page when the user does not have + # access, but formats like :xml or :json, should return 401. + # + # If you have any extra navigational formats, like :iphone or :mobile, you + # should add them to the navigational formats lists. + # + # The "*/*" below is required to match Internet Explorer requests. + # config.navigational_formats = ["*/*", :html] + + # The default HTTP method used to sign out a resource. Default is :delete. + config.sign_out_via = :delete + + # ==> OmniAuth + # Add a new OmniAuth provider. Check the wiki for more information on setting + # up on your models and hooks. + # config.omniauth :github, 'APP_ID', 'APP_SECRET', :scope => 'user,public_repo' + + # ==> Warden configuration + # If you want to use other strategies, that are not supported by Devise, or + # change the failure app, you can configure them inside the config.warden block. + # + # config.warden do |manager| + # manager.intercept_401 = false + # manager.default_strategies(:scope => :user).unshift :some_external_strategy + # end + + # ==> Mountable engine configurations + # When using Devise inside an engine, let's call it `MyEngine`, and this engine + # is mountable, there are some extra configurations to be taken into account. + # The following options are available, assuming the engine is mounted as: + # + # mount MyEngine, at: "/my_engine" + # + # The router that invoked `devise_for`, in the example above, would be: + # config.router_name = :my_engine + # + # When using omniauth, Devise cannot automatically set Omniauth path, + # so you need to do it manually. For the users scope, it would be: + # config.omniauth_path_prefix = "/my_engine/users/auth" +end \ No newline at end of file diff --git a/config/initializers/inflections.rb b/config/initializers/inflections.rb new file mode 100644 index 00000000..5d8d9be2 --- /dev/null +++ b/config/initializers/inflections.rb @@ -0,0 +1,15 @@ +# Be sure to restart your server when you modify this file. + +# Add new inflection rules using the following format +# (all these examples are active by default): +# ActiveSupport::Inflector.inflections do |inflect| +# inflect.plural /^(ox)$/i, '\1en' +# inflect.singular /^(ox)en/i, '\1' +# inflect.irregular 'person', 'people' +# inflect.uncountable %w( fish sheep ) +# end +# +# These inflection rules are supported but not enabled by default: +# ActiveSupport::Inflector.inflections do |inflect| +# inflect.acronym 'RESTful' +# end diff --git a/config/initializers/mime_types.rb b/config/initializers/mime_types.rb new file mode 100644 index 00000000..72aca7e4 --- /dev/null +++ b/config/initializers/mime_types.rb @@ -0,0 +1,5 @@ +# Be sure to restart your server when you modify this file. + +# Add new mime types for use in respond_to blocks: +# Mime::Type.register "text/richtext", :rtf +# Mime::Type.register_alias "text/html", :iphone diff --git a/config/initializers/rails_admin.rb b/config/initializers/rails_admin.rb new file mode 100644 index 00000000..c2ffc919 --- /dev/null +++ b/config/initializers/rails_admin.rb @@ -0,0 +1,179 @@ +# RailsAdmin config file. Generated on September 22, 2012 18:58 +# See github.com/sferik/rails_admin for more informations + +RailsAdmin.config do |config| + + # If your default_local is different from :en, uncomment the following 2 lines and set your default locale here: + # require 'i18n' + # I18n.default_locale = :de + + config.current_user_method { current_user } # auto-generated + + # If you want to track changes on your models: + config.audit_with :history, Applicant + config.audit_with :history, User + + # Or with a PaperTrail: (you need to install it first) + # config.audit_with :paper_trail, User + + # Set the admin name here (optional second array element will appear in a beautiful RailsAdmin red ©) + config.main_app_name = ['Reuman', 'Admin'] + # or for a dynamic name: + # config.main_app_name = Proc.new { |controller| [Rails.application.engine_name.titleize, controller.params['action'].titleize] } + + + # ==> Global show view settings + # Display empty fields in show views + # config.compact_show_view = false + + # ==> Global list view settings + # Number of default rows per-page: + config.default_items_per_page = 50 + + # ==> Included models + # Add all excluded models here: + # config.excluded_models = [Applicant, User] + + # Add models here if you want to go 'whitelist mode': + # config.included_models = [Applicant, User] + + # Application wide tried label methods for models' instances + # config.label_methods << :description # Default is [:name, :title] + + # ==> Global models configuration + # config.models do + # # Configuration here will affect all included models in all scopes, handle with care! + # + # list do + # # Configuration here will affect all included models in list sections (same for show, export, edit, update, create) + # + # fields_of_type :date do + # # Configuration here will affect all date fields, in the list section, for all included models. See README for a comprehensive type list. + # end + # end + # end + # + # ==> Model specific configuration + # Keep in mind that *all* configuration blocks are optional. + # RailsAdmin will try his best to provide the best defaults for each section, for each field. + # Try to override as few things as possible, in the most generic way. Try to avoid setting labels for models and attributes, use ActiveRecord I18n API instead. + # Less code is better code! + # config.model MyModel do + # # Cross-section field configuration + # object_label_method :name # Name of the method called for pretty printing an *instance* of ModelName + # label 'My model' # Name of ModelName (smartly defaults to ActiveRecord's I18n API) + # label_plural 'My models' # Same, plural + # weight -1 # Navigation priority. Bigger is higher. + # parent OtherModel # Set parent model for navigation. MyModel will be nested below. OtherModel will be on first position of the dropdown + # navigation_label # Sets dropdown entry's name in navigation. Only for parents! + # # Section specific configuration: + # list do + # filters [:id, :name] # Array of field names which filters should be shown by default in the table header + # items_per_page 100 # Override default_items_per_page + # sort_by :id # Sort column (default is primary key) + # sort_reverse true # Sort direction (default is true for primary key, last created first) + # # Here goes the fields configuration for the list view + # end + # end + + # Your model's configuration, to help you get started: + + # All fields marked as 'hidden' won't be shown anywhere in the rails_admin unless you mark them as visible. (visible(true)) + + config.model Applicant do + # Found associations: + # Found columns: + # configure :id, :integer + # configure :password, :password # Hidden + # configure :password_confirmation, :password # Hidden + # configure :reset_password_token, :string # Hidden + # configure :reset_password_sent_at, :datetime + # configure :remember_created_at, :datetime + # configure :sign_in_count, :integer + # configure :current_sign_in_at, :datetime + # configure :last_sign_in_at, :datetime + # configure :confirmation_token, :string + # configure :confirmed_at, :datetime + # configure :confirmation_sent_at, :datetime + # configure :failed_attempts, :integer + # configure :unlock_token, :string + # configure :locked_at, :datetime + # configure :authentication_token, :string + # configure :pid, :string + configure :email, :string + configure :current_sign_in_ip, :string + configure :last_sign_in_ip, :string + configure :first_name, :string + configure :last_name, :string + configure :college, :string + configure :current_major, :string + configure :applying_to, :string + configure :bild_1, :float + configure :chem_6a, :float + configure :chem_6b, :float + configure :mae_8, :float + configure :math_20a, :float + configure :math_20b, :float + configure :math_20c, :float + configure :phys_2a, :float + configure :phys_2b, :float + configure :average_gpa, :float + configure :created_at, :datetime + # configure :submitted_at, :datetime + # configure :updated_at, :datetime # # Sections: + # list do; end + # export do; end + # show do; end + edit do + configure :email, :string + configure :current_sign_in_ip, :string + configure :last_sign_in_ip, :string + configure :first_name, :string + configure :last_name, :string + configure :college, :string + configure :current_major, :string + configure :applying_to, :string + configure :bild_1, :float + configure :chem_6a, :float + configure :chem_6b, :float + configure :mae_8, :float + configure :math_20a, :float + configure :math_20b, :float + configure :math_20c, :float + configure :phys_2a, :float + configure :phys_2b, :float + configure :average_gpa, :float + configure :created_at, :datetime + end + # create do; end + # update do; end + end + # config.model User do + # # Found associations: + # # Found columns: + # configure :id, :integer + # configure :email, :string + # configure :password, :password # Hidden + # configure :password_confirmation, :password # Hidden + # configure :reset_password_token, :string # Hidden + # configure :reset_password_sent_at, :datetime + # configure :remember_created_at, :datetime + # configure :sign_in_count, :integer + # configure :current_sign_in_at, :datetime + # configure :last_sign_in_at, :datetime + # configure :current_sign_in_ip, :string + # configure :last_sign_in_ip, :string + # configure :failed_attempts, :integer + # configure :unlock_token, :string + # configure :locked_at, :datetime + # configure :authentication_token, :string + # configure :created_at, :datetime + # configure :updated_at, :datetime # # Sections: + # list do; end + # export do; end + # show do; end + # edit do; end + # create do; end + # update do; end + # end +end diff --git a/config/initializers/rails_admin.rb.example b/config/initializers/rails_admin.rb.example new file mode 100644 index 00000000..71756afe --- /dev/null +++ b/config/initializers/rails_admin.rb.example @@ -0,0 +1,164 @@ +# RailsAdmin config file. Generated on September 24, 2012 18:34 +# See github.com/sferik/rails_admin for more informations + +RailsAdmin.config do |config| + + # If your default_local is different from :en, uncomment the following 2 lines and set your default locale here: + # require 'i18n' + # I18n.default_locale = :de + + config.current_user_method { current_user } # auto-generated + + # If you want to track changes on your models: + # config.audit_with :history, User + + # Or with a PaperTrail: (you need to install it first) + # config.audit_with :paper_trail, User + + # Set the admin name here (optional second array element will appear in a beautiful RailsAdmin red ©) + config.main_app_name = ['Reuman', 'Admin'] + # or for a dynamic name: + # config.main_app_name = Proc.new { |controller| [Rails.application.engine_name.titleize, controller.params['action'].titleize] } + + + # ==> Global show view settings + # Display empty fields in show views + # config.compact_show_view = false + + # ==> Global list view settings + # Number of default rows per-page: + # config.default_items_per_page = 20 + + # ==> Included models + # Add all excluded models here: + # config.excluded_models = [Applicant, User] + + # Add models here if you want to go 'whitelist mode': + # config.included_models = [Applicant, User] + + # Application wide tried label methods for models' instances + # config.label_methods << :description # Default is [:name, :title] + + # ==> Global models configuration + # config.models do + # # Configuration here will affect all included models in all scopes, handle with care! + # + # list do + # # Configuration here will affect all included models in list sections (same for show, export, edit, update, create) + # + # fields_of_type :date do + # # Configuration here will affect all date fields, in the list section, for all included models. See README for a comprehensive type list. + # end + # end + # end + # + # ==> Model specific configuration + # Keep in mind that *all* configuration blocks are optional. + # RailsAdmin will try his best to provide the best defaults for each section, for each field. + # Try to override as few things as possible, in the most generic way. Try to avoid setting labels for models and attributes, use ActiveRecord I18n API instead. + # Less code is better code! + # config.model MyModel do + # # Cross-section field configuration + # object_label_method :name # Name of the method called for pretty printing an *instance* of ModelName + # label 'My model' # Name of ModelName (smartly defaults to ActiveRecord's I18n API) + # label_plural 'My models' # Same, plural + # weight -1 # Navigation priority. Bigger is higher. + # parent OtherModel # Set parent model for navigation. MyModel will be nested below. OtherModel will be on first position of the dropdown + # navigation_label # Sets dropdown entry's name in navigation. Only for parents! + # # Section specific configuration: + # list do + # filters [:id, :name] # Array of field names which filters should be shown by default in the table header + # items_per_page 100 # Override default_items_per_page + # sort_by :id # Sort column (default is primary key) + # sort_reverse true # Sort direction (default is true for primary key, last created first) + # # Here goes the fields configuration for the list view + # end + # end + + # Your model's configuration, to help you get started: + + # All fields marked as 'hidden' won't be shown anywhere in the rails_admin unless you mark them as visible. (visible(true)) + + # config.model Applicant do + # # Found associations: + # # Found columns: + # configure :id, :integer + # configure :first_name, :string + # configure :last_name, :string + # configure :pid, :string + # configure :college, :string + # configure :current_major, :string + # configure :applying_to, :string + # configure :bild_1, :float + # configure :chem_6a, :float + # configure :chem_6b, :float + # configure :chem_6c, :float + # configure :mae_8, :float + # configure :math_20a, :float + # configure :math_20b, :float + # configure :math_20c, :float + # configure :phys_2a, :float + # configure :phys_2b, :float + # configure :average_gpa, :float + # configure :submitted_at, :datetime + # configure :email, :string + # configure :password, :password # Hidden + # configure :password_confirmation, :password # Hidden + # configure :reset_password_token, :string # Hidden + # configure :reset_password_sent_at, :datetime + # configure :remember_created_at, :datetime + # configure :sign_in_count, :integer + # configure :current_sign_in_at, :datetime + # configure :last_sign_in_at, :datetime + # configure :current_sign_in_ip, :string + # configure :last_sign_in_ip, :string + # configure :confirmation_token, :string + # configure :confirmed_at, :datetime + # configure :confirmation_sent_at, :datetime + # configure :unconfirmed_email, :string + # configure :failed_attempts, :integer + # configure :unlock_token, :string + # configure :locked_at, :datetime + # configure :authentication_token, :string + # configure :created_at, :datetime + # configure :updated_at, :datetime # # Sections: + # list do; end + # export do; end + # show do; end + # edit do; end + # create do; end + # update do; end + # end + # config.model User do + # # Found associations: + # # Found columns: + # configure :id, :integer + # configure :email, :string + # configure :password, :password # Hidden + # configure :password_confirmation, :password # Hidden + # configure :reset_password_token, :string # Hidden + # configure :reset_password_sent_at, :datetime + # configure :remember_created_at, :datetime + # configure :sign_in_count, :integer + # configure :current_sign_in_at, :datetime + # configure :last_sign_in_at, :datetime + # configure :current_sign_in_ip, :string + # configure :last_sign_in_ip, :string + # configure :confirmation_token, :string + # configure :confirmed_at, :datetime + # configure :confirmation_sent_at, :datetime + # configure :unconfirmed_email, :string + # configure :failed_attempts, :integer + # configure :unlock_token, :string + # configure :locked_at, :datetime + # configure :authentication_token, :string + # configure :created_at, :datetime + # configure :updated_at, :datetime # # Sections: + # list do; end + # export do; end + # show do; end + # edit do; end + # create do; end + # update do; end + # end +end diff --git a/config/initializers/secret_token.rb b/config/initializers/secret_token.rb new file mode 100644 index 00000000..a0d71bff --- /dev/null +++ b/config/initializers/secret_token.rb @@ -0,0 +1,7 @@ +# Be sure to restart your server when you modify this file. + +# Your secret key for verifying the integrity of signed cookies. +# If you change this key, all old signed cookies will become invalid! +# Make sure the secret is at least 30 characters and all random, +# no regular words or you'll be exposed to dictionary attacks. +Reuman::Application.config.secret_token = '0b00931d048a0c2340ad7471f8595347298074f4d87f95abccaf3a2441ac27edee54a1c02717831bc619865e314af437f0aa843563b2e1e53e6ec9ac35f040ce' diff --git a/config/initializers/session_store.rb b/config/initializers/session_store.rb new file mode 100644 index 00000000..507fd627 --- /dev/null +++ b/config/initializers/session_store.rb @@ -0,0 +1,8 @@ +# Be sure to restart your server when you modify this file. + +Reuman::Application.config.session_store :cookie_store, key: '_reuman_session' + +# Use the database for sessions instead of the cookie-based default, +# which shouldn't be used to store highly confidential information +# (create the session table with "rails generate session_migration") +# Reuman::Application.config.session_store :active_record_store diff --git a/config/initializers/trusted_proxies.rb b/config/initializers/trusted_proxies.rb new file mode 100644 index 00000000..4a241079 --- /dev/null +++ b/config/initializers/trusted_proxies.rb @@ -0,0 +1 @@ +Reuman::Application.config.action_dispatch.trusted_proxies = /^201\.202\.203\.204$|^127\.0\.0\.1$|^(10|132|172\.(1[6-9]|2[0-9]|30|31)|192\.168)\./i \ No newline at end of file diff --git a/config/initializers/wrap_parameters.rb b/config/initializers/wrap_parameters.rb new file mode 100644 index 00000000..999df201 --- /dev/null +++ b/config/initializers/wrap_parameters.rb @@ -0,0 +1,14 @@ +# Be sure to restart your server when you modify this file. +# +# This file contains settings for ActionController::ParamsWrapper which +# is enabled by default. + +# Enable parameter wrapping for JSON. You can disable this by setting :format to an empty array. +ActiveSupport.on_load(:action_controller) do + wrap_parameters format: [:json] +end + +# Disable root element in JSON by default. +ActiveSupport.on_load(:active_record) do + self.include_root_in_json = false +end diff --git a/config/locales/devise.en.yml b/config/locales/devise.en.yml new file mode 100644 index 00000000..a25f3792 --- /dev/null +++ b/config/locales/devise.en.yml @@ -0,0 +1,59 @@ +# Additional translations at https://github.com/plataformatec/devise/wiki/I18n + +en: + errors: + messages: + expired: "has expired, please request a new one" + not_found: "not found" + already_confirmed: "was already confirmed, please try signing in" + not_locked: "was not locked" + not_saved_status: "Current Application Errors" + not_saved: + one: "1 error prohibited this %{resource} from being saved:" + other: "%{count} errors prohibited this %{resource} from being saved:" + + devise: + failure: + already_authenticated: 'You are already signed in.' + unauthenticated: 'You need to sign in or sign up before continuing.' + unconfirmed: 'You have to confirm your account before continuing.' + locked: 'Your account is locked.' + invalid: 'Invalid email or password.' + invalid_token: 'Invalid authentication token.' + timeout: 'Your session expired, please sign in again to continue.' + inactive: 'Your account was not activated yet.' + sessions: + signed_in: 'Signed in successfully.' + signed_out: 'Signed out successfully.' + passwords: + send_instructions: 'You will receive an email with instructions about how to reset your password in a few minutes.' + updated: 'Your password was changed successfully. You are now signed in.' + updated_not_active: 'Your password was changed successfully.' + send_paranoid_instructions: "If your email address exists in our database, you will receive a password recovery link at your email address in a few minutes." + no_token: "You can't access this page without coming from a password reset email. If you do come from a password reset email, please make sure you used the full URL provided." + confirmations: + send_instructions: 'You will receive an email with instructions about how to confirm your account in a few minutes.' + send_paranoid_instructions: 'If your email address exists in our database, you will receive an email with instructions about how to confirm your account in a few minutes.' + confirmed: 'Your account was successfully confirmed. You are now signed in.' + registrations: + signed_up: 'Welcome! You have signed up successfully.' + signed_up_but_unconfirmed: 'A message with a confirmation link has been sent to your email address. Please open the link to activate your account.' + signed_up_but_inactive: 'You have signed up successfully. However, we could not sign you in because your account is not yet activated.' + signed_up_but_locked: 'You have signed up successfully. However, we could not sign you in because your account is locked.' + updated: 'You updated your account successfully.' + update_needs_confirmation: "You updated your account successfully, but we need to verify your new email address. Please check your email and click on the confirm link to finalize confirming your new email address." + destroyed: 'Bye! Your account was successfully cancelled. We hope to see you again soon.' + unlocks: + send_instructions: 'You will receive an email with instructions about how to unlock your account in a few minutes.' + unlocked: 'Your account has been unlocked successfully. Please sign in to continue.' + send_paranoid_instructions: 'If your account exists, you will receive an email with instructions about how to unlock it in a few minutes.' + omniauth_callbacks: + success: 'Successfully authenticated from %{kind} account.' + failure: 'Could not authenticate you from %{kind} because "%{reason}".' + mailer: + confirmation_instructions: + subject: 'Confirmation instructions' + reset_password_instructions: + subject: 'Reset password instructions' + unlock_instructions: + subject: 'Unlock Instructions' diff --git a/config/locales/en.yml b/config/locales/en.yml new file mode 100644 index 00000000..179c14ca --- /dev/null +++ b/config/locales/en.yml @@ -0,0 +1,5 @@ +# Sample localization file for English. Add more files in this directory for other locales. +# See https://github.com/svenfuchs/rails-i18n/tree/master/rails%2Flocale for starting points. + +en: + hello: "Hello world" diff --git a/config/routes.rb b/config/routes.rb new file mode 100644 index 00000000..4314dbab --- /dev/null +++ b/config/routes.rb @@ -0,0 +1,83 @@ +Reuman::Application.routes.draw do + mount RailsAdmin::Engine => '/admin', :as => 'rails_admin' + + devise_for :users + + devise_for :users, :controllers => { :sessions => "users/sessions" } do + match "users/sign_out" => "devise/sessions#destroy" + end + + namespace :applicants do + get "recommenders" => "recommenders#edit" + put "recommenders" => "recommenders#update" + delete "recommenders" => "recommenders#destroy" + + get "records" => "academic_records#edit" + put "records" => "academic_records#update" + delete "records" => "academic_records#destroy" + end + + match "closed" => "welcome#closed" + + # The priority is based upon order of creation: + # first created -> highest priority. + devise_for :applicants, :controllers => { :confirmations => "applicants/confirmations", :registrations => "applicants/registrations", :sessions => "applicants/sessions" } do + get "applicants/status" => "applicants/registrations#status", :as => :applicant_status + get "applicants/submit" => "applicants/registrations#submit", :as => :submit_application + end + + # Sample of regular route: + # match 'products/:id' => 'catalog#view' + # Keep in mind you can assign values other than :controller and :action + + # Sample of named route: + # match 'products/:id/purchase' => 'catalog#purchase', :as => :purchase + # This route can be invoked with purchase_url(:id => product.id) + + # Sample resource route (maps HTTP verbs to controller actions automatically): + # resources :products + + # Sample resource route with options: + # resources :products do + # member do + # get 'short' + # post 'toggle' + # end + # + # collection do + # get 'sold' + # end + # end + + # Sample resource route with sub-resources: + # resources :products do + # resources :comments, :sales + # resource :seller + # end + + # Sample resource route with more complex sub-resources + # resources :products do + # resources :comments + # resources :sales do + # get 'recent', :on => :collection + # end + # end + + # Sample resource route within a namespace: + # namespace :admin do + # # Directs /admin/products/* to Admin::ProductsController + # # (app/controllers/admin/products_controller.rb) + # resources :products + # end + + + # You can have the root of your site routed with "root" + # just remember to delete public/index.html. + root :to => "welcome#index" + + # See how all your routes lay out with "rake routes" + + # This is a legacy wild controller route that's not recommended for RESTful applications. + # Note: This route will make all actions in every controller accessible via GET requests. + # match ':controller(/:action(/:id(.:format)))' +end diff --git a/config/setup_load_paths.rb b/config/setup_load_paths.rb new file mode 100644 index 00000000..5c6e80e3 --- /dev/null +++ b/config/setup_load_paths.rb @@ -0,0 +1,14 @@ +if ENV['MY_RUBY_HOME'] && ENV['MY_RUBY_HOME'].include?('rvm') + begin + gems_path = ENV['MY_RUBY_HOME'].split(/@/)[0].sub(/rubies/,'gems') + ENV['GEM_PATH'] = "#{gems_path}:#{gems_path}@global" + require 'rvm' + RVM.use_from_path! File.dirname(File.dirname(__FILE__)) + rescue LoadError + raise "RVM gem is currently unavailable." + end +end + +# If you're not using Bundler at all, remove lines bellow +ENV['BUNDLE_GEMFILE'] = File.expand_path('../Gemfile', File.dirname(__FILE__)) +require 'bundler/setup' \ No newline at end of file diff --git a/db/migrate/20120923015412_devise_create_users.rb b/db/migrate/20120923015412_devise_create_users.rb new file mode 100644 index 00000000..90b975d7 --- /dev/null +++ b/db/migrate/20120923015412_devise_create_users.rb @@ -0,0 +1,46 @@ +class DeviseCreateUsers < ActiveRecord::Migration + def change + create_table(:users) do |t| + ## Database authenticatable + t.string :email, :null => false, :default => "" + t.string :encrypted_password, :null => false, :default => "" + + ## Recoverable + t.string :reset_password_token + t.datetime :reset_password_sent_at + + ## Rememberable + t.datetime :remember_created_at + + ## Trackable + t.integer :sign_in_count, :default => 0 + t.datetime :current_sign_in_at + t.datetime :last_sign_in_at + t.string :current_sign_in_ip + t.string :last_sign_in_ip + + ## Confirmable + t.string :confirmation_token + t.datetime :confirmed_at + t.datetime :confirmation_sent_at + t.string :unconfirmed_email # Only if using reconfirmable + + ## Lockable + t.integer :failed_attempts, :default => 0 # Only if lock strategy is :failed_attempts + t.string :unlock_token # Only if unlock strategy is :email or :both + t.datetime :locked_at + + ## Token authenticatable + t.string :authentication_token + + + t.timestamps + end + + add_index :users, :email, :unique => true + add_index :users, :reset_password_token, :unique => true + add_index :users, :confirmation_token, :unique => true + add_index :users, :unlock_token, :unique => true + add_index :users, :authentication_token, :unique => true + end +end diff --git a/db/migrate/20120923015419_devise_create_applicants.rb b/db/migrate/20120923015419_devise_create_applicants.rb new file mode 100644 index 00000000..1849aa1f --- /dev/null +++ b/db/migrate/20120923015419_devise_create_applicants.rb @@ -0,0 +1,69 @@ +class DeviseCreateApplicants < ActiveRecord::Migration + def change + create_table(:applicants) do |t| + + # contact info + t.string :first_name + t.string :last_name + t.string :phone + + # personal info + t.date :dob + t.string :citizenship + t.string :disability + t.string :gender + t.string :ethnicity + t.string :race + + # academic info + t.text :lab_skills + t.text :cpu_skills + t.text :statement + + t.datetime :submitted_at + + ## Database authenticatable + t.string :email, :null => false, :default => "" + t.string :encrypted_password, :null => false, :default => "" + + ## Recoverable + t.string :reset_password_token + t.datetime :reset_password_sent_at + + ## Rememberable + t.datetime :remember_created_at + + ## Trackable + t.integer :sign_in_count, :default => 0 + t.datetime :current_sign_in_at + t.datetime :last_sign_in_at + t.string :current_sign_in_ip + t.string :last_sign_in_ip + + ## Confirmable + t.string :confirmation_token + t.datetime :confirmed_at + t.datetime :confirmation_sent_at + t.string :unconfirmed_email # Only if using reconfirmable + + ## Lockable + t.integer :failed_attempts, :default => 0 # Only if lock strategy is :failed_attempts + t.string :unlock_token # Only if unlock strategy is :email or :both + t.datetime :locked_at + + ## Token authenticatable + t.string :authentication_token + + ## ActsAsStateMachine State + t.string :aasm_state + + t.timestamps + end + + add_index :applicants, :email, :unique => true + add_index :applicants, :reset_password_token, :unique => true + add_index :applicants, :confirmation_token, :unique => true + add_index :applicants, :unlock_token, :unique => true + add_index :applicants, :authentication_token, :unique => true + end +end diff --git a/db/migrate/20120923015827_create_rails_admin_histories_table.rb b/db/migrate/20120923015827_create_rails_admin_histories_table.rb new file mode 100644 index 00000000..3c743aa2 --- /dev/null +++ b/db/migrate/20120923015827_create_rails_admin_histories_table.rb @@ -0,0 +1,18 @@ +class CreateRailsAdminHistoriesTable < ActiveRecord::Migration + def self.up + create_table :rails_admin_histories do |t| + t.text :message # title, name, or object_id + t.string :username + t.integer :item + t.string :table + t.integer :month, :limit => 2 + t.integer :year, :limit => 5 + t.timestamps + end + add_index(:rails_admin_histories, [:item, :table, :month, :year], :name => 'index_rails_admin_histories' ) + end + + def self.down + drop_table :rails_admin_histories + end +end diff --git a/db/migrate/20121122074515_create_addresses.rb b/db/migrate/20121122074515_create_addresses.rb new file mode 100644 index 00000000..3d29be44 --- /dev/null +++ b/db/migrate/20121122074515_create_addresses.rb @@ -0,0 +1,17 @@ +class CreateAddresses < ActiveRecord::Migration + def change + create_table :addresses do |t| + t.string :address + t.string :address2 + t.string :city + t.string :state + t.string :zip + t.string :country + t.string :label + t.string :permanent + t.integer :applicant_id + + t.timestamps + end + end +end diff --git a/db/migrate/20121126032545_create_academic_records.rb b/db/migrate/20121126032545_create_academic_records.rb new file mode 100644 index 00000000..544ad90d --- /dev/null +++ b/db/migrate/20121126032545_create_academic_records.rb @@ -0,0 +1,17 @@ +class CreateAcademicRecords < ActiveRecord::Migration + def change + create_table :academic_records do |t| + t.string :university + t.date :start + t.date :finish + t.string :academic_level + t.string :degree + t.float :gpa + t.float :gpa_range, :default => 4.0 + t.text :gpa_comment + t.integer :applicant_id + + t.timestamps + end + end +end diff --git a/db/migrate/20121126220714_create_awards.rb b/db/migrate/20121126220714_create_awards.rb new file mode 100644 index 00000000..c3fd6411 --- /dev/null +++ b/db/migrate/20121126220714_create_awards.rb @@ -0,0 +1,12 @@ +class CreateAwards < ActiveRecord::Migration + def change + create_table :awards do |t| + t.string :title + t.date :date + t.text :description + t.integer :applicant_id + + t.timestamps + end + end +end diff --git a/db/migrate/20121217005021_create_recommenders.rb b/db/migrate/20121217005021_create_recommenders.rb new file mode 100644 index 00000000..578a5d80 --- /dev/null +++ b/db/migrate/20121217005021_create_recommenders.rb @@ -0,0 +1,17 @@ +class CreateRecommenders < ActiveRecord::Migration + def change + create_table :recommenders do |t| + t.string :first_name + t.string :last_name + t.string :title + t.string :department + t.string :organization + t.string :url + t.string :email + t.string :phone + + t.timestamps + end + end +end + \ No newline at end of file diff --git a/db/migrate/20121217025345_create_recommendations.rb b/db/migrate/20121217025345_create_recommendations.rb new file mode 100644 index 00000000..0373847d --- /dev/null +++ b/db/migrate/20121217025345_create_recommendations.rb @@ -0,0 +1,15 @@ +class CreateRecommendations < ActiveRecord::Migration + def change + create_table :recommendations do |t| + t.integer :known_applicant_for + t.string :known_capacity + t.string :overall_promise + t.string :undergraduate_institution + t.text :body + t.integer :applicant_id + t.integer :recommender_id + + t.timestamps + end + end +end diff --git a/db/schema.rb b/db/schema.rb new file mode 100644 index 00000000..5c262a52 --- /dev/null +++ b/db/schema.rb @@ -0,0 +1,163 @@ +# encoding: UTF-8 +# This file is auto-generated from the current state of the database. Instead +# of editing this file, please use the migrations feature of Active Record to +# incrementally modify your database, and then regenerate this schema definition. +# +# Note that this schema.rb definition is the authoritative source for your +# database schema. If you need to create the application database on another +# system, you should be using db:schema:load, not running all the migrations +# from scratch. The latter is a flawed and unsustainable approach (the more migrations +# you'll amass, the slower it'll run and the greater likelihood for issues). +# +# It's strongly recommended to check this file into your version control system. + +ActiveRecord::Schema.define(:version => 20121217025345) do + + create_table "academic_records", :force => true do |t| + t.string "university" + t.date "start" + t.date "finish" + t.string "academic_level" + t.string "degree" + t.float "gpa" + t.float "gpa_range", :default => 4.0 + t.text "gpa_comment" + t.integer "applicant_id" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + create_table "addresses", :force => true do |t| + t.string "address" + t.string "address2" + t.string "city" + t.string "state" + t.string "zip" + t.string "country" + t.string "label" + t.string "permanent" + t.integer "applicant_id" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + create_table "applicants", :force => true do |t| + t.string "first_name" + t.string "last_name" + t.string "phone" + t.date "dob" + t.string "citizenship" + t.string "disability" + t.string "gender" + t.string "ethnicity" + t.string "race" + t.text "lab_skills" + t.text "cpu_skills" + t.text "statement" + t.datetime "submitted_at" + t.string "email", :default => "", :null => false + t.string "encrypted_password", :default => "", :null => false + t.string "reset_password_token" + t.datetime "reset_password_sent_at" + t.datetime "remember_created_at" + t.integer "sign_in_count", :default => 0 + t.datetime "current_sign_in_at" + t.datetime "last_sign_in_at" + t.string "current_sign_in_ip" + t.string "last_sign_in_ip" + t.string "confirmation_token" + t.datetime "confirmed_at" + t.datetime "confirmation_sent_at" + t.string "unconfirmed_email" + t.integer "failed_attempts", :default => 0 + t.string "unlock_token" + t.datetime "locked_at" + t.string "authentication_token" + t.string "aasm_state" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + add_index "applicants", ["authentication_token"], :name => "index_applicants_on_authentication_token", :unique => true + add_index "applicants", ["confirmation_token"], :name => "index_applicants_on_confirmation_token", :unique => true + add_index "applicants", ["email"], :name => "index_applicants_on_email", :unique => true + add_index "applicants", ["reset_password_token"], :name => "index_applicants_on_reset_password_token", :unique => true + add_index "applicants", ["unlock_token"], :name => "index_applicants_on_unlock_token", :unique => true + + create_table "awards", :force => true do |t| + t.string "title" + t.date "date" + t.text "description" + t.integer "applicant_id" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + create_table "rails_admin_histories", :force => true do |t| + t.text "message" + t.string "username" + t.integer "item" + t.string "table" + t.integer "month", :limit => 2 + t.integer "year", :limit => 8 + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + add_index "rails_admin_histories", ["item", "table", "month", "year"], :name => "index_rails_admin_histories" + + create_table "recommendations", :force => true do |t| + t.integer "known_applicant_for" + t.string "known_capacity" + t.string "overall_promise" + t.string "undergraduate_institution" + t.text "body" + t.integer "applicant_id" + t.integer "recommender_id" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + create_table "recommenders", :force => true do |t| + t.string "first_name" + t.string "last_name" + t.string "title" + t.string "department" + t.string "organization" + t.string "url" + t.string "email" + t.string "phone" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + create_table "users", :force => true do |t| + t.string "email", :default => "", :null => false + t.string "encrypted_password", :default => "", :null => false + t.string "reset_password_token" + t.datetime "reset_password_sent_at" + t.datetime "remember_created_at" + t.integer "sign_in_count", :default => 0 + t.datetime "current_sign_in_at" + t.datetime "last_sign_in_at" + t.string "current_sign_in_ip" + t.string "last_sign_in_ip" + t.string "confirmation_token" + t.datetime "confirmed_at" + t.datetime "confirmation_sent_at" + t.string "unconfirmed_email" + t.integer "failed_attempts", :default => 0 + t.string "unlock_token" + t.datetime "locked_at" + t.string "authentication_token" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + add_index "users", ["authentication_token"], :name => "index_users_on_authentication_token", :unique => true + add_index "users", ["confirmation_token"], :name => "index_users_on_confirmation_token", :unique => true + add_index "users", ["email"], :name => "index_users_on_email", :unique => true + add_index "users", ["reset_password_token"], :name => "index_users_on_reset_password_token", :unique => true + add_index "users", ["unlock_token"], :name => "index_users_on_unlock_token", :unique => true + +end diff --git a/db/seeds.rb b/db/seeds.rb new file mode 100644 index 00000000..083a41fc --- /dev/null +++ b/db/seeds.rb @@ -0,0 +1,13 @@ +# This file should contain all the record creation needed to seed the database with its default values. +# The data can then be loaded with the rake db:seed (or created alongside the db with db:setup). +# +# Examples: +# +# cities = City.create([{ name: 'Chicago' }, { name: 'Copenhagen' }]) +# Mayor.create(name: 'Emanuel', city: cities.first) +u = User.create(:email => 'jgrevich@ucsd.edu', :password => 'buddha') +u.confirmed_at = DateTime.now +u.save +u = User.create(:email => 'be-uginfo@bioeng.ucsd.edu', :password => 'demonstration') +u.confirmed_at = DateTime.now +u.save \ No newline at end of file diff --git a/doc/README_FOR_APP b/doc/README_FOR_APP new file mode 100644 index 00000000..fe41f5cc --- /dev/null +++ b/doc/README_FOR_APP @@ -0,0 +1,2 @@ +Use this README file to introduce your application and point to useful places in the API for learning more. +Run "rake doc:app" to generate API documentation for your models, controllers, helpers, and libraries. diff --git a/lib/assets/.gitkeep b/lib/assets/.gitkeep new file mode 100644 index 00000000..e69de29b diff --git a/lib/tasks/.gitkeep b/lib/tasks/.gitkeep new file mode 100644 index 00000000..e69de29b diff --git a/public/404.html b/public/404.html new file mode 100644 index 00000000..9a48320a --- /dev/null +++ b/public/404.html @@ -0,0 +1,26 @@ + + + + The page you were looking for doesn't exist (404) + + + + + +
+

The page you were looking for doesn't exist.

+

You may have mistyped the address or the page may have moved.

+
+ + diff --git a/public/422.html b/public/422.html new file mode 100644 index 00000000..83660ab1 --- /dev/null +++ b/public/422.html @@ -0,0 +1,26 @@ + + + + The change you wanted was rejected (422) + + + + + +
+

The change you wanted was rejected.

+

Maybe you tried to change something you didn't have access to.

+
+ + diff --git a/public/500.html b/public/500.html new file mode 100644 index 00000000..f3648a0d --- /dev/null +++ b/public/500.html @@ -0,0 +1,25 @@ + + + + We're sorry, but something went wrong (500) + + + + + +
+

We're sorry, but something went wrong.

+
+ + diff --git a/public/favicon.ico b/public/favicon.ico new file mode 100644 index 00000000..e69de29b diff --git a/public/robots.txt b/public/robots.txt new file mode 100644 index 00000000..085187fa --- /dev/null +++ b/public/robots.txt @@ -0,0 +1,5 @@ +# See http://www.robotstxt.org/wc/norobots.html for documentation on how to use the robots.txt file +# +# To ban all spiders from the entire site uncomment the next two lines: +# User-Agent: * +# Disallow: / diff --git a/script/rails b/script/rails new file mode 100755 index 00000000..f8da2cff --- /dev/null +++ b/script/rails @@ -0,0 +1,6 @@ +#!/usr/bin/env ruby +# This command will automatically be run when you run "rails" with Rails 3 gems installed from the root of your application. + +APP_PATH = File.expand_path('../../config/application', __FILE__) +require File.expand_path('../../config/boot', __FILE__) +require 'rails/commands' diff --git a/spec/controllers/applicants/academic_records_controller_spec.rb b/spec/controllers/applicants/academic_records_controller_spec.rb new file mode 100644 index 00000000..fb6c7db1 --- /dev/null +++ b/spec/controllers/applicants/academic_records_controller_spec.rb @@ -0,0 +1,5 @@ +require 'spec_helper' + +describe AcademicRecordsController do + +end \ No newline at end of file diff --git a/spec/controllers/applicants/confirmations_controller_spec.rb b/spec/controllers/applicants/confirmations_controller_spec.rb new file mode 100644 index 00000000..25796b50 --- /dev/null +++ b/spec/controllers/applicants/confirmations_controller_spec.rb @@ -0,0 +1,5 @@ +require 'spec_helper' + +describe ConfirmationsController + +end \ No newline at end of file diff --git a/spec/controllers/applicants/recommendations_controller_spec.rb b/spec/controllers/applicants/recommendations_controller_spec.rb new file mode 100644 index 00000000..fddd68e9 --- /dev/null +++ b/spec/controllers/applicants/recommendations_controller_spec.rb @@ -0,0 +1,5 @@ +require 'spec_helper' + +describe RecommendaitonsController + +end \ No newline at end of file diff --git a/spec/controllers/applicants/registrations_controller_spec.rb b/spec/controllers/applicants/registrations_controller_spec.rb new file mode 100644 index 00000000..6d29b12a --- /dev/null +++ b/spec/controllers/applicants/registrations_controller_spec.rb @@ -0,0 +1,5 @@ +require 'spec_helper' + +describe RegistrationsController do + +end \ No newline at end of file diff --git a/spec/controllers/applicants/sessions_controller_spec.rb b/spec/controllers/applicants/sessions_controller_spec.rb new file mode 100644 index 00000000..48e84ec6 --- /dev/null +++ b/spec/controllers/applicants/sessions_controller_spec.rb @@ -0,0 +1,5 @@ +require 'spec_helper' + +describe SessionsController do + +end \ No newline at end of file diff --git a/spec/controllers/application_controller_spec.rb b/spec/controllers/application_controller_spec.rb new file mode 100644 index 00000000..57c4300d --- /dev/null +++ b/spec/controllers/application_controller_spec.rb @@ -0,0 +1,5 @@ +require 'spec_helper' + +describe ApplicationController do + +end \ No newline at end of file diff --git a/spec/controllers/users/sessions_controller_spec.rb b/spec/controllers/users/sessions_controller_spec.rb new file mode 100644 index 00000000..689e68b6 --- /dev/null +++ b/spec/controllers/users/sessions_controller_spec.rb @@ -0,0 +1,5 @@ +require 'spec_helper' + +describe SessionsController do + +end \ No newline at end of file diff --git a/spec/controllers/welcome_controller_spec.rb b/spec/controllers/welcome_controller_spec.rb new file mode 100644 index 00000000..748097c1 --- /dev/null +++ b/spec/controllers/welcome_controller_spec.rb @@ -0,0 +1,5 @@ +require 'spec_helper' + +describe WelcomeController do + +end \ No newline at end of file diff --git a/spec/helpers/academic_records_helper_spec.rb b/spec/helpers/academic_records_helper_spec.rb new file mode 100644 index 00000000..d78ee2d8 --- /dev/null +++ b/spec/helpers/academic_records_helper_spec.rb @@ -0,0 +1,5 @@ +require 'spec_helper' + +describe 'AcademicRecordsHelper' do + +end \ No newline at end of file diff --git a/spec/helpers/application_helper_spec.rb b/spec/helpers/application_helper_spec.rb new file mode 100644 index 00000000..3e18a60b --- /dev/null +++ b/spec/helpers/application_helper_spec.rb @@ -0,0 +1,5 @@ +require 'spec_helper' + +describe 'ApplicationHelper' do + +end \ No newline at end of file diff --git a/spec/helpers/recommendations_helper_spec.rb b/spec/helpers/recommendations_helper_spec.rb new file mode 100644 index 00000000..e7618768 --- /dev/null +++ b/spec/helpers/recommendations_helper_spec.rb @@ -0,0 +1,5 @@ +require 'spec_helper' + +describe 'RecommendationsHelper' do + +end \ No newline at end of file diff --git a/spec/models/academic_record_spec.rb b/spec/models/academic_record_spec.rb new file mode 100644 index 00000000..b740e482 --- /dev/null +++ b/spec/models/academic_record_spec.rb @@ -0,0 +1,6 @@ +require 'spec_helper' + +describe AcademicRecord do + +end + diff --git a/spec/models/address_spec.rb b/spec/models/address_spec.rb new file mode 100644 index 00000000..10c9008d --- /dev/null +++ b/spec/models/address_spec.rb @@ -0,0 +1,5 @@ +require 'spec_helper' + +describe Address do + +end \ No newline at end of file diff --git a/spec/models/applicant_spec.rb b/spec/models/applicant_spec.rb new file mode 100644 index 00000000..70a31af7 --- /dev/null +++ b/spec/models/applicant_spec.rb @@ -0,0 +1,5 @@ +require 'spec_helper' + +describe Applicant do + +end \ No newline at end of file diff --git a/spec/models/award_spec.rb b/spec/models/award_spec.rb new file mode 100644 index 00000000..b2cb4195 --- /dev/null +++ b/spec/models/award_spec.rb @@ -0,0 +1,5 @@ +require 'spec_helper' + +describe Award do + +end diff --git a/spec/models/recommendation_spec.rb b/spec/models/recommendation_spec.rb new file mode 100644 index 00000000..ade73015 --- /dev/null +++ b/spec/models/recommendation_spec.rb @@ -0,0 +1,5 @@ +require 'spec_helper' + +describe Recommendation do + +end \ No newline at end of file diff --git a/spec/models/recommender_spec.rb b/spec/models/recommender_spec.rb new file mode 100644 index 00000000..1b2fa85e --- /dev/null +++ b/spec/models/recommender_spec.rb @@ -0,0 +1,5 @@ +require 'spec_helper' + +describe Recommender do + +end diff --git a/spec/models/user_spec.rb b/spec/models/user_spec.rb new file mode 100644 index 00000000..99805123 --- /dev/null +++ b/spec/models/user_spec.rb @@ -0,0 +1,5 @@ +require 'spec_helper' + +describe User do + +end \ No newline at end of file diff --git a/spec/requests/pages_spec.rb b/spec/requests/pages_spec.rb new file mode 100644 index 00000000..c00d34cf --- /dev/null +++ b/spec/requests/pages_spec.rb @@ -0,0 +1,22 @@ +require 'spec_helper' + +describe "Pages" do + describe "GET /" do + + end + + describe "GET recommenders" do + + end + + describe "GET records" do + + end + + describe "GET applicants" do + + end + + + +end diff --git a/vendor/assets/javascripts/.gitkeep b/vendor/assets/javascripts/.gitkeep new file mode 100644 index 00000000..e69de29b diff --git a/vendor/assets/javascripts/bootstrap-datepicker.js b/vendor/assets/javascripts/bootstrap-datepicker.js new file mode 100644 index 00000000..41f8871e --- /dev/null +++ b/vendor/assets/javascripts/bootstrap-datepicker.js @@ -0,0 +1,850 @@ +/* ========================================================= + * bootstrap-datepicker.js + * http://www.eyecon.ro/bootstrap-datepicker + * ========================================================= + * Copyright 2012 Stefan Petre + * Improvements by Andrew Rowls + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ========================================================= */ + +!function( $ ) { + + function UTCDate(){ + return new Date(Date.UTC.apply(Date, arguments)); + } + function UTCToday(){ + var today = new Date(); + return UTCDate(today.getUTCFullYear(), today.getUTCMonth(), today.getUTCDate()); + } + + // Picker object + + var Datepicker = function(element, options) { + var that = this; + + this.element = $(element); + this.language = options.language||this.element.data('date-language')||"en"; + this.language = this.language in dates ? this.language : "en"; + this.format = DPGlobal.parseFormat(options.format||this.element.data('date-format')||'mm/dd/yyyy'); + this.picker = $(DPGlobal.template) + .appendTo('body') + .on({ + click: $.proxy(this.click, this) + }); + this.isInput = this.element.is('input'); + this.component = this.element.is('.date') ? this.element.find('.add-on') : false; + this.hasInput = this.component && this.element.find('input').length; + if(this.component && this.component.length === 0) + this.component = false; + + this.forceParse = true; + if ('forceParse' in options) { + this.forceParse = options.forceParse; + } else if ('dateForceParse' in this.element.data()) { + this.forceParse = this.element.data('date-force-parse'); + } + + if (this.isInput) { + this.element.on({ + focus: $.proxy(this.show, this), + keyup: $.proxy(this.update, this), + keydown: $.proxy(this.keydown, this) + }); + } else { + if (this.component && this.hasInput){ + // For components that are not readonly, allow keyboard nav + this.element.find('input').on({ + focus: $.proxy(this.show, this), + keyup: $.proxy(this.update, this), + keydown: $.proxy(this.keydown, this) + }); + + this.component.on('click', $.proxy(this.show, this)); + } else { + this.element.on('click', $.proxy(this.show, this)); + } + } + + $(document).on('mousedown', function (e) { + // Clicked outside the datepicker, hide it + if ($(e.target).closest('.datepicker').length == 0) { + that.hide(); + } + }); + + this.autoclose = false; + if ('autoclose' in options) { + this.autoclose = options.autoclose; + } else if ('dateAutoclose' in this.element.data()) { + this.autoclose = this.element.data('date-autoclose'); + } + + this.keyboardNavigation = true; + if ('keyboardNavigation' in options) { + this.keyboardNavigation = options.keyboardNavigation; + } else if ('dateKeyboardNavigation' in this.element.data()) { + this.keyboardNavigation = this.element.data('date-keyboard-navigation'); + } + + switch(options.startView || this.element.data('date-start-view')){ + case 2: + case 'decade': + this.viewMode = this.startViewMode = 2; + break; + case 1: + case 'year': + this.viewMode = this.startViewMode = 1; + break; + case 0: + case 'month': + default: + this.viewMode = this.startViewMode = 0; + break; + } + + this.todayBtn = (options.todayBtn||this.element.data('date-today-btn')||false); + this.todayHighlight = (options.todayHighlight||this.element.data('date-today-highlight')||false); + + this.weekStart = ((options.weekStart||this.element.data('date-weekstart')||dates[this.language].weekStart||0) % 7); + this.weekEnd = ((this.weekStart + 6) % 7); + this.startDate = -Infinity; + this.endDate = Infinity; + this.setStartDate(options.startDate||this.element.data('date-startdate')); + this.setEndDate(options.endDate||this.element.data('date-enddate')); + this.fillDow(); + this.fillMonths(); + this.update(); + this.showMode(); + }; + + Datepicker.prototype = { + constructor: Datepicker, + + show: function(e) { + this.picker.show(); + this.height = this.component ? this.component.outerHeight() : this.element.outerHeight(); + this.update(); + this.place(); + $(window).on('resize', $.proxy(this.place, this)); + if (e ) { + e.stopPropagation(); + e.preventDefault(); + } + this.element.trigger({ + type: 'show', + date: this.date + }); + }, + + hide: function(e){ + this.picker.hide(); + $(window).off('resize', this.place); + this.viewMode = this.startViewMode; + this.showMode(); + if (!this.isInput) { + $(document).off('mousedown', this.hide); + } + + if ( + this.forceParse && + ( + this.isInput && this.element.val() || + this.hasInput && this.element.find('input').val() + ) + ) + this.setValue(); + this.element.trigger({ + type: 'hide', + date: this.date + }); + }, + + getDate: function() { + var d = this.getUTCDate(); + return new Date(d.getTime() + (d.getTimezoneOffset()*60000)) + }, + + getUTCDate: function() { + return this.date; + }, + + setDate: function(d) { + this.setUTCDate(new Date(d.getTime() - (d.getTimezoneOffset()*60000))); + }, + + setUTCDate: function(d) { + this.date = d; + this.setValue(); + }, + + setValue: function() { + var formatted = DPGlobal.formatDate(this.date, this.format, this.language); + if (!this.isInput) { + if (this.component){ + this.element.find('input').prop('value', formatted); + } + this.element.data('date', formatted); + } else { + this.element.prop('value', formatted); + } + }, + + setStartDate: function(startDate){ + this.startDate = startDate||-Infinity; + if (this.startDate !== -Infinity) { + this.startDate = DPGlobal.parseDate(this.startDate, this.format, this.language); + } + this.update(); + this.updateNavArrows(); + }, + + setEndDate: function(endDate){ + this.endDate = endDate||Infinity; + if (this.endDate !== Infinity) { + this.endDate = DPGlobal.parseDate(this.endDate, this.format, this.language); + } + this.update(); + this.updateNavArrows(); + }, + + place: function(){ + var zIndex = parseInt(this.element.parents().filter(function() { + return $(this).css('z-index') != 'auto'; + }).first().css('z-index'))+10; + var offset = this.component ? this.component.offset() : this.element.offset(); + this.picker.css({ + top: offset.top + this.height, + left: offset.left, + zIndex: zIndex + }); + }, + + update: function(){ + this.date = DPGlobal.parseDate( + this.isInput ? this.element.prop('value') : this.element.data('date') || this.element.find('input').prop('value'), + this.format, this.language + ); + if (this.date < this.startDate) { + this.viewDate = new Date(this.startDate); + } else if (this.date > this.endDate) { + this.viewDate = new Date(this.endDate); + } else { + this.viewDate = new Date(this.date); + } + this.fill(); + }, + + fillDow: function(){ + var dowCnt = this.weekStart; + var html = ''; + while (dowCnt < this.weekStart + 7) { + html += ''+dates[this.language].daysMin[(dowCnt++)%7]+''; + } + html += ''; + this.picker.find('.datepicker-days thead').append(html); + }, + + fillMonths: function(){ + var html = ''; + var i = 0 + while (i < 12) { + html += ''+dates[this.language].monthsShort[i++]+''; + } + this.picker.find('.datepicker-months td').html(html); + }, + + fill: function() { + var d = new Date(this.viewDate), + year = d.getUTCFullYear(), + month = d.getUTCMonth(), + startYear = this.startDate !== -Infinity ? this.startDate.getUTCFullYear() : -Infinity, + startMonth = this.startDate !== -Infinity ? this.startDate.getUTCMonth() : -Infinity, + endYear = this.endDate !== Infinity ? this.endDate.getUTCFullYear() : Infinity, + endMonth = this.endDate !== Infinity ? this.endDate.getUTCMonth() : Infinity, + currentDate = this.date.valueOf(), + today = new Date(); + this.picker.find('.datepicker-days thead th:eq(1)') + .text(dates[this.language].months[month]+' '+year); + this.picker.find('tfoot th.today') + .text(dates[this.language].today) + .toggle(this.todayBtn); + this.updateNavArrows(); + this.fillMonths(); + var prevMonth = UTCDate(year, month-1, 28,0,0,0,0), + day = DPGlobal.getDaysInMonth(prevMonth.getUTCFullYear(), prevMonth.getUTCMonth()); + prevMonth.setUTCDate(day); + prevMonth.setUTCDate(day - (prevMonth.getUTCDay() - this.weekStart + 7)%7); + var nextMonth = new Date(prevMonth); + nextMonth.setUTCDate(nextMonth.getUTCDate() + 42); + nextMonth = nextMonth.valueOf(); + var html = []; + var clsName; + while(prevMonth.valueOf() < nextMonth) { + if (prevMonth.getUTCDay() == this.weekStart) { + html.push(''); + } + clsName = ''; + if (prevMonth.getUTCFullYear() < year || (prevMonth.getUTCFullYear() == year && prevMonth.getUTCMonth() < month)) { + clsName += ' old'; + } else if (prevMonth.getUTCFullYear() > year || (prevMonth.getUTCFullYear() == year && prevMonth.getUTCMonth() > month)) { + clsName += ' new'; + } + // Compare internal UTC date with local today, not UTC today + if (this.todayHighlight && + prevMonth.getUTCFullYear() == today.getFullYear() && + prevMonth.getUTCMonth() == today.getMonth() && + prevMonth.getUTCDate() == today.getDate()) { + clsName += ' today'; + } + if (prevMonth.valueOf() == currentDate) { + clsName += ' active'; + } + if (prevMonth.valueOf() < this.startDate || prevMonth.valueOf() > this.endDate) { + clsName += ' disabled'; + } + html.push(''+prevMonth.getUTCDate() + ''); + if (prevMonth.getUTCDay() == this.weekEnd) { + html.push(''); + } + prevMonth.setUTCDate(prevMonth.getUTCDate()+1); + } + this.picker.find('.datepicker-days tbody').empty().append(html.join('')); + var currentYear = this.date.getUTCFullYear(); + + var months = this.picker.find('.datepicker-months') + .find('th:eq(1)') + .text(year) + .end() + .find('span').removeClass('active'); + if (currentYear == year) { + months.eq(this.date.getUTCMonth()).addClass('active'); + } + if (year < startYear || year > endYear) { + months.addClass('disabled'); + } + if (year == startYear) { + months.slice(0, startMonth).addClass('disabled'); + } + if (year == endYear) { + months.slice(endMonth+1).addClass('disabled'); + } + + html = ''; + year = parseInt(year/10, 10) * 10; + var yearCont = this.picker.find('.datepicker-years') + .find('th:eq(1)') + .text(year + '-' + (year + 9)) + .end() + .find('td'); + year -= 1; + for (var i = -1; i < 11; i++) { + html += ''+year+''; + year += 1; + } + yearCont.html(html); + }, + + updateNavArrows: function() { + var d = new Date(this.viewDate), + year = d.getUTCFullYear(), + month = d.getUTCMonth(); + switch (this.viewMode) { + case 0: + if (this.startDate !== -Infinity && year <= this.startDate.getUTCFullYear() && month <= this.startDate.getUTCMonth()) { + this.picker.find('.prev').css({visibility: 'hidden'}); + } else { + this.picker.find('.prev').css({visibility: 'visible'}); + } + if (this.endDate !== Infinity && year >= this.endDate.getUTCFullYear() && month >= this.endDate.getUTCMonth()) { + this.picker.find('.next').css({visibility: 'hidden'}); + } else { + this.picker.find('.next').css({visibility: 'visible'}); + } + break; + case 1: + case 2: + if (this.startDate !== -Infinity && year <= this.startDate.getUTCFullYear()) { + this.picker.find('.prev').css({visibility: 'hidden'}); + } else { + this.picker.find('.prev').css({visibility: 'visible'}); + } + if (this.endDate !== Infinity && year >= this.endDate.getUTCFullYear()) { + this.picker.find('.next').css({visibility: 'hidden'}); + } else { + this.picker.find('.next').css({visibility: 'visible'}); + } + break; + } + }, + + click: function(e) { + e.stopPropagation(); + e.preventDefault(); + var target = $(e.target).closest('span, td, th'); + if (target.length == 1) { + switch(target[0].nodeName.toLowerCase()) { + case 'th': + switch(target[0].className) { + case 'switch': + this.showMode(1); + break; + case 'prev': + case 'next': + var dir = DPGlobal.modes[this.viewMode].navStep * (target[0].className == 'prev' ? -1 : 1); + switch(this.viewMode){ + case 0: + this.viewDate = this.moveMonth(this.viewDate, dir); + break; + case 1: + case 2: + this.viewDate = this.moveYear(this.viewDate, dir); + break; + } + this.fill(); + break; + case 'today': + var date = new Date(); + date.setUTCHours(0); + date.setUTCMinutes(0); + date.setUTCSeconds(0); + date.setUTCMilliseconds(0); + + this.showMode(-2); + var which = this.todayBtn == 'linked' ? null : 'view'; + this._setDate(date, which); + break; + } + break; + case 'span': + if (!target.is('.disabled')) { + this.viewDate.setUTCDate(1); + if (target.is('.month')) { + var month = target.parent().find('span').index(target); + this.viewDate.setUTCMonth(month); + this.element.trigger({ + type: 'changeMonth', + date: this.viewDate + }); + } else { + var year = parseInt(target.text(), 10)||0; + this.viewDate.setUTCFullYear(year); + this.element.trigger({ + type: 'changeYear', + date: this.viewDate + }); + } + this.showMode(-1); + this.fill(); + } + break; + case 'td': + if (target.is('.day') && !target.is('.disabled')){ + var day = parseInt(target.text(), 10)||1; + var year = this.viewDate.getUTCFullYear(), + month = this.viewDate.getUTCMonth(); + if (target.is('.old')) { + if (month == 0) { + month = 11; + year -= 1; + } else { + month -= 1; + } + } else if (target.is('.new')) { + if (month == 11) { + month = 0; + year += 1; + } else { + month += 1; + } + } + this._setDate(UTCDate(year, month, day,0,0,0,0)); + } + break; + } + } + }, + + _setDate: function(date, which){ + if (!which || which == 'date') + this.date = date; + if (!which || which == 'view') + this.viewDate = date; + this.fill(); + this.setValue(); + this.element.trigger({ + type: 'changeDate', + date: this.date + }); + var element; + if (this.isInput) { + element = this.element; + } else if (this.component){ + element = this.element.find('input'); + } + if (element) { + element.change(); + if (this.autoclose) { + this.hide(); + } + } + }, + + moveMonth: function(date, dir){ + if (!dir) return date; + var new_date = new Date(date.valueOf()), + day = new_date.getUTCDate(), + month = new_date.getUTCMonth(), + mag = Math.abs(dir), + new_month, test; + dir = dir > 0 ? 1 : -1; + if (mag == 1){ + test = dir == -1 + // If going back one month, make sure month is not current month + // (eg, Mar 31 -> Feb 31 == Feb 28, not Mar 02) + ? function(){ return new_date.getUTCMonth() == month; } + // If going forward one month, make sure month is as expected + // (eg, Jan 31 -> Feb 31 == Feb 28, not Mar 02) + : function(){ return new_date.getUTCMonth() != new_month; }; + new_month = month + dir; + new_date.setUTCMonth(new_month); + // Dec -> Jan (12) or Jan -> Dec (-1) -- limit expected date to 0-11 + if (new_month < 0 || new_month > 11) + new_month = (new_month + 12) % 12; + } else { + // For magnitudes >1, move one month at a time... + for (var i=0; i= this.startDate && date <= this.endDate; + }, + + keydown: function(e){ + if (this.picker.is(':not(:visible)')){ + if (e.keyCode == 27) // allow escape to hide and re-show picker + this.show(); + return; + } + var dateChanged = false, + dir, day, month, + newDate, newViewDate; + switch(e.keyCode){ + case 27: // escape + this.hide(); + e.preventDefault(); + break; + case 37: // left + case 39: // right + if (!this.keyboardNavigation) break; + dir = e.keyCode == 37 ? -1 : 1; + if (e.ctrlKey){ + newDate = this.moveYear(this.date, dir); + newViewDate = this.moveYear(this.viewDate, dir); + } else if (e.shiftKey){ + newDate = this.moveMonth(this.date, dir); + newViewDate = this.moveMonth(this.viewDate, dir); + } else { + newDate = new Date(this.date); + newDate.setUTCDate(this.date.getUTCDate() + dir); + newViewDate = new Date(this.viewDate); + newViewDate.setUTCDate(this.viewDate.getUTCDate() + dir); + } + if (this.dateWithinRange(newDate)){ + this.date = newDate; + this.viewDate = newViewDate; + this.setValue(); + this.update(); + e.preventDefault(); + dateChanged = true; + } + break; + case 38: // up + case 40: // down + if (!this.keyboardNavigation) break; + dir = e.keyCode == 38 ? -1 : 1; + if (e.ctrlKey){ + newDate = this.moveYear(this.date, dir); + newViewDate = this.moveYear(this.viewDate, dir); + } else if (e.shiftKey){ + newDate = this.moveMonth(this.date, dir); + newViewDate = this.moveMonth(this.viewDate, dir); + } else { + newDate = new Date(this.date); + newDate.setUTCDate(this.date.getUTCDate() + dir * 7); + newViewDate = new Date(this.viewDate); + newViewDate.setUTCDate(this.viewDate.getUTCDate() + dir * 7); + } + if (this.dateWithinRange(newDate)){ + this.date = newDate; + this.viewDate = newViewDate; + this.setValue(); + this.update(); + e.preventDefault(); + dateChanged = true; + } + break; + case 13: // enter + this.hide(); + e.preventDefault(); + break; + case 9: // tab + this.hide(); + break; + } + if (dateChanged){ + this.element.trigger({ + type: 'changeDate', + date: this.date + }); + var element; + if (this.isInput) { + element = this.element; + } else if (this.component){ + element = this.element.find('input'); + } + if (element) { + element.change(); + } + } + }, + + showMode: function(dir) { + if (dir) { + this.viewMode = Math.max(0, Math.min(2, this.viewMode + dir)); + } + this.picker.find('>div').hide().filter('.datepicker-'+DPGlobal.modes[this.viewMode].clsName).show(); + this.updateNavArrows(); + } + }; + + $.fn.datepicker = function ( option ) { + var args = Array.apply(null, arguments); + args.shift(); + return this.each(function () { + var $this = $(this), + data = $this.data('datepicker'), + options = typeof option == 'object' && option; + if (!data) { + $this.data('datepicker', (data = new Datepicker(this, $.extend({}, $.fn.datepicker.defaults,options)))); + } + if (typeof option == 'string' && typeof data[option] == 'function') { + data[option].apply(data, args); + } + }); + }; + + $.fn.datepicker.defaults = { + }; + $.fn.datepicker.Constructor = Datepicker; + var dates = $.fn.datepicker.dates = { + en: { + days: ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday"], + daysShort: ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"], + daysMin: ["Su", "Mo", "Tu", "We", "Th", "Fr", "Sa", "Su"], + months: ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"], + monthsShort: ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"], + today: "Today" + } + } + + var DPGlobal = { + modes: [ + { + clsName: 'days', + navFnc: 'Month', + navStep: 1 + }, + { + clsName: 'months', + navFnc: 'FullYear', + navStep: 1 + }, + { + clsName: 'years', + navFnc: 'FullYear', + navStep: 10 + }], + isLeapYear: function (year) { + return (((year % 4 === 0) && (year % 100 !== 0)) || (year % 400 === 0)) + }, + getDaysInMonth: function (year, month) { + return [31, (DPGlobal.isLeapYear(year) ? 29 : 28), 31, 30, 31, 30, 31, 31, 30, 31, 30, 31][month] + }, + validParts: /dd?|mm?|MM?|yy(?:yy)?/g, + nonpunctuation: /[^ -\/:-@\[-`{-~\t\n\r]+/g, + parseFormat: function(format){ + // IE treats \0 as a string end in inputs (truncating the value), + // so it's a bad format delimiter, anyway + var separators = format.replace(this.validParts, '\0').split('\0'), + parts = format.match(this.validParts); + if (!separators || !separators.length || !parts || parts.length == 0){ + throw new Error("Invalid date format."); + } + return {separators: separators, parts: parts}; + }, + parseDate: function(date, format, language) { + if (date instanceof Date) return date; + if (/^[-+]\d+[dmwy]([\s,]+[-+]\d+[dmwy])*$/.test(date)) { + var part_re = /([-+]\d+)([dmwy])/, + parts = date.match(/([-+]\d+)([dmwy])/g), + part, dir; + date = new Date(); + for (var i=0; i'+ + ''+ + ''+ + ''+ + ''+ + ''+ + '', + contTemplate: '', + footTemplate: '' + }; + DPGlobal.template = ''; +}( window.jQuery ); \ No newline at end of file diff --git a/vendor/assets/stylesheets/.gitkeep b/vendor/assets/stylesheets/.gitkeep new file mode 100644 index 00000000..e69de29b diff --git a/vendor/plugins/.gitkeep b/vendor/plugins/.gitkeep new file mode 100644 index 00000000..e69de29b