Skip to content

Commit

Permalink
refactor(config): Adjusts registration verbiage to always allow user …
Browse files Browse the repository at this point in the history
…registration (#232)
  • Loading branch information
cbaudouinjr authored May 24, 2020
1 parent accd02e commit 1a31861
Show file tree
Hide file tree
Showing 6 changed files with 7 additions and 22 deletions.
8 changes: 0 additions & 8 deletions app/controllers/manage/questionnaires_controller.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
class Manage::QuestionnairesController < Manage::ApplicationController
include QuestionnairesControllable

before_action :ensure_registration_is_open, only: [:new, :create]
before_action :set_questionnaire, only: [:show, :edit, :update, :destroy, :check_in, :convert_to_admin, :update_acc_status, :message_events]

respond_to :html, :json
Expand Down Expand Up @@ -170,11 +169,4 @@ def convert_boarded_bus_param(values, questionnaire = nil)
def set_questionnaire
@questionnaire = ::Questionnaire.find(params[:id])
end

def ensure_registration_is_open
if HackathonConfig['disable_account_registration']
flash[:alert] = "Registration has closed"
redirect_to root_path
end
end
end
7 changes: 1 addition & 6 deletions app/controllers/users/registrations_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,7 @@ class Users::RegistrationsController < Devise::RegistrationsController

# GET /resource/sign_up
def new
if HackathonConfig['disable_account_registration']
flash[:alert] = "Registration has closed"
redirect_to root_path
else
super
end
super
end

# POST /resource
Expand Down
6 changes: 3 additions & 3 deletions app/views/devise/registrations/new.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@
Register for
%span.emphasized= HackathonConfig['name']

- if !HackathonConfig['registration_is_open'] || HackathonConfig['disclaimer_message'].present?
- if !HackathonConfig['accepting_questionnaires'] || HackathonConfig['disclaimer_message'].present?
#disclaimer
- if !HackathonConfig['registration_is_open']
- if !HackathonConfig['accepting_questionnaires']
.center
%strong Registration is now closed. Thanks to everyone who applied!
%strong We are no longer accepting applications. Thanks to everyone who applied!
%br
- if HackathonConfig['disclaimer_message'].present?
= markdown(HackathonConfig['disclaimer_message'])
Expand Down
2 changes: 1 addition & 1 deletion app/views/questionnaires/show.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
%p.center
= btn_link_to "RSVP NOW &raquo;".html_safe, rsvp_path
- if !@questionnaire.can_rsvp? && @questionnaire.acc_status != "denied"
- if HackathonConfig['registration_is_open']
- if HackathonConfig['accepting_questionnaires']
- if HackathonConfig['thanks_for_applying_message'].present?
= markdown(HackathonConfig['thanks_for_applying_message'])
- else
Expand Down
3 changes: 1 addition & 2 deletions config/app.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,10 @@
defaults: &defaults

# Logic config
registration_is_open: true
accepting_questionnaires: true
last_day_to_apply: "<%= Date.new(2000, 1, 1).to_s %>"
event_start_date: "<%= Date.new(2000, 1, 1).to_s %>"
auto_late_waitlist: false
disable_account_registration: false

# Content config
name: HackFoo
Expand Down
3 changes: 1 addition & 2 deletions config/locales/en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,11 +55,10 @@ en:
school:
is_home: The "home" school is separated from all other schools on dashboard metrics.
hackathon_config:
registration_is_open: Specify that registration is open. This does <strong>not</strong> block registration; it only changes messaging around it.
accepting_questionnaires: Specify that questionnaires are being accepted. This does <strong>not</strong> block applying; it only changes messaging around it.
last_day_to_apply: 'Last date to apply to your hackathon (format: YYYY-MM-DD)'
event_start_date: 'Start date of your hackathon (format: YYYY-MM-DD)'
auto_late_waitlist: Automatically set application status to "late waitlist" for new applications
disable_account_registration: Prevent applicants from applying

name: Your hackathon's name
logo_asset: Optional logo asset (should be a full https:// URL to a .jpg, .png, or .svg file)
Expand Down

0 comments on commit 1a31861

Please sign in to comment.