Include code of conduct on conference

This commit is contained in:
James Mason 2018-03-16 12:49:00 -07:00 committed by Ana María Martínez Gómez
parent 217ec1a46f
commit 95196c7f80
5 changed files with 47 additions and 1 deletions

View file

@ -11,6 +11,7 @@ class Conference < ApplicationRecord
scope :past, (-> { where('end_date < ?', Date.current) })
belongs_to :organization
delegate :code_of_conduct, to: :organization
has_paper_trail ignore: %i(updated_at guid revision events_per_week), meta: { conference_id: :id }

View file

@ -0,0 +1,20 @@
= content_for :splash_nav do
%li
= link_to 'Code of Conduct', '#',
data: { toggle: 'modal', target: '#modal-code-of-conduct'}
- content_for :modals do
- cache [organization, '#CoC-modal'] do
.modal.fade{ id: "modal-code-of-conduct" }
.modal-dialog
.modal-content
.modal-header
%button.close{ data: { dismiss: 'modal' } }
%i.fa.fa-close
%h3.modal-title Code of Conduct
.modal-body
= markdown organization.code_of_conduct
.modal-footer
= link_to 'permalink',
[:code_of_conduct, organization],
target: '_blank'

View file

@ -1,4 +1,4 @@
.row
.row{ id: "conference-#{conference.id}" }
.col-md-12
.well
.row
@ -23,6 +23,10 @@
= link_to "View Conference", conference_path(conference.short_title), class: 'btn btn-default'
- if conference.program and conference.program.schedule_public
= link_to "Schedule", conference_schedule_path(conference.short_title), class: 'btn btn-default'
- unless conference.code_of_conduct.blank?
= link_to "Code of Conduct",
[:code_of_conduct, conference.organization],
class: 'btn btn-default'
- if conference.registration_open?
- if conference.user_registered?(current_user)
= link_to "My Registration", conference_conference_registration_path(conference.short_title), class: 'btn btn-default'

View file

@ -11,6 +11,9 @@
= @conference.title
#splash
- if @conference.code_of_conduct.present?
= render 'code_of_conduct', organization: @conference.organization
-# header/description
= render 'header', conference: @conference, venue: @conference.venue

View file

@ -43,6 +43,24 @@ feature 'Code of Conduct:' do
expect(page).to have_text(sample_text)
end
end
context 'on a conference' do
let!(:conference) { create(:full_conference, organization: organization) }
it 'is linked from the index' do
visit conferences_path
within "#conference-#{conference.id}" do
click_on 'Code of Conduct'
end
expect(page).to have_text(sample_text)
end
it 'is included in the splash page', js: true do
visit conference_path(conference)
click_on 'Code of Conduct'
expect(page).to have_text(sample_text)
end
end
end
end
end