Skip to content

Commit e79ec4c

Browse files
authored
Merge pull request #1069 from amatsuda/save_and_add_fix
Fix ActionView::MissingTemplate error on "Save and Add"
2 parents cabc75f + 29cdbc9 commit e79ec4c

File tree

3 files changed

+27
-2
lines changed

3 files changed

+27
-2
lines changed

app/views/staff/time_slots/create.turbo_stream.haml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
%turbo-stream{action: 'datatable-add', target: 'organizer-time-slots'}
55
%template
6-
= render(time_slot_decorated)
6+
= render(partial: 'staff/time_slots/time_slot', formats: [:html], object: time_slot_decorated)
77

88
= turbo_stream.update 'flash' do
99
= show_flash

app/views/staff/time_slots/update.turbo_stream.haml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
%turbo-stream{action: 'datatable-update', target: 'organizer-time-slots', 'row-id': @time_slot.id}
44
%template
5-
= render(time_slot_decorated)
5+
= render(partial: 'staff/time_slots/time_slot', formats: [:html], object: time_slot_decorated)
66

77
= turbo_stream.update 'flash' do
88
= show_flash
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
require 'rails_helper'
2+
3+
feature 'Staff Organizers can manage time slots', type: :system do
4+
let(:event) { create(:event, start_date: Date.today, end_date: Date.today + 2.days) }
5+
let!(:room) { create(:room, name: 'Main Hall', event: event) }
6+
let!(:organizer_user) { create(:organizer, event: event) }
7+
8+
before { login_as(organizer_user) }
9+
10+
scenario 'creates a time slot via the "Save and Add" button', js: true do
11+
visit event_staff_schedule_time_slots_path(event)
12+
13+
click_link 'Add Time Slot'
14+
15+
within('#time-slot-new-dialog') do
16+
select '1', from: 'Day'
17+
select 'Main Hall', from: 'Room'
18+
click_button 'Save and Add'
19+
end
20+
21+
expect(page).to have_content('Time slot added.')
22+
expect(event.time_slots.count).to eq(1)
23+
expect(page).to have_css('#organizer-time-slots tbody tr')
24+
end
25+
end

0 commit comments

Comments
 (0)