Skip to content
Open
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/people_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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) || []
Expand All @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion app/controllers/workshop_logs_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 8 additions & 0 deletions app/models/workshop_log.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions app/views/people/sections/_workshop_log_card.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
<!-- TITLE -->
<div class="text-sm font-semibold text-gray-900 leading-tight pr-6 mb-1">
<%= workshop_log.workshop_title.presence || "Workshop Log ##{workshop_log.id}" %>
<%= render "workshop_logs/content_icons", workshop_log: workshop_log %>
</div>

<!-- WINDOWS TYPE -->
Expand Down
2 changes: 2 additions & 0 deletions app/views/people/sections/_workshop_log_date_row.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,11 @@
<% if show_actions %>
<div class="text-sm font-bold text-gray-800 whitespace-nowrap"><%= display_date.strftime("%b %-d") %></div>
<div class="text-xs text-gray-400 ml-3"><%= display_date.strftime("%Y") %></div>
<%= render "workshop_logs/content_icons", workshop_log: workshop_log %>
<% else %>
<div class="text-xs text-gray-400"><%= display_date.strftime("%Y") %></div>
<div class="text-sm font-bold text-gray-800 whitespace-nowrap"><%= display_date.strftime("%b %-d") %></div>
<%= render "workshop_logs/content_icons", workshop_log: workshop_log %>
<% end %>
<% end %>
<% { "Total" => workshop_log.total_attendance,
Expand Down
10 changes: 10 additions & 0 deletions app/views/workshop_logs/_content_icons.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<% if workshop_log.has_quotes? || workshop_log.has_gallery_images? %>
<span class="inline-flex items-center gap-1 text-teal-400">
<% if workshop_log.has_quotes? %>
<i class="fa-regular fa-comment text-xs" title="Has quotes"></i>
<% end %>
<% if workshop_log.has_gallery_images? %>
<i class="fa-regular fa-image text-xs" title="Has images"></i>
<% end %>
</span>
<% end %>
1 change: 1 addition & 0 deletions app/views/workshop_logs/_index.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@
<tr id="workshop_log_<%= log.id %>" class="hover:bg-gray-50 transition-colors duration-150">
<td class="px-2 text-left text-xs whitespace-nowrap">
<%= link_to (log.date || log.created_at)&.strftime("%b %d, %Y"), workshop_log_path(log) %>
<%= render "workshop_logs/content_icons", workshop_log: log %>
</td>
<td class="px-2 text-left text-sm font-bold">
<% if log.workshop %>
Expand Down