hackathon_manager 0.13.1 → 0.13.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: edbee88bd48b0012031f81d0c2a0c919a5947c4a5939edd1bb0afc4e873bac82
4
- data.tar.gz: f1076092210ee338b5a6bdc764b7af0b917c41a0a4389cfd5a5912b8b3ad9317
3
+ metadata.gz: 7496dfde19a105b82b8ad9ed044127c612d9edeffe215d8aaca871cb9542fa65
4
+ data.tar.gz: 2beec10c47c9e6e2bf5df5f8310414c100a784bb11195c5bea90f8b1fcebfc4c
5
5
  SHA512:
6
- metadata.gz: 591427e0bc9e78d9188c852cb9e7861e99cbd50e2172bb3617410762f9b4a504fc6efe07ae909591a90a740d1ba91841d557df40d521f5fae6a422f7bd5e7981
7
- data.tar.gz: 30e6bc7c85b75ab71fe60ed1265492368c09d2535d3c3ecb3d5797013ebd7f34c18527791a0d24fb39cd08d4baedd2821b690104cf2830af632d33faeb49b3d9
6
+ metadata.gz: 3f28ad43a041257be5a9fd335ca7855d89b4a66bddacd732459587c8c13e49d4f00800eaee3b724942e70100bafc6019ece1f014fedca4a972a0548c00703dcb
7
+ data.tar.gz: '09e7f61155f287b0432fde7255d3065c60efa8565ffecb653bf1a507b5e56f8c7125e36c70773d4812f95a7c7cd6de822405a2d7dc3280596c58c2a07605f8d7'
@@ -16,6 +16,16 @@ $.fn.bulkRowEdit = function() {
16
16
  return false;
17
17
  }
18
18
 
19
+ var number = ids.length;
20
+ var questionnaires = number === 1 ? 'questionnaire' : 'questionnaires';
21
+ var status = $('select[data-bulk-row-edit] option[value=' + action + ']').text();
22
+ var message = 'Are you sure? This will set ' + number + ' ' + questionnaires + ' to "' + status + '".\n\nThis may trigger an automatic email to each applicant depending on your automated messages.';
23
+
24
+ if (!confirm(message)) {
25
+ $('[type=submit][data-bulk-row-edit]').prop('disabled', false);
26
+ return false;
27
+ }
28
+
19
29
  $.ajax({
20
30
  url: $('form[data-bulk-row-edit]').attr('action'),
21
31
  type: 'PATCH',
@@ -31,7 +31,8 @@ class Manage::QuestionnairesController < Manage::ApplicationController
31
31
  create_params = convert_school_name_to_id(create_params)
32
32
  @questionnaire = ::Questionnaire.new(create_params)
33
33
  if @questionnaire.valid?
34
- user = User.new(email: email, password: Devise.friendly_token.first(10))
34
+ users = User.where(email: email)
35
+ user = users.count == 1 ? users.first : User.new(email: email, password: Devise.friendly_token.first(10))
35
36
  if user.save
36
37
  @questionnaire.user = user
37
38
  @questionnaire.save
@@ -7,12 +7,22 @@ class Questionnaire < ApplicationRecord
7
7
  after_save :update_school_questionnaire_count
8
8
  after_destroy :update_school_questionnaire_count
9
9
 
10
+ belongs_to :user
11
+ belongs_to :school
12
+ belongs_to :bus_list, optional: true
13
+
14
+ validates_uniqueness_of :user_id
15
+
10
16
  validates_presence_of :first_name, :last_name, :phone, :date_of_birth, :school_id, :experience, :shirt_size, :interest
11
17
  validates_presence_of :gender, :major, :level_of_study, :graduation_year, :race_ethnicity
12
18
  validates_presence_of :agreement_accepted, message: "Please read & accept"
13
19
  validates_presence_of :code_of_conduct_accepted, message: "Please read & accept"
14
20
  validates_presence_of :data_sharing_accepted, message: "Please read & accept"
15
21
 
22
+ DIETARY_SPECIAL_NEEDS_MAX_LENGTH = 500
23
+ validates_length_of :dietary_restrictions, maximum: DIETARY_SPECIAL_NEEDS_MAX_LENGTH
24
+ validates_length_of :special_needs, maximum: DIETARY_SPECIAL_NEEDS_MAX_LENGTH
25
+
16
26
  # if HackathonManager.field_enabled?(:why_attend)
17
27
  # validates_presence_of :why_attend
18
28
  # end
@@ -27,9 +37,6 @@ class Questionnaire < ApplicationRecord
27
37
  validates :vcs_url, url: { allow_blank: true }
28
38
  validates_format_of :vcs_url, with: %r{((github.com\/\w+\/?)|(bitbucket.org\/\w+\/?))}, allow_blank: true, message: "Must be a GitHub or BitBucket url"
29
39
 
30
- belongs_to :school
31
- belongs_to :bus_list, optional: true
32
-
33
40
  strip_attributes
34
41
 
35
42
  POSSIBLE_EXPERIENCES = {
@@ -110,8 +117,6 @@ class Questionnaire < ApplicationRecord
110
117
  validates_inclusion_of :shirt_size, in: POSSIBLE_SHIRT_SIZES
111
118
  validates_inclusion_of :acc_status, in: POSSIBLE_ACC_STATUS
112
119
 
113
- belongs_to :user
114
-
115
120
  def email
116
121
  user&.email
117
122
  end
@@ -10,7 +10,7 @@
10
10
  %br
11
11
  = f.input :first_name, input_html: { "data-validate" => "presence" }, label: "First Name", autofocus: true
12
12
  = f.input :last_name, input_html: { "data-validate" => "presence" }, label: "Last Name"
13
- = f.input :email, input_html: { "data-validate" => "presence email", value: @questionnaire.user.try(:email) }, required: true
13
+ = f.input :email, input_html: { "data-validate" => "presence email", value: @questionnaire.user.try(:email) }, required: true, hint: 'Can be an existing user (without a questionnaire) or a new user. If this is a new user, they will receive a randomly-generated password that they must request a password reset for.'
14
14
  = f.input :phone, input_html: { "data-validate" => "presence" }
15
15
  = f.input :date_of_birth, start_year: Date.today.year - 18, end_year: Date.today.year - 90, order: [:month, :day, :year], input_html: { "data-validate" => "presence" }
16
16
 
@@ -20,8 +20,8 @@
20
20
  = f.input :major, input_html: { "data-validate" => "presence" }, wrapper_html: { class: 'input--half' }
21
21
  = f.input :gender, collection: collection_or_text(@questionnaire.gender, Questionnaire::POSSIBLE_GENDERS), include_blank: "(select one...)", input_html: { "data-validate" => "presence" }, wrapper_html: { class: 'input--half' }
22
22
  = f.input :shirt_size, as: :select, collection: Questionnaire::POSSIBLE_SHIRT_SIZES, include_blank: "(select one...)", input_html: { "data-validate" => "presence" }, wrapper_html: { class: 'input--half' }
23
- = f.input :dietary_restrictions, as: :text, label: "Health restrictions", wrapper_html: { class: 'input--half' }
24
- = f.input :special_needs, as: :text, label: "Special needs", wrapper_html: { class: 'input--half' }
23
+ = f.input :dietary_restrictions, as: :text, label: "Health restrictions", wrapper_html: { class: 'input--half' }, maxlength: Questionnaire::DIETARY_SPECIAL_NEEDS_MAX_LENGTH
24
+ = f.input :special_needs, as: :text, label: "Special needs", wrapper_html: { class: 'input--half' }, maxlength: Questionnaire::DIETARY_SPECIAL_NEEDS_MAX_LENGTH
25
25
 
26
26
  .right
27
27
  %button.button{ type: "button", "data-wizard" => "next" } Next
@@ -0,0 +1,6 @@
1
+ class ChangeQuestionnaireDietarySpecialNeedsStringToText < ActiveRecord::Migration[5.2]
2
+ def change
3
+ change_column :questionnaires, :dietary_restrictions, :text
4
+ change_column :questionnaires, :special_needs, :text
5
+ end
6
+ end
@@ -1,3 +1,3 @@
1
1
  module HackathonManager
2
- VERSION = '0.13.1'.freeze
2
+ VERSION = '0.13.2'.freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hackathon_manager
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.13.1
4
+ version: 0.13.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Stuart Olivera
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-01-22 00:00:00.000000000 Z
11
+ date: 2019-01-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -708,6 +708,7 @@ files:
708
708
  - db/migrate/20190107233210_create_trackable_events.rb
709
709
  - db/migrate/20190113231044_refactor_bus_lists.rb
710
710
  - db/migrate/20190118204143_add_role_to_users.rb
711
+ - db/migrate/20190125021648_change_questionnaire_dietary_special_needs_string_to_text.rb
711
712
  - db/schools.csv
712
713
  - db/seed_messages/questionnaire--accepted.md
713
714
  - db/seed_messages/questionnaire--denied.md