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
13 changes: 10 additions & 3 deletions app/controllers/workshops_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,15 @@ def edit
end

def show
set_show
@workshop.increment_view_count!(session: session, request: request)
if turbo_frame_request?
@workshop = Workshop.with_all_rich_text.find(params[:id]).decorate
set_show
render partial: "show_lazy", locals: { workshop: @workshop }
else
@workshop = Workshop.find(params[:id]).decorate
@workshop.increment_view_count!(session: session, request: request)
render :show
end
end

def update
Expand Down Expand Up @@ -155,13 +162,13 @@ def search
private

def set_show
@workshop = Workshop.find(params[:id]).decorate
@quotes = Quote.where(workshop_id: @workshop.id).active
@leader_spotlights = @workshop.associated_resources.leader_spotlights.where(inactive: false)
@workshop_variations = @workshop.workshop_variations.active
@sectors = @workshop.sectorable_items.published.map { |item| item.sector if item.sector.published }.compact if @workshop.sectorable_items.any?
end


def set_form_variables
@workshop.build_primary_asset if @workshop.primary_asset.blank?
@workshop.gallery_assets.build
Expand Down
14 changes: 0 additions & 14 deletions app/views/workshops/_show.html.erb

This file was deleted.

1 change: 1 addition & 0 deletions app/views/workshops/_show_body.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@
<li class="-mb-px mr-1 ml-auto">
<a
href="#workshopVariations"
data-turbo="false"
class="
px-3 py-1 rounded bg-gray-200 text-gray-500 text-sm
hover:bg-gray-300 hover:text-gray-700 transition-colors duration-200
Expand Down
5 changes: 5 additions & 0 deletions app/views/workshops/_show_lazy.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<%= turbo_frame_tag "show_lazy" do %>
<%= render "show_tags", workshop: workshop %>
<%= render "show_body", workshop: workshop %>
<%= render "show_associations", workshop: workshop %>
<% end %>
69 changes: 69 additions & 0 deletions app/views/workshops/_show_skeleton.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
<div class="bg-white border border-gray-200 rounded-xl shadow p-6 animate-pulse mt-6">
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

these skeletons are the best loaders

<!-- Top spacer -->
<div class="mt-6 h-4 w-1/3 bg-gray-200 rounded"></div>

<!-- Tabs -->
<div class="my-4">
<ul class="flex border-b border-gray-300 pb-4 gap-2">
<li>
<div class="h-8 w-24 bg-gray-200 rounded"></div>
</li>

<li class="ml-auto">
<div class="h-7 w-40 bg-gray-200 rounded"></div>
</li>
</ul>

<!-- Content -->
<div class="mt-6 ml-2 space-y-8">
<!-- Section: Objective -->
<div>
<div class="h-5 w-32 bg-gray-300 rounded mb-2"></div>
<div class="border-t border-gray-200 mb-3"></div>

<div class="space-y-2">
<div class="h-3 w-full bg-gray-200 rounded"></div>
<div class="h-3 w-11/12 bg-gray-200 rounded"></div>
<div class="h-3 w-10/12 bg-gray-200 rounded"></div>
</div>
</div>

<!-- Section: Materials -->
<div>
<div class="h-5 w-32 bg-gray-300 rounded mb-2"></div>
<div class="border-t border-gray-200 mb-3"></div>

<div class="space-y-2">
<div class="h-3 w-1/2 bg-gray-200 rounded"></div>
<div class="h-3 w-1/3 bg-gray-200 rounded"></div>
<div class="h-3 w-2/5 bg-gray-200 rounded"></div>
</div>
</div>

<!-- Section: Introduction -->
<div>
<div class="h-5 w-40 bg-gray-300 rounded mb-2"></div>
<div class="border-t border-gray-200 mb-3"></div>

<div class="space-y-2">
<div class="h-3 w-full bg-gray-200 rounded"></div>
<div class="h-3 w-full bg-gray-200 rounded"></div>
<div class="h-3 w-5/6 bg-gray-200 rounded"></div>
<div class="h-3 w-4/6 bg-gray-200 rounded"></div>
</div>
</div>

<!-- Section: Gallery -->
<div>
<div class="h-5 w-28 bg-gray-300 rounded mb-2"></div>
<div class="border-t border-gray-200 mb-4"></div>

<div class="flex flex-wrap gap-4">
<% 3.times do %>
<div class="w-32 h-32 bg-gray-200 rounded border border-gray-300"></div>
<% end %>
</div>
</div>
</div>
</div>
</div>
15 changes: 14 additions & 1 deletion app/views/workshops/show.html.erb
Original file line number Diff line number Diff line change
@@ -1 +1,14 @@
<%= render "show" %>
<div class="workshop-show max-w-7xl mx-auto <%= DomainTheme.bg_class_for(:workshops) %> border border-gray-200 rounded-xl shadow p-6">
<div class="flex flex-col gap-6">
<!-- Main Workshop Show -->
<div id="show" class="flex-1">
<!-- Tabs -->
<%= render "show_header", workshop: @workshop %>
<%= render "show_actions_row", workshop: @workshop %>

<%= turbo_frame_tag "show_lazy", src: workshop_path(@workshop), data: {turbo: false} do %>
<%= render 'show_skeleton' %>
<% end %>
</div>
</div>
</div>