Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions app/controllers/admin/meetings_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ def create
if @meeting.save
redirect_to [:admin, @meeting], notice: t('admin.messages.meeting.created')
else
flash[:notice] = @meeting.errors.full_messages.join('<br/>')
flash[:notice] = @meeting.errors.full_messages.join(', ')
render :new
end
end
Expand All @@ -33,7 +33,7 @@ def update
if @meeting.update(meeting_params)
redirect_to [:admin, @meeting], notice: t('admin.messages.meeting.updated')
else
flash[:notice] = @meeting.errors.full_messages.join('<br/>')
flash[:notice] = @meeting.errors.full_messages.join(', ')
render 'edit'
end
end
Expand Down
2 changes: 1 addition & 1 deletion app/models/meeting.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ class Meeting < ApplicationRecord
has_many :invitations, class_name: 'MeetingInvitation'
has_and_belongs_to_many :chapters

validates :date_and_time, :ends_at, :venue, presence: true
validates :date_and_time, :ends_at, presence: true
validates :slug, uniqueness: true, if: proc { |model| model.slug.present? }

before_validation :set_date_and_time, :set_end_date_and_time
Expand Down
4 changes: 2 additions & 2 deletions app/views/layouts/_messages.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@
- name = name.eql?('notice') ? 'info' : name
- if msg.is_a?(String)
.alert.alert-dismissible.fade.show.mb-0{ 'data-alert': '', class: "alert-#{name}", role: 'alert' }
= content_tag :div, msg.html_safe
= content_tag :div, msg
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, here we can simplify the markup, something like

Suggested change
= content_tag :div, msg
%div= msg

%button.btn-close{ type: 'button', 'data-bs-dismiss': 'alert', 'aria-label': 'Close' }
- elsif msg.is_a?(Array)
- msg.each do |message|
.alert.alert-dismissible.fade.show.mb-0{ 'data-alert': '', class: "alert-#{name}", role: 'alert' }
= content_tag :span, message.html_safe
= content_tag :span, message
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
= content_tag :span, message
%span= message

%button.btn-close{ type: 'button', 'data-bs-dismiss': 'alert', 'aria-label': 'Close' }

2 changes: 1 addition & 1 deletion spec/features/admin/meeting_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@

click_on 'Save'

expect(page).to have_content('Venue can\'t be blank')
expect(page).to have_content('Venue must be set')
end
end

Expand Down
2 changes: 1 addition & 1 deletion spec/models/meeting_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
subject(:meeting) { Fabricate(:meeting) }
it { is_expected.to validate_presence_of(:date_and_time) }
it { is_expected.to validate_presence_of(:ends_at) }
it { is_expected.to validate_presence_of(:venue) }
it { should belong_to(:venue) }

context '#slug' do
it 'fails when slug not present' do
Expand Down