Unlint CfP views #BetterPlace

This commit is contained in:
James Mason 2018-10-17 16:44:08 -07:00
parent 195d7e08ac
commit 21c5b842b1
11 changed files with 89 additions and 55 deletions

View file

@ -23,7 +23,9 @@ linters:
- "app/views/admin/cfps/_events_cfp.html.haml"
- "app/views/admin/cfps/_form.html.haml"
- "app/views/admin/cfps/_tracks_cfp.html.haml"
- "app/views/admin/cfps/edit.haml"
- "app/views/admin/cfps/index.html.haml"
- "app/views/admin/cfps/new.haml"
- "app/views/admin/cfps/show.html.haml"
- "app/views/admin/comments/_all_comments.html.haml"
- "app/views/admin/comments/_posted_comments.html.haml"
@ -262,10 +264,6 @@ linters:
InstanceVariables:
exclude:
- "app/views/admin/booths/_change_state_dropdown.html.haml"
- "app/views/admin/cfps/_booths_cfp.html.haml"
- "app/views/admin/cfps/_events_cfp.html.haml"
- "app/views/admin/cfps/_form.html.haml"
- "app/views/admin/cfps/_tracks_cfp.html.haml"
- "app/views/admin/conferences/_todo_list.html.haml"
- "app/views/admin/difficulty_levels/_form.html.haml"
- "app/views/admin/event_types/_form.html.haml"
@ -319,9 +317,6 @@ linters:
- "app/views/admin/booths/_change_state_dropdown.html.haml"
- "app/views/admin/booths/index.html.haml"
- "app/views/admin/booths/show.html.haml"
- "app/views/admin/cfps/_form.html.haml"
- "app/views/admin/cfps/index.html.haml"
- "app/views/admin/cfps/show.html.haml"
- "app/views/admin/comments/_all_comments.html.haml"
- "app/views/admin/comments/_posted_comments.html.haml"
- "app/views/admin/comments/_unread_comments.html.haml"
@ -483,8 +478,6 @@ linters:
# Offense count: 34
IdNames:
exclude:
- "app/views/admin/cfps/_events_cfp.html.haml"
- "app/views/admin/cfps/_tracks_cfp.html.haml"
- "app/views/admin/comments/index.html.haml"
- "app/views/admin/conferences/index.html.haml"
- "app/views/admin/conferences/show.html.haml"

View file

@ -0,0 +1,19 @@
# frozen_string_literal: true
module Admin
module CfpsHelper
def cfp_form_url(cfp, conference)
if cfp.new_record?
admin_conference_program_cfps_path
else
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

View file

@ -1,20 +1,20 @@
%dt
Type:
%dd
= @cfp.cfp_type.capitalize
= cfp.cfp_type.capitalize
%dt
Start Date:
%dd
= @cfp.start_date.strftime('%A, %B %e. %Y')
= cfp.start_date.strftime('%A, %B %e. %Y')
%dt
End Date:
%dd
= @cfp.end_date.strftime('%A, %B %e. %Y')
= cfp.end_date.strftime('%A, %B %e. %Y')
%dt
Description
%dd
= markdown(@cfp.description)
= markdown(cfp.description)
%dt
Days Left
%dd
= pluralize(@cfp.remaining_days, 'day')
= pluralize(cfp.remaining_days, 'day')

View file

@ -1,46 +1,46 @@
%dt
Type:
%dd
= @cfp.cfp_type.capitalize
= cfp.cfp_type.capitalize
%dt
Start Date:
%dd#start_date
= @cfp.start_date.strftime('%A, %B %-d. %Y')
%dd#start-date
= cfp.start_date.strftime('%A, %B %-d. %Y')
%dt
End Date:
%dd#end_date
= @cfp.end_date.strftime('%A, %B %-d. %Y')
%dd#end-date
= cfp.end_date.strftime('%A, %B %-d. %Y')
%dt
Description:
%dd#description
= markdown(@cfp.description)
= markdown(cfp.description)
%dt
Days Left:
%dd
= pluralize(@cfp.remaining_days, 'day')
= pluralize(cfp.remaining_days, 'day')
%dt
Event types:
%dd
= event_types_sentence(@conference)
= event_types_sentence(conference)
%dt
Tracks:
%dd
= tracks(@conference)
= tracks(conference)
%dt
Public Schedule:
%dd#schedule_public
- if @program.schedule_public
%dd#schedule-public
- if conference.program.schedule_public
Yes
- else
No
%dt
Schedule changeable?
%dd#schedule_changes
- if @program.schedule_fluid
%dd#schedule-changes
- if conference.program.schedule_fluid
Yes
- else
No
%dt
Rating Levels:
%dd#rating
= @program.rating
= conference.program.rating

View file

@ -4,10 +4,20 @@
%h1 Call for Papers
.row
.col-md-8
= semantic_form_for(@cfp, url: (@cfp.new_record? ? admin_conference_program_cfps_path : admin_conference_program_cfp_path(@conference.short_title, @cfp)), html: {multipart: true}) do |f|
= f.input :start_date, as: :string, input_html: { id: 'registration-period-start-datepicker', start_date: @conference.start_date, end_date: @conference.end_date, readonly: 'readonly' }
= f.input :end_date, as: :string, input_html: { id: 'registration-period-end-datepicker', readonly: 'readonly' }
= f.input :cfp_type, as: :select, collection: (@cfp.new_record? ? @program.remaining_cfp_types : [@cfp.cfp_type] + @program.remaining_cfp_types).map {|type| ["#{type.capitalize}", type]}, include_blank: false, label: 'Type', input_html: { class: 'select-help-toggle' }
= f.input :description, input_html: {rows: 2, data: { provide: 'markdown-editable' } }, hint: markdown_hint
= semantic_form_for(cfp, url: cfp_form_url(cfp, conference),
html: { multipart: true }) do |f|
= f.input :start_date, as: :string,
input_html: { id: 'registration-period-start-datepicker',
start_date: conference.start_date,
end_date: conference.end_date, readonly: 'readonly' }
= 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
= f.action :submit, as: :button, button_html: { class: 'btn btn-primary' }
= f.action :submit, as: :button,
button_html: { class: 'btn btn-primary' }

View file

@ -1,20 +1,20 @@
%dt
Type:
%dd
= @cfp.cfp_type.capitalize
= cfp.cfp_type.capitalize
%dt
Start Date:
%dd#start_date
= @cfp.start_date.strftime('%A, %B %-d. %Y')
%dd#start-date
= cfp.start_date.strftime('%A, %B %-d. %Y')
%dt
End Date:
%dd#end_date
= @cfp.end_date.strftime('%A, %B %-d. %Y')
%dd#end-date
= cfp.end_date.strftime('%A, %B %-d. %Y')
%dt
Description:
%dd#description
= markdown(@cfp.description)
= markdown(cfp.description)
%dt
Days Left:
%dd
= pluralize(@cfp.remaining_days, 'day')
= pluralize(cfp.remaining_days, 'day')

View file

@ -0,0 +1 @@
= render 'form', cfp: @cfp, conference: @conference

View file

@ -19,8 +19,8 @@
- @program.cfps.each do |cfp|
%tr
%td
= link_to(admin_conference_program_cfp_path(@conference.short_title, cfp.id)) do
= cfp.cfp_type.capitalize
= link_to cfp.cfp_type.capitalize,
admin_conference_program_cfp_path(@conference, cfp)
%td
= cfp.start_date.strftime('%A, %B %-d. %Y')
%td
@ -32,9 +32,16 @@
= pluralize(cfp.remaining_days, 'day')
%td
.btn-group
= link_to 'Edit', edit_admin_conference_program_cfp_path(@conference.short_title, cfp.id), method: :get, class: 'btn btn-primary'
= link_to 'Delete', admin_conference_program_cfp_path(@conference.short_title, cfp.id), method: 'delete', class: 'btn btn-danger', data: { confirm: 'Are you sure you want to delete the CfP?' }
= link_to 'Edit',
edit_admin_conference_program_cfp_path(@conference, cfp),
method: :get, class: 'btn btn-primary'
= link_to 'Delete',
admin_conference_program_cfp_path(@conference, cfp),
method: 'delete', class: 'btn btn-danger',
data: { confirm: 'Are you sure?' }
- 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.short_title), class: 'btn btn-primary'
= link_to 'Create Call for Papers',
new_admin_conference_program_cfp_path(@conference),
class: 'btn btn-primary'

View file

@ -0,0 +1 @@
= render 'form', cfp: @cfp, conference: @conference

View file

@ -7,10 +7,13 @@
.row
.col-md-8
%dl.dl-horizontal
= render "#{@cfp.cfp_type}_cfp"
= render "#{@cfp.cfp_type}_cfp", cfp: @cfp, conference: @conference
.row
.col-md-12.text-right
= link_to(edit_admin_conference_program_cfp_path(@conference.short_title, @cfp.id), class: 'btn btn-primary') do
Edit
= link_to(admin_conference_program_cfp_path(@conference.short_title, @cfp.id), method: 'delete', class: 'btn btn-danger', data: { confirm: 'Are you sure you want to delete the CfP?' }) do
Delete
= link_to 'Edit',
edit_admin_conference_program_cfp_path(@conference, @cfp),
class: 'btn btn-primary'
= link_to 'Delete',
admin_conference_program_cfp_path(@conference, @cfp),
method: 'delete', class: 'btn btn-danger',
data: { confirm: 'Are you sure you want to delete the CfP?' }

View file

@ -36,8 +36,8 @@ feature Conference do
.to eq('Call for papers successfully created.')
visit admin_conference_program_cfp_path(conference.short_title, conference.program.cfp)
expect(find('#start_date').text).to eq(today.strftime('%A, %B %-d. %Y'))
expect(find('#end_date').text).to eq((today + 6).strftime('%A, %B %-d. %Y'))
expect(find('#start-date').text).to eq(today.strftime('%A, %B %-d. %Y'))
expect(find('#end-date').text).to eq((today + 6).strftime('%A, %B %-d. %Y'))
expect(Cfp.count).to eq(expected_count)
end
@ -74,8 +74,8 @@ feature Conference do
.to eq('Call for papers successfully updated.')
visit admin_conference_program_cfp_path(conference.short_title, conference.program.cfp)
expect(find('#start_date').text).to eq(today.strftime('%A, %B %-d. %Y'))
expect(find('#end_date').text).to eq((today + 14).strftime('%A, %B %-d. %Y'))
expect(find('#start-date').text).to eq(today.strftime('%A, %B %-d. %Y'))
expect(find('#end-date').text).to eq((today + 14).strftime('%A, %B %-d. %Y'))
expect(Cfp.count).to eq(expected_count)
end
end