hackathon_manager 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/MIT-LICENSE +20 -0
- data/README.md +90 -0
- data/Rakefile +36 -0
- data/app/assets/config/hackathon_manager_manifest.js +0 -0
- data/app/assets/javascripts/hackathon_manager/application.js +16 -0
- data/app/assets/javascripts/hackathon_manager/jquery.transit.min.js +1 -0
- data/app/assets/javascripts/hackathon_manager/main.js +237 -0
- data/app/assets/javascripts/hackathon_manager/manage/application.js +20 -0
- data/app/assets/javascripts/hackathon_manager/manage/lib/emailEvents.js +25 -0
- data/app/assets/javascripts/hackathon_manager/manage/lib/jquery.bulkRowSelect.js +13 -0
- data/app/assets/javascripts/hackathon_manager/manage/lib/jquery.bulkRowedit.js +42 -0
- data/app/assets/javascripts/hackathon_manager/manage/lib/jquery.chartkickAutoReload.js +8 -0
- data/app/assets/javascripts/hackathon_manager/manage/lib/setupDataTables.js +98 -0
- data/app/assets/javascripts/hackathon_manager/manage/lib/setupHighcharts.js +34 -0
- data/app/assets/javascripts/hackathon_manager/manage/map.js +58 -0
- data/app/assets/javascripts/hackathon_manager/registrations.js +26 -0
- data/app/assets/javascripts/hackathon_manager/us.json +1 -0
- data/app/assets/javascripts/hackathon_manager/vendor/buttons.html5.min.js +22 -0
- data/app/assets/javascripts/hackathon_manager/vendor/d3.v3.min.js +5 -0
- data/app/assets/javascripts/hackathon_manager/vendor/dataTables.buttons.min.js +35 -0
- data/app/assets/javascripts/hackathon_manager/vendor/jquery.dataTables.min.js +164 -0
- data/app/assets/javascripts/hackathon_manager/vendor/pdfmake.min.js +22 -0
- data/app/assets/javascripts/hackathon_manager/vendor/queue.v1.min.js +1 -0
- data/app/assets/javascripts/hackathon_manager/vendor/topojson.v1.min.js +1 -0
- data/app/assets/javascripts/hackathon_manager/vendor/vfs_fonts.js +1 -0
- data/app/assets/stylesheets/hackathon_manager/core.sass +20 -0
- data/app/assets/stylesheets/hackathon_manager/datatables/buttons.dataTables.min.css +1 -0
- data/app/assets/stylesheets/hackathon_manager/datatables/jquery.dataTables.min.css +1 -0
- data/app/assets/stylesheets/hackathon_manager/forms/_confirmation.sass +21 -0
- data/app/assets/stylesheets/hackathon_manager/forms/_forms.sass +243 -0
- data/app/assets/stylesheets/hackathon_manager/general/_base.sass +105 -0
- data/app/assets/stylesheets/hackathon_manager/general/_button.sass +49 -0
- data/app/assets/stylesheets/hackathon_manager/general/_footer.sass +21 -0
- data/app/assets/stylesheets/hackathon_manager/general/_main.sass +4 -0
- data/app/assets/stylesheets/hackathon_manager/general/_media-queries.sass +52 -0
- data/app/assets/stylesheets/hackathon_manager/general/_mixins.sass +58 -0
- data/app/assets/stylesheets/hackathon_manager/general/_mlh.sass +13 -0
- data/app/assets/stylesheets/hackathon_manager/general/_sidebar.sass +70 -0
- data/app/assets/stylesheets/hackathon_manager/general/_status-colors.sass +14 -0
- data/app/assets/stylesheets/hackathon_manager/general/_table.sass +26 -0
- data/app/assets/stylesheets/hackathon_manager/mailer.sass +108 -0
- data/app/assets/stylesheets/hackathon_manager/manage.sass +119 -0
- data/app/assets/stylesheets/hackathon_manager/scaffolds.scss +50 -0
- data/app/assets/stylesheets/variables.sass +41 -0
- data/app/controllers/bus_lists_controller.rb +37 -0
- data/app/controllers/concerns/questionnaires_controllable.rb +15 -0
- data/app/controllers/manage/admins_controller.rb +55 -0
- data/app/controllers/manage/application_controller.rb +13 -0
- data/app/controllers/manage/bus_lists_controller.rb +71 -0
- data/app/controllers/manage/dashboard_controller.rb +112 -0
- data/app/controllers/manage/messages_controller.rb +88 -0
- data/app/controllers/manage/questionnaires_controller.rb +172 -0
- data/app/controllers/manage/schools_controller.rb +87 -0
- data/app/controllers/manage/stats_controller.rb +77 -0
- data/app/controllers/questionnaires_controller.rb +145 -0
- data/app/controllers/rsvps_controller.rb +97 -0
- data/app/controllers/users/omniauth_callbacks_controller.rb +18 -0
- data/app/controllers/users/registrations_controller.rb +63 -0
- data/app/datatables/admin_datatable.rb +29 -0
- data/app/datatables/message_datatable.rb +30 -0
- data/app/datatables/questionnaire_datatable.rb +39 -0
- data/app/datatables/school_datatable.rb +34 -0
- data/app/helpers/hackathon_manager_helper.rb +36 -0
- data/app/helpers/manage/dashboard_helper.rb +9 -0
- data/app/inputs/deletable_attachment_input.rb +11 -0
- data/app/inputs/formatted_boolean_input.rb +26 -0
- data/app/inputs/school_selection_input.rb +9 -0
- data/app/mailers/application_mailer.rb +4 -0
- data/app/mailers/mail_preview.rb +42 -0
- data/app/mailers/mailer.rb +84 -0
- data/app/models/bus_list.rb +24 -0
- data/app/models/deletable_attachment.rb +17 -0
- data/app/models/fips.rb +3 -0
- data/app/models/message.rb +76 -0
- data/app/models/questionnaire.rb +166 -0
- data/app/models/schedule.rb +53 -0
- data/app/models/school.rb +31 -0
- data/app/models/school_name_duplicate.rb +7 -0
- data/app/models/user.rb +52 -0
- data/app/views/application/_bus_list_info.html.haml +20 -0
- data/app/views/application/_bus_list_stats.html.haml +9 -0
- data/app/views/application/_questionnaire_summary.html.haml +54 -0
- data/app/views/bus_lists/show.html.haml +45 -0
- data/app/views/devise/passwords/_form.html.haml +9 -0
- data/app/views/devise/passwords/edit.html.haml +14 -0
- data/app/views/devise/passwords/new.html.haml +5 -0
- data/app/views/devise/registrations/_form.html.haml +8 -0
- data/app/views/devise/registrations/edit.html.haml +20 -0
- data/app/views/devise/registrations/new.html.haml +18 -0
- data/app/views/devise/sessions/_form.html.haml +8 -0
- data/app/views/devise/sessions/new.html.haml +9 -0
- data/app/views/layouts/_shared_footer.html.haml +1 -0
- data/app/views/layouts/_sidebar.html.haml +22 -0
- data/app/views/layouts/blank.html.haml +12 -0
- data/app/views/layouts/dayof.html.haml +12 -0
- data/app/views/layouts/hackathon_manager.html.haml +12 -0
- data/app/views/layouts/mailer.html.erb +51 -0
- data/app/views/layouts/manage/application.html.haml +26 -0
- data/app/views/mailer/_getting_there.html.erb +14 -0
- data/app/views/mailer/_questions.html.erb +2 -0
- data/app/views/mailer/accepted_email.html.erb +13 -0
- data/app/views/mailer/application_confirmation_email.html.erb +13 -0
- data/app/views/mailer/bulk_message_email.html.erb +1 -0
- data/app/views/mailer/bulk_templates/_default.html.erb +1 -0
- data/app/views/mailer/bus_captain_confirmation_email.html.erb +12 -0
- data/app/views/mailer/bus_list_update_email.html.erb +7 -0
- data/app/views/mailer/denied_email.html.erb +5 -0
- data/app/views/mailer/incomplete_reminder_email.html.erb +6 -0
- data/app/views/mailer/rsvp_confirmation_email.html.erb +8 -0
- data/app/views/mailer/slack_invite_email.html.erb +10 -0
- data/app/views/manage/admins/_form.html.haml +18 -0
- data/app/views/manage/admins/edit.html.haml +12 -0
- data/app/views/manage/admins/index.html.haml +15 -0
- data/app/views/manage/admins/new.html.haml +8 -0
- data/app/views/manage/admins/show.html.haml +17 -0
- data/app/views/manage/bus_lists/_form.html.haml +14 -0
- data/app/views/manage/bus_lists/edit.html.haml +8 -0
- data/app/views/manage/bus_lists/index.html.haml +26 -0
- data/app/views/manage/bus_lists/new.html.haml +6 -0
- data/app/views/manage/bus_lists/show.html.haml +92 -0
- data/app/views/manage/dashboard/index.html.haml +64 -0
- data/app/views/manage/dashboard/map_data.tsv.erb +48 -0
- data/app/views/manage/messages/_form.html.haml +15 -0
- data/app/views/manage/messages/edit.html.haml +10 -0
- data/app/views/manage/messages/index.html.haml +17 -0
- data/app/views/manage/messages/new.html.haml +8 -0
- data/app/views/manage/messages/show.html.haml +50 -0
- data/app/views/manage/questionnaires/_form.html.haml +54 -0
- data/app/views/manage/questionnaires/edit.html.haml +12 -0
- data/app/views/manage/questionnaires/index.html.haml +36 -0
- data/app/views/manage/questionnaires/new.html.haml +8 -0
- data/app/views/manage/questionnaires/show.html.haml +63 -0
- data/app/views/manage/schools/_form.html.haml +16 -0
- data/app/views/manage/schools/edit.html.haml +12 -0
- data/app/views/manage/schools/index.html.haml +18 -0
- data/app/views/manage/schools/merge.html.haml +35 -0
- data/app/views/manage/schools/new.html.haml +8 -0
- data/app/views/manage/schools/show.html.haml +52 -0
- data/app/views/manage/stats/index.html.haml +55 -0
- data/app/views/questionnaires/_form.html.haml +70 -0
- data/app/views/questionnaires/edit.html.haml +10 -0
- data/app/views/questionnaires/new.html.haml +7 -0
- data/app/views/questionnaires/show.html.haml +30 -0
- data/app/views/rsvps/show.html.haml +61 -0
- data/app/workers/bulk_message_worker.rb +86 -0
- data/app/workers/slack_invite_worker.rb +49 -0
- data/config/blazer.yml +56 -0
- data/config/initializers/ajax_datatables_rails.rb +7 -0
- data/config/initializers/chartkick.rb +4 -0
- data/config/initializers/devise.rb +265 -0
- data/config/initializers/hackathon.rb +9 -0
- data/config/initializers/mime_types.rb +5 -0
- data/config/initializers/new_framework_defaults.rb +20 -0
- data/config/initializers/sidekiq.rb +11 -0
- data/config/initializers/simple_form.rb +164 -0
- data/config/initializers/static_data.rb +7 -0
- data/config/initializers/wrap_parameters.rb +14 -0
- data/config/routes.rb +74 -0
- data/db/migrate/20141011210642_create_participants.rb +18 -0
- data/db/migrate/20141029055313_create_schools.rb +12 -0
- data/db/migrate/20150104071608_add_shirt_and_dietary_medical_to_participants.rb +6 -0
- data/db/migrate/20150104190233_add_attachment_resume_to_participants.rb +13 -0
- data/db/migrate/20150110020958_add_international_to_participants.rb +5 -0
- data/db/migrate/20150110215933_change_participants_to_registration.rb +5 -0
- data/db/migrate/20150110222214_create_users.rb +5 -0
- data/db/migrate/20150110222455_add_portfolio_and_vcs_urls_to_registrations.rb +6 -0
- data/db/migrate/20150110222655_add_devise_to_users.rb +48 -0
- data/db/migrate/20150111000224_change_resgistrations_to_questionnaire.rb +5 -0
- data/db/migrate/20150111012709_add_questionnaire_ref_to_users.rb +8 -0
- data/db/migrate/20150113205638_add_amin_to_users.rb +5 -0
- data/db/migrate/20150113233730_add_questionnaire_count_to_schools.rb +12 -0
- data/db/migrate/20150125213100_set_default_admin_value.rb +17 -0
- data/db/migrate/20150216232155_add_agreement_accepted_to_questionnaires.rb +5 -0
- data/db/migrate/20150218051450_add_admin_read_only_to_users.rb +5 -0
- data/db/migrate/20150221165513_create_messages.rb +15 -0
- data/db/migrate/20150225235817_add_status_to_user.rb +7 -0
- data/db/migrate/20150302011457_create_fips.rb +11 -0
- data/db/migrate/20150326031423_add_template_to_message.rb +5 -0
- data/db/migrate/20150410175056_create_bus_lists.rb +12 -0
- data/db/migrate/20150411161432_add_capacity_notes_captain_to_bus_lists.rb +8 -0
- data/db/migrate/20150415165844_add_is_bus_captain_to_questionnaire.rb +5 -0
- data/db/migrate/20150415181114_add_check_in_data_to_questionnaire.rb +8 -0
- data/db/migrate/20151224015223_change_read_only_user_to_limited.rb +5 -0
- data/db/migrate/20160110012217_add_code_of_conduct_accepted_to_questionnaire.rb +5 -0
- data/db/migrate/20160110222639_add_omniauth_to_users.rb +8 -0
- data/db/migrate/20160111020817_update_questionnaire_for_my_mlh.rb +14 -0
- data/db/migrate/20160112222137_add_option_for_alt_travel_to_questionnaire.rb +6 -0
- data/db/migrate/20160208061253_rename_can_share_resume_to_info.rb +5 -0
- data/db/migrate/20161020032736_remove_resume_from_questionnaires.rb +14 -0
- data/db/migrate/20161024145452_add_data_sharing_to_questionnaire.rb +5 -0
- data/db/migrate/20161206073921_rename_graduation_to_level_of_study.rb +6 -0
- data/db/migrate/20161206084722_add_reminder_sent_at_to_users.rb +5 -0
- data/db/migrate/20161208055809_add_attachment_resume_to_questionnaires.rb +11 -0
- data/db/migrate/20161212030010_add_interest_to_questionnaire.rb +5 -0
- data/db/migrate/20170107210122_create_school_name_duplicates.rb +10 -0
- data/db/migrate/20170128063020_install_blazer.rb +45 -0
- data/db/schools.csv +1 -0
- data/db/seeds.rb +17 -0
- data/lib/hackathon_manager/engine.rb +35 -0
- data/lib/hackathon_manager/version.rb +3 -0
- data/lib/hackathon_manager.rb +5 -0
- data/lib/tasks/coverage.rake +14 -0
- data/lib/tasks/hackathon_manager_tasks.rake +4 -0
- metadata +667 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 9b629f9fbc6de4475abdcae57d3249f940073f93
|
4
|
+
data.tar.gz: cfa43250214ba8b096fc81d63cbf52fddd2f49b8
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 47a1c3daf4157814e45ee0a59c8c46367862d88fe9b5db918f46e41f2bb2ebf8152da0d260ac60539d7e5769a4a17448ed345856fa8b64f34dc62e1593790678
|
7
|
+
data.tar.gz: 023a806098e9254409b4757d2cf6290fd69afe72226e31f0dbe4a893dfe949cc1303d702eee7b02f4951134f8030db313afe32a5924fc436593efaa834e40dcc
|
data/MIT-LICENSE
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright 2017 Stuart Olivera
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,90 @@
|
|
1
|
+
# HackathonManager [![Build Status](https://travis-ci.org/codeRIT/hackathon_manager.svg?branch=master)](https://travis-ci.org/codeRIT/hackathon_manager) [![Code Climate](https://codeclimate.com/github/codeRIT/hackathon_manager/badges/gpa.svg)](https://codeclimate.com/github/codeRIT/hackathon_manager) [![Test Coverage](https://codeclimate.com/github/codeRIT/hackathon_manager/badges/coverage.svg)](https://codeclimate.com/github/codeRIT/hackathon_manager/coverage) [![security](https://hakiri.io/github/codeRIT/hackathon_manager/master.svg)](https://hakiri.io/github/codeRIT/hackathon_manager/master)
|
2
|
+
|
3
|
+
***Still a work in progress! Instructions below are incomplete.** Check out [WiCHacks](https://github.com/sman591/wichacks) for an implementation example.*
|
4
|
+
|
5
|
+
Originally developed for [BrickHack](https://github.com/codeRIT/brickhack.io), this is a Ruby on Rails "plugin" that adds typical hackathon management features to any existing Ruby on Rails application.
|
6
|
+
|
7
|
+
* **Hacker applications:** Users sign up/in using [MyMLH](https://my.mlh.io/), which includes standard hackathon application info. This pre-fills the BrickHack application, so hackers don't have to duplicate information!
|
8
|
+
* **Acceptance, RSVPs**: Manage applications & coordinate acceptance/waitlist/denials
|
9
|
+
* **Bus Lists:** Coordinate bus sign-ups during the RSVP process while communicating important information to riders & captains
|
10
|
+
* **Email communication**: Ensure hackers get consistent, timely information throughout their application process, while enabling the organizing team to communicate important information at any time.
|
11
|
+
* **Statistics & Visualization:** Surface key information about the application base, distribution of applicants, progress towards attendance, etc.
|
12
|
+
|
13
|
+
## Usage
|
14
|
+
|
15
|
+
HackathonManager uses a variety of third-party services & Ruby gems:
|
16
|
+
|
17
|
+
* [Devise](https://github.com/plataformatec/devise) + [MyMLH](https://my.mlh.io/) (authentication & attendee identity)
|
18
|
+
* [Sidekiq](https://github.com/mperham/sidekiq) (background jobs)
|
19
|
+
* [Sparkpost](https://www.sparkpost.com/) (email)
|
20
|
+
* [Paperclip](https://github.com/thoughtbot/paperclip) + [Amazon S3](https://aws.amazon.com/s3/) (resume storage)
|
21
|
+
* [Chartkick](http://chartkick.com/) (management charts)
|
22
|
+
|
23
|
+
Steps to get the basic flow working:
|
24
|
+
|
25
|
+
1. Add an "apply" or "register" button on your hackathon homepage. This button directs the user through a sign up/login flow to collect their information.
|
26
|
+
```erb
|
27
|
+
<%= link_to 'Click here to apply!'.html_safe, questionnaires_path %>
|
28
|
+
```
|
29
|
+
|
30
|
+
2. Once you have at least one user in the system, you can promote them to an admin to access the management interface. Open up a console session with `bin/rails console`:
|
31
|
+
```ruby
|
32
|
+
>> User.last.update_attribute(:admin, true)
|
33
|
+
=> true
|
34
|
+
```
|
35
|
+
|
36
|
+
3. You can then access the management interface from `http://your-site/manage`
|
37
|
+
|
38
|
+
## Installation
|
39
|
+
|
40
|
+
Add this line to your application's Gemfile:
|
41
|
+
|
42
|
+
```ruby
|
43
|
+
gem 'hackathon_manager'
|
44
|
+
```
|
45
|
+
|
46
|
+
And then execute:
|
47
|
+
```bash
|
48
|
+
$ bundle
|
49
|
+
```
|
50
|
+
|
51
|
+
Now, add our database migrations:
|
52
|
+
```bash
|
53
|
+
$ bin/rails railties:install:migrations
|
54
|
+
```
|
55
|
+
|
56
|
+
And finally, create the file `config/hackathon.yml`:
|
57
|
+
|
58
|
+
```yaml
|
59
|
+
defaults: &defaults
|
60
|
+
registration_is_open: true
|
61
|
+
event_is_over: false
|
62
|
+
last_day_to_apply: <%= Date.new(2017, 2, 11) %>
|
63
|
+
auto_late_waitlist: false
|
64
|
+
logo_asset: logo.png
|
65
|
+
|
66
|
+
development:
|
67
|
+
<<: *defaults
|
68
|
+
|
69
|
+
test: &test
|
70
|
+
<<: *defaults
|
71
|
+
last_day_to_apply: <%= 2.months.from_now %>
|
72
|
+
|
73
|
+
production:
|
74
|
+
<<: *defaults
|
75
|
+
|
76
|
+
staging:
|
77
|
+
<<: *defaults
|
78
|
+
```
|
79
|
+
|
80
|
+
## Contributing
|
81
|
+
|
82
|
+
GitHub issues and pull requests welcome!
|
83
|
+
|
84
|
+
## License
|
85
|
+
The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
|
86
|
+
|
87
|
+
|
88
|
+
# IMPORTANT
|
89
|
+
|
90
|
+
* Set a `root to:` (root path)
|
data/Rakefile
ADDED
@@ -0,0 +1,36 @@
|
|
1
|
+
begin
|
2
|
+
require 'bundler/setup'
|
3
|
+
rescue LoadError
|
4
|
+
puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
|
5
|
+
end
|
6
|
+
|
7
|
+
require 'rdoc/task'
|
8
|
+
|
9
|
+
RDoc::Task.new(:rdoc) do |rdoc|
|
10
|
+
rdoc.rdoc_dir = 'rdoc'
|
11
|
+
rdoc.title = 'HackathonManager'
|
12
|
+
rdoc.options << '--line-numbers'
|
13
|
+
rdoc.rdoc_files.include('README.md')
|
14
|
+
rdoc.rdoc_files.include('lib/**/*.rb')
|
15
|
+
end
|
16
|
+
|
17
|
+
APP_RAKEFILE = File.expand_path("../test/dummy/Rakefile", __FILE__)
|
18
|
+
load 'rails/tasks/engine.rake'
|
19
|
+
|
20
|
+
|
21
|
+
load 'rails/tasks/statistics.rake'
|
22
|
+
|
23
|
+
|
24
|
+
|
25
|
+
require 'bundler/gem_tasks'
|
26
|
+
|
27
|
+
require 'rake/testtask'
|
28
|
+
|
29
|
+
Rake::TestTask.new(:test) do |t|
|
30
|
+
t.libs << 'test'
|
31
|
+
t.pattern = 'test/**/*_test.rb'
|
32
|
+
t.verbose = false
|
33
|
+
end
|
34
|
+
|
35
|
+
|
36
|
+
task default: :test
|
File without changes
|
@@ -0,0 +1,16 @@
|
|
1
|
+
// This is a manifest file that'll be compiled into application.js, which will include all the files
|
2
|
+
// listed below.
|
3
|
+
//
|
4
|
+
// Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
|
5
|
+
// or vendor/assets/javascripts of plugins, if any, can be referenced here using a relative path.
|
6
|
+
//
|
7
|
+
// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
|
8
|
+
// the compiled file.
|
9
|
+
//
|
10
|
+
// WARNING: THE FIRST BLANK LINE MARKS THE END OF WHAT'S TO BE PROCESSED, ANY BLANK LINE SHOULD
|
11
|
+
// GO AFTER THE REQUIRES BELOW.
|
12
|
+
//
|
13
|
+
//= require jquery
|
14
|
+
//= require jquery_ujs
|
15
|
+
//= require jquery.ui.autocomplete
|
16
|
+
//= require_directory .
|
@@ -0,0 +1 @@
|
|
1
|
+
(function(t,e){if(typeof define==="function"&&define.amd){define(["jquery"],e)}else if(typeof exports==="object"){module.exports=e(require("jquery"))}else{e(t.jQuery)}})(this,function(t){t.transit={version:"0.9.12",propertyMap:{marginLeft:"margin",marginRight:"margin",marginBottom:"margin",marginTop:"margin",paddingLeft:"padding",paddingRight:"padding",paddingBottom:"padding",paddingTop:"padding"},enabled:true,useTransitionEnd:false};var e=document.createElement("div");var n={};function i(t){if(t in e.style)return t;var n=["Moz","Webkit","O","ms"];var i=t.charAt(0).toUpperCase()+t.substr(1);for(var r=0;r<n.length;++r){var s=n[r]+i;if(s in e.style){return s}}}function r(){e.style[n.transform]="";e.style[n.transform]="rotateY(90deg)";return e.style[n.transform]!==""}var s=navigator.userAgent.toLowerCase().indexOf("chrome")>-1;n.transition=i("transition");n.transitionDelay=i("transitionDelay");n.transform=i("transform");n.transformOrigin=i("transformOrigin");n.filter=i("Filter");n.transform3d=r();var a={transition:"transitionend",MozTransition:"transitionend",OTransition:"oTransitionEnd",WebkitTransition:"webkitTransitionEnd",msTransition:"MSTransitionEnd"};var o=n.transitionEnd=a[n.transition]||null;for(var u in n){if(n.hasOwnProperty(u)&&typeof t.support[u]==="undefined"){t.support[u]=n[u]}}e=null;t.cssEase={_default:"ease","in":"ease-in",out:"ease-out","in-out":"ease-in-out",snap:"cubic-bezier(0,1,.5,1)",easeInCubic:"cubic-bezier(.550,.055,.675,.190)",easeOutCubic:"cubic-bezier(.215,.61,.355,1)",easeInOutCubic:"cubic-bezier(.645,.045,.355,1)",easeInCirc:"cubic-bezier(.6,.04,.98,.335)",easeOutCirc:"cubic-bezier(.075,.82,.165,1)",easeInOutCirc:"cubic-bezier(.785,.135,.15,.86)",easeInExpo:"cubic-bezier(.95,.05,.795,.035)",easeOutExpo:"cubic-bezier(.19,1,.22,1)",easeInOutExpo:"cubic-bezier(1,0,0,1)",easeInQuad:"cubic-bezier(.55,.085,.68,.53)",easeOutQuad:"cubic-bezier(.25,.46,.45,.94)",easeInOutQuad:"cubic-bezier(.455,.03,.515,.955)",easeInQuart:"cubic-bezier(.895,.03,.685,.22)",easeOutQuart:"cubic-bezier(.165,.84,.44,1)",easeInOutQuart:"cubic-bezier(.77,0,.175,1)",easeInQuint:"cubic-bezier(.755,.05,.855,.06)",easeOutQuint:"cubic-bezier(.23,1,.32,1)",easeInOutQuint:"cubic-bezier(.86,0,.07,1)",easeInSine:"cubic-bezier(.47,0,.745,.715)",easeOutSine:"cubic-bezier(.39,.575,.565,1)",easeInOutSine:"cubic-bezier(.445,.05,.55,.95)",easeInBack:"cubic-bezier(.6,-.28,.735,.045)",easeOutBack:"cubic-bezier(.175, .885,.32,1.275)",easeInOutBack:"cubic-bezier(.68,-.55,.265,1.55)"};t.cssHooks["transit:transform"]={get:function(e){return t(e).data("transform")||new f},set:function(e,i){var r=i;if(!(r instanceof f)){r=new f(r)}if(n.transform==="WebkitTransform"&&!s){e.style[n.transform]=r.toString(true)}else{e.style[n.transform]=r.toString()}t(e).data("transform",r)}};t.cssHooks.transform={set:t.cssHooks["transit:transform"].set};t.cssHooks.filter={get:function(t){return t.style[n.filter]},set:function(t,e){t.style[n.filter]=e}};if(t.fn.jquery<"1.8"){t.cssHooks.transformOrigin={get:function(t){return t.style[n.transformOrigin]},set:function(t,e){t.style[n.transformOrigin]=e}};t.cssHooks.transition={get:function(t){return t.style[n.transition]},set:function(t,e){t.style[n.transition]=e}}}p("scale");p("scaleX");p("scaleY");p("translate");p("rotate");p("rotateX");p("rotateY");p("rotate3d");p("perspective");p("skewX");p("skewY");p("x",true);p("y",true);function f(t){if(typeof t==="string"){this.parse(t)}return this}f.prototype={setFromString:function(t,e){var n=typeof e==="string"?e.split(","):e.constructor===Array?e:[e];n.unshift(t);f.prototype.set.apply(this,n)},set:function(t){var e=Array.prototype.slice.apply(arguments,[1]);if(this.setter[t]){this.setter[t].apply(this,e)}else{this[t]=e.join(",")}},get:function(t){if(this.getter[t]){return this.getter[t].apply(this)}else{return this[t]||0}},setter:{rotate:function(t){this.rotate=b(t,"deg")},rotateX:function(t){this.rotateX=b(t,"deg")},rotateY:function(t){this.rotateY=b(t,"deg")},scale:function(t,e){if(e===undefined){e=t}this.scale=t+","+e},skewX:function(t){this.skewX=b(t,"deg")},skewY:function(t){this.skewY=b(t,"deg")},perspective:function(t){this.perspective=b(t,"px")},x:function(t){this.set("translate",t,null)},y:function(t){this.set("translate",null,t)},translate:function(t,e){if(this._translateX===undefined){this._translateX=0}if(this._translateY===undefined){this._translateY=0}if(t!==null&&t!==undefined){this._translateX=b(t,"px")}if(e!==null&&e!==undefined){this._translateY=b(e,"px")}this.translate=this._translateX+","+this._translateY}},getter:{x:function(){return this._translateX||0},y:function(){return this._translateY||0},scale:function(){var t=(this.scale||"1,1").split(",");if(t[0]){t[0]=parseFloat(t[0])}if(t[1]){t[1]=parseFloat(t[1])}return t[0]===t[1]?t[0]:t},rotate3d:function(){var t=(this.rotate3d||"0,0,0,0deg").split(",");for(var e=0;e<=3;++e){if(t[e]){t[e]=parseFloat(t[e])}}if(t[3]){t[3]=b(t[3],"deg")}return t}},parse:function(t){var e=this;t.replace(/([a-zA-Z0-9]+)\((.*?)\)/g,function(t,n,i){e.setFromString(n,i)})},toString:function(t){var e=[];for(var i in this){if(this.hasOwnProperty(i)){if(!n.transform3d&&(i==="rotateX"||i==="rotateY"||i==="perspective"||i==="transformOrigin")){continue}if(i[0]!=="_"){if(t&&i==="scale"){e.push(i+"3d("+this[i]+",1)")}else if(t&&i==="translate"){e.push(i+"3d("+this[i]+",0)")}else{e.push(i+"("+this[i]+")")}}}}return e.join(" ")}};function c(t,e,n){if(e===true){t.queue(n)}else if(e){t.queue(e,n)}else{t.each(function(){n.call(this)})}}function l(e){var i=[];t.each(e,function(e){e=t.camelCase(e);e=t.transit.propertyMap[e]||t.cssProps[e]||e;e=h(e);if(n[e])e=h(n[e]);if(t.inArray(e,i)===-1){i.push(e)}});return i}function d(e,n,i,r){var s=l(e);if(t.cssEase[i]){i=t.cssEase[i]}var a=""+y(n)+" "+i;if(parseInt(r,10)>0){a+=" "+y(r)}var o=[];t.each(s,function(t,e){o.push(e+" "+a)});return o.join(", ")}t.fn.transition=t.fn.transit=function(e,i,r,s){var a=this;var u=0;var f=true;var l=t.extend(true,{},e);if(typeof i==="function"){s=i;i=undefined}if(typeof i==="object"){r=i.easing;u=i.delay||0;f=typeof i.queue==="undefined"?true:i.queue;s=i.complete;i=i.duration}if(typeof r==="function"){s=r;r=undefined}if(typeof l.easing!=="undefined"){r=l.easing;delete l.easing}if(typeof l.duration!=="undefined"){i=l.duration;delete l.duration}if(typeof l.complete!=="undefined"){s=l.complete;delete l.complete}if(typeof l.queue!=="undefined"){f=l.queue;delete l.queue}if(typeof l.delay!=="undefined"){u=l.delay;delete l.delay}if(typeof i==="undefined"){i=t.fx.speeds._default}if(typeof r==="undefined"){r=t.cssEase._default}i=y(i);var p=d(l,i,r,u);var h=t.transit.enabled&&n.transition;var b=h?parseInt(i,10)+parseInt(u,10):0;if(b===0){var g=function(t){a.css(l);if(s){s.apply(a)}if(t){t()}};c(a,f,g);return a}var m={};var v=function(e){var i=false;var r=function(){if(i){a.unbind(o,r)}if(b>0){a.each(function(){this.style[n.transition]=m[this]||null})}if(typeof s==="function"){s.apply(a)}if(typeof e==="function"){e()}};if(b>0&&o&&t.transit.useTransitionEnd){i=true;a.bind(o,r)}else{window.setTimeout(r,b)}a.each(function(){if(b>0){this.style[n.transition]=p}t(this).css(l)})};var z=function(t){this.offsetWidth;v(t)};c(a,f,z);return this};function p(e,i){if(!i){t.cssNumber[e]=true}t.transit.propertyMap[e]=n.transform;t.cssHooks[e]={get:function(n){var i=t(n).css("transit:transform");return i.get(e)},set:function(n,i){var r=t(n).css("transit:transform");r.setFromString(e,i);t(n).css({"transit:transform":r})}}}function h(t){return t.replace(/([A-Z])/g,function(t){return"-"+t.toLowerCase()})}function b(t,e){if(typeof t==="string"&&!t.match(/^[\-0-9\.]+$/)){return t}else{return""+t+e}}function y(e){var n=e;if(typeof n==="string"&&!n.match(/^[\-0-9\.]+/)){n=t.fx.speeds[n]||t.fx.speeds._default}return b(n,"ms")}t.transit.getTransitionValue=d;return t});
|
@@ -0,0 +1,237 @@
|
|
1
|
+
$(document).ready(function () {
|
2
|
+
|
3
|
+
var $sidebar = $('.sidebar');
|
4
|
+
|
5
|
+
if ($('.carousel').length > 0) {
|
6
|
+
$('.maps.carousel').owlCarousel({
|
7
|
+
items: 3,
|
8
|
+
singleItem: true
|
9
|
+
});
|
10
|
+
$('.support.carousel').owlCarousel({
|
11
|
+
singleItem: true
|
12
|
+
});
|
13
|
+
$('.mentor-list.carousel').owlCarousel({
|
14
|
+
singleItem: true
|
15
|
+
});
|
16
|
+
}
|
17
|
+
|
18
|
+
if ( $sidebar.hasClass('home') ) {
|
19
|
+
$('.nav-link, .scroll-to').on('click', function (e) {
|
20
|
+
e.preventDefault();
|
21
|
+
$('.active').removeClass('active');
|
22
|
+
$(e.currentTarget).addClass('active');
|
23
|
+
var id = $(e.currentTarget).attr('href');
|
24
|
+
id = id.substring(1);
|
25
|
+
var $target = $(id);
|
26
|
+
$target.addClass('active');
|
27
|
+
$('html,body').animate({
|
28
|
+
scrollTop: ($target.offset().top)
|
29
|
+
}, 1000);
|
30
|
+
});
|
31
|
+
}
|
32
|
+
|
33
|
+
$('#sidebar-toggle').on('click', toggleSidebar);
|
34
|
+
|
35
|
+
function toggleSidebar (e) {
|
36
|
+
if ($sidebar.hasClass('open')) {
|
37
|
+
$('#main').off('click', toggleSidebar);
|
38
|
+
$sidebar.removeClass('open');
|
39
|
+
}
|
40
|
+
else {
|
41
|
+
$('#main').on('click', toggleSidebar);
|
42
|
+
$sidebar.addClass('open');
|
43
|
+
}
|
44
|
+
}
|
45
|
+
|
46
|
+
$.fn.toggleDetails = function() {
|
47
|
+
var toggle = function() {
|
48
|
+
$('.details').slideUp();
|
49
|
+
$(this).parent().find('.details:hidden').slideDown();
|
50
|
+
};
|
51
|
+
|
52
|
+
$(this).each(function() {
|
53
|
+
$(this).on('click', toggle);
|
54
|
+
});
|
55
|
+
};
|
56
|
+
|
57
|
+
$('.toggle-details').toggleDetails();
|
58
|
+
|
59
|
+
$.fn.toggleBlock = function() {
|
60
|
+
var toggle = function() {
|
61
|
+
var $this = $(this);
|
62
|
+
$('.info').slideUp();
|
63
|
+
$('#' + $this.data('target') + ':hidden').slideDown();
|
64
|
+
};
|
65
|
+
$(this).each(function() {
|
66
|
+
$(this).on('click', toggle);
|
67
|
+
});
|
68
|
+
};
|
69
|
+
$('.block .name').toggleBlock();
|
70
|
+
|
71
|
+
$('[name="questionnaire[travel_not_from_school]"]').on('change', function() {
|
72
|
+
var $location = $('[name="questionnaire[travel_location]"]');
|
73
|
+
if (this.value === "true") {
|
74
|
+
$location.parent().show();
|
75
|
+
$location.prop('disabled', false);
|
76
|
+
}
|
77
|
+
else {
|
78
|
+
$location.parent().hide();
|
79
|
+
$location.prop('disabled', true);
|
80
|
+
}
|
81
|
+
});
|
82
|
+
|
83
|
+
$('[name="questionnaire[acc_status]"]').on('change', function() {
|
84
|
+
var $content = $('.hide-if-not-attending');
|
85
|
+
if ($(this).val() == 'rsvp_denied') {
|
86
|
+
$content.hide();
|
87
|
+
}
|
88
|
+
else {
|
89
|
+
$content.show();
|
90
|
+
}
|
91
|
+
});
|
92
|
+
|
93
|
+
$.fn.validate = function(option) {
|
94
|
+
var previous_invalid_inputs = [];
|
95
|
+
|
96
|
+
var validateInput = function() {
|
97
|
+
var success = true, types = $(this).data('validate').split(/[ ,]+/), value = $(this).val();
|
98
|
+
if ($(this).is(':checkbox') && !$(this).is(':checked')) {
|
99
|
+
value = "";
|
100
|
+
}
|
101
|
+
if ($(this).is(':disabled')) {
|
102
|
+
return true;
|
103
|
+
}
|
104
|
+
for (i = types.length-1; i >= 0; i--) {
|
105
|
+
switch (types[i]) {
|
106
|
+
case 'presence':
|
107
|
+
if (!value || $.trim(value).length < 1) {
|
108
|
+
notify(this, "Missing Information");
|
109
|
+
success = false;
|
110
|
+
}
|
111
|
+
break;
|
112
|
+
case 'email':
|
113
|
+
if (value) {
|
114
|
+
var re = /^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;
|
115
|
+
if (!re.test(value)) {
|
116
|
+
notify(this, "Invalid Email");
|
117
|
+
success = false;
|
118
|
+
}
|
119
|
+
}
|
120
|
+
break;
|
121
|
+
case 'file-max-size':
|
122
|
+
if (this.files && this.files[0] && this.files[0].size > parseInt($(this).data('validate-file-max-size'))) {
|
123
|
+
notify(this, "File Too Large");
|
124
|
+
success = false;
|
125
|
+
}
|
126
|
+
break;
|
127
|
+
case 'file-content-type':
|
128
|
+
if (this.files && this.files[0] && this.files[0].type != $(this).data('validate-file-content-type')) {
|
129
|
+
notify(this, "Invalid File Type");
|
130
|
+
success = false;
|
131
|
+
}
|
132
|
+
break;
|
133
|
+
}
|
134
|
+
}
|
135
|
+
if (success) {
|
136
|
+
$(this).parent().removeClass('field_with_errors').find('.error').fadeOut(200, function() {
|
137
|
+
$(this).remove();
|
138
|
+
});
|
139
|
+
}
|
140
|
+
return success;
|
141
|
+
};
|
142
|
+
|
143
|
+
var validateAll = function() {
|
144
|
+
var success = true, invalid_inputs = [], first_input;
|
145
|
+
$(this).find('[data-validate]').each(function(i) {
|
146
|
+
if (!validateInput.call(this)) {
|
147
|
+
success = false;
|
148
|
+
invalid_inputs.push(i);
|
149
|
+
if (!first_input || $(this).is(':focus')) {
|
150
|
+
first_input = this;
|
151
|
+
}
|
152
|
+
}
|
153
|
+
});
|
154
|
+
if (invalid_inputs.length > 0 && $(invalid_inputs).not(previous_invalid_inputs).length == 0 && $(previous_invalid_inputs).not(invalid_inputs).length == 0) {
|
155
|
+
$(this).find('[data-validate]').each(function() {
|
156
|
+
$(this).parent().find('.error').fadeOut(50).fadeIn(100);
|
157
|
+
});
|
158
|
+
}
|
159
|
+
if (first_input) {
|
160
|
+
$(first_input).focus();
|
161
|
+
}
|
162
|
+
previous_invalid_inputs = invalid_inputs;
|
163
|
+
return success;
|
164
|
+
};
|
165
|
+
|
166
|
+
var notify = function(input, message) {
|
167
|
+
var $element = $(input).parent().find('.error');
|
168
|
+
if ($element.length < 1) {
|
169
|
+
$element = $('<span class="error"></span>').hide().insertAfter(input);
|
170
|
+
}
|
171
|
+
$element.text(message);
|
172
|
+
$element.fadeIn(100);
|
173
|
+
$element.parent().addClass('field_with_errors');
|
174
|
+
};
|
175
|
+
|
176
|
+
if (option == 'now') {
|
177
|
+
return validateAll.call(this);
|
178
|
+
}
|
179
|
+
else {
|
180
|
+
$(this).on('submit', function() {
|
181
|
+
$(this).find('[type=submit]').prop('disabled', true);
|
182
|
+
if (!validateAll.call(this)) {
|
183
|
+
$(this).find('[type=submit]').prop('disabled', false);
|
184
|
+
return false;
|
185
|
+
}
|
186
|
+
return true;
|
187
|
+
});
|
188
|
+
$(this).find('[data-validate]').each(function() {
|
189
|
+
$(this).on('blur', validateInput);
|
190
|
+
});
|
191
|
+
}
|
192
|
+
};
|
193
|
+
|
194
|
+
$('[data-validate=form]').validate();
|
195
|
+
|
196
|
+
$.fn.wizard = function() {
|
197
|
+
var form = this;
|
198
|
+
|
199
|
+
var goToStage = function($newStage) {
|
200
|
+
$(form).find('.wizard-current').removeClass('wizard-current');
|
201
|
+
$newStage.addClass('wizard-current');
|
202
|
+
$("html, body").animate({ scrollTop: 0 }, "slow");
|
203
|
+
if ($newStage.find('.field_with_errors').length > 0) {
|
204
|
+
$newStage.find(".field_with_errors").first().find(":input").focus();
|
205
|
+
} else {
|
206
|
+
$newStage.find(":input").first().focus();
|
207
|
+
}
|
208
|
+
}
|
209
|
+
|
210
|
+
var nextStage = function() {
|
211
|
+
if (!$(form).find('.wizard-current').validate('now')) {
|
212
|
+
return false;
|
213
|
+
}
|
214
|
+
goToStage($(form).find('.wizard-current').next());
|
215
|
+
};
|
216
|
+
|
217
|
+
var previousStage = function() {
|
218
|
+
goToStage($(form).find('.wizard-current').prev());
|
219
|
+
};
|
220
|
+
|
221
|
+
if ($(form).find('.field_with_errors').length > 0) {
|
222
|
+
goToStage($(form).find('.field_with_errors').first().parents('.wizard-stage'));
|
223
|
+
}
|
224
|
+
$(this).find('[data-wizard=next]').each(function() {
|
225
|
+
$(this).on('click', nextStage);
|
226
|
+
});
|
227
|
+
$(this).find('[data-wizard=previous]').each(function() {
|
228
|
+
$(this).on('click', previousStage);
|
229
|
+
});
|
230
|
+
if ($(this).is('.wizard-skip-valid')) {
|
231
|
+
nextStage.call(this);
|
232
|
+
}
|
233
|
+
};
|
234
|
+
|
235
|
+
$('.wizard').wizard();
|
236
|
+
|
237
|
+
});
|
@@ -0,0 +1,20 @@
|
|
1
|
+
//= require_directory ../
|
2
|
+
//= require_directory .
|
3
|
+
//= require ../vendor/jquery.dataTables.min
|
4
|
+
//= require ../vendor/dataTables.buttons.min
|
5
|
+
//= require ../vendor/buttons.html5.min
|
6
|
+
//= require ../vendor/pdfmake.min
|
7
|
+
//= require ../vendor/vfs_fonts
|
8
|
+
//= require selectize
|
9
|
+
//= require highcharts
|
10
|
+
//= require chartkick
|
11
|
+
//= require_directory ./lib
|
12
|
+
|
13
|
+
$(document).ready(function () {
|
14
|
+
$('.selectize').selectize();
|
15
|
+
$('select[data-bulk-row-edit]').bulkRowEdit();
|
16
|
+
$().bulkRowSelect();
|
17
|
+
$('body').chartkickAutoReload();
|
18
|
+
setupDataTables();
|
19
|
+
setupHighcharts();
|
20
|
+
});
|
@@ -0,0 +1,25 @@
|
|
1
|
+
$(document).ready(function () {
|
2
|
+
$('.email-events').each(function() {
|
3
|
+
var events_container = this;
|
4
|
+
|
5
|
+
$(events_container).html('<span class="fa fa-circle-o-notch fa-spin"></span>');
|
6
|
+
|
7
|
+
var data_url = $(events_container).data('url');
|
8
|
+
$.ajax(data_url)
|
9
|
+
.done(function(json) {
|
10
|
+
if (!json.length) {
|
11
|
+
$(events_container).html('<em>No events found.</em>');
|
12
|
+
return;
|
13
|
+
}
|
14
|
+
|
15
|
+
var $new_html = $('<ul>');
|
16
|
+
$(json).each(function(_, event) {
|
17
|
+
$new_html.append('<li><p>' + event.subject + ' : <strong>' + event.type + '</strong><br><em>' + event.timestamp + '</em></p></li>');
|
18
|
+
});
|
19
|
+
$(events_container).html($new_html);
|
20
|
+
})
|
21
|
+
.fail(function() {
|
22
|
+
$(events_container).html('<em>An error ocurred. Please try again later.</em>');
|
23
|
+
});
|
24
|
+
});
|
25
|
+
});
|
@@ -0,0 +1,13 @@
|
|
1
|
+
$.fn.bulkRowSelect = function() {
|
2
|
+
|
3
|
+
var applyAction = function() {
|
4
|
+
var checkState = $('[data-bulk-row-select]').prop('checked');
|
5
|
+
$('input[type=checkbox][data-bulk-row-edit]').prop('checked', checkState);
|
6
|
+
return true;
|
7
|
+
};
|
8
|
+
|
9
|
+
$('[data-bulk-row-select]').on('click', function(e) {
|
10
|
+
return applyAction();
|
11
|
+
});
|
12
|
+
|
13
|
+
};
|
@@ -0,0 +1,42 @@
|
|
1
|
+
$.fn.bulkRowEdit = function() {
|
2
|
+
|
3
|
+
var applyAction = function() {
|
4
|
+
$('[type=submit][data-bulk-row-edit]').prop('disabled', true);
|
5
|
+
|
6
|
+
var ids = [];
|
7
|
+
$('input[type=checkbox][data-bulk-row-edit]:checked').each(function() {
|
8
|
+
ids[ids.length] = $(this).data('bulk-row-edit');
|
9
|
+
});
|
10
|
+
|
11
|
+
var action = $('select[data-bulk-row-edit]').val();
|
12
|
+
|
13
|
+
if (ids.length == 0) {
|
14
|
+
alert('No rows are selected to be modified!');
|
15
|
+
$('[type=submit][data-bulk-row-edit]').prop('disabled', false);
|
16
|
+
return false;
|
17
|
+
}
|
18
|
+
|
19
|
+
$.ajax({
|
20
|
+
url: $('form[data-bulk-row-edit]').attr('action'),
|
21
|
+
type: 'PATCH',
|
22
|
+
data: {
|
23
|
+
bulk_action: action,
|
24
|
+
bulk_ids: ids
|
25
|
+
}
|
26
|
+
}).done(function() {
|
27
|
+
window.questionnairesDataTable.draw(false);
|
28
|
+
}).fail(function() {
|
29
|
+
alert("Request failed, please refresh the page or try again later.");
|
30
|
+
}).always(function() {
|
31
|
+
$('[type=submit][data-bulk-row-edit]').prop('disabled', false);
|
32
|
+
});
|
33
|
+
|
34
|
+
return true;
|
35
|
+
};
|
36
|
+
|
37
|
+
$('[type=submit][data-bulk-row-edit]').on('click', function(e) {
|
38
|
+
e.preventDefault();
|
39
|
+
return applyAction();
|
40
|
+
});
|
41
|
+
|
42
|
+
};
|
@@ -0,0 +1,98 @@
|
|
1
|
+
var setupDataTables = function() {
|
2
|
+
|
3
|
+
var defaultDataTableOptions = function() {
|
4
|
+
return {
|
5
|
+
dom: 'Bfrtip',
|
6
|
+
processing : true,
|
7
|
+
serverSide : true,
|
8
|
+
ajax : {
|
9
|
+
url : $(this).data('source'),
|
10
|
+
type : "POST"
|
11
|
+
},
|
12
|
+
pagingType : 'full_numbers',
|
13
|
+
lengthMenu: [
|
14
|
+
[ 10, 25, 50, 100, -1 ],
|
15
|
+
[ '10 rows', '25 rows', '50 rows', '100 rows', 'Show all' ]
|
16
|
+
],
|
17
|
+
buttons: [
|
18
|
+
'pageLength',
|
19
|
+
{
|
20
|
+
extend: 'collection',
|
21
|
+
text: 'Export',
|
22
|
+
buttons: [
|
23
|
+
'csvHtml5',
|
24
|
+
'pdfHtml5'
|
25
|
+
]
|
26
|
+
}
|
27
|
+
]
|
28
|
+
}
|
29
|
+
};
|
30
|
+
|
31
|
+
var setupDataTable = function($table, options) {
|
32
|
+
var lastTable;
|
33
|
+
$table.each(function() {
|
34
|
+
lastTable = $(this).DataTable($.extend(defaultDataTableOptions.call(this), options));
|
35
|
+
});
|
36
|
+
|
37
|
+
return lastTable;
|
38
|
+
};
|
39
|
+
|
40
|
+
window.questionnairesDataTable = setupDataTable($('.datatable.questionnaires'), {
|
41
|
+
order : [2, 'desc'],
|
42
|
+
scrollX : false,
|
43
|
+
columns : [
|
44
|
+
{ orderable : false, data: 'bulk' },
|
45
|
+
{ orderable : false, data: 'link' },
|
46
|
+
{ orderable: true, data: 'id' },
|
47
|
+
{ orderable: true, data: 'first_name' },
|
48
|
+
{ orderable: true, data: 'last_name' },
|
49
|
+
{ orderable: true, data: 'email' },
|
50
|
+
{ orderable: true, data: 'acc_status' },
|
51
|
+
{ orderable: true, data: 'checked_in' },
|
52
|
+
{ orderable: true, data: 'school' }
|
53
|
+
]
|
54
|
+
});
|
55
|
+
|
56
|
+
setupDataTable($('.datatable.users'), {
|
57
|
+
order : [1, 'asc'],
|
58
|
+
scrollX : false,
|
59
|
+
columns : [
|
60
|
+
{ orderable: false, data: 'link' },
|
61
|
+
{ orderable: true, data: 'id' },
|
62
|
+
{ orderable: true, data: 'email' },
|
63
|
+
{ orderable: true, data: 'admin_limited_access' }
|
64
|
+
]
|
65
|
+
});
|
66
|
+
|
67
|
+
setupDataTable($('.datatable.messages'), {
|
68
|
+
order : [1, 'desc'],
|
69
|
+
scrollX : false,
|
70
|
+
columns : [
|
71
|
+
{ orderable: false, data: 'link'},
|
72
|
+
{ orderable: true, data: 'id'},
|
73
|
+
{ orderable: true, data: 'name'},
|
74
|
+
{ orderable: true, data: 'subject'},
|
75
|
+
{ orderable: false, data: 'status'}
|
76
|
+
]
|
77
|
+
});
|
78
|
+
|
79
|
+
setupDataTable($('.datatable.schools'), {
|
80
|
+
order : [5, 'desc'],
|
81
|
+
scrollX : false,
|
82
|
+
columns : [
|
83
|
+
{ orderable: false, data: 'link' },
|
84
|
+
{ orderable: true, data: 'id' },
|
85
|
+
{ orderable: true, data: 'name' },
|
86
|
+
{ orderable: true, data: 'city' },
|
87
|
+
{ orderable: true, data: 'state' },
|
88
|
+
{ orderable: true, data: 'questionnaire_count' },
|
89
|
+
{ orderable: false, data: 'bus_list' }
|
90
|
+
]
|
91
|
+
});
|
92
|
+
|
93
|
+
setupDataTable($('.datatable.stats'), {
|
94
|
+
scrollX : false,
|
95
|
+
processing : false,
|
96
|
+
serverSide : false
|
97
|
+
});
|
98
|
+
};
|
@@ -0,0 +1,34 @@
|
|
1
|
+
var setupHighcharts = function() {
|
2
|
+
Highcharts.setOptions({
|
3
|
+
global: {
|
4
|
+
timezoneOffset: 5 * 60,
|
5
|
+
useUTC: false
|
6
|
+
},
|
7
|
+
legend: {
|
8
|
+
labelFormatter: function() {
|
9
|
+
var total = 0;
|
10
|
+
for(var i=this.yData.length; i--;) { total += this.yData[i]; };
|
11
|
+
return this.name + ': ' + total;
|
12
|
+
}
|
13
|
+
},
|
14
|
+
chart: {
|
15
|
+
backgroundColor: "#f0f0f0"
|
16
|
+
},
|
17
|
+
tooltip: {
|
18
|
+
shared: true
|
19
|
+
},
|
20
|
+
plotOptions: {
|
21
|
+
series: {
|
22
|
+
animation: false
|
23
|
+
},
|
24
|
+
pie: {
|
25
|
+
allowPointSelect: true,
|
26
|
+
cursor: 'pointer',
|
27
|
+
dataLabels: {
|
28
|
+
enabled: true,
|
29
|
+
format: '<b>{point.name}</b>: {point.y}'
|
30
|
+
}
|
31
|
+
}
|
32
|
+
}
|
33
|
+
});
|
34
|
+
};
|