From 4d067add46f6c28031ae96ad1e931001ad086ea1 Mon Sep 17 00:00:00 2001 From: Michael Ball Date: Tue, 2 Mar 2021 21:21:20 -0800 Subject: [PATCH 01/13] Add Committee Review Text Column --- app/models/cfp.rb | 1 - app/models/event.rb | 1 + app/models/program.rb | 1 - app/serializers/event_serializer.rb | 1 + db/schema.rb | 3 ++- spec/factories/events.rb | 1 + spec/models/event_spec.rb | 1 + spec/serializers/event_serializer_spec.rb | 1 + 8 files changed, 7 insertions(+), 3 deletions(-) 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 0370926b..a2000fc9 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/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 4e81ef3b..56d18dba 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/schema.rb b/db/schema.rb index e8ac08e8..d2898113 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -10,7 +10,7 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema.define(version: 2020_07_16_181602) do +ActiveRecord::Schema.define(version: 2021_03_03_052026) do # These are extensions that must be enabled in order to support this database enable_extension "plpgsql" @@ -257,6 +257,7 @@ ActiveRecord::Schema.define(version: 2020_07_16_181602) do t.integer "program_id" t.integer "max_attendees" t.integer "comments_count", default: 0, null: false + t.text "committee_review" end create_table "events_registrations", force: :cascade do |t| diff --git a/spec/factories/events.rb b/spec/factories/events.rb index 18d40a3b..1ff915d6 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/models/event_spec.rb b/spec/models/event_spec.rb index c2dca815..2a934faa 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/serializers/event_serializer_spec.rb b/spec/serializers/event_serializer_spec.rb index b365a310..4dafc33a 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 b41b77c67657c5393c5aa4d177110be4cb39e77b Mon Sep 17 00:00:00 2001 From: Michael Ball Date: Tue, 2 Mar 2021 21:21:29 -0800 Subject: [PATCH 02/13] Add Committee Review Text Column --- db/migrate/20210303052026_add_committee_review_to_events.rb | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 db/migrate/20210303052026_add_committee_review_to_events.rb diff --git a/db/migrate/20210303052026_add_committee_review_to_events.rb b/db/migrate/20210303052026_add_committee_review_to_events.rb new file mode 100644 index 00000000..9f2757c9 --- /dev/null +++ b/db/migrate/20210303052026_add_committee_review_to_events.rb @@ -0,0 +1,5 @@ +class AddCommitteeReviewToEvents < ActiveRecord::Migration[5.2] + def change + add_column :events, :committee_review, :text + end +end From 71eb408620826738563d7ff056013c677b07d3b6 Mon Sep 17 00:00:00 2001 From: Michael Ball Date: Tue, 2 Mar 2021 21:50:59 -0800 Subject: [PATCH 03/13] Fixup Routes: properly handle custom domains, add /events/:id alias --- config/routes.rb | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/config/routes.rb b/config/routes.rb index ef984ca9..073bfe3e 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -167,6 +167,7 @@ Osem::Application.routes.draw do end end resource :program, only: [] do + get 'event/:id', to: 'proposals#show', as: :conference_program_event get 'proposal/:id', to: 'proposals#show' # For backward compatibility resources :proposals, except: :destroy do get 'commercials/render_commercial' => 'commercials#render_commercial' @@ -222,15 +223,15 @@ Osem::Application.routes.draw do get '/admin' => redirect('/admin/conferences') + constraints DomainConstraint do + root to: 'conferences#show' + end + unless ENV['OSEM_ROOT_CONFERENCE'].blank? root to: redirect("/conferences/#{ENV['OSEM_ROOT_CONFERENCE']}") else root to: 'conferences#index', via: [:get, :options] end - constraints DomainConstraint do - root to: 'conferences#show' - end - get '/.well-known/apple-developer-merchantid-domain-association', to: 'application#apple_pay' end From cb9455f8130b4914493753e04bb167cadd4f4532 Mon Sep 17 00:00:00 2001 From: Michael Ball Date: Thu, 4 Mar 2021 01:39:12 -0800 Subject: [PATCH 04/13] show reviewer comments field in the app --- app/views/admin/events/_proposal.html.haml | 5 +++++ app/views/proposals/_proposal_form.html.haml | 5 +++++ 2 files changed, 10 insertions(+) diff --git a/app/views/admin/events/_proposal.html.haml b/app/views/admin/events/_proposal.html.haml index 05d48bb7..7f6141ef 100644 --- a/app/views/admin/events/_proposal.html.haml +++ b/app/views/admin/events/_proposal.html.haml @@ -122,6 +122,11 @@ %b Requirements %td= simple_format(@event.description) + %tr + %td + %b Committee Review + %td= markdown(@event.committee_review) + - if @conference.program.rating_enabled? = render 'voting', event: @event, diff --git a/app/views/proposals/_proposal_form.html.haml b/app/views/proposals/_proposal_form.html.haml index 5b4e7079..00cf9a90 100644 --- a/app/views/proposals/_proposal_form.html.haml +++ b/app/views/proposals/_proposal_form.html.haml @@ -62,6 +62,11 @@ 250 words. + - if current_user.has_any_role? :admin, { name: :organizer, resource: @conference }, { name: :cfp, resource: @conference } + %br + = f.input :committee_review, input_html: { rows: 5, data: { provide: 'markdown' }, placeholder: '' }, + hint: markdown_hint('This field is shared with the submission authors.') + - 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' From 0e74c2e2962b274ff8c7b614fd46db88f8d6eb72 Mon Sep 17 00:00:00 2001 From: Michael Ball Date: Thu, 15 Apr 2021 22:31:46 -0700 Subject: [PATCH 05/13] Minor tidying up --- app/views/admin/events/_proposal.html.haml | 9 +++------ app/views/proposals/_proposal_form.html.haml | 5 +++-- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/app/views/admin/events/_proposal.html.haml b/app/views/admin/events/_proposal.html.haml index 7f6141ef..7fe086b1 100644 --- a/app/views/admin/events/_proposal.html.haml +++ b/app/views/admin/events/_proposal.html.haml @@ -73,9 +73,7 @@ %td = link_to @event.submitter.name, admin_user_path(@event.submitter) - if @event.submitter.email_public - ( - = link_to @event.submitter.email, "mailto: #{@event.submitter.email}" - ) + = "(#{mail_to(@event.submitter.email)})" %tr %td %b Speakers @@ -84,9 +82,7 @@ %div = link_to speaker.name, admin_user_path(speaker) - if speaker.email_public - ( - = link_to speaker.email, "mailto: #{speaker.email}" - ) + = "(#{mail_to(speaker.email)})" %tr %td %b Volunteers @@ -117,6 +113,7 @@ %td %b Submission Description %td= markdown(@event.submission_text) + %tr %td %b Requirements diff --git a/app/views/proposals/_proposal_form.html.haml b/app/views/proposals/_proposal_form.html.haml index eb03e9fa..f5ef752f 100644 --- a/app/views/proposals/_proposal_form.html.haml +++ b/app/views/proposals/_proposal_form.html.haml @@ -28,9 +28,10 @@ = render 'proposals/submission_type_content_form', f: f, program: @program -# TODO-SNAPCON: Extract this to be a `conference_committee_role?` - - if current_user.has_any_role? :admin, { name: :organizer, resource: @conference }, { name: :cfp, resource: @conference } + - read_only = !current_user.has_any_role? :admin, { name: :organizer, resource: @conference }, { name: :cfp, resource: @conference } %br - = f.input :committee_review, input_html: { rows: 5, data: { provide: 'markdown' } }, + = f.input :committee_review, + input_html: { rows: 5, data: { provide: 'markdown' }, readonly: read_only }, hint: markdown_hint('This field is shared with the submission authors.') - if @program.cfp&.enable_registrations? From 9786843eacea303449b6d13194253976819a5089 Mon Sep 17 00:00:00 2001 From: Michael Ball Date: Fri, 16 Apr 2021 00:33:47 -0700 Subject: [PATCH 06/13] Display Committee Review on #show and #edit. Also show submission_text on the #show page for authors. --- app/controllers/proposals_controller.rb | 10 +++++----- app/views/proposals/_proposal_form.html.haml | 11 +++++++++-- app/views/proposals/show.html.haml | 19 +++++++++++++++++++ 3 files changed, 33 insertions(+), 7 deletions(-) diff --git a/app/controllers/proposals_controller.rb b/app/controllers/proposals_controller.rb index bf1b3adc..404178ea 100644 --- a/app/controllers/proposals_controller.rb +++ b/app/controllers/proposals_controller.rb @@ -169,11 +169,11 @@ class ProposalsController < ApplicationController private def event_params - params.require(:event).permit(:event_type_id, :track_id, :difficulty_level_id, - :title, :subtitle, :abstract, :submission_text, :description, - :require_registration, :max_attendees, :language, - speaker_ids: [], volunteer_ids: [] - ) + # TODO-SNAPCON: Restrict committee review to admins. + params.require(:event).permit(:event_type_id, :track_id, :difficulty_level_id, + :title, :subtitle, :abstract, :submission_text, :description, + :require_registration, :max_attendees, :language, + :committee_review, speaker_ids: [], volunteer_ids: []) end def user_params diff --git a/app/views/proposals/_proposal_form.html.haml b/app/views/proposals/_proposal_form.html.haml index f5ef752f..b54f074c 100644 --- a/app/views/proposals/_proposal_form.html.haml +++ b/app/views/proposals/_proposal_form.html.haml @@ -28,11 +28,18 @@ = render 'proposals/submission_type_content_form', f: f, program: @program -# TODO-SNAPCON: Extract this to be a `conference_committee_role?` - - read_only = !current_user.has_any_role? :admin, { name: :organizer, resource: @conference }, { name: :cfp, resource: @conference } + - if current_user.has_any_role?(:admin, { name: :organizer, resource: @conference }, { name: :cfp, resource: @conference }) %br = f.input :committee_review, - input_html: { rows: 5, data: { provide: 'markdown' }, readonly: read_only }, + input_html: { rows: 5, data: { provide: 'markdown' } }, hint: markdown_hint('This field is shared with the submission authors.') + - elsif @event.committee_review.present? + %br + %strong.control-label Committee Review + %small + Use this feedback to improve your submission. + .well + = markdown(@event.committee_review) - if @program.cfp&.enable_registrations? = f.inputs 'Enable pre-registration' do diff --git a/app/views/proposals/show.html.haml b/app/views/proposals/show.html.haml index 5d2dd948..9d5cfe73 100644 --- a/app/views/proposals/show.html.haml +++ b/app/views/proposals/show.html.haml @@ -138,3 +138,22 @@ - if @surveys_after_event.any? && @event.ended? .page-header = render partial: 'surveys/list', locals: { surveys: @surveys_after_event, conference: @conference } + + - if @event.committee_review.present? || @event.submission_text.present? && can?(:edit, @event) + %hr + %p Information for event authors only: + .panel.panel-info + .panel-heading + Committee Review + %button.btn.btn-primary.btn-xs{ type: "button", 'data-toggle': "collapse", 'data-target': "#committee-panel", 'aria-expanded': "false", 'aria-controls': "committee-panel" } + Toggle + .panel-body.collapse#committee-panel + = markdown(@event.committee_review) + + .panel.panel-info + .panel-heading + Submission Details + %button.btn.btn-primary.btn-xs{ type: "button", 'data-toggle': "collapse", 'data-target': "#submission-panel", 'aria-expanded': "false", 'aria-controls': "submission-panel" } + Toggle + .panel-body.collapse#submission-panel + = markdown(@event.submission_text) From f6c7a50bba1e9151a0383d96bf9d49e4612075ea Mon Sep 17 00:00:00 2001 From: Michael Ball Date: Fri, 16 Apr 2021 01:08:28 -0700 Subject: [PATCH 07/13] Add {committee_review} to emails and support HTML --- app/models/email_settings.rb | 2 ++ app/views/admin/emails/_help.html.haml | 9 ++++++--- app/views/admin/events/_proposal.html.haml | 4 ++-- app/views/mailbot/email_template.html.erb | 4 ++-- 4 files changed, 12 insertions(+), 7 deletions(-) diff --git a/app/models/email_settings.rb b/app/models/email_settings.rb index 8a8ab0b5..e5b64801 100644 --- a/app/models/email_settings.rb +++ b/app/models/email_settings.rb @@ -91,6 +91,8 @@ class EmailSettings < ApplicationRecord h['eventtitle'] = event.title h['proposalslink'] = Rails.application.routes.url_helpers.conference_program_proposals_url( conference.short_title, host: (ENV['OSEM_HOSTNAME'] || 'localhost:3000')) + h['committee_review'] = event.committee_review + h['committee_review_html'] = ApplicationController.helpers.markdown(event.committee_review) end if booth diff --git a/app/views/admin/emails/_help.html.haml b/app/views/admin/emails/_help.html.haml index 371bac7b..d62589b0 100644 --- a/app/views/admin/emails/_help.html.haml +++ b/app/views/admin/emails/_help.html.haml @@ -17,6 +17,12 @@ %tr %td {eventtitle} %td The title of an accepted or rejected proposal + %tr + %td {committee_review} + %td The raw text in the committee review for the proposal + %tr + %td {committee_review_html} + %td The committee review markdown rendered as HTML. %tr %td {conference_start_date} %td The start date of the conference @@ -56,9 +62,6 @@ %td {conference_splash_link} %td The link to conference splash page - if @conference.booths - %tr - %td {submitter_name} - %td Submitter's name %tr %td {booth_title} %td Booth's title diff --git a/app/views/admin/events/_proposal.html.haml b/app/views/admin/events/_proposal.html.haml index 7fe086b1..c21f364f 100644 --- a/app/views/admin/events/_proposal.html.haml +++ b/app/views/admin/events/_proposal.html.haml @@ -73,7 +73,7 @@ %td = link_to @event.submitter.name, admin_user_path(@event.submitter) - if @event.submitter.email_public - = "(#{mail_to(@event.submitter.email)})" + (#{mail_to(@event.submitter.email)}) %tr %td %b Speakers @@ -82,7 +82,7 @@ %div = link_to speaker.name, admin_user_path(speaker) - if speaker.email_public - = "(#{mail_to(speaker.email)})" + (#{mail_to(speaker.email)}) %tr %td %b Volunteers diff --git a/app/views/mailbot/email_template.html.erb b/app/views/mailbot/email_template.html.erb index 6176cf08..8dd249a0 100644 --- a/app/views/mailbot/email_template.html.erb +++ b/app/views/mailbot/email_template.html.erb @@ -1,7 +1,7 @@ <%= render partial: "layouts/mailbot_header" %>
- <%= @email_body %> + <%= @email_body.html_safe %>
-<%= render partial: "layouts/mailbot_footer" %> \ No newline at end of file +<%= render partial: "layouts/mailbot_footer" %> From a88402642c5d42acc3aeffbc66fedc3585fb68e0 Mon Sep 17 00:00:00 2001 From: Michael Ball Date: Fri, 16 Apr 2021 01:15:22 -0700 Subject: [PATCH 08/13] What the heck! Add a short URL for conferences --- config/routes.rb | 3 +++ 1 file changed, 3 insertions(+) diff --git a/config/routes.rb b/config/routes.rb index ec8a5fb0..1c31e0d0 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -236,4 +236,7 @@ Osem::Application.routes.draw do get '/admin' => redirect('/admin/conferences') get '/calendar' => 'conferences#calendar' get '/.well-known/apple-developer-merchantid-domain-association', to: 'application#apple_pay' + + # A Short Fallback Route + get '/:id', to: 'conferences#show' end From 9774779fbc1407c0d96127e08f1767d4468386c0 Mon Sep 17 00:00:00 2001 From: CactusPuppy Date: Fri, 16 Apr 2021 09:47:42 -0700 Subject: [PATCH 09/13] Attempt to use stable release of codacy reporter --- .github/workflows/spec.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/spec.yml b/.github/workflows/spec.yml index 83f1aca4..b2e7d847 100644 --- a/.github/workflows/spec.yml +++ b/.github/workflows/spec.yml @@ -46,7 +46,7 @@ jobs: - name: spec/${{ matrix.suite }} run: bundle exec rake spec:${{ matrix.suite }} - name: coverage upload ${{ matrix.suite }} - uses: codacy/codacy-coverage-reporter-action@master + uses: codacy/codacy-coverage-reporter-action@v1 if: github.ref == 'refs/heads/master' with: project-token: ${{ secrets.CODACY_PROJECT_TOKEN }} From 5a3012f0b7464f7a67bc8cd73127d001589d184a Mon Sep 17 00:00:00 2001 From: Michael Ball Date: Sat, 17 Apr 2021 17:08:16 -0700 Subject: [PATCH 10/13] Add comiittee_review(_html) options to email spec --- spec/models/email_settings_spec.rb | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/spec/models/email_settings_spec.rb b/spec/models/email_settings_spec.rb index b594c60c..ea4275ca 100644 --- a/spec/models/email_settings_spec.rb +++ b/spec/models/email_settings_spec.rb @@ -134,7 +134,12 @@ describe EmailSettings do context 'conference has event' do before do - event_hash = { 'eventtitle' => 'Talk about talks', 'proposalslink' => 'http://localhost:3000/conferences/goto/program/proposals' } + event_hash = { + 'eventtitle': 'Talk about talks', + 'proposalslink': 'http://localhost:3000/conferences/goto/program/proposals', + 'committee_review': '', + 'committee_review_html': '' + } expected_hash.merge!(event_hash) end From 4c056f208e2b22a69ba6c75d4c17c7d01c7842f8 Mon Sep 17 00:00:00 2001 From: Michael Ball Date: Sat, 17 Apr 2021 17:29:58 -0700 Subject: [PATCH 11/13] Delinting --- app/controllers/proposals_controller.rb | 10 +++++----- spec/models/email_settings_spec.rb | 6 +++--- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/app/controllers/proposals_controller.rb b/app/controllers/proposals_controller.rb index 404178ea..87636b2c 100644 --- a/app/controllers/proposals_controller.rb +++ b/app/controllers/proposals_controller.rb @@ -169,11 +169,11 @@ class ProposalsController < ApplicationController private def event_params - # TODO-SNAPCON: Restrict committee review to admins. - params.require(:event).permit(:event_type_id, :track_id, :difficulty_level_id, - :title, :subtitle, :abstract, :submission_text, :description, - :require_registration, :max_attendees, :language, - :committee_review, speaker_ids: [], volunteer_ids: []) + # TODO-SNAPCON: Restrict committee review to admins. + params.require(:event).permit(:event_type_id, :track_id, :difficulty_level_id, + :title, :subtitle, :abstract, :submission_text, :description, + :require_registration, :max_attendees, :language, + :committee_review, speaker_ids: [], volunteer_ids: []) end def user_params diff --git a/spec/models/email_settings_spec.rb b/spec/models/email_settings_spec.rb index ea4275ca..ff7c2409 100644 --- a/spec/models/email_settings_spec.rb +++ b/spec/models/email_settings_spec.rb @@ -135,9 +135,9 @@ describe EmailSettings do context 'conference has event' do before do event_hash = { - 'eventtitle': 'Talk about talks', - 'proposalslink': 'http://localhost:3000/conferences/goto/program/proposals', - 'committee_review': '', + 'eventtitle': 'Talk about talks', + 'proposalslink': 'http://localhost:3000/conferences/goto/program/proposals', + 'committee_review': '', 'committee_review_html': '' } expected_hash.merge!(event_hash) From 59f534a01010b79ddc6aff141ae72bc0df90c3eb Mon Sep 17 00:00:00 2001 From: Michael Ball Date: Sat, 17 Apr 2021 17:33:59 -0700 Subject: [PATCH 12/13] fix hash style --- spec/models/email_settings_spec.rb | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/spec/models/email_settings_spec.rb b/spec/models/email_settings_spec.rb index ff7c2409..a9f7ae6e 100644 --- a/spec/models/email_settings_spec.rb +++ b/spec/models/email_settings_spec.rb @@ -135,10 +135,10 @@ describe EmailSettings do context 'conference has event' do before do event_hash = { - 'eventtitle': 'Talk about talks', - 'proposalslink': 'http://localhost:3000/conferences/goto/program/proposals', - 'committee_review': '', - 'committee_review_html': '' + 'eventtitle' => 'Talk about talks', + 'proposalslink' => 'http://localhost:3000/conferences/goto/program/proposals', + 'committee_review' => nil, + 'committee_review_html' =>'' } expected_hash.merge!(event_hash) end From b099246f783bd4e62dd54071445abe2092abfcd2 Mon Sep 17 00:00:00 2001 From: Michael Ball Date: Sat, 17 Apr 2021 17:45:55 -0700 Subject: [PATCH 13/13] delinting...space.... --- spec/models/email_settings_spec.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec/models/email_settings_spec.rb b/spec/models/email_settings_spec.rb index a9f7ae6e..3ac6598d 100644 --- a/spec/models/email_settings_spec.rb +++ b/spec/models/email_settings_spec.rb @@ -138,7 +138,7 @@ describe EmailSettings do 'eventtitle' => 'Talk about talks', 'proposalslink' => 'http://localhost:3000/conferences/goto/program/proposals', 'committee_review' => nil, - 'committee_review_html' =>'' + 'committee_review_html' => '' } expected_hash.merge!(event_hash) end