mirror of
https://github.com/openSUSE/osem.git
synced 2026-08-16 21:24:05 +00:00
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 new
|
||||
@cfp = @program.cfps.new
|
||||
@cfp = @program.cfps.new(cfp_params_or_first_remaining_type)
|
||||
end
|
||||
|
||||
def edit; end
|
||||
|
|
@ -59,5 +59,11 @@ module Admin
|
|||
def cfp_params
|
||||
params.require(:cfp).permit(:start_date, :end_date, :description, :cfp_type)
|
||||
end
|
||||
|
||||
def cfp_params_or_first_remaining_type
|
||||
cfp_params
|
||||
rescue ActionController::ParameterMissing
|
||||
{ 'cfp_type' => @program.remaining_cfp_types.first }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -9,11 +9,5 @@ module Admin
|
|||
admin_conference_program_cfp_path(conference, cfp)
|
||||
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
|
||||
|
|
|
|||
|
|
@ -1,11 +1,14 @@
|
|||
.row
|
||||
.col-md-12
|
||||
.page-header
|
||||
%h1 Call for Papers
|
||||
%h1
|
||||
Call for
|
||||
= cfp.cfp_type.capitalize
|
||||
.row
|
||||
.col-md-8
|
||||
= semantic_form_for(cfp, url: cfp_form_url(cfp, conference),
|
||||
html: { multipart: true }) do |f|
|
||||
= f.input :cfp_type, as: :hidden
|
||||
= f.input :start_date, as: :string,
|
||||
input_html: { id: 'registration-period-start-datepicker',
|
||||
start_date: conference.start_date,
|
||||
|
|
@ -13,9 +16,6 @@
|
|||
= f.input :end_date, as: :string,
|
||||
input_html: { id: 'registration-period-end-datepicker',
|
||||
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,
|
||||
input_html: { rows: 2, data: { provide: 'markdown-editable' } }
|
||||
%p.text-right
|
||||
|
|
|
|||
|
|
@ -43,6 +43,14 @@
|
|||
- if can? :new, @program.cfps.new
|
||||
.row
|
||||
.col-md-12.text-right
|
||||
= link_to 'Create Call for Papers',
|
||||
new_admin_conference_program_cfp_path(@conference),
|
||||
class: 'btn btn-primary'
|
||||
.btn-group
|
||||
%button.btn.btn-primary.dropdown-toggle{ type: 'button',
|
||||
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