hackathon_manager 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (205) hide show
  1. checksums.yaml +7 -0
  2. data/MIT-LICENSE +20 -0
  3. data/README.md +90 -0
  4. data/Rakefile +36 -0
  5. data/app/assets/config/hackathon_manager_manifest.js +0 -0
  6. data/app/assets/javascripts/hackathon_manager/application.js +16 -0
  7. data/app/assets/javascripts/hackathon_manager/jquery.transit.min.js +1 -0
  8. data/app/assets/javascripts/hackathon_manager/main.js +237 -0
  9. data/app/assets/javascripts/hackathon_manager/manage/application.js +20 -0
  10. data/app/assets/javascripts/hackathon_manager/manage/lib/emailEvents.js +25 -0
  11. data/app/assets/javascripts/hackathon_manager/manage/lib/jquery.bulkRowSelect.js +13 -0
  12. data/app/assets/javascripts/hackathon_manager/manage/lib/jquery.bulkRowedit.js +42 -0
  13. data/app/assets/javascripts/hackathon_manager/manage/lib/jquery.chartkickAutoReload.js +8 -0
  14. data/app/assets/javascripts/hackathon_manager/manage/lib/setupDataTables.js +98 -0
  15. data/app/assets/javascripts/hackathon_manager/manage/lib/setupHighcharts.js +34 -0
  16. data/app/assets/javascripts/hackathon_manager/manage/map.js +58 -0
  17. data/app/assets/javascripts/hackathon_manager/registrations.js +26 -0
  18. data/app/assets/javascripts/hackathon_manager/us.json +1 -0
  19. data/app/assets/javascripts/hackathon_manager/vendor/buttons.html5.min.js +22 -0
  20. data/app/assets/javascripts/hackathon_manager/vendor/d3.v3.min.js +5 -0
  21. data/app/assets/javascripts/hackathon_manager/vendor/dataTables.buttons.min.js +35 -0
  22. data/app/assets/javascripts/hackathon_manager/vendor/jquery.dataTables.min.js +164 -0
  23. data/app/assets/javascripts/hackathon_manager/vendor/pdfmake.min.js +22 -0
  24. data/app/assets/javascripts/hackathon_manager/vendor/queue.v1.min.js +1 -0
  25. data/app/assets/javascripts/hackathon_manager/vendor/topojson.v1.min.js +1 -0
  26. data/app/assets/javascripts/hackathon_manager/vendor/vfs_fonts.js +1 -0
  27. data/app/assets/stylesheets/hackathon_manager/core.sass +20 -0
  28. data/app/assets/stylesheets/hackathon_manager/datatables/buttons.dataTables.min.css +1 -0
  29. data/app/assets/stylesheets/hackathon_manager/datatables/jquery.dataTables.min.css +1 -0
  30. data/app/assets/stylesheets/hackathon_manager/forms/_confirmation.sass +21 -0
  31. data/app/assets/stylesheets/hackathon_manager/forms/_forms.sass +243 -0
  32. data/app/assets/stylesheets/hackathon_manager/general/_base.sass +105 -0
  33. data/app/assets/stylesheets/hackathon_manager/general/_button.sass +49 -0
  34. data/app/assets/stylesheets/hackathon_manager/general/_footer.sass +21 -0
  35. data/app/assets/stylesheets/hackathon_manager/general/_main.sass +4 -0
  36. data/app/assets/stylesheets/hackathon_manager/general/_media-queries.sass +52 -0
  37. data/app/assets/stylesheets/hackathon_manager/general/_mixins.sass +58 -0
  38. data/app/assets/stylesheets/hackathon_manager/general/_mlh.sass +13 -0
  39. data/app/assets/stylesheets/hackathon_manager/general/_sidebar.sass +70 -0
  40. data/app/assets/stylesheets/hackathon_manager/general/_status-colors.sass +14 -0
  41. data/app/assets/stylesheets/hackathon_manager/general/_table.sass +26 -0
  42. data/app/assets/stylesheets/hackathon_manager/mailer.sass +108 -0
  43. data/app/assets/stylesheets/hackathon_manager/manage.sass +119 -0
  44. data/app/assets/stylesheets/hackathon_manager/scaffolds.scss +50 -0
  45. data/app/assets/stylesheets/variables.sass +41 -0
  46. data/app/controllers/bus_lists_controller.rb +37 -0
  47. data/app/controllers/concerns/questionnaires_controllable.rb +15 -0
  48. data/app/controllers/manage/admins_controller.rb +55 -0
  49. data/app/controllers/manage/application_controller.rb +13 -0
  50. data/app/controllers/manage/bus_lists_controller.rb +71 -0
  51. data/app/controllers/manage/dashboard_controller.rb +112 -0
  52. data/app/controllers/manage/messages_controller.rb +88 -0
  53. data/app/controllers/manage/questionnaires_controller.rb +172 -0
  54. data/app/controllers/manage/schools_controller.rb +87 -0
  55. data/app/controllers/manage/stats_controller.rb +77 -0
  56. data/app/controllers/questionnaires_controller.rb +145 -0
  57. data/app/controllers/rsvps_controller.rb +97 -0
  58. data/app/controllers/users/omniauth_callbacks_controller.rb +18 -0
  59. data/app/controllers/users/registrations_controller.rb +63 -0
  60. data/app/datatables/admin_datatable.rb +29 -0
  61. data/app/datatables/message_datatable.rb +30 -0
  62. data/app/datatables/questionnaire_datatable.rb +39 -0
  63. data/app/datatables/school_datatable.rb +34 -0
  64. data/app/helpers/hackathon_manager_helper.rb +36 -0
  65. data/app/helpers/manage/dashboard_helper.rb +9 -0
  66. data/app/inputs/deletable_attachment_input.rb +11 -0
  67. data/app/inputs/formatted_boolean_input.rb +26 -0
  68. data/app/inputs/school_selection_input.rb +9 -0
  69. data/app/mailers/application_mailer.rb +4 -0
  70. data/app/mailers/mail_preview.rb +42 -0
  71. data/app/mailers/mailer.rb +84 -0
  72. data/app/models/bus_list.rb +24 -0
  73. data/app/models/deletable_attachment.rb +17 -0
  74. data/app/models/fips.rb +3 -0
  75. data/app/models/message.rb +76 -0
  76. data/app/models/questionnaire.rb +166 -0
  77. data/app/models/schedule.rb +53 -0
  78. data/app/models/school.rb +31 -0
  79. data/app/models/school_name_duplicate.rb +7 -0
  80. data/app/models/user.rb +52 -0
  81. data/app/views/application/_bus_list_info.html.haml +20 -0
  82. data/app/views/application/_bus_list_stats.html.haml +9 -0
  83. data/app/views/application/_questionnaire_summary.html.haml +54 -0
  84. data/app/views/bus_lists/show.html.haml +45 -0
  85. data/app/views/devise/passwords/_form.html.haml +9 -0
  86. data/app/views/devise/passwords/edit.html.haml +14 -0
  87. data/app/views/devise/passwords/new.html.haml +5 -0
  88. data/app/views/devise/registrations/_form.html.haml +8 -0
  89. data/app/views/devise/registrations/edit.html.haml +20 -0
  90. data/app/views/devise/registrations/new.html.haml +18 -0
  91. data/app/views/devise/sessions/_form.html.haml +8 -0
  92. data/app/views/devise/sessions/new.html.haml +9 -0
  93. data/app/views/layouts/_shared_footer.html.haml +1 -0
  94. data/app/views/layouts/_sidebar.html.haml +22 -0
  95. data/app/views/layouts/blank.html.haml +12 -0
  96. data/app/views/layouts/dayof.html.haml +12 -0
  97. data/app/views/layouts/hackathon_manager.html.haml +12 -0
  98. data/app/views/layouts/mailer.html.erb +51 -0
  99. data/app/views/layouts/manage/application.html.haml +26 -0
  100. data/app/views/mailer/_getting_there.html.erb +14 -0
  101. data/app/views/mailer/_questions.html.erb +2 -0
  102. data/app/views/mailer/accepted_email.html.erb +13 -0
  103. data/app/views/mailer/application_confirmation_email.html.erb +13 -0
  104. data/app/views/mailer/bulk_message_email.html.erb +1 -0
  105. data/app/views/mailer/bulk_templates/_default.html.erb +1 -0
  106. data/app/views/mailer/bus_captain_confirmation_email.html.erb +12 -0
  107. data/app/views/mailer/bus_list_update_email.html.erb +7 -0
  108. data/app/views/mailer/denied_email.html.erb +5 -0
  109. data/app/views/mailer/incomplete_reminder_email.html.erb +6 -0
  110. data/app/views/mailer/rsvp_confirmation_email.html.erb +8 -0
  111. data/app/views/mailer/slack_invite_email.html.erb +10 -0
  112. data/app/views/manage/admins/_form.html.haml +18 -0
  113. data/app/views/manage/admins/edit.html.haml +12 -0
  114. data/app/views/manage/admins/index.html.haml +15 -0
  115. data/app/views/manage/admins/new.html.haml +8 -0
  116. data/app/views/manage/admins/show.html.haml +17 -0
  117. data/app/views/manage/bus_lists/_form.html.haml +14 -0
  118. data/app/views/manage/bus_lists/edit.html.haml +8 -0
  119. data/app/views/manage/bus_lists/index.html.haml +26 -0
  120. data/app/views/manage/bus_lists/new.html.haml +6 -0
  121. data/app/views/manage/bus_lists/show.html.haml +92 -0
  122. data/app/views/manage/dashboard/index.html.haml +64 -0
  123. data/app/views/manage/dashboard/map_data.tsv.erb +48 -0
  124. data/app/views/manage/messages/_form.html.haml +15 -0
  125. data/app/views/manage/messages/edit.html.haml +10 -0
  126. data/app/views/manage/messages/index.html.haml +17 -0
  127. data/app/views/manage/messages/new.html.haml +8 -0
  128. data/app/views/manage/messages/show.html.haml +50 -0
  129. data/app/views/manage/questionnaires/_form.html.haml +54 -0
  130. data/app/views/manage/questionnaires/edit.html.haml +12 -0
  131. data/app/views/manage/questionnaires/index.html.haml +36 -0
  132. data/app/views/manage/questionnaires/new.html.haml +8 -0
  133. data/app/views/manage/questionnaires/show.html.haml +63 -0
  134. data/app/views/manage/schools/_form.html.haml +16 -0
  135. data/app/views/manage/schools/edit.html.haml +12 -0
  136. data/app/views/manage/schools/index.html.haml +18 -0
  137. data/app/views/manage/schools/merge.html.haml +35 -0
  138. data/app/views/manage/schools/new.html.haml +8 -0
  139. data/app/views/manage/schools/show.html.haml +52 -0
  140. data/app/views/manage/stats/index.html.haml +55 -0
  141. data/app/views/questionnaires/_form.html.haml +70 -0
  142. data/app/views/questionnaires/edit.html.haml +10 -0
  143. data/app/views/questionnaires/new.html.haml +7 -0
  144. data/app/views/questionnaires/show.html.haml +30 -0
  145. data/app/views/rsvps/show.html.haml +61 -0
  146. data/app/workers/bulk_message_worker.rb +86 -0
  147. data/app/workers/slack_invite_worker.rb +49 -0
  148. data/config/blazer.yml +56 -0
  149. data/config/initializers/ajax_datatables_rails.rb +7 -0
  150. data/config/initializers/chartkick.rb +4 -0
  151. data/config/initializers/devise.rb +265 -0
  152. data/config/initializers/hackathon.rb +9 -0
  153. data/config/initializers/mime_types.rb +5 -0
  154. data/config/initializers/new_framework_defaults.rb +20 -0
  155. data/config/initializers/sidekiq.rb +11 -0
  156. data/config/initializers/simple_form.rb +164 -0
  157. data/config/initializers/static_data.rb +7 -0
  158. data/config/initializers/wrap_parameters.rb +14 -0
  159. data/config/routes.rb +74 -0
  160. data/db/migrate/20141011210642_create_participants.rb +18 -0
  161. data/db/migrate/20141029055313_create_schools.rb +12 -0
  162. data/db/migrate/20150104071608_add_shirt_and_dietary_medical_to_participants.rb +6 -0
  163. data/db/migrate/20150104190233_add_attachment_resume_to_participants.rb +13 -0
  164. data/db/migrate/20150110020958_add_international_to_participants.rb +5 -0
  165. data/db/migrate/20150110215933_change_participants_to_registration.rb +5 -0
  166. data/db/migrate/20150110222214_create_users.rb +5 -0
  167. data/db/migrate/20150110222455_add_portfolio_and_vcs_urls_to_registrations.rb +6 -0
  168. data/db/migrate/20150110222655_add_devise_to_users.rb +48 -0
  169. data/db/migrate/20150111000224_change_resgistrations_to_questionnaire.rb +5 -0
  170. data/db/migrate/20150111012709_add_questionnaire_ref_to_users.rb +8 -0
  171. data/db/migrate/20150113205638_add_amin_to_users.rb +5 -0
  172. data/db/migrate/20150113233730_add_questionnaire_count_to_schools.rb +12 -0
  173. data/db/migrate/20150125213100_set_default_admin_value.rb +17 -0
  174. data/db/migrate/20150216232155_add_agreement_accepted_to_questionnaires.rb +5 -0
  175. data/db/migrate/20150218051450_add_admin_read_only_to_users.rb +5 -0
  176. data/db/migrate/20150221165513_create_messages.rb +15 -0
  177. data/db/migrate/20150225235817_add_status_to_user.rb +7 -0
  178. data/db/migrate/20150302011457_create_fips.rb +11 -0
  179. data/db/migrate/20150326031423_add_template_to_message.rb +5 -0
  180. data/db/migrate/20150410175056_create_bus_lists.rb +12 -0
  181. data/db/migrate/20150411161432_add_capacity_notes_captain_to_bus_lists.rb +8 -0
  182. data/db/migrate/20150415165844_add_is_bus_captain_to_questionnaire.rb +5 -0
  183. data/db/migrate/20150415181114_add_check_in_data_to_questionnaire.rb +8 -0
  184. data/db/migrate/20151224015223_change_read_only_user_to_limited.rb +5 -0
  185. data/db/migrate/20160110012217_add_code_of_conduct_accepted_to_questionnaire.rb +5 -0
  186. data/db/migrate/20160110222639_add_omniauth_to_users.rb +8 -0
  187. data/db/migrate/20160111020817_update_questionnaire_for_my_mlh.rb +14 -0
  188. data/db/migrate/20160112222137_add_option_for_alt_travel_to_questionnaire.rb +6 -0
  189. data/db/migrate/20160208061253_rename_can_share_resume_to_info.rb +5 -0
  190. data/db/migrate/20161020032736_remove_resume_from_questionnaires.rb +14 -0
  191. data/db/migrate/20161024145452_add_data_sharing_to_questionnaire.rb +5 -0
  192. data/db/migrate/20161206073921_rename_graduation_to_level_of_study.rb +6 -0
  193. data/db/migrate/20161206084722_add_reminder_sent_at_to_users.rb +5 -0
  194. data/db/migrate/20161208055809_add_attachment_resume_to_questionnaires.rb +11 -0
  195. data/db/migrate/20161212030010_add_interest_to_questionnaire.rb +5 -0
  196. data/db/migrate/20170107210122_create_school_name_duplicates.rb +10 -0
  197. data/db/migrate/20170128063020_install_blazer.rb +45 -0
  198. data/db/schools.csv +1 -0
  199. data/db/seeds.rb +17 -0
  200. data/lib/hackathon_manager/engine.rb +35 -0
  201. data/lib/hackathon_manager/version.rb +3 -0
  202. data/lib/hackathon_manager.rb +5 -0
  203. data/lib/tasks/coverage.rake +14 -0
  204. data/lib/tasks/hackathon_manager_tasks.rake +4 -0
  205. metadata +667 -0
@@ -0,0 +1,49 @@
1
+ require 'httparty'
2
+
3
+ class SlackInviteWorker
4
+ include Sidekiq::Worker
5
+
6
+ def perform(questionnaire_id)
7
+ questionnaire = Questionnaire.find(questionnaire_id)
8
+ email = questionnaire.email
9
+ first_name = questionnaire.first_name
10
+ last_name = questionnaire.last_name
11
+ json = query_api('users.admin.invite', "&email=#{email}&first_name=#{first_name}&last_name=#{last_name}&set_active=true")
12
+
13
+ return if json[:ok]
14
+
15
+ if json[:error]
16
+ return if ok_errors.include?(json[:error])
17
+ return attempt_manual_invite(questionnaire.id, email) if use_manual_errors.include?(json[:error])
18
+ raise "Slack error: #{json[:error]}"
19
+ end
20
+
21
+ raise "Failed to invite to Slack."
22
+ end
23
+
24
+ private
25
+
26
+ def query_api(method, params = '')
27
+ response = HTTParty.post("https://brickhack3.slack.com/api/#{method}?token=#{ENV['SLACK_API_TOKEN']}#{params}")
28
+ json = JSON.parse(response.body, symbolize_names: true)
29
+ raise "Could not read Slack response" unless json
30
+ json
31
+ end
32
+
33
+ def attempt_manual_invite(questionnaire_id, email)
34
+ json = query_api('users.list')
35
+ raise "Slack error: #{json[:error]}" if json[:error]
36
+
37
+ return if json[:members].find { |member| member[:profile][:email] == email }
38
+
39
+ Mailer.delay.slack_invite_email(questionnaire_id)
40
+ end
41
+
42
+ def ok_errors
43
+ ['already_invited', 'already_in_team']
44
+ end
45
+
46
+ def use_manual_errors
47
+ ['invalid_email', 'invite_limit_reached']
48
+ end
49
+ end
data/config/blazer.yml ADDED
@@ -0,0 +1,56 @@
1
+ # see https://github.com/ankane/blazer for more info
2
+
3
+ data_sources:
4
+ main:
5
+ url: <%= ENV["BLAZER_DATABASE_URL"] %>
6
+
7
+ # statement timeout, in seconds
8
+ # none by default
9
+ # timeout: 15
10
+
11
+ # caching settings
12
+ # can greatly improve speed
13
+ # off by default
14
+ # cache:
15
+ # mode: slow # or all
16
+ # expires_in: 60 # min
17
+ # slow_threshold: 15 # sec, only used in slow mode
18
+
19
+ # wrap queries in a transaction for safety
20
+ # not necessary if you use a read-only user
21
+ # true by default
22
+ # use_transaction: false
23
+
24
+ smart_variables:
25
+ # zone_id: "SELECT id, name FROM zones ORDER BY name ASC"
26
+ # period: ["day", "week", "month"]
27
+ # status: {0: "Active", 1: "Archived"}
28
+
29
+ linked_columns:
30
+ # user_id: "/admin/users/{value}"
31
+
32
+ smart_columns:
33
+ # user_id: "SELECT id, name FROM users WHERE id IN {value}"
34
+
35
+ # create audits
36
+ audit: true
37
+
38
+ # change the time zone
39
+ # time_zone: "Pacific Time (US & Canada)"
40
+
41
+ # class name of the user model
42
+ # user_class: User
43
+
44
+ # method name for the user model
45
+ # user_name: name
46
+
47
+ # optional auth method to use as a before_action (default: nil)
48
+ # before_action: :authenticate!
49
+
50
+ # email to send checks from
51
+ # from_email: blazer@example.org
52
+
53
+ check_schedules:
54
+ - "1 day"
55
+ - "1 hour"
56
+ - "5 minutes"
@@ -0,0 +1,7 @@
1
+ AjaxDatatablesRails.configure do |config|
2
+ # available options for db_adapter are: :pg, :mysql, :mysql2, :sqlite, :sqlite3
3
+ config.db_adapter = :mysql2
4
+
5
+ # available options for orm are: :active_record, :mongoid
6
+ config.orm = :active_record
7
+ end
@@ -0,0 +1,4 @@
1
+ Chartkick.options = {
2
+ height: "165px",
3
+ colors: ["#4886C2", "#62A0DC", "#7BB9F5", "#95D3FF", "#AEECFF", "#C7FFFF"]
4
+ }
@@ -0,0 +1,265 @@
1
+ # Use this hook to configure devise mailer, warden hooks and so forth.
2
+ # Many of these configuration options can be set straight in your model.
3
+ Devise.setup do |config|
4
+ # The secret key used by Devise. Devise uses this key to generate
5
+ # random tokens. Changing this key will render invalid all existing
6
+ # confirmation, reset password and unlock tokens in the database.
7
+ config.secret_key = ENV['DEVISE_SECRET_KEY'] || '5acabf34c8645a0f699bb6a60cdc9fcf8f7eb414cf1a27ba5ee45b162362e9b1726fb745d885b5070f69a91dc2cf1c6b61b4c126bca808d0f23723e1c421b51c'
8
+
9
+ # ==> Mailer Configuration
10
+ # Configure the e-mail address which will be shown in Devise::Mailer,
11
+ # note that it will be overwritten if you use your own mailer class
12
+ # with default "from" parameter.
13
+ config.mailer_sender = 'codeRIT <noreply@coderit.org>'
14
+
15
+ # Configure the class responsible to send e-mails.
16
+ # config.mailer = 'Devise::Mailer'
17
+
18
+ # ==> ORM configuration
19
+ # Load and configure the ORM. Supports :active_record (default) and
20
+ # :mongoid (bson_ext recommended) by default. Other ORMs may be
21
+ # available as additional gems.
22
+ require 'devise/orm/active_record'
23
+
24
+ # ==> Configuration for any authentication mechanism
25
+ # Configure which keys are used when authenticating a user. The default is
26
+ # just :email. You can configure it to use [:username, :subdomain], so for
27
+ # authenticating a user, both parameters are required. Remember that those
28
+ # parameters are used only when authenticating and not when retrieving from
29
+ # session. If you need permissions, you should implement that in a before filter.
30
+ # You can also supply a hash where the value is a boolean determining whether
31
+ # or not authentication should be aborted when the value is not present.
32
+ # config.authentication_keys = [ :email ]
33
+
34
+ # Configure parameters from the request object used for authentication. Each entry
35
+ # given should be a request method and it will automatically be passed to the
36
+ # find_for_authentication method and considered in your model lookup. For instance,
37
+ # if you set :request_keys to [:subdomain], :subdomain will be used on authentication.
38
+ # The same considerations mentioned for authentication_keys also apply to request_keys.
39
+ # config.request_keys = []
40
+
41
+ # Configure which authentication keys should be case-insensitive.
42
+ # These keys will be downcased upon creating or modifying a user and when used
43
+ # to authenticate or find a user. Default is :email.
44
+ config.case_insensitive_keys = [ :email ]
45
+
46
+ # Configure which authentication keys should have whitespace stripped.
47
+ # These keys will have whitespace before and after removed upon creating or
48
+ # modifying a user and when used to authenticate or find a user. Default is :email.
49
+ config.strip_whitespace_keys = [ :email ]
50
+
51
+ # Tell if authentication through request.params is enabled. True by default.
52
+ # It can be set to an array that will enable params authentication only for the
53
+ # given strategies, for example, `config.params_authenticatable = [:database]` will
54
+ # enable it only for database (email + password) authentication.
55
+ # config.params_authenticatable = true
56
+
57
+ # Tell if authentication through HTTP Auth is enabled. False by default.
58
+ # It can be set to an array that will enable http authentication only for the
59
+ # given strategies, for example, `config.http_authenticatable = [:database]` will
60
+ # enable it only for database authentication. The supported strategies are:
61
+ # :database = Support basic authentication with authentication key + password
62
+ # config.http_authenticatable = false
63
+
64
+ # If 401 status code should be returned for AJAX requests. True by default.
65
+ # config.http_authenticatable_on_xhr = true
66
+
67
+ # The realm used in Http Basic Authentication. 'Application' by default.
68
+ # config.http_authentication_realm = 'Application'
69
+
70
+ # It will change confirmation, password recovery and other workflows
71
+ # to behave the same regardless if the e-mail provided was right or wrong.
72
+ # Does not affect registerable.
73
+ # config.paranoid = true
74
+
75
+ # By default Devise will store the user in session. You can skip storage for
76
+ # particular strategies by setting this option.
77
+ # Notice that if you are skipping storage for all authentication paths, you
78
+ # may want to disable generating routes to Devise's sessions controller by
79
+ # passing skip: :sessions to `devise_for` in your config/routes.rb
80
+ config.skip_session_storage = [:http_auth]
81
+
82
+ # By default, Devise cleans up the CSRF token on authentication to
83
+ # avoid CSRF token fixation attacks. This means that, when using AJAX
84
+ # requests for sign in and sign up, you need to get a new CSRF token
85
+ # from the server. You can disable this option at your own risk.
86
+ # config.clean_up_csrf_token_on_authentication = true
87
+
88
+ # ==> Configuration for :database_authenticatable
89
+ # For bcrypt, this is the cost for hashing the password and defaults to 10. If
90
+ # using other encryptors, it sets how many times you want the password re-encrypted.
91
+ #
92
+ # Limiting the stretches to just one in testing will increase the performance of
93
+ # your test suite dramatically. However, it is STRONGLY RECOMMENDED to not use
94
+ # a value less than 10 in other environments. Note that, for bcrypt (the default
95
+ # encryptor), the cost increases exponentially with the number of stretches (e.g.
96
+ # a value of 20 is already extremely slow: approx. 60 seconds for 1 calculation).
97
+ config.stretches = Rails.env.test? ? 1 : 10
98
+
99
+ # Setup a pepper to generate the encrypted password.
100
+ # config.pepper = ''
101
+
102
+ # ==> Configuration for :confirmable
103
+ # A period that the user is allowed to access the website even without
104
+ # confirming their account. For instance, if set to 2.days, the user will be
105
+ # able to access the website for two days without confirming their account,
106
+ # access will be blocked just in the third day. Default is 0.days, meaning
107
+ # the user cannot access the website without confirming their account.
108
+ # config.allow_unconfirmed_access_for = 2.days
109
+
110
+ # A period that the user is allowed to confirm their account before their
111
+ # token becomes invalid. For example, if set to 3.days, the user can confirm
112
+ # their account within 3 days after the mail was sent, but on the fourth day
113
+ # their account can't be confirmed with the token any more.
114
+ # Default is nil, meaning there is no restriction on how long a user can take
115
+ # before confirming their account.
116
+ # config.confirm_within = 3.days
117
+
118
+ # If true, requires any email changes to be confirmed (exactly the same way as
119
+ # initial account confirmation) to be applied. Requires additional unconfirmed_email
120
+ # db field (see migrations). Until confirmed, new email is stored in
121
+ # unconfirmed_email column, and copied to email column on successful confirmation.
122
+ config.reconfirmable = true
123
+
124
+ # Defines which key will be used when confirming an account
125
+ # config.confirmation_keys = [ :email ]
126
+
127
+ # ==> Configuration for :rememberable
128
+ # The time the user will be remembered without asking for credentials again.
129
+ # config.remember_for = 2.weeks
130
+
131
+ # Invalidates all the remember me tokens when the user signs out.
132
+ config.expire_all_remember_me_on_sign_out = true
133
+
134
+ # If true, extends the user's remember period when remembered via cookie.
135
+ # config.extend_remember_period = false
136
+
137
+ # Options to be passed to the created cookie. For instance, you can set
138
+ # secure: true in order to force SSL only cookies.
139
+ # config.rememberable_options = {}
140
+
141
+ # ==> Configuration for :validatable
142
+ # Range for password length.
143
+ config.password_length = 8..128
144
+
145
+ # Email regex used to validate email formats. It simply asserts that
146
+ # one (and only one) @ exists in the given string. This is mainly
147
+ # to give user feedback and not to assert the e-mail validity.
148
+ # config.email_regexp = /\A[^@\s]+@[^@\s]+\z/
149
+
150
+ # ==> Configuration for :timeoutable
151
+ # The time you want to timeout the user session without activity. After this
152
+ # time the user will be asked for credentials again. Default is 30 minutes.
153
+ config.timeout_in = 2.days
154
+
155
+ # If true, expires auth token on session timeout.
156
+ # config.expire_auth_token_on_timeout = false
157
+
158
+ # ==> Configuration for :lockable
159
+ # Defines which strategy will be used to lock an account.
160
+ # :failed_attempts = Locks an account after a number of failed attempts to sign in.
161
+ # :none = No lock strategy. You should handle locking by yourself.
162
+ # config.lock_strategy = :failed_attempts
163
+
164
+ # Defines which key will be used when locking and unlocking an account
165
+ # config.unlock_keys = [ :email ]
166
+
167
+ # Defines which strategy will be used to unlock an account.
168
+ # :email = Sends an unlock link to the user email
169
+ # :time = Re-enables login after a certain amount of time (see :unlock_in below)
170
+ # :both = Enables both strategies
171
+ # :none = No unlock strategy. You should handle unlocking by yourself.
172
+ # config.unlock_strategy = :both
173
+
174
+ # Number of authentication tries before locking an account if lock_strategy
175
+ # is failed attempts.
176
+ # config.maximum_attempts = 20
177
+
178
+ # Time interval to unlock the account if :time is enabled as unlock_strategy.
179
+ # config.unlock_in = 1.hour
180
+
181
+ # Warn on the last attempt before the account is locked.
182
+ # config.last_attempt_warning = true
183
+
184
+ # ==> Configuration for :recoverable
185
+ #
186
+ # Defines which key will be used when recovering the password for an account
187
+ # config.reset_password_keys = [ :email ]
188
+
189
+ # Time interval you can reset your password with a reset password key.
190
+ # Don't put a too small interval or your users won't have the time to
191
+ # change their passwords.
192
+ config.reset_password_within = 6.hours
193
+
194
+ # ==> Configuration for :encryptable
195
+ # Allow you to use another encryption algorithm besides bcrypt (default). You can use
196
+ # :sha1, :sha512 or encryptors from others authentication tools as :clearance_sha1,
197
+ # :authlogic_sha512 (then you should set stretches above to 20 for default behavior)
198
+ # and :restful_authentication_sha1 (then you should set stretches to 10, and copy
199
+ # REST_AUTH_SITE_KEY to pepper).
200
+ #
201
+ # Require the `devise-encryptable` gem when using anything other than bcrypt
202
+ # config.encryptor = :sha512
203
+
204
+ # ==> Scopes configuration
205
+ # Turn scoped views on. Before rendering "sessions/new", it will first check for
206
+ # "users/sessions/new". It's turned off by default because it's slower if you
207
+ # are using only default views.
208
+ # config.scoped_views = false
209
+
210
+ # Configure the default scope given to Warden. By default it's the first
211
+ # devise role declared in your routes (usually :user).
212
+ # config.default_scope = :user
213
+
214
+ # Set this configuration to false if you want /users/sign_out to sign out
215
+ # only the current scope. By default, Devise signs out all scopes.
216
+ # config.sign_out_all_scopes = true
217
+
218
+ # ==> Navigation configuration
219
+ # Lists the formats that should be treated as navigational. Formats like
220
+ # :html, should redirect to the sign in page when the user does not have
221
+ # access, but formats like :xml or :json, should return 401.
222
+ #
223
+ # If you have any extra navigational formats, like :iphone or :mobile, you
224
+ # should add them to the navigational formats lists.
225
+ #
226
+ # The "*/*" below is required to match Internet Explorer requests.
227
+ # config.navigational_formats = ['*/*', :html]
228
+
229
+ # The default HTTP method used to sign out a resource. Default is :delete.
230
+ config.sign_out_via = :delete
231
+
232
+ # ==> OmniAuth
233
+ # Add a new OmniAuth provider. Check the wiki for more information on setting
234
+ # up on your models and hooks.
235
+ config.omniauth :mlh, ENV['MLH_KEY'], ENV['MLH_SECRET']
236
+
237
+ # ==> Warden configuration
238
+ # If you want to use other strategies, that are not supported by Devise, or
239
+ # change the failure app, you can configure them inside the config.warden block.
240
+ #
241
+ # config.warden do |manager|
242
+ # manager.intercept_401 = false
243
+ # manager.default_strategies(scope: :user).unshift :some_external_strategy
244
+ # end
245
+
246
+ # ==> Mountable engine configurations
247
+ # When using Devise inside an engine, let's call it `MyEngine`, and this engine
248
+ # is mountable, there are some extra configurations to be taken into account.
249
+ # The following options are available, assuming the engine is mounted as:
250
+ #
251
+ # mount MyEngine, at: '/my_engine'
252
+ #
253
+ # The router that invoked `devise_for`, in the example above, would be:
254
+ # config.router_name = :my_engine
255
+ #
256
+ # When using omniauth, Devise cannot automatically set Omniauth path,
257
+ # so you need to do it manually. For the users scope, it would be:
258
+ # config.omniauth_path_prefix = '/my_engine/users/auth'
259
+
260
+ # Devise
261
+ Rails.application.config.to_prepare do
262
+ Devise::Mailer.layout "mailer"
263
+ Devise::SessionsController.layout "hackathon_manager"
264
+ end
265
+ end
@@ -0,0 +1,9 @@
1
+ Rails.application.configure do
2
+ config.hackathon = config_for(:hackathon)
3
+
4
+ # Applications without a specified config.time_zone will parse
5
+ # this as a string instead of a DateTime
6
+ if config.hackathon['last_day_to_apply'].is_a?(String)
7
+ config.hackathon['last_day_to_apply'] = DateTime.parse(config.hackathon['last_day_to_apply'])
8
+ end
9
+ end
@@ -0,0 +1,5 @@
1
+ # Be sure to restart your server when you modify this file.
2
+
3
+ # Add new mime types for use in respond_to blocks:
4
+ # Mime::Type.register "text/richtext", :rtf
5
+ Mime::Type.register "text/tsv", :tsv
@@ -0,0 +1,20 @@
1
+ # Be sure to restart your server when you modify this file.
2
+ #
3
+ # This file contains migration options to ease your Rails 5.0 upgrade.
4
+ #
5
+ # Once upgraded flip defaults one by one to migrate to the new default.
6
+ #
7
+ # Read the Rails 5.0 release notes for more info on each option.
8
+
9
+ # Enable per-form CSRF tokens. Previous versions had false.
10
+ Rails.application.config.action_controller.per_form_csrf_tokens = false
11
+
12
+ # Enable origin-checking CSRF mitigation. Previous versions had false.
13
+ Rails.application.config.action_controller.forgery_protection_origin_check = false
14
+
15
+ # Make Ruby 2.4 preserve the timezone of the receiver when calling `to_time`.
16
+ # Previous versions had false.
17
+ ActiveSupport.to_time_preserves_timezone = false
18
+
19
+ # Require `belongs_to` associations by default. Previous versions had false.
20
+ Rails.application.config.active_record.belongs_to_required_by_default = false
@@ -0,0 +1,11 @@
1
+ if Rails.env.production? || Rails.env.staging?
2
+ Sidekiq.configure_server do |config|
3
+ config.redis = { url: ENV['REDIS_URL'] }
4
+ end
5
+
6
+ Sidekiq.configure_client do |config|
7
+ config.redis = { url: ENV['REDIS_URL'] }
8
+ end
9
+ end
10
+
11
+ Sidekiq::Extensions.enable_delay!
@@ -0,0 +1,164 @@
1
+ # Use this setup block to configure all options available in SimpleForm.
2
+ SimpleForm.setup do |config|
3
+ # Wrappers are used by the form builder to generate a
4
+ # complete input. You can remove any component from the
5
+ # wrapper, change the order or even add your own to the
6
+ # stack. The options given below are used to wrap the
7
+ # whole input.
8
+ config.wrappers :default, class: :input, hint_class: :field_with_hint, error_class: :field_with_errors do |b|
9
+ ## Extensions enabled by default
10
+ # Any of these extensions can be disabled for a
11
+ # given input by passing: `f.input EXTENSION_NAME => false`.
12
+ # You can make any of these extensions optional by
13
+ # renaming `b.use` to `b.optional`.
14
+
15
+ # Determines whether to use HTML5 (:email, :url, ...)
16
+ # and required attributes
17
+ b.use :html5
18
+
19
+ # Calculates placeholders automatically from I18n
20
+ # You can also pass a string as f.input placeholder: "Placeholder"
21
+ b.use :placeholder
22
+
23
+ ## Optional extensions
24
+ # They are disabled unless you pass `f.input EXTENSION_NAME => true`
25
+ # to the input. If so, they will retrieve the values from the model
26
+ # if any exists. If you want to enable any of those
27
+ # extensions by default, you can change `b.optional` to `b.use`.
28
+
29
+ # Calculates maxlength from length validations for string inputs
30
+ b.optional :maxlength
31
+
32
+ # Calculates pattern from format validations for string inputs
33
+ b.optional :pattern
34
+
35
+ # Calculates min and max from length validations for numeric inputs
36
+ b.optional :min_max
37
+
38
+ # Calculates readonly automatically from readonly attributes
39
+ b.optional :readonly
40
+
41
+ ## Inputs
42
+ b.use :label_input
43
+ b.use :hint, wrap_with: { tag: :span, class: :hint }
44
+ b.use :error, wrap_with: { tag: :span, class: :error }
45
+
46
+ ## full_messages_for
47
+ # If you want to display the full error message for the attribute, you can
48
+ # use the component :full_error, like:
49
+ #
50
+ # b.use :full_error, wrap_with: { tag: :span, class: :error }
51
+ end
52
+
53
+ # The default wrapper to be used by the FormBuilder.
54
+ config.default_wrapper = :default
55
+
56
+ # Define the way to render check boxes / radio buttons with labels.
57
+ # Defaults to :nested for bootstrap config.
58
+ # inline: input + label
59
+ # nested: label > input
60
+ config.boolean_style = :nested
61
+
62
+ # Default class for buttons
63
+ config.button_class = 'button'
64
+
65
+ # Method used to tidy up errors. Specify any Rails Array method.
66
+ # :first lists the first message for each field.
67
+ # Use :to_sentence to list all errors for each field.
68
+ # config.error_method = :first
69
+
70
+ # Default tag used for error notification helper.
71
+ config.error_notification_tag = :div
72
+
73
+ # CSS class to add for error notification helper.
74
+ config.error_notification_class = 'alert alert-error'
75
+
76
+ # ID to add for error notification helper.
77
+ # config.error_notification_id = nil
78
+
79
+ # Series of attempts to detect a default label method for collection.
80
+ # config.collection_label_methods = [ :to_label, :name, :title, :to_s ]
81
+
82
+ # Series of attempts to detect a default value method for collection.
83
+ # config.collection_value_methods = [ :id, :to_s ]
84
+
85
+ # You can wrap a collection of radio/check boxes in a pre-defined tag, defaulting to none.
86
+ # config.collection_wrapper_tag = nil
87
+
88
+ # You can define the class to use on all collection wrappers. Defaulting to none.
89
+ # config.collection_wrapper_class = nil
90
+
91
+ # You can wrap each item in a collection of radio/check boxes with a tag,
92
+ # defaulting to :span.
93
+ # config.item_wrapper_tag = :span
94
+
95
+ # You can define a class to use in all item wrappers. Defaulting to none.
96
+ # config.item_wrapper_class = nil
97
+
98
+ # How the label text should be generated altogether with the required text.
99
+ # config.label_text = lambda { |label, required, explicit_label| "#{required} #{label}" }
100
+
101
+ # You can define the class to use on all labels. Default is nil.
102
+ # config.label_class = nil
103
+
104
+ # You can define the default class to be used on forms. Can be overriden
105
+ # with `html: { :class }`. Defaulting to none.
106
+ # config.default_form_class = nil
107
+
108
+ # You can define which elements should obtain additional classes
109
+ # config.generate_additional_classes_for = [:wrapper, :label, :input]
110
+
111
+ # Whether attributes are required by default (or not). Default is true.
112
+ # config.required_by_default = true
113
+
114
+ # Tell browsers whether to use the native HTML5 validations (novalidate form option).
115
+ # These validations are enabled in SimpleForm's internal config but disabled by default
116
+ # in this configuration, which is recommended due to some quirks from different browsers.
117
+ # To stop SimpleForm from generating the novalidate option, enabling the HTML5 validations,
118
+ # change this configuration to true.
119
+ config.browser_validations = false
120
+
121
+ # Collection of methods to detect if a file type was given.
122
+ # config.file_methods = [ :mounted_as, :file?, :public_filename ]
123
+
124
+ # Custom mappings for input types. This should be a hash containing a regexp
125
+ # to match as key, and the input type that will be used when the field name
126
+ # matches the regexp as value.
127
+ # config.input_mappings = { /count/ => :integer }
128
+
129
+ # Custom wrappers for input types. This should be a hash containing an input
130
+ # type as key and the wrapper that will be used for all inputs with specified type.
131
+ # config.wrapper_mappings = { string: :prepend }
132
+
133
+ # Namespaces where SimpleForm should look for custom input classes that
134
+ # override default inputs.
135
+ # config.custom_inputs_namespaces << "CustomInputs"
136
+
137
+ # Default priority for time_zone inputs.
138
+ # config.time_zone_priority = nil
139
+
140
+ # Default priority for country inputs.
141
+ # config.country_priority = nil
142
+
143
+ # When false, do not use translations for labels.
144
+ # config.translate_labels = true
145
+
146
+ # Automatically discover new inputs in Rails' autoload path.
147
+ # config.inputs_discovery = true
148
+
149
+ # Cache SimpleForm inputs discovery
150
+ # config.cache_discovery = !Rails.env.development?
151
+
152
+ # Default class for inputs
153
+ # config.input_class = nil
154
+
155
+ # Define the default class of the input wrapper of the boolean input.
156
+ config.boolean_label_class = 'checkbox'
157
+
158
+ # Defines if the default input wrapper class should be included in radio
159
+ # collection wrappers.
160
+ # config.include_default_input_wrapper_class = true
161
+
162
+ # Defines which i18n scope will be used in Simple Form.
163
+ # config.i18n_scope = 'simple_form'
164
+ end
@@ -0,0 +1,7 @@
1
+ static_data = {}
2
+ Dir["#{Rails.root}/config/data/**/*.yml"].each do |file|
3
+ basename = File.basename(file, ".yml")
4
+ static_data[basename] = YAML.load_file(file)
5
+ end
6
+
7
+ STATIC_DATA = static_data.freeze
@@ -0,0 +1,14 @@
1
+ # Be sure to restart your server when you modify this file.
2
+
3
+ # This file contains settings for ActionController::ParamsWrapper which
4
+ # is enabled by default.
5
+
6
+ # Enable parameter wrapping for JSON. You can disable this by setting :format to an empty array.
7
+ ActiveSupport.on_load(:action_controller) do
8
+ wrap_parameters format: [:json]
9
+ end
10
+
11
+ # To enable root element in JSON for ActiveRecord objects.
12
+ # ActiveSupport.on_load(:active_record) do
13
+ # self.include_root_in_json = true
14
+ # end