Add a switch for allowing registration on events (proposals)
This commit is contained in:
parent
75bf1380ba
commit
03f7951676
10 changed files with 30 additions and 9 deletions
|
|
@ -57,7 +57,11 @@ module Admin
|
||||||
private
|
private
|
||||||
|
|
||||||
def cfp_params
|
def cfp_params
|
||||||
params.require(:cfp).permit(:start_date, :end_date, :description, :cfp_type)
|
params.require(:cfp).permit(
|
||||||
|
:start_date, :end_date,
|
||||||
|
:description, :cfp_type,
|
||||||
|
:enable_registrations
|
||||||
|
)
|
||||||
end
|
end
|
||||||
|
|
||||||
def cfp_params_or_first_remaining_type
|
def cfp_params_or_first_remaining_type
|
||||||
|
|
|
||||||
|
|
@ -18,6 +18,11 @@
|
||||||
readonly: 'readonly' }
|
readonly: 'readonly' }
|
||||||
= f.input :description, hint: markdown_hint,
|
= f.input :description, hint: markdown_hint,
|
||||||
input_html: { rows: 2, data: { provide: 'markdown-editable' } }
|
input_html: { rows: 2, data: { provide: 'markdown-editable' } }
|
||||||
|
- if cfp.cfp_type == 'events'
|
||||||
|
= f.input :enable_registrations, as: :boolean,
|
||||||
|
hint: 'Allow submitters to request registration?'
|
||||||
|
- else
|
||||||
|
= f.input :enable_registrations, as: :hidden
|
||||||
%p.text-right
|
%p.text-right
|
||||||
= f.action :submit, as: :button,
|
= f.action :submit, as: :button,
|
||||||
button_html: { class: 'btn btn-primary' }
|
button_html: { class: 'btn btn-primary' }
|
||||||
|
|
|
||||||
|
|
@ -43,10 +43,11 @@
|
||||||
250
|
250
|
||||||
words.
|
words.
|
||||||
|
|
||||||
= f.inputs 'Enable pre-registration' do
|
- if @program.cfp.enable_registrations?
|
||||||
= f.input :require_registration, label: 'Require participants to register to your event'
|
= f.inputs 'Enable pre-registration' do
|
||||||
- message = @event.room ? "Value must be between 1 and #{@event.room.size}" : 'Check room capacity after scheduling.'
|
= f.input :require_registration, label: 'Require participants to register to your event'
|
||||||
= f.input :max_attendees, hint: 'The maximum number of participants. ' + message
|
- message = @event.room ? "Value must be between 1 and #{@event.room.size}" : 'Check room capacity after scheduling.'
|
||||||
|
= f.input :max_attendees, hint: 'The maximum number of participants. ' + message
|
||||||
|
|
||||||
- if current_user.has_any_role? :admin, { name: :organizer, resource: @conference }, { name: :cfp, resource: @conference }
|
- if current_user.has_any_role? :admin, { name: :organizer, resource: @conference }, { name: :cfp, resource: @conference }
|
||||||
= f.input :is_highlight
|
= f.input :is_highlight
|
||||||
|
|
|
||||||
|
|
@ -59,7 +59,8 @@
|
||||||
250
|
250
|
||||||
words.
|
words.
|
||||||
|
|
||||||
= f.input :require_registration, label: 'Require participants to register to your event'
|
- if @program.cfp.enable_registrations?
|
||||||
|
= f.input :require_registration, label: 'Require participants to register to your event'
|
||||||
|
|
||||||
%p.text-right
|
%p.text-right
|
||||||
= link_to '#description', 'data-toggle' => 'collapse', id: 'description_link' do
|
= link_to '#description', 'data-toggle' => 'collapse', id: 'description_link' do
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,5 @@
|
||||||
|
class AddAllowReservationsOnCfps < ActiveRecord::Migration[5.0]
|
||||||
|
def change
|
||||||
|
add_column 'cfps', 'enable_registrations', :boolean, default: false
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
@ -42,13 +42,14 @@ ActiveRecord::Schema.define(version: 20181113195810) do
|
||||||
end
|
end
|
||||||
|
|
||||||
create_table "cfps", force: :cascade do |t|
|
create_table "cfps", force: :cascade do |t|
|
||||||
t.date "start_date", null: false
|
t.date "start_date", null: false
|
||||||
t.date "end_date", null: false
|
t.date "end_date", null: false
|
||||||
t.datetime "created_at"
|
t.datetime "created_at"
|
||||||
t.datetime "updated_at"
|
t.datetime "updated_at"
|
||||||
t.integer "program_id"
|
t.integer "program_id"
|
||||||
t.string "cfp_type"
|
t.string "cfp_type"
|
||||||
t.text "description"
|
t.text "description"
|
||||||
|
t.boolean "enable_registrations", default: false
|
||||||
end
|
end
|
||||||
|
|
||||||
create_table "comments", force: :cascade do |t|
|
create_table "comments", force: :cascade do |t|
|
||||||
|
|
@ -434,6 +435,7 @@ ActiveRecord::Schema.define(version: 20181113195810) do
|
||||||
t.datetime "updated_at"
|
t.datetime "updated_at"
|
||||||
t.boolean "include_cfp", default: false
|
t.boolean "include_cfp", default: false
|
||||||
t.boolean "include_booths"
|
t.boolean "include_booths"
|
||||||
|
t.boolean "shuffle_highlights", default: false, null: false
|
||||||
end
|
end
|
||||||
|
|
||||||
create_table "sponsors", force: :cascade do |t|
|
create_table "sponsors", force: :cascade do |t|
|
||||||
|
|
|
||||||
|
|
@ -8,6 +8,7 @@ FactoryBot.define do
|
||||||
end_date { 2.days.from_now }
|
end_date { 2.days.from_now }
|
||||||
cfp_type { 'events' }
|
cfp_type { 'events' }
|
||||||
description { 'This is a test description' }
|
description { 'This is a test description' }
|
||||||
|
enable_registrations { true }
|
||||||
program
|
program
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -5,6 +5,7 @@ require 'spec_helper'
|
||||||
feature Commercial do
|
feature Commercial do
|
||||||
# It is necessary to use bang version of let to build roles before user
|
# It is necessary to use bang version of let to build roles before user
|
||||||
let!(:conference) { create(:conference) }
|
let!(:conference) { create(:conference) }
|
||||||
|
let!(:cfp) { create(:cfp, program: conference.program) }
|
||||||
let!(:organizer_role) { Role.find_by(name: 'organizer', resource: conference) }
|
let!(:organizer_role) { Role.find_by(name: 'organizer', resource: conference) }
|
||||||
let!(:organizer) { create(:user, role_ids: [organizer_role.id]) }
|
let!(:organizer) { create(:user, role_ids: [organizer_role.id]) }
|
||||||
let!(:participant) { create(:user) }
|
let!(:participant) { create(:user) }
|
||||||
|
|
|
||||||
|
|
@ -94,6 +94,7 @@ feature Event do
|
||||||
|
|
||||||
scenario 'update a proposal' do
|
scenario 'update a proposal' do
|
||||||
conference = create(:conference)
|
conference = create(:conference)
|
||||||
|
create(:cfp, program: conference.program)
|
||||||
proposal = create(:event, program: conference.program)
|
proposal = create(:event, program: conference.program)
|
||||||
|
|
||||||
sign_in proposal.submitter
|
sign_in proposal.submitter
|
||||||
|
|
|
||||||
|
|
@ -4,6 +4,7 @@ require 'spec_helper'
|
||||||
|
|
||||||
feature 'Version' do
|
feature 'Version' do
|
||||||
let!(:conference) { create(:conference) }
|
let!(:conference) { create(:conference) }
|
||||||
|
let!(:cfp) { create(:cfp, program: conference.program) }
|
||||||
let!(:organizer_role) { Role.find_by(name: 'organizer', resource: conference) }
|
let!(:organizer_role) { Role.find_by(name: 'organizer', resource: conference) }
|
||||||
let!(:organizer) { create(:user, role_ids: [organizer_role.id]) }
|
let!(:organizer) { create(:user, role_ids: [organizer_role.id]) }
|
||||||
let(:event_with_commercial) { create(:event, program: conference.program) }
|
let(:event_with_commercial) { create(:event, program: conference.program) }
|
||||||
|
|
@ -35,7 +36,6 @@ feature 'Version' do
|
||||||
end
|
end
|
||||||
|
|
||||||
scenario 'display changes in cfp', feature: true, versioning: true, js: true do
|
scenario 'display changes in cfp', feature: true, versioning: true, js: true do
|
||||||
cfp = create(:cfp, program: conference.program)
|
|
||||||
cfp.update_attributes(start_date: (Time.zone.today + 1).strftime('%d/%m/%Y'), end_date: (Time.zone.today + 3).strftime('%d/%m/%Y'))
|
cfp.update_attributes(start_date: (Time.zone.today + 1).strftime('%d/%m/%Y'), end_date: (Time.zone.today + 3).strftime('%d/%m/%Y'))
|
||||||
cfp_id = cfp.id
|
cfp_id = cfp.id
|
||||||
cfp.destroy
|
cfp.destroy
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue