mirror of
https://github.com/ryankazokas/turbovault-app.git
synced 2026-04-17 06:42:53 +00:00
105 lines
4.2 KiB
Plaintext
105 lines
4.2 KiB
Plaintext
<div>
|
|
<div class="flex justify-between items-center mb-6">
|
|
<div>
|
|
<h1 class="text-3xl font-bold"><%= @collection.name %></h1>
|
|
<% if @collection.subcollection? %>
|
|
<p class="text-gray-600 mt-1">
|
|
Subcollection of <%= link_to @collection.parent_collection.name, @collection.parent_collection, class: "text-indigo-600 hover:text-indigo-800" %>
|
|
</p>
|
|
<% end %>
|
|
</div>
|
|
<div class="flex space-x-2">
|
|
<%= link_to "Edit", edit_collection_path(@collection), class: "px-4 py-2 bg-indigo-600 text-white rounded hover:bg-indigo-700" %>
|
|
<%= button_to "Delete", @collection, method: :delete, data: { turbo_confirm: "Are you sure you want to delete '#{@collection.name}'? This will permanently remove the collection but games in it will not be deleted." }, class: "px-4 py-2 bg-red-600 text-white rounded hover:bg-red-700" %>
|
|
</div>
|
|
</div>
|
|
|
|
<% if @collection.description.present? %>
|
|
<div class="bg-white p-6 rounded-lg shadow mb-6">
|
|
<p class="text-gray-700"><%= @collection.description %></p>
|
|
</div>
|
|
<% end %>
|
|
|
|
<div class="bg-white p-6 rounded-lg shadow mb-6">
|
|
<div class="grid grid-cols-2 gap-4">
|
|
<div>
|
|
<div class="text-gray-500 text-sm">Total Games</div>
|
|
<div class="text-3xl font-bold"><%= @collection.game_count %></div>
|
|
</div>
|
|
|
|
<% if @collection.subcollections.any? %>
|
|
<div>
|
|
<div class="text-gray-500 text-sm">Subcollections</div>
|
|
<div class="text-3xl font-bold"><%= @collection.subcollections.count %></div>
|
|
</div>
|
|
<% end %>
|
|
</div>
|
|
</div>
|
|
|
|
<% if @collection.subcollections.any? %>
|
|
<div class="bg-white p-6 rounded-lg shadow mb-6">
|
|
<h2 class="text-xl font-bold mb-4">Subcollections</h2>
|
|
<div class="grid grid-cols-1 md:grid-cols-3 gap-4">
|
|
<% @collection.subcollections.each do |subcollection| %>
|
|
<div class="border border-gray-200 p-4 rounded-lg">
|
|
<%= link_to subcollection.name, subcollection, class: "font-semibold text-indigo-600 hover:text-indigo-800" %>
|
|
<div class="text-sm text-gray-500 mt-1">
|
|
<%= pluralize(subcollection.game_count, "game") %>
|
|
</div>
|
|
</div>
|
|
<% end %>
|
|
</div>
|
|
</div>
|
|
<% end %>
|
|
|
|
<div class="bg-white p-6 rounded-lg shadow">
|
|
<h2 class="text-xl font-bold mb-4">Games in Collection</h2>
|
|
|
|
<% if @games.any? %>
|
|
<div class="space-y-4">
|
|
<% @games.each do |game| %>
|
|
<div class="border-b pb-4 last:border-b-0">
|
|
<div class="flex justify-between items-start">
|
|
<div>
|
|
<%= link_to game.title, game, class: "text-lg font-semibold text-indigo-600 hover:text-indigo-800" %>
|
|
<div class="text-sm text-gray-500 mt-1">
|
|
<%= game.platform.name %>
|
|
·
|
|
<span class="<%= game.physical? ? 'text-blue-600' : 'text-green-600' %>">
|
|
<%= game.format.titleize %>
|
|
</span>
|
|
<% if game.completion_status %>
|
|
· <%= game.completion_status.titleize %>
|
|
<% end %>
|
|
<% if game.user_rating %>
|
|
· ⭐ <%= game.user_rating %>/5
|
|
<% end %>
|
|
</div>
|
|
<% if game.genres.any? %>
|
|
<div class="mt-2 flex flex-wrap gap-1">
|
|
<% game.genres.each do |genre| %>
|
|
<span class="px-2 py-1 bg-gray-100 text-gray-600 rounded text-xs"><%= genre.name %></span>
|
|
<% end %>
|
|
</div>
|
|
<% end %>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<% end %>
|
|
</div>
|
|
|
|
<% if @games.respond_to?(:total_pages) && @games.total_pages > 1 %>
|
|
<div class="mt-6">
|
|
<%#= paginate @games %>
|
|
</div>
|
|
<% end %>
|
|
<% else %>
|
|
<p class="text-gray-500">No games in this collection yet. <%= link_to "Add games", games_path, class: "text-indigo-600 hover:text-indigo-800" %> to get started.</p>
|
|
<% end %>
|
|
</div>
|
|
|
|
<div class="mt-6">
|
|
<%= link_to "← Back to Collections", collections_path, class: "text-indigo-600 hover:text-indigo-800" %>
|
|
</div>
|
|
</div>
|