diff --git a/app/controllers/people_controller.rb b/app/controllers/people_controller.rb index 11f91d356..b784290f7 100644 --- a/app/controllers/people_controller.rb +++ b/app/controllers/people_controller.rb @@ -55,7 +55,7 @@ def show @story_ideas = @person.user&.story_ideas_as_creator&.order(created_at: :desc)&.paginate(page: params[:page], per_page: per_page) || [] render partial: "people/sections/story_ideas", locals: { person: @person, story_ideas: @story_ideas } when "workshop_logs" - @workshop_logs = @person.user&.workshop_logs&.includes(:workshop, :windows_type)&.order(date: :desc, created_at: :desc) || WorkshopLog.none + @workshop_logs = @person.user&.workshop_logs&.includes(:workshop, :windows_type, :quotable_item_quotes, :gallery_assets)&.order(date: :desc, created_at: :desc) || WorkshopLog.none render partial: "people/sections/workshop_logs", locals: { person: @person, workshop_logs: @workshop_logs } when "workshop_variation_ideas" @workshop_variation_ideas = @person.user&.workshop_variation_ideas_creator&.order(created_at: :desc)&.paginate(page: params[:page], per_page: per_page) || [] @@ -70,7 +70,7 @@ def show def workshop_logs authorize! @person @person = @person.decorate - all_logs = @person.user&.workshop_logs&.includes(:workshop, :windows_type)&.order(date: :desc, created_at: :desc) || WorkshopLog.none + all_logs = @person.user&.workshop_logs&.includes(:workshop, :windows_type, :quotable_item_quotes, :gallery_assets)&.order(date: :desc, created_at: :desc) || WorkshopLog.none @grouped_logs = all_logs.group_by { |log| log.workshop_id || log.external_workshop_title }.sort_by { |_key, logs| dates = logs.first(10).map { |l| -(l.date || l.created_at.to_date).to_time.to_i } dates.fill(0, dates.size...10) diff --git a/app/controllers/workshop_logs_controller.rb b/app/controllers/workshop_logs_controller.rb index f01fe79c8..ec024d4e3 100644 --- a/app/controllers/workshop_logs_controller.rb +++ b/app/controllers/workshop_logs_controller.rb @@ -5,7 +5,7 @@ def index authorize! @per_page = params[:number_of_items_per_page].presence || 10 params[:workshop_id] ||= @workshop&.id - base_scope = authorized_scope(WorkshopLog.includes(:workshop, :windows_type, created_by: :person) + base_scope = authorized_scope(WorkshopLog.includes(:workshop, :windows_type, :quotable_item_quotes, :gallery_assets, created_by: :person) .where(type: "WorkshopLog")) filtered = base_scope.search(params) @workshop_logs_unpaginated = filtered diff --git a/app/models/workshop_log.rb b/app/models/workshop_log.rb index 1f5fdefcf..b290bc05a 100644 --- a/app/models/workshop_log.rb +++ b/app/models/workshop_log.rb @@ -107,6 +107,14 @@ def date_label date ? date.strftime("%m/%d/%Y") : created_at.strftime("%m/%d/%Y") end + def has_quotes? + all_quotable_item_quotes.any? + end + + def has_gallery_images? + gallery_assets.any? + end + def workshop_quotes workshop&.quotes || Quote.none end diff --git a/app/views/people/sections/_workshop_log_card.html.erb b/app/views/people/sections/_workshop_log_card.html.erb index 75c231399..2d9aaa0a9 100644 --- a/app/views/people/sections/_workshop_log_card.html.erb +++ b/app/views/people/sections/_workshop_log_card.html.erb @@ -15,6 +15,7 @@
<%= workshop_log.workshop_title.presence || "Workshop Log ##{workshop_log.id}" %> + <%= render "workshop_logs/content_icons", workshop_log: workshop_log %>
diff --git a/app/views/people/sections/_workshop_log_date_row.html.erb b/app/views/people/sections/_workshop_log_date_row.html.erb index ceae2e4b2..3529ef171 100644 --- a/app/views/people/sections/_workshop_log_date_row.html.erb +++ b/app/views/people/sections/_workshop_log_date_row.html.erb @@ -10,9 +10,11 @@ <% if show_actions %>
<%= display_date.strftime("%b %-d") %>
<%= display_date.strftime("%Y") %>
+ <%= render "workshop_logs/content_icons", workshop_log: workshop_log %> <% else %>
<%= display_date.strftime("%Y") %>
<%= display_date.strftime("%b %-d") %>
+ <%= render "workshop_logs/content_icons", workshop_log: workshop_log %> <% end %> <% end %> <% { "Total" => workshop_log.total_attendance, diff --git a/app/views/workshop_logs/_content_icons.html.erb b/app/views/workshop_logs/_content_icons.html.erb new file mode 100644 index 000000000..fcf3cdf76 --- /dev/null +++ b/app/views/workshop_logs/_content_icons.html.erb @@ -0,0 +1,10 @@ +<% if workshop_log.has_quotes? || workshop_log.has_gallery_images? %> + + <% if workshop_log.has_quotes? %> + + <% end %> + <% if workshop_log.has_gallery_images? %> + + <% end %> + +<% end %> diff --git a/app/views/workshop_logs/_index.html.erb b/app/views/workshop_logs/_index.html.erb index e314103df..ebea38907 100644 --- a/app/views/workshop_logs/_index.html.erb +++ b/app/views/workshop_logs/_index.html.erb @@ -80,6 +80,7 @@ <%= link_to (log.date || log.created_at)&.strftime("%b %d, %Y"), workshop_log_path(log) %> + <%= render "workshop_logs/content_icons", workshop_log: log %> <% if log.workshop %>