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/_events_cfp.html.haml"
- "app/views/admin/cfps/_form.html.haml" - "app/views/admin/cfps/_form.html.haml"
- "app/views/admin/cfps/_tracks_cfp.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/index.html.haml"
- "app/views/admin/cfps/new.haml"
- "app/views/admin/cfps/show.html.haml" - "app/views/admin/cfps/show.html.haml"
- "app/views/admin/comments/_all_comments.html.haml" - "app/views/admin/comments/_all_comments.html.haml"
- "app/views/admin/comments/_posted_comments.html.haml" - "app/views/admin/comments/_posted_comments.html.haml"
@ -262,10 +264,6 @@ linters:
InstanceVariables: InstanceVariables:
exclude: exclude:
- "app/views/admin/booths/_change_state_dropdown.html.haml" - "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/conferences/_todo_list.html.haml"
- "app/views/admin/difficulty_levels/_form.html.haml" - "app/views/admin/difficulty_levels/_form.html.haml"
- "app/views/admin/event_types/_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/_change_state_dropdown.html.haml"
- "app/views/admin/booths/index.html.haml" - "app/views/admin/booths/index.html.haml"
- "app/views/admin/booths/show.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/_all_comments.html.haml"
- "app/views/admin/comments/_posted_comments.html.haml" - "app/views/admin/comments/_posted_comments.html.haml"
- "app/views/admin/comments/_unread_comments.html.haml" - "app/views/admin/comments/_unread_comments.html.haml"
@ -483,8 +478,6 @@ linters:
# Offense count: 34 # Offense count: 34
IdNames: IdNames:
exclude: 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/comments/index.html.haml"
- "app/views/admin/conferences/index.html.haml" - "app/views/admin/conferences/index.html.haml"
- "app/views/admin/conferences/show.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 %dt
Type: Type:
%dd %dd
= @cfp.cfp_type.capitalize = cfp.cfp_type.capitalize
%dt %dt
Start Date: Start Date:
%dd %dd
= @cfp.start_date.strftime('%A, %B %e. %Y') = cfp.start_date.strftime('%A, %B %e. %Y')
%dt %dt
End Date: End Date:
%dd %dd
= @cfp.end_date.strftime('%A, %B %e. %Y') = cfp.end_date.strftime('%A, %B %e. %Y')
%dt %dt
Description Description
%dd %dd
= markdown(@cfp.description) = markdown(cfp.description)
%dt %dt
Days Left Days Left
%dd %dd
= pluralize(@cfp.remaining_days, 'day') = pluralize(cfp.remaining_days, 'day')

View file

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

View file

@ -4,10 +4,20 @@
%h1 Call for Papers %h1 Call for Papers
.row .row
.col-md-8 .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| = semantic_form_for(cfp, url: cfp_form_url(cfp, conference),
= 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' } html: { multipart: true }) do |f|
= f.input :end_date, as: :string, input_html: { id: 'registration-period-end-datepicker', readonly: 'readonly' } = f.input :start_date, as: :string,
= 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' } input_html: { id: 'registration-period-start-datepicker',
= f.input :description, input_html: {rows: 2, data: { provide: 'markdown-editable' } }, hint: markdown_hint 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 %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 %dt
Type: Type:
%dd %dd
= @cfp.cfp_type.capitalize = cfp.cfp_type.capitalize
%dt %dt
Start Date: Start Date:
%dd#start_date %dd#start-date
= @cfp.start_date.strftime('%A, %B %-d. %Y') = cfp.start_date.strftime('%A, %B %-d. %Y')
%dt %dt
End Date: End Date:
%dd#end_date %dd#end-date
= @cfp.end_date.strftime('%A, %B %-d. %Y') = cfp.end_date.strftime('%A, %B %-d. %Y')
%dt %dt
Description: Description:
%dd#description %dd#description
= markdown(@cfp.description) = markdown(cfp.description)
%dt %dt
Days Left: Days Left:
%dd %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| - @program.cfps.each do |cfp|
%tr %tr
%td %td
= link_to(admin_conference_program_cfp_path(@conference.short_title, cfp.id)) do = link_to cfp.cfp_type.capitalize,
= cfp.cfp_type.capitalize admin_conference_program_cfp_path(@conference, cfp)
%td %td
= cfp.start_date.strftime('%A, %B %-d. %Y') = cfp.start_date.strftime('%A, %B %-d. %Y')
%td %td
@ -32,9 +32,16 @@
= pluralize(cfp.remaining_days, 'day') = pluralize(cfp.remaining_days, 'day')
%td %td
.btn-group .btn-group
= link_to 'Edit', edit_admin_conference_program_cfp_path(@conference.short_title, cfp.id), method: :get, class: 'btn btn-primary' = link_to 'Edit',
= 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?' } 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 - if can? :new, @program.cfps.new
.row .row
.col-md-12.text-right .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 .row
.col-md-8 .col-md-8
%dl.dl-horizontal %dl.dl-horizontal
= render "#{@cfp.cfp_type}_cfp" = render "#{@cfp.cfp_type}_cfp", cfp: @cfp, conference: @conference
.row .row
.col-md-12.text-right .col-md-12.text-right
= link_to(edit_admin_conference_program_cfp_path(@conference.short_title, @cfp.id), class: 'btn btn-primary') do = link_to 'Edit',
Edit edit_admin_conference_program_cfp_path(@conference, @cfp),
= 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 class: 'btn btn-primary'
Delete = 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.') .to eq('Call for papers successfully created.')
visit admin_conference_program_cfp_path(conference.short_title, conference.program.cfp) 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('#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('#end-date').text).to eq((today + 6).strftime('%A, %B %-d. %Y'))
expect(Cfp.count).to eq(expected_count) expect(Cfp.count).to eq(expected_count)
end end
@ -74,8 +74,8 @@ feature Conference do
.to eq('Call for papers successfully updated.') .to eq('Call for papers successfully updated.')
visit admin_conference_program_cfp_path(conference.short_title, conference.program.cfp) 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('#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('#end-date').text).to eq((today + 14).strftime('%A, %B %-d. %Y'))
expect(Cfp.count).to eq(expected_count) expect(Cfp.count).to eq(expected_count)
end end
end end