mirror of
https://github.com/openSUSE/osem.git
synced 2026-08-13 11:44:02 +00:00
Add Call for Booths
This commit is contained in:
parent
4615505fcd
commit
b86472ac3c
8 changed files with 92 additions and 13 deletions
|
|
@ -180,6 +180,7 @@ linters:
|
|||
InstanceVariables:
|
||||
exclude:
|
||||
- "app/views/admin/campaigns/_form.html.haml"
|
||||
- "app/views/admin/cfps/_booths_cfp.html.haml"
|
||||
- "app/views/admin/cfps/_form.html.haml"
|
||||
- "app/views/admin/conferences/_todo_list.html.haml"
|
||||
- "app/views/admin/difficulty_levels/_form.html.haml"
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
# cannot delete program if there are events submitted
|
||||
|
||||
class Cfp < ActiveRecord::Base
|
||||
TYPES = %w(events).freeze
|
||||
TYPES = %w(events booths).freeze
|
||||
|
||||
scope :for_events, (-> { find_by(cfp_type: 'events') })
|
||||
|
||||
|
|
|
|||
12
app/views/admin/cfps/_booths_cfp.html.haml
Normal file
12
app/views/admin/cfps/_booths_cfp.html.haml
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
%dt
|
||||
Start Date
|
||||
%dd
|
||||
= @cfp.start_date.strftime('%A, %B %e. %Y')
|
||||
%dt
|
||||
End Date
|
||||
%dd
|
||||
= @cfp.end_date.strftime('%A, %B %e. %Y')
|
||||
%dt
|
||||
Days Left
|
||||
%dd
|
||||
= pluralize(@cfp.remaining_days, 'day')
|
||||
|
|
@ -3,7 +3,7 @@
|
|||
FactoryGirl.define do
|
||||
factory :cfp do
|
||||
start_date { 1.day.ago }
|
||||
end_date { 6.days.from_now }
|
||||
end_date { 2.days.from_now }
|
||||
cfp_type 'events'
|
||||
|
||||
program
|
||||
|
|
|
|||
|
|
@ -60,16 +60,32 @@ feature 'Has correct abilities' do
|
|||
visit edit_admin_conference_program_path(conference.short_title)
|
||||
expect(current_path).to eq(edit_admin_conference_program_path(conference.short_title))
|
||||
|
||||
# Only event type exists
|
||||
visit new_admin_conference_program_cfp_path(conference.short_title)
|
||||
expect(current_path).to eq(new_admin_conference_program_cfp_path(conference.short_title))
|
||||
|
||||
# Both event and booth exists
|
||||
cfb = create(:cfp, cfp_type: 'booths', program: conference.program)
|
||||
visit new_admin_conference_program_cfp_path(conference.short_title)
|
||||
expect(current_path).to eq root_path
|
||||
|
||||
visit edit_admin_conference_program_cfp_path(conference.short_title, conference.program.cfp)
|
||||
expect(current_path).to eq(edit_admin_conference_program_cfp_path(conference.short_title, conference.program.cfp))
|
||||
|
||||
conference.program.cfp.destroy!
|
||||
visit new_admin_conference_program_cfp_path(conference.short_title)
|
||||
expect(current_path).to eq new_admin_conference_program_cfp_path(conference.short_title)
|
||||
create(:cfp, program: conference.program)
|
||||
|
||||
visit edit_admin_conference_program_cfp_path(conference.short_title, conference.program.cfp)
|
||||
expect(current_path).to eq(edit_admin_conference_program_cfp_path(conference.short_title, conference.program.cfp))
|
||||
# Only booth exists
|
||||
visit new_admin_conference_program_cfp_path(conference.short_title)
|
||||
expect(current_path).to eq(new_admin_conference_program_cfp_path(conference.short_title))
|
||||
|
||||
visit edit_admin_conference_program_cfp_path(conference.short_title, cfb)
|
||||
expect(current_path). to eq(edit_admin_conference_program_cfp_path(conference.short_title, cfb))
|
||||
|
||||
cfb.destroy
|
||||
visit new_admin_conference_program_cfp_path(conference.short_title)
|
||||
expect(current_path).to eq(new_admin_conference_program_cfp_path(conference.short_title))
|
||||
|
||||
create(:event, program: conference.program)
|
||||
visit edit_admin_conference_program_event_path(conference.short_title, conference.program.events.first)
|
||||
|
|
|
|||
|
|
@ -102,16 +102,32 @@ feature 'Has correct abilities' do
|
|||
visit edit_admin_conference_program_path(conference.short_title)
|
||||
expect(current_path).to eq(edit_admin_conference_program_path(conference.short_title))
|
||||
|
||||
# Only event exists
|
||||
visit new_admin_conference_program_cfp_path(conference.short_title)
|
||||
expect(current_path).to eq(new_admin_conference_program_cfp_path(conference.short_title))
|
||||
|
||||
# Both event and booth exists
|
||||
cfb = create(:cfp, cfp_type: 'booths', program: conference.program)
|
||||
visit new_admin_conference_program_cfp_path(conference.short_title)
|
||||
expect(current_path).to eq root_path
|
||||
|
||||
visit edit_admin_conference_program_cfp_path(conference.short_title, conference.program.cfp)
|
||||
expect(current_path).to eq(edit_admin_conference_program_cfp_path(conference.short_title, conference.program.cfp))
|
||||
|
||||
conference.program.cfp.destroy!
|
||||
visit new_admin_conference_program_cfp_path(conference.short_title)
|
||||
expect(current_path).to eq new_admin_conference_program_cfp_path(conference.short_title)
|
||||
create(:cfp, program: conference.program)
|
||||
|
||||
visit edit_admin_conference_program_cfp_path(conference.short_title, conference.program.cfp)
|
||||
expect(current_path).to eq(edit_admin_conference_program_cfp_path(conference.short_title, conference.program.cfp))
|
||||
# Only booth exists
|
||||
visit new_admin_conference_program_cfp_path(conference.short_title)
|
||||
expect(current_path).to eq(new_admin_conference_program_cfp_path(conference.short_title))
|
||||
|
||||
visit edit_admin_conference_program_cfp_path(conference.short_title, cfb)
|
||||
expect(current_path). to eq(edit_admin_conference_program_cfp_path(conference.short_title, cfb))
|
||||
|
||||
cfb.destroy
|
||||
visit new_admin_conference_program_cfp_path(conference.short_title)
|
||||
expect(current_path).to eq(new_admin_conference_program_cfp_path(conference.short_title))
|
||||
|
||||
visit admin_conference_program_events_path(conference.short_title)
|
||||
expect(current_path).to eq(admin_conference_program_events_path(conference.short_title))
|
||||
|
|
|
|||
|
|
@ -108,16 +108,32 @@ feature 'Has correct abilities' do
|
|||
visit edit_admin_conference_program_path(conference.short_title)
|
||||
expect(current_path).to eq(edit_admin_conference_program_path(conference.short_title))
|
||||
|
||||
# Only event type exists
|
||||
visit new_admin_conference_program_cfp_path(conference.short_title)
|
||||
expect(current_path).to eq(new_admin_conference_program_cfp_path(conference.short_title))
|
||||
|
||||
# Both event and booth exists
|
||||
cfb = create(:cfp, cfp_type: 'booths', program: conference.program)
|
||||
visit new_admin_conference_program_cfp_path(conference.short_title)
|
||||
expect(current_path).to eq root_path
|
||||
|
||||
visit edit_admin_conference_program_cfp_path(conference.short_title, conference.program.cfp)
|
||||
expect(current_path).to eq(edit_admin_conference_program_cfp_path(conference.short_title, conference.program.cfp))
|
||||
|
||||
conference.program.cfp.destroy!
|
||||
visit new_admin_conference_program_cfp_path(conference.short_title)
|
||||
expect(current_path).to eq new_admin_conference_program_cfp_path(conference.short_title)
|
||||
create(:cfp, program: conference.program)
|
||||
|
||||
visit edit_admin_conference_program_cfp_path(conference.short_title, conference.program.cfp)
|
||||
expect(current_path).to eq(edit_admin_conference_program_cfp_path(conference.short_title, conference.program.cfp))
|
||||
# Only booth exists
|
||||
visit new_admin_conference_program_cfp_path(conference.short_title)
|
||||
expect(current_path).to eq(new_admin_conference_program_cfp_path(conference.short_title))
|
||||
|
||||
visit edit_admin_conference_program_cfp_path(conference.short_title, cfb)
|
||||
expect(current_path). to eq(edit_admin_conference_program_cfp_path(conference.short_title, cfb))
|
||||
|
||||
cfb.destroy
|
||||
visit new_admin_conference_program_cfp_path(conference.short_title)
|
||||
expect(current_path).to eq(new_admin_conference_program_cfp_path(conference.short_title))
|
||||
|
||||
visit admin_conference_program_events_path(conference.short_title)
|
||||
expect(current_path).to eq(admin_conference_program_events_path(conference.short_title))
|
||||
|
|
|
|||
|
|
@ -253,10 +253,28 @@ describe Program do
|
|||
end
|
||||
|
||||
describe '#remaining_cfp_types' do
|
||||
it 'returns an array with the types for which a cfp doesn\'t exist' do
|
||||
it 'returns an array with the types for which a cfp doesn\'t exist, when only the Event type does' do
|
||||
expect(program.remaining_cfp_types).to eq(Cfp::TYPES)
|
||||
create(:cfp, cfp_type: 'events', program: program, end_date: Date.current + 1)
|
||||
create(:cfp, cfp_type: 'events', program: program)
|
||||
expect(program.remaining_cfp_types).to eq(['booths'])
|
||||
end
|
||||
|
||||
it 'returns an array with the types for which a cfp doesn\'t exist, when only the Booth type does' do
|
||||
expect(program.remaining_cfp_types).to eq(Cfp::TYPES)
|
||||
create(:cfp, cfp_type: 'booths', program: program)
|
||||
expect(program.remaining_cfp_types).to eq(['events'])
|
||||
end
|
||||
|
||||
it 'returns an empty array when all the cfp types exist' do
|
||||
expect(program.remaining_cfp_types).to eq(Cfp::TYPES)
|
||||
create(:cfp, cfp_type: 'events', program: program)
|
||||
create(:cfp, cfp_type: 'booths', program: program)
|
||||
expect(program.remaining_cfp_types).to eq([])
|
||||
end
|
||||
|
||||
it 'returns all the possible cfp types when there is no existed cfp type' do
|
||||
expect(program.remaining_cfp_types).to eq(Cfp::TYPES)
|
||||
expect(program.remaining_cfp_types). to eq(%w[events booths])
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue