From 4b6697977c2d8f46bf08befd4db12df426a8a534 Mon Sep 17 00:00:00 2001 From: kinoppyd Date: Thu, 25 Apr 2024 20:30:15 +0900 Subject: [PATCH] =?UTF-8?q?Revert=20"=E3=82=B9=E3=82=B1=E3=82=B8=E3=83=A5?= =?UTF-8?q?=E3=83=BC=E3=83=AB=E7=94=BB=E9=9D=A2=E3=81=AE=E3=83=A2=E3=83=90?= =?UTF-8?q?=E3=82=A4=E3=83=AB=E5=AF=BE=E5=BF=9C"?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/plans_controller.rb | 6 +++--- app/models/schedule/table.rb | 5 ++--- app/models/schedule/tables.rb | 4 ++-- app/views/plans/update.turbo_stream.erb | 5 ----- app/views/schedules/_card.html.erb | 12 ++++++------ app/views/schedules/_mobile_table_row.html.erb | 7 ------- app/views/schedules/_table_row.html.erb | 14 +++++--------- app/views/schedules/index.html.erb | 7 +------ 8 files changed, 19 insertions(+), 41 deletions(-) delete mode 100644 app/views/schedules/_mobile_table_row.html.erb diff --git a/app/controllers/plans_controller.rb b/app/controllers/plans_controller.rb index a30c05a5..31c8875d 100644 --- a/app/controllers/plans_controller.rb +++ b/app/controllers/plans_controller.rb @@ -162,9 +162,9 @@ def set_attributes_for_turbo_stream @row, @track_list = catch(:abort) do @schedule_table.days.each do |day| - @table = @schedule_table[day] - @table.rows.each do |row| - throw :abort, [row, @table.track_list] if row.schedules.map(&:id).include?(target_schedule_id) + table = @schedule_table[day] + table.rows.each do |row| + throw :abort, [row, table.track_list] if row.schedules.map(&:id).include?(target_schedule_id) end end end diff --git a/app/models/schedule/table.rb b/app/models/schedule/table.rb index 2acaccff..8275b352 100644 --- a/app/models/schedule/table.rb +++ b/app/models/schedule/table.rb @@ -2,10 +2,9 @@ class Schedule class Table - attr_reader :track_list, :rows, :day + attr_reader :track_list, :rows - def initialize(schedules, day = nil) - @day = day + def initialize(schedules) @track_list = schedules.map(&:track).uniq.sort_by(&:position).map(&:name) grouped_schedules = schedules.group_by do |s| diff --git a/app/models/schedule/tables.rb b/app/models/schedule/tables.rb index bb1933a2..a4112c01 100644 --- a/app/models/schedule/tables.rb +++ b/app/models/schedule/tables.rb @@ -6,8 +6,8 @@ class Tables def initialize(schedules) @schedules = schedules - @map = @schedules.group_by { _1.start_at.strftime(DATE_FORMAT) }.to_h do |k, v| - [k, Schedule::Table.new(v, k)] + @map = @schedules.group_by { _1.start_at.strftime(DATE_FORMAT) }.transform_values do |v| + Schedule::Table.new(v) end end diff --git a/app/views/plans/update.turbo_stream.erb b/app/views/plans/update.turbo_stream.erb index de2dac87..6d71a3d1 100644 --- a/app/views/plans/update.turbo_stream.erb +++ b/app/views/plans/update.turbo_stream.erb @@ -1,8 +1,3 @@ <%= turbo_stream.replace @row.turbo_stream_id do %> <%= render partial: 'schedules/table_row', locals: { row: @row, plan: @plan, track_list: @track_list} %> <% end %> -<%= turbo_stream.update "mobile-table-#{@table.day}" do %> - <% @table.rows.each do |row| %> - <%= render partial: 'schedules/mobile_table_row', locals: { row: row, plan: @plan, track_list: @table.track_list } %> - <% end %> -<% end %> diff --git a/app/views/schedules/_card.html.erb b/app/views/schedules/_card.html.erb index 442de64e..8c8f9057 100644 --- a/app/views/schedules/_card.html.erb +++ b/app/views/schedules/_card.html.erb @@ -1,6 +1,6 @@ <%= turbo_frame_tag schedule do %>
-
+
<% schedule.speakers.each do |speaker| %>
@@ -10,11 +10,11 @@ <% end %> <% unless mode == :team %> -
-
+
+
Lang: <%= schedule.language %>
-
+
Track: <%= schedule.track.name %>
@@ -48,7 +48,7 @@ <% end %>
-
+
<% if mode == :plan && @plan.schedules.include?(schedule) %>