hackathon_manager 0.1.0 → 0.2.0

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
  SHA1:
3
- metadata.gz: 9b629f9fbc6de4475abdcae57d3249f940073f93
4
- data.tar.gz: cfa43250214ba8b096fc81d63cbf52fddd2f49b8
3
+ metadata.gz: b094f3052081eed2e1934b6d9614f3445d375650
4
+ data.tar.gz: 52e54d51b7842bc792b6331f292994134ae3bed6
5
5
  SHA512:
6
- metadata.gz: 47a1c3daf4157814e45ee0a59c8c46367862d88fe9b5db918f46e41f2bb2ebf8152da0d260ac60539d7e5769a4a17448ed345856fa8b64f34dc62e1593790678
7
- data.tar.gz: 023a806098e9254409b4757d2cf6290fd69afe72226e31f0dbe4a893dfe949cc1303d702eee7b02f4951134f8030db313afe32a5924fc436593efaa834e40dcc
6
+ metadata.gz: b09f0085305e16198ed495f6fc168813f5819eff20d39ad66fb0c3cc6902e3a4b207574c9cf756904218dc0d8dfb8a5558d292526bae4207890ccd5f4e85cc43
7
+ data.tar.gz: 53d3039108ff4f156d914d1f5847d7e2fe9fe5805e92a933adcea8a6c7c9ecbcf23af4b81995201016a2a1d31009d06a9223f9ae832fd7c2bfd52255fbd6ccfd
@@ -28,6 +28,7 @@ class QuestionnairesController < ApplicationController
28
28
  @questionnaire = Questionnaire.new
29
29
 
30
30
  if session["devise.provider_data"] && session["devise.provider_data"]["info"]
31
+ @skip_my_mlh_fields = true
31
32
  @questionnaire.tap do |q|
32
33
  q.first_name = session["devise.provider_data"]["info"]["first_name"]
33
34
  q.last_name = session["devise.provider_data"]["info"]["last_name"]
@@ -16,12 +16,12 @@ class Users::RegistrationsController < Devise::RegistrationsController
16
16
 
17
17
  # GET /resource/edit
18
18
  def edit
19
- redirect_to questionnaires_path
19
+ super
20
20
  end
21
21
 
22
22
  # PUT /resource
23
23
  def update
24
- redirect_to questionnaires_path
24
+ super
25
25
  end
26
26
 
27
27
  # DELETE /resource
@@ -15,7 +15,8 @@
15
15
  = @questionnaire.travel_not_from_school ? "Somewhere else (#{@questionnaire.travel_location})" : "My school (#{@questionnaire.school.full_name})"
16
16
 
17
17
  %fieldset
18
- %legend Provided by My MLH
18
+ - if @questionnaire.user.provider == 'mlh'
19
+ %legend Provided by My MLH
19
20
  %p
20
21
  %b First name:
21
22
  = @questionnaire.first_name
@@ -1,4 +1,4 @@
1
- %div{class:'form-container'}
1
+ .form-container
2
2
  = simple_form_for(resource, as: resource_name, url: password_path(resource_name), html: { method: :post }) do |f|
3
3
  = f.error_notification
4
4
  .form-inputs
@@ -6,4 +6,4 @@
6
6
  .center
7
7
  .form-actions
8
8
  = f.button :submit, "Send Reset Instructions"
9
- = render "devise/shared/links"
9
+ = render "devise/shared/links"
@@ -1,7 +1,7 @@
1
- %section{class:'section'}
2
- %div{class:'container'}
3
- %h1{class:'section-title'} Change your password
4
- %div{class:'form-container'}
1
+ .section
2
+ .container
3
+ .section-title Change your password
4
+ .form-container
5
5
  = simple_form_for(resource, as: resource_name, url: password_path(resource_name), html: { method: :put }) do |f|
6
6
  = f.error_notification
7
7
  = f.input :reset_password_token, as: :hidden
@@ -1,5 +1,5 @@
1
- %section{class:'section'}
2
- %div{class:'container'}
3
- %h1{class:'section-title'} Password Reset
1
+ .section
2
+ .container
3
+ %h1.section-title Password Reset
4
4
 
5
5
  = render 'form'
@@ -1,8 +1,16 @@
1
1
  = simple_form_for(resource, as: resource_name, url: registration_path(resource_name)) do |f|
2
2
  .form-actions
3
3
  .center
4
- = btn_link_to "Sign Up with My MLH &raquo;".html_safe, user_mlh_omniauth_authorize_path
4
+ = btn_link_to "Sign Up using My MLH &raquo;".html_safe, user_mlh_omniauth_authorize_path
5
+ %p
6
+ %em or create an account:
7
+ .form-inputs
8
+ = f.input :email, required: true, autofocus: true
9
+ = f.input :password, required: true
10
+ = f.input :password_confirmation, required: true, label:"Confirm"
11
+ .form-actions
12
+ .center
13
+ = f.button :submit, "Sign up"
5
14
  %p.center
6
15
  Already applied?
7
- %br
8
- = btn_link_to "Sign In &raquo;".html_safe, user_mlh_omniauth_authorize_path
16
+ = link_to "Sign In".html_safe, new_user_session_path
@@ -1,15 +1,13 @@
1
1
  %section.section
2
2
  .container
3
3
  .form-container.signup
4
- %h1.section-title Sign Up or Sign In
4
+ %h1.section-title Sign Up
5
5
 
6
6
  #disclaimer
7
7
  - unless Rails.configuration.hackathon['registration_is_open']
8
8
  .center
9
9
  %strong Registration is now closed. Thanks to everyone who applied!
10
10
  %br
11
- %br
12
- Registration is simplified with #{link_to "My MLH", "https://my.mlh.io", style: "color: #f5f5f5; text-decoration: underline;"}! Click below to sign into your existing My MLH account, or create one. You'll be redirected back to BrickHack to finish your application afterwards.
13
11
  %ul
14
12
  %li Applicants must be 18 years of age by February 11th
15
13
  %li RIT students must still apply
@@ -1,8 +1,18 @@
1
- .form-actions
2
- .center
3
- %p
4
- = btn_link_to "Sign In with My MLH &raquo;".html_safe, user_mlh_omniauth_authorize_path
1
+ = simple_form_for(resource, as: resource_name, url: session_path(resource_name)) do |f|
2
+ .form-actions
3
+ .center
4
+ %p
5
+ = btn_link_to "Sign in using My MLH &raquo;".html_safe, user_mlh_omniauth_authorize_path
6
+ %p
7
+ %em or use an account:
8
+ .form-inputs
9
+ = f.input :email, required: false, input_html: { autofocus: true }
10
+ = f.input :password, required: false
11
+ = f.input :remember_me, as: :boolean if devise_mapping.rememberable?
12
+ .form-actions{class:'center'}
13
+ = f.button :submit, "Sign In"
5
14
  %p
6
15
  Need an account?
7
- %br
8
- = btn_link_to "Sign Up &raquo;".html_safe, new_user_registration_path
16
+ = link_to "Sign Up".html_safe, new_user_registration_path
17
+ \-
18
+ = link_to "Forgot password", new_user_password_path
@@ -1,7 +1,7 @@
1
1
  .section
2
2
  .container
3
3
  .form-container.login
4
- %h1.section-title Log In
4
+ %h1.section-title Sign In
5
5
  - if notice
6
6
  .form-success
7
7
  .success_message
@@ -14,9 +14,9 @@
14
14
  = btn_link_to "Review", new_questionnaires_path
15
15
  - else
16
16
  %div
17
- = btn_link_to "Login", new_user_session_path
17
+ = btn_link_to "Sign In", new_user_session_path
18
18
  %div
19
- = btn_link_to "Register", new_user_registration_path
19
+ = btn_link_to "Sign Up", new_user_registration_path
20
20
  - if user_signed_in?
21
21
  %div
22
22
  = btn_link_to "Sign Out", destroy_user_session_path, method: :delete
@@ -6,7 +6,7 @@
6
6
  = stylesheet_link_tag "application", :media => "all"
7
7
  = csrf_meta_tags
8
8
  %body
9
- %div{class:'day-of'}
9
+ .day-of
10
10
  = yield
11
11
  = javascript_include_tag "application"
12
- = javascript_include_tag "vendor/owl.carousel.min.js"
12
+ = javascript_include_tag "vendor/owl.carousel.min.js"
@@ -1,4 +1,4 @@
1
- %div{class:'form-container'}
1
+ .form-container
2
2
  = simple_form_for @questionnaire, url: url_for(action: @questionnaire.new_record? ? "create" : "update", controller: "questionnaires"), html: { "data-validate" => "form" } do |f|
3
3
 
4
4
  - if f.error_notification.present?
@@ -10,7 +10,9 @@
10
10
 
11
11
  .form-inputs
12
12
  %fieldset
13
- %legend Provided by My MLH
13
+ - if @questionnaire&.user&.provider == 'mlh'
14
+ %legend Provided by My MLH
15
+ %br
14
16
  = f.input :first_name, placeholder: "Joe", input_html: { "data-validate" => "presence" }, label: "First Name", autofocus: true
15
17
  = f.input :last_name, placeholder: "Smith", input_html: { "data-validate" => "presence" }, label: "Last Name"
16
18
  = f.input :email, placeholder: "joe@example.com", input_html: { "data-validate" => "presence email", value: @questionnaire.user.try(:email) }, required: true
@@ -26,6 +28,7 @@
26
28
  = f.input :special_needs, placeholder: "Any special needs or requests (optional)", label: "Special needs"
27
29
 
28
30
  .form-inputs
31
+ %br
29
32
  = f.input :experience, as: :select, collection: Questionnaire::POSSIBLE_EXPERIENCES.invert, include_blank: "(select one...)", label: "Experience", input_html: { "data-validate" => "presence" }
30
33
  = f.input :interest, as: :select, collection: Questionnaire::POSSIBLE_INTERESTS.invert, include_blank: "(select one...)", label: "Interest", input_html: { "data-validate" => "presence" }
31
34
 
@@ -50,5 +53,5 @@
50
53
  %a{href:"/assets/BrickHack_ReleaseAgreement.pdf", target:"_blank"} BrickHack Agreement
51
54
  = f.input :agreement_accepted, as: :formatted_boolean, label: "I accept the BrickHack Agreement", input_html: { "data-validate" => "presence" }
52
55
 
53
- %div{class:'center'}
56
+ .center
54
57
  = f.button :submit, value: ( @questionnaire.new_record? ? 'Create' : 'Save' )
@@ -1,4 +1,4 @@
1
- %div{class:'form-container'}
1
+ .form-container
2
2
  = simple_form_for @school, url: url_for(action: @school.new_record? ? "create" : "update", controller: "schools"), html: { "data-validate" => "form" } do |f|
3
3
 
4
4
  - if f.error_notification.present?
@@ -12,5 +12,5 @@
12
12
  = f.input :state
13
13
  = f.association :bus_list, include_blank: "(none)"
14
14
 
15
- %div{class:'center'}
15
+ .center
16
16
  = f.button :submit, value: ( @school.new_record? ? 'Create' : 'Save' )
@@ -27,7 +27,7 @@
27
27
  %strong= @school.full_name
28
28
  school name to this new school.
29
29
 
30
- %div{class:'center'}
30
+ .center
31
31
  = f.button :submit, value: 'Merge'
32
32
 
33
33
  .form-container
@@ -1,4 +1,4 @@
1
- %div{class:"form-container wizard#{action_name == "new" ? " wizard-skip-valid" : ""}"}
1
+ %div{class:"form-container wizard#{@skip_my_mlh_fields ? " wizard-skip-valid" : ""}"}
2
2
  = simple_form_for @questionnaire, url: url_for(controller: "questionnaires", action: "update"), html: { "data-validate" => "form" } do |f|
3
3
 
4
4
  - if f.error_notification.present?
@@ -65,6 +65,6 @@
65
65
  I agree to the terms of both the MLH Contest Terms and Conditions and the MLH Privacy Policy. Please note that you may receive pre and post-event informational e-mails and occasional messages about hackathons from MLH as per the MLH Privacy Policy.
66
66
  = f.input :data_sharing_accepted, as: :formatted_boolean, label: "I accept the MLH data sharing notice", input_html: { "data-validate" => "presence" }
67
67
 
68
- %div{class:'center'}
68
+ .center
69
69
  %button.button{ type: "button", "data-wizard" => "previous" } Previous
70
70
  = f.button :submit, value: ( @questionnaire.new_record? ? 'Apply' : 'Save' )
@@ -1,6 +1,6 @@
1
1
  - title "Application"
2
- %div{class:'form-success'}
3
- %div{class:'success_message'}
2
+ .form-success
3
+ .success_message
4
4
  %p#notice= notice
5
5
  - if @questionnaire.can_rsvp?
6
6
  - if @questionnaire.did_rsvp?
@@ -19,12 +19,14 @@
19
19
  - else
20
20
  %p Thanks for applying!
21
21
 
22
- %div{class:'participant_info'}
22
+ .participant_info
23
23
  %p Below is a copy of your application.
24
24
 
25
25
  = render partial: 'questionnaire_summary'
26
26
 
27
27
  %p
28
28
  = btn_link_to '<span class="fa fa-pencil icon-space-r"></span> Edit Application'.html_safe, edit_questionnaires_path
29
+ - if !@questionnaire.user.provider
30
+ = btn_link_to '<span class="fa fa-user icon-space-r"></span> Edit Account'.html_safe, edit_user_registration_path
29
31
  %p
30
32
  Unhappy? #{link_to "Revoke my application", user_registration_path, data: { confirm: "Are you sure? Your account and application will be permanently erased." }, method: :delete}
@@ -1,3 +1,3 @@
1
1
  module HackathonManager
2
- VERSION = '0.1.0'
2
+ VERSION = '0.2.0'
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.1.0
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Stuart Olivera
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-06-03 00:00:00.000000000 Z
11
+ date: 2017-07-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -512,7 +512,6 @@ files:
512
512
  - app/models/fips.rb
513
513
  - app/models/message.rb
514
514
  - app/models/questionnaire.rb
515
- - app/models/schedule.rb
516
515
  - app/models/school.rb
517
516
  - app/models/school_name_duplicate.rb
518
517
  - app/models/user.rb
@@ -1,53 +0,0 @@
1
- require 'httparty'
2
- SHEETS_KEY = ENV['GOOGLESHEETS_KEY']
3
- SHEETS_URL = "https://sheets.googleapis.com/v4/spreadsheets/".freeze
4
- SHEETS_FIELDS = "fields=sheets(data.rowData.values.userEnteredValue)".freeze
5
- SECTION = ":section".freeze
6
- ITEM = ":item".freeze
7
-
8
- class Schedule
9
- def initialize(spreadsheet_id, sheet = 0)
10
- cache_key = "schedule/#{spreadsheet_id}"
11
- parsed_response = Rails.cache.fetch(cache_key, expires_in: 1.hour) do
12
- response = HTTParty.get(SHEETS_URL + "#{spreadsheet_id}?#{SHEETS_FIELDS}&key=#{SHEETS_KEY}")
13
- response ? response.parsed_response.to_hash : nil
14
- end
15
-
16
- unless parsed_response && parsed_response["error"].nil?
17
- Rails.logger.error "Error reading Google Sheet #{spreadsheet_id}"
18
- return
19
- end
20
-
21
- @sheet = parsed_response["sheets"][sheet]
22
- end
23
-
24
- def rows
25
- @sheet ? @sheet["data"][0]["rowData"] : []
26
- end
27
-
28
- def sections
29
- section = []
30
- sections = []
31
- rows.each do |row|
32
- if row["values"][0]["userEnteredValue"]["stringValue"] == SECTION
33
- sections << section unless section.count.zero?
34
- section = [row["values"][1]["userEnteredValue"]["stringValue"]]
35
- else
36
- fill_section(section, row)
37
- end
38
- end
39
- sections << section unless section.empty?
40
- sections
41
- end
42
-
43
- private
44
-
45
- def fill_section(section, row)
46
- r = []
47
- row["values"].map do |col|
48
- next if !col.empty? && col["userEnteredValue"]["stringValue"] == ITEM
49
- r << (col.empty? ? '' : col["userEnteredValue"]["stringValue"])
50
- end
51
- section << r unless r.count.zero?
52
- end
53
- end