Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Gizmo: SectionNavigation #1964

Merged
merged 1 commit into from
Nov 25, 2023
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
6 changes: 6 additions & 0 deletions app/furniture/section_navigation.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# frozen_string_literal: true

class SectionNavigation
def self.router
end
end
1 change: 1 addition & 0 deletions app/furniture/section_navigation/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# SectionNavigation
9 changes: 9 additions & 0 deletions app/furniture/section_navigation/section_navigation.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
class SectionNavigation
class SectionNavigation < Furniture
location(parent: :room)

def rooms
space.rooms.where.not(id: space.entrance_id)
end
end
end
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<div class="mt-3 grid grid-cols-1 gap-5 sm:gap-6 sm:grid-cols-2 lg:grid-cols-4 items-center">
<% policy_scope(section_navigation.rooms).each do |room| %>
<%= link_to [room.space, room], class: "no-underline" do %>
<%= render CardComponent.new(
data: { access_level: room.access_level, slug: room.slug, model: "room", id: room.id },
classes: "group self-stretch hover:bg-orange-50"
) do %>
<div class="px-4 py-5 flex items-center justify-between">
<h3 class="text-base font-semibold text-orange-500 group-hover:text-orange-400">
<%= room.name %>
</h3>

<button class="rounded-full bg-orange-500 p-1 ml-2 text-white shadow-sm group-hover:bg-orange-400" data-role="enter">
<%= render SvgComponent.new(classes: "h-5 w-5") do %>
<path stroke-linecap="round" stroke-linejoin="round" d="M8.25 4.5l7.5 7.5-7.5 7.5" />
<% end %>
</button>
</div>
<%- end %>
<%- end %>
<% end %>
</div>
1 change: 1 addition & 0 deletions app/models/furniture.rb
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ def self.registry
markdown_text_block: ::MarkdownTextBlock,
marketplace: ::Marketplace::Marketplace,
livestream: ::Livestream,
section_navigation: SectionNavigation::SectionNavigation,
embedded_form: EmbeddedForm
}
end
Expand Down