Moving to github

This commit is contained in:
2026-03-28 19:24:29 -04:00
commit 036fa7ab33
302 changed files with 17838 additions and 0 deletions

View File

@@ -0,0 +1,32 @@
<%= form_with model: collection, class: "space-y-6" do |f| %>
<% if collection.errors.any? %>
<div class="bg-red-100 border border-red-400 text-red-700 px-4 py-3 rounded">
<ul>
<% collection.errors.full_messages.each do |message| %>
<li><%= message %></li>
<% end %>
</ul>
</div>
<% end %>
<div>
<%= f.label :name, class: "block text-sm font-medium text-gray-700" %>
<%= f.text_field :name, class: "mt-1 block w-full rounded-md border-gray-300 shadow-sm focus:border-indigo-500 focus:ring-indigo-500" %>
</div>
<div>
<%= f.label :description, class: "block text-sm font-medium text-gray-700" %>
<%= f.text_area :description, rows: 4, class: "mt-1 block w-full rounded-md border-gray-300 shadow-sm focus:border-indigo-500 focus:ring-indigo-500" %>
</div>
<div>
<%= f.label :parent_collection_id, "Parent Collection (optional)", class: "block text-sm font-medium text-gray-700" %>
<%= f.collection_select :parent_collection_id, @collections, :id, :name, { include_blank: "None (Root Collection)" }, class: "mt-1 block w-full rounded-md border-gray-300 shadow-sm focus:border-indigo-500 focus:ring-indigo-500" %>
<p class="mt-1 text-sm text-gray-500">Subcollections can only be one level deep</p>
</div>
<div class="flex justify-between">
<%= f.submit class: "px-6 py-2 bg-indigo-600 text-white rounded-md hover:bg-indigo-700" %>
<%= link_to "Cancel", collection.persisted? ? collection : collections_path, class: "px-6 py-2 bg-gray-200 text-gray-700 rounded-md hover:bg-gray-300" %>
</div>
<% end %>

View File

@@ -0,0 +1,4 @@
<div>
<h1 class="font-bold text-4xl">Collections#create</h1>
<p>Find me in app/views/collections/create.html.erb</p>
</div>

View File

@@ -0,0 +1,4 @@
<div>
<h1 class="font-bold text-4xl">Collections#destroy</h1>
<p>Find me in app/views/collections/destroy.html.erb</p>
</div>

View File

@@ -0,0 +1,7 @@
<div class="max-w-2xl mx-auto">
<h1 class="text-3xl font-bold mb-6">Edit Collection</h1>
<div class="bg-white p-6 rounded-lg shadow">
<%= render "form", collection: @collection %>
</div>
</div>

View File

@@ -0,0 +1,4 @@
<div>
<h1 class="font-bold text-4xl">Collections#games</h1>
<p>Find me in app/views/collections/games.html.erb</p>
</div>

View File

@@ -0,0 +1,51 @@
<div>
<div class="flex justify-between items-center mb-6">
<h1 class="text-3xl font-bold">My Collections</h1>
<%= link_to "New Collection", new_collection_path, class: "px-4 py-2 bg-indigo-600 text-white rounded hover:bg-indigo-700" %>
</div>
<% if @root_collections.any? %>
<div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6">
<% @root_collections.each do |collection| %>
<div class="bg-white p-6 rounded-lg shadow">
<h2 class="text-xl font-bold mb-2">
<%= link_to collection.name, collection, class: "text-indigo-600 hover:text-indigo-800" %>
</h2>
<% if collection.description.present? %>
<p class="text-gray-600 mb-4"><%= truncate(collection.description, length: 100) %></p>
<% end %>
<div class="text-sm text-gray-500 mb-4">
<%= pluralize(collection.game_count, "game") %>
</div>
<% if collection.subcollections.any? %>
<div class="mb-4">
<p class="text-sm font-medium text-gray-700 mb-2">Subcollections:</p>
<div class="space-y-1">
<% collection.subcollections.each do |subcollection| %>
<div class="text-sm">
<%= link_to subcollection.name, subcollection, class: "text-indigo-600 hover:text-indigo-800" %>
(<%= pluralize(subcollection.game_count, "game") %>)
</div>
<% end %>
</div>
</div>
<% end %>
<div class="flex space-x-2 mt-4">
<%= link_to "View", collection, class: "text-indigo-600 hover:text-indigo-800 text-sm" %>
<%= link_to "Edit", edit_collection_path(collection), class: "text-blue-600 hover:text-blue-800 text-sm" %>
<%= button_to "Delete", collection, method: :delete, data: { turbo_confirm: "Are you sure you want to delete the collection '#{collection.name}'? Games in this collection will not be deleted." }, class: "text-red-600 hover:text-red-800 text-sm" %>
</div>
</div>
<% end %>
</div>
<% else %>
<div class="bg-white p-8 rounded-lg shadow text-center">
<p class="text-gray-500 mb-4">You haven't created any collections yet.</p>
<%= link_to "Create Your First Collection", new_collection_path, class: "text-indigo-600 hover:text-indigo-800" %>
</div>
<% end %>
</div>

View File

@@ -0,0 +1,7 @@
<div class="max-w-2xl mx-auto">
<h1 class="text-3xl font-bold mb-6">New Collection</h1>
<div class="bg-white p-6 rounded-lg shadow">
<%= render "form", collection: @collection %>
</div>
</div>

View File

@@ -0,0 +1,104 @@
<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>

View File

@@ -0,0 +1,4 @@
<div>
<h1 class="font-bold text-4xl">Collections#update</h1>
<p>Find me in app/views/collections/update.html.erb</p>
</div>