From d40ab944c2325579f8e33bb810ce3f7bff827e31 Mon Sep 17 00:00:00 2001 From: Michael Ball Date: Tue, 2 Mar 2021 20:46:14 -0800 Subject: [PATCH 1/9] Render conference md without escaping description html --- app/views/conferences/_conference_details.html.haml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/conferences/_conference_details.html.haml b/app/views/conferences/_conference_details.html.haml index 02e54c29..d6512c78 100644 --- a/app/views/conferences/_conference_details.html.haml +++ b/app/views/conferences/_conference_details.html.haml @@ -15,7 +15,7 @@ = "#{conference.venue.city}/#{conference.venue.country_name}" - unless conference.description.blank? %p - = markdown(conference.description) + = markdown(conference.description, escape_html=false) .col-md-2 .btn-group-vertical - if !@conference || @conference != conference From d067221f570a563bd43b1c2e2e48607f8ebd947e Mon Sep 17 00:00:00 2001 From: Michael Ball Date: Tue, 2 Mar 2021 20:46:35 -0800 Subject: [PATCH 2/9] Show all conferences by default on Conferences#index --- app/views/conferences/index.html.haml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/app/views/conferences/index.html.haml b/app/views/conferences/index.html.haml index 5382989c..fbcb426e 100644 --- a/app/views/conferences/index.html.haml +++ b/app/views/conferences/index.html.haml @@ -10,12 +10,12 @@ .col-md-12 %p.text-right %button{ type: 'button', class: 'btn btn-link btn-sm', 'data-toggle' => 'collapse', 'data-target' => '#antiquated', 'aria-expanded' => 'true', 'aria-controls' => 'antiquated'} - Older conferences + Past Conferences %span.notranslate = "(#{@antiquated.count})" - %i.fa.fa-chevron-right - %i.fa.fa-chevron-down{ style: 'display: none' } - #antiquated.collapse + %i.fa.fa-chevron-right{ style: 'display: none' } + %i.fa.fa-chevron-down + #antiquated - @antiquated.each do |conference| = render '/conferences/conference_details', conference: conference - if @antiquated.empty? && @current.empty? && User.empty? From 3d99661d027c4445e8df4f66429e408618a8337d Mon Sep 17 00:00:00 2001 From: Michael Ball Date: Sat, 6 Mar 2021 11:30:57 -0800 Subject: [PATCH 3/9] Add a submission instructions columns --- app/models/cfp.rb | 1 - app/models/event.rb | 1 + app/models/event_type.rb | 1 + app/models/program.rb | 1 - app/serializers/event_serializer.rb | 1 + ...0306185903_add_submission_instructions_to_event_types.rb | 5 +++++ db/schema.rb | 6 +++++- spec/factories/event_types.rb | 1 + spec/factories/events.rb | 1 + spec/features/event_types_spec.rb | 1 + spec/models/event_spec.rb | 1 + spec/models/event_type_spec.rb | 1 + spec/serializers/event_serializer_spec.rb | 1 + 13 files changed, 19 insertions(+), 3 deletions(-) create mode 100644 db/migrate/20210306185903_add_submission_instructions_to_event_types.rb diff --git a/app/models/cfp.rb b/app/models/cfp.rb index 55e542f7..f5161aac 100644 --- a/app/models/cfp.rb +++ b/app/models/cfp.rb @@ -14,7 +14,6 @@ # updated_at :datetime # program_id :integer # -# cannot delete program if there are events submitted class Cfp < ApplicationRecord TYPES = %w(events booths tracks).freeze diff --git a/app/models/event.rb b/app/models/event.rb index ba04ba20..d10ae1a1 100644 --- a/app/models/event.rb +++ b/app/models/event.rb @@ -7,6 +7,7 @@ # id :bigint not null, primary key # abstract :text # comments_count :integer default(0), not null +# committee_review :text # description :text # guid :string not null # is_highlight :boolean default(FALSE) diff --git a/app/models/event_type.rb b/app/models/event_type.rb index 67d7fb20..2ef440bc 100644 --- a/app/models/event_type.rb +++ b/app/models/event_type.rb @@ -10,6 +10,7 @@ # length :integer default(30) # maximum_abstract_length :integer default(500) # minimum_abstract_length :integer default(0) +# submission_instructions :text # title :string not null # created_at :datetime # updated_at :datetime diff --git a/app/models/program.rb b/app/models/program.rb index 45b8f65c..19000746 100644 --- a/app/models/program.rb +++ b/app/models/program.rb @@ -22,7 +22,6 @@ # # index_programs_on_selected_schedule_id (selected_schedule_id) # -# cannot delete program if there are events submitted class Program < ApplicationRecord has_paper_trail on: [:update], ignore: [:updated_at], meta: { conference_id: :conference_id } diff --git a/app/serializers/event_serializer.rb b/app/serializers/event_serializer.rb index 8c30b1a1..9bf196f2 100644 --- a/app/serializers/event_serializer.rb +++ b/app/serializers/event_serializer.rb @@ -7,6 +7,7 @@ # id :bigint not null, primary key # abstract :text # comments_count :integer default(0), not null +# committee_review :text # description :text # guid :string not null # is_highlight :boolean default(FALSE) diff --git a/db/migrate/20210306185903_add_submission_instructions_to_event_types.rb b/db/migrate/20210306185903_add_submission_instructions_to_event_types.rb new file mode 100644 index 00000000..f38243d1 --- /dev/null +++ b/db/migrate/20210306185903_add_submission_instructions_to_event_types.rb @@ -0,0 +1,5 @@ +class AddSubmissionInstructionsToEventTypes < ActiveRecord::Migration[5.2] + def change + add_column :event_types, :submission_instructions, :text + end +end diff --git a/db/schema.rb b/db/schema.rb index dee892f6..633160d4 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -10,7 +10,10 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema.define(version: 2021_02_15_213515) do +ActiveRecord::Schema.define(version: 2021_03_06_185903) do + + # These are extensions that must be enabled in order to support this database + enable_extension "plpgsql" create_table "answers", force: :cascade do |t| t.string "title" @@ -219,6 +222,7 @@ ActiveRecord::Schema.define(version: 2021_02_15_213515) do t.integer "program_id" t.datetime "created_at" t.datetime "updated_at" + t.text "submission_instructions" end create_table "event_users", force: :cascade do |t| diff --git a/spec/factories/event_types.rb b/spec/factories/event_types.rb index c68d3fae..2d56afed 100644 --- a/spec/factories/event_types.rb +++ b/spec/factories/event_types.rb @@ -10,6 +10,7 @@ # length :integer default(30) # maximum_abstract_length :integer default(500) # minimum_abstract_length :integer default(0) +# submission_instructions :text # title :string not null # created_at :datetime # updated_at :datetime diff --git a/spec/factories/events.rb b/spec/factories/events.rb index c8360449..2f68c311 100644 --- a/spec/factories/events.rb +++ b/spec/factories/events.rb @@ -7,6 +7,7 @@ # id :bigint not null, primary key # abstract :text # comments_count :integer default(0), not null +# committee_review :text # description :text # guid :string not null # is_highlight :boolean default(FALSE) diff --git a/spec/features/event_types_spec.rb b/spec/features/event_types_spec.rb index 8e05784a..b2dad18e 100644 --- a/spec/features/event_types_spec.rb +++ b/spec/features/event_types_spec.rb @@ -22,6 +22,7 @@ feature EventType do fill_in 'event_type_title', with: 'Party' fill_in 'event_type_length', with: '240' + fill_in 'event_type_description', with: '### This is a description' fill_in 'event_type_minimum_abstract_length', with: '0' fill_in 'event_type_maximum_abstract_length', with: '13042' page.find('#event_type_color').set('#e4e4e4') diff --git a/spec/models/event_spec.rb b/spec/models/event_spec.rb index 14e0b044..e2c6f584 100644 --- a/spec/models/event_spec.rb +++ b/spec/models/event_spec.rb @@ -7,6 +7,7 @@ # id :bigint not null, primary key # abstract :text # comments_count :integer default(0), not null +# committee_review :text # description :text # guid :string not null # is_highlight :boolean default(FALSE) diff --git a/spec/models/event_type_spec.rb b/spec/models/event_type_spec.rb index 2cfc57be..a9d064c8 100644 --- a/spec/models/event_type_spec.rb +++ b/spec/models/event_type_spec.rb @@ -10,6 +10,7 @@ # length :integer default(30) # maximum_abstract_length :integer default(500) # minimum_abstract_length :integer default(0) +# submission_instructions :text # title :string not null # created_at :datetime # updated_at :datetime diff --git a/spec/serializers/event_serializer_spec.rb b/spec/serializers/event_serializer_spec.rb index 506134cf..3ad68cad 100644 --- a/spec/serializers/event_serializer_spec.rb +++ b/spec/serializers/event_serializer_spec.rb @@ -7,6 +7,7 @@ # id :bigint not null, primary key # abstract :text # comments_count :integer default(0), not null +# committee_review :text # description :text # guid :string not null # is_highlight :boolean default(FALSE) From bc4177154ad8f72df1ae974d2ac61382b3e2a616 Mon Sep 17 00:00:00 2001 From: Michael Ball Date: Sat, 6 Mar 2021 12:45:00 -0800 Subject: [PATCH 4/9] Add editing submission instructions --- app/controllers/admin/event_types_controller.rb | 2 +- app/views/admin/event_types/_form.html.haml | 1 + app/views/admin/event_types/index.html.haml | 3 +++ spec/features/event_types_spec.rb | 6 +++++- 4 files changed, 10 insertions(+), 2 deletions(-) diff --git a/app/controllers/admin/event_types_controller.rb b/app/controllers/admin/event_types_controller.rb index 137e8f00..e7f19863 100644 --- a/app/controllers/admin/event_types_controller.rb +++ b/app/controllers/admin/event_types_controller.rb @@ -49,7 +49,7 @@ module Admin private def event_type_params - params.require(:event_type).permit(:title, :length, :minimum_abstract_length, :maximum_abstract_length, :color, :conference_id, :description) + params.require(:event_type).permit(:title, :length, :minimum_abstract_length, :maximum_abstract_length, :submission_instructions, :color, :conference_id, :description) end end end diff --git a/app/views/admin/event_types/_form.html.haml b/app/views/admin/event_types/_form.html.haml index 91533877..526e9381 100644 --- a/app/views/admin/event_types/_form.html.haml +++ b/app/views/admin/event_types/_form.html.haml @@ -15,6 +15,7 @@ = f.input :description, as: :text, hint: markdown_hint, input_html: { rows: 5, data: { provide: 'markdown-editable' } } = f.input :minimum_abstract_length, input_html: {size: 3} = f.input :maximum_abstract_length, input_html: {size: 3} + = f.input :submission_instructions, as: :text, hint: markdown_hint, input_html: { rows: 5, data: { provide: 'markdown-editable' } } = f.input :color, input_html: { size: 6, type: 'color' } %p.text-right = f.action :submit, as: :button, button_html: { class: 'btn btn-primary' } diff --git a/app/views/admin/event_types/index.html.haml b/app/views/admin/event_types/index.html.haml index e18cceeb..015a3397 100644 --- a/app/views/admin/event_types/index.html.haml +++ b/app/views/admin/event_types/index.html.haml @@ -10,6 +10,7 @@ %thead %th Title %th Description + %th Instructions %th Length %th Abstract Length %th Color @@ -21,6 +22,8 @@ = event_type.title %td = markdown(event_type.description) + %td + = markdown(event_type.submission_instructions) %td = event_type.length Minutes diff --git a/spec/features/event_types_spec.rb b/spec/features/event_types_spec.rb index b2dad18e..593875dc 100644 --- a/spec/features/event_types_spec.rb +++ b/spec/features/event_types_spec.rb @@ -22,7 +22,8 @@ feature EventType do fill_in 'event_type_title', with: 'Party' fill_in 'event_type_length', with: '240' - fill_in 'event_type_description', with: '### This is a description' + fill_in 'event_type_description', with: '**Description**' + fill_in 'event_type_submission_instructions', with: '**Instructions**' fill_in 'event_type_minimum_abstract_length', with: '0' fill_in 'event_type_maximum_abstract_length', with: '13042' page.find('#event_type_color').set('#e4e4e4') @@ -30,11 +31,14 @@ feature EventType do click_button 'Create Event type' page.find('#flash') # Validations + # binding.pry expect(flash).to eq('Event type successfully created.') within('table#event_types') do expect(page.has_content?('Party')).to be true expect(page.has_content?('13042')).to be true expect(page.has_content?('#E4E4E4')).to be true + expect(page.has_content?('Description')).to be true + expect(page.has_content?('Instructions')).to be true expect(page.assert_selector('tr', count: 3)).to be true end From 1a24533b00ff3cfa4b75282f01c2456ededdfc80 Mon Sep 17 00:00:00 2001 From: Michael Ball Date: Sun, 7 Mar 2021 12:56:45 -0800 Subject: [PATCH 5/9] Display submission instructions on the new/edit forms --- app/views/proposals/_proposal_form.html.haml | 17 +++++-------- app/views/proposals/new.html.haml | 25 ++++++++++---------- 2 files changed, 18 insertions(+), 24 deletions(-) diff --git a/app/views/proposals/_proposal_form.html.haml b/app/views/proposals/_proposal_form.html.haml index 5b4e7079..463cafa1 100644 --- a/app/views/proposals/_proposal_form.html.haml +++ b/app/views/proposals/_proposal_form.html.haml @@ -47,21 +47,16 @@ words. %br + - @conference.program.event_types.each do |event_type| + %span{ class: 'help-block select-help-text event_event_type_id collapse', id: "#{event_type.id}-help" } + %h3 + = event_type.name + Instructions + = markdown(event_type.submission_instructions) = f.input :submission_text, input_html: { rows: 5, data: { provide: 'markdown' }, placeholder: '' }, hint: markdown_hint('Only conference organizers will read this.') - %p - You have used - %span#submission-count #{@event.submission_word_count} - words. Submission descriptions must be between - %span#submission-minimum-word-count - 0 - and - %span#submission-maximum-word-count - 250 - words. - - if current_user.is_admin? or @program.cfp.enable_registrations? = f.inputs 'Enable pre-registration' do = f.input :require_registration, label: 'Require participants to register to your event' diff --git a/app/views/proposals/new.html.haml b/app/views/proposals/new.html.haml index bdd16e11..41969acc 100644 --- a/app/views/proposals/new.html.haml +++ b/app/views/proposals/new.html.haml @@ -61,22 +61,21 @@ 250 words. + %br + - @conference.program.event_types.each do |event_type| + %span{ class: 'help-block select-help-text event_event_type_id collapse', id: "#{event_type.id}-help" } + %h3 + = event_type.name + Instructions + %p Please use this as the template for your submission. + This part of the submissions is intended only for the conference committee. + %hr + = markdown(event_type.submission_instructions) + + = f.input :submission_text, input_html: { rows: 5, data: { provide: 'markdown' } }, hint: markdown_hint - %p - You have used - %span#submission-count #{@event.submission_word_count} - words. Submission descriptions must be between - %span#submission-minimum-word-count - 0 - and - %span#submission-maximum-word-count - 250 - words. - - - - if @program.cfp.enable_registrations? = f.input :require_registration, label: 'Require participants to register to your event' From 2d1246448cbf3565d8a46e4501550e08ba0a0619 Mon Sep 17 00:00:00 2001 From: Michael Ball Date: Mon, 8 Mar 2021 02:13:57 -0800 Subject: [PATCH 6/9] Add some tests for the submission instructions --- spec/factories/event_types.rb | 2 ++ spec/features/proposals_spec.rb | 6 +++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/spec/factories/event_types.rb b/spec/factories/event_types.rb index 2d56afed..92fdf1c8 100644 --- a/spec/factories/event_types.rb +++ b/spec/factories/event_types.rb @@ -23,6 +23,8 @@ FactoryBot.define do length { 30 } minimum_abstract_length { 0 } maximum_abstract_length { 500 } + description { 'Example Event Description'} + submission_instructions { 'Example Event Instructions'} color { '#ffffff' } program end diff --git a/spec/features/proposals_spec.rb b/spec/features/proposals_spec.rb index 15c23fcb..d75788a4 100644 --- a/spec/features/proposals_spec.rb +++ b/spec/features/proposals_spec.rb @@ -136,11 +136,15 @@ feature Event do select('Example Event Type', from: 'event[event_type_id]') expect(page).to have_selector(".in[id='#{find_field('event[event_type_id]').value}-help']") # End of animation + expect(page).to have_text('Example Event Description') fill_in 'event_abstract', with: 'Lorem ipsum abstract' expect(page).to have_text('You have used 3 words') fill_in 'event_submission_text', with: 'Lorem ipsum submission_text' - expect(page).to have_text('Submission description') + expect(page).to have_text('Submission text') + # Submission Instructions content + expect(page).to have_text('Example Event Instructions') + click_link 'Do you require something special?' fill_in 'event_description', with: 'Lorem ipsum description' From 8242eb333877dc5493e0112e2bc0ea3f959eec92 Mon Sep 17 00:00:00 2001 From: Michael Ball Date: Mon, 8 Mar 2021 02:18:44 -0800 Subject: [PATCH 7/9] Remove submission_limit validation for submission_text --- app/views/proposals/new.html.haml | 2 +- spec/models/event_spec.rb | 14 -------------- 2 files changed, 1 insertion(+), 15 deletions(-) diff --git a/app/views/proposals/new.html.haml b/app/views/proposals/new.html.haml index 41969acc..2d4f200a 100644 --- a/app/views/proposals/new.html.haml +++ b/app/views/proposals/new.html.haml @@ -68,7 +68,7 @@ = event_type.name Instructions %p Please use this as the template for your submission. - This part of the submissions is intended only for the conference committee. + This part of the submission is intended only for the conference committee. %hr = markdown(event_type.submission_instructions) diff --git a/spec/models/event_spec.rb b/spec/models/event_spec.rb index e2c6f584..030ad382 100644 --- a/spec/models/event_spec.rb +++ b/spec/models/event_spec.rb @@ -117,20 +117,6 @@ describe Event do event.event_type.minimum_abstract_length = 2 end - context 'is invalid' do - it 'when submission text is too long' do - event.submission_text = 'four too many words' - expect(event.valid?).to eq false - expect(event.errors[:submission_text]).to eq ['cannot have more than 3 words'] - end - - it 'when submission text is too short' do - event.submission_text = 'word' - expect(event.valid?).to eq false - expect(event.errors[:submission_text]).to eq ['cannot have less than 2 words'] - end - end - context 'is valid' do it 'when submission text is within limts' do event.abstract = 'the magic three' From 337a04d4ab4f4a261e823eb1f7d5209e098678ff Mon Sep 17 00:00:00 2001 From: Michael Ball Date: Mon, 8 Mar 2021 03:07:56 -0800 Subject: [PATCH 8/9] Delint --- spec/factories/event_types.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec/factories/event_types.rb b/spec/factories/event_types.rb index 92fdf1c8..dce51724 100644 --- a/spec/factories/event_types.rb +++ b/spec/factories/event_types.rb @@ -23,7 +23,7 @@ FactoryBot.define do length { 30 } minimum_abstract_length { 0 } maximum_abstract_length { 500 } - description { 'Example Event Description'} + description { 'Example Event Description' } submission_instructions { 'Example Event Instructions'} color { '#ffffff' } program From 4d34817928abff8568255f907e6b4ceda1f7fc9c Mon Sep 17 00:00:00 2001 From: Michael Ball Date: Mon, 8 Mar 2021 03:08:03 -0800 Subject: [PATCH 9/9] Delint --- spec/factories/event_types.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec/factories/event_types.rb b/spec/factories/event_types.rb index dce51724..9fcc1452 100644 --- a/spec/factories/event_types.rb +++ b/spec/factories/event_types.rb @@ -24,7 +24,7 @@ FactoryBot.define do minimum_abstract_length { 0 } maximum_abstract_length { 500 } description { 'Example Event Description' } - submission_instructions { 'Example Event Instructions'} + submission_instructions { 'Example Event Instructions' } color { '#ffffff' } program end