Select Call type when creating; don't switch types.
This commit is contained in:
parent
e518431b8e
commit
75bf1380ba
4 changed files with 22 additions and 14 deletions
|
|
@ -11,7 +11,7 @@ module Admin
|
||||||
def show; end
|
def show; end
|
||||||
|
|
||||||
def new
|
def new
|
||||||
@cfp = @program.cfps.new
|
@cfp = @program.cfps.new(cfp_params_or_first_remaining_type)
|
||||||
end
|
end
|
||||||
|
|
||||||
def edit; end
|
def edit; end
|
||||||
|
|
@ -59,5 +59,11 @@ module Admin
|
||||||
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)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def cfp_params_or_first_remaining_type
|
||||||
|
cfp_params
|
||||||
|
rescue ActionController::ParameterMissing
|
||||||
|
{ 'cfp_type' => @program.remaining_cfp_types.first }
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -9,11 +9,5 @@ module Admin
|
||||||
admin_conference_program_cfp_path(conference, cfp)
|
admin_conference_program_cfp_path(conference, cfp)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def select_cfp_types(cfp, program)
|
|
||||||
cfp_types = program.remaining_cfp_types
|
|
||||||
cfp_types.unshift(cfp.cfp_type) unless cfp.new_record?
|
|
||||||
cfp_types.map { |cfp_type| ["#{cfp_type.capitalize}", cfp_type] }
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -1,11 +1,14 @@
|
||||||
.row
|
.row
|
||||||
.col-md-12
|
.col-md-12
|
||||||
.page-header
|
.page-header
|
||||||
%h1 Call for Papers
|
%h1
|
||||||
|
Call for
|
||||||
|
= cfp.cfp_type.capitalize
|
||||||
.row
|
.row
|
||||||
.col-md-8
|
.col-md-8
|
||||||
= semantic_form_for(cfp, url: cfp_form_url(cfp, conference),
|
= semantic_form_for(cfp, url: cfp_form_url(cfp, conference),
|
||||||
html: { multipart: true }) do |f|
|
html: { multipart: true }) do |f|
|
||||||
|
= f.input :cfp_type, as: :hidden
|
||||||
= f.input :start_date, as: :string,
|
= f.input :start_date, as: :string,
|
||||||
input_html: { id: 'registration-period-start-datepicker',
|
input_html: { id: 'registration-period-start-datepicker',
|
||||||
start_date: conference.start_date,
|
start_date: conference.start_date,
|
||||||
|
|
@ -13,9 +16,6 @@
|
||||||
= f.input :end_date, as: :string,
|
= f.input :end_date, as: :string,
|
||||||
input_html: { id: 'registration-period-end-datepicker',
|
input_html: { id: 'registration-period-end-datepicker',
|
||||||
readonly: 'readonly' }
|
readonly: 'readonly' }
|
||||||
= f.input :cfp_type, as: :select, include_blank: false,
|
|
||||||
collection: select_cfp_types(cfp, conference.program),
|
|
||||||
label: 'Type', input_html: { class: 'select-help-toggle' }
|
|
||||||
= 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' } }
|
||||||
%p.text-right
|
%p.text-right
|
||||||
|
|
|
||||||
|
|
@ -43,6 +43,14 @@
|
||||||
- if can? :new, @program.cfps.new
|
- if can? :new, @program.cfps.new
|
||||||
.row
|
.row
|
||||||
.col-md-12.text-right
|
.col-md-12.text-right
|
||||||
= link_to 'Create Call for Papers',
|
.btn-group
|
||||||
new_admin_conference_program_cfp_path(@conference),
|
%button.btn.btn-primary.dropdown-toggle{ type: 'button',
|
||||||
class: 'btn btn-primary'
|
data: { toggle: 'dropdown' } }
|
||||||
|
Add Call for...
|
||||||
|
%span.caret
|
||||||
|
%ul.dropdown-menu
|
||||||
|
- @program.remaining_cfp_types.each do |cfp_type|
|
||||||
|
%li
|
||||||
|
= link_to cfp_type.capitalize,
|
||||||
|
new_admin_conference_program_cfp_path(@conference,
|
||||||
|
cfp: { cfp_type: cfp_type })
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue