mirror of
https://github.com/ryankazokas/turbovault-app.git
synced 2026-04-17 06:42:53 +00:00
Moving to github
This commit is contained in:
148
app/views/games/bulk_edit.html.erb
Normal file
148
app/views/games/bulk_edit.html.erb
Normal file
@@ -0,0 +1,148 @@
|
||||
<div class="max-w-4xl mx-auto">
|
||||
<h1 class="text-3xl font-bold mb-6">Bulk Edit <%= pluralize(@games.count, "Game") %></h1>
|
||||
|
||||
<div class="bg-blue-50 border-l-4 border-blue-400 p-4 mb-6">
|
||||
<div class="flex">
|
||||
<div class="flex-shrink-0">
|
||||
<svg class="h-5 w-5 text-blue-400" viewBox="0 0 20 20" fill="currentColor">
|
||||
<path fill-rule="evenodd" d="M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a1 1 0 000 2v3a1 1 0 001 1h1a1 1 0 100-2v-3a1 1 0 00-1-1H9z" clip-rule="evenodd" />
|
||||
</svg>
|
||||
</div>
|
||||
<div class="ml-3">
|
||||
<p class="text-sm text-blue-700">
|
||||
<strong>Tip:</strong> Only fill in the fields you want to update. Empty fields will be left unchanged.
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="bg-white p-6 rounded-lg shadow mb-6">
|
||||
<h2 class="text-xl font-bold mb-4">Selected Games</h2>
|
||||
<div class="space-y-1">
|
||||
<% @games.each do |game| %>
|
||||
<div class="text-sm text-gray-700">• <%= game.title %> (<%= game.platform.name %>)</div>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<%= form_with url: bulk_update_games_path, method: :patch, class: "bg-white p-6 rounded-lg shadow space-y-6" do |f| %>
|
||||
<% @game_ids.each do |id| %>
|
||||
<%= hidden_field_tag "game_ids[]", id %>
|
||||
<% end %>
|
||||
|
||||
<div class="grid grid-cols-1 md:grid-cols-2 gap-6">
|
||||
<div>
|
||||
<%= label_tag :completion_status, "Completion Status", class: "block text-sm font-medium text-gray-700" %>
|
||||
<%= select_tag :completion_status,
|
||||
options_for_select([
|
||||
["Don't Change", ""],
|
||||
["Backlog", "backlog"],
|
||||
["Currently Playing", "currently_playing"],
|
||||
["Completed", "completed"],
|
||||
["On Hold", "on_hold"],
|
||||
["Not Playing", "not_playing"]
|
||||
]),
|
||||
class: "mt-1 block w-full rounded-md border-gray-300 shadow-sm focus:border-indigo-500 focus:ring-indigo-500" %>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<%= label_tag :condition, "Condition (Physical Games)", class: "block text-sm font-medium text-gray-700" %>
|
||||
<%= select_tag :condition,
|
||||
options_for_select([
|
||||
["Don't Change", ""],
|
||||
["CIB (Complete in Box)", "cib"],
|
||||
["Loose", "loose"],
|
||||
["Sealed", "sealed"],
|
||||
["Good", "good"],
|
||||
["Fair", "fair"]
|
||||
]),
|
||||
class: "mt-1 block w-full rounded-md border-gray-300 shadow-sm focus:border-indigo-500 focus:ring-indigo-500" %>
|
||||
</div>
|
||||
|
||||
<div class="md:col-span-2">
|
||||
<%= label_tag :location, "Location", class: "block text-sm font-medium text-gray-700" %>
|
||||
<%= text_field_tag :location, "",
|
||||
placeholder: "Leave empty to not change",
|
||||
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">Will update all selected games to this location</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="border-t pt-6">
|
||||
<h3 class="text-lg font-medium text-gray-900 mb-4">Collections</h3>
|
||||
|
||||
<div class="mb-4">
|
||||
<%= label_tag :collection_action, "Collection Action", class: "block text-sm font-medium text-gray-700" %>
|
||||
<%= select_tag :collection_action,
|
||||
options_for_select([
|
||||
["Don't Change", ""],
|
||||
["Add to Collections", "add"],
|
||||
["Remove from Collections", "remove"],
|
||||
["Replace Collections", "replace"]
|
||||
]),
|
||||
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">
|
||||
<strong>Add:</strong> Adds to existing collections |
|
||||
<strong>Remove:</strong> Removes from selected collections |
|
||||
<strong>Replace:</strong> Sets to only selected collections
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<% if @collections.any? %>
|
||||
<div class="space-y-2 max-h-48 overflow-y-auto border border-gray-300 rounded-md p-3 bg-gray-50">
|
||||
<% @collections.each do |collection| %>
|
||||
<div class="flex items-start">
|
||||
<%= check_box_tag "collection_ids[]", collection.id, false,
|
||||
id: "collection_ids_#{collection.id}",
|
||||
class: "rounded border-gray-300 text-indigo-600 focus:ring-indigo-500 mt-1" %>
|
||||
<%= label_tag "collection_ids_#{collection.id}", class: "ml-2 text-sm" do %>
|
||||
<span class="font-medium text-gray-900"><%= collection.name %></span>
|
||||
<% if collection.subcollection? %>
|
||||
<span class="text-gray-500 text-xs">(subcollection of <%= collection.parent_collection.name %>)</span>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
<% else %>
|
||||
<p class="text-gray-500 text-sm">
|
||||
No collections yet. <%= link_to "Create a collection", new_collection_path, class: "text-indigo-600 hover:text-indigo-800" %> first.
|
||||
</p>
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
<div class="border-t pt-6">
|
||||
<h3 class="text-lg font-medium text-gray-900 mb-4">Genres</h3>
|
||||
|
||||
<div class="mb-4">
|
||||
<%= label_tag :genre_action, "Genre Action", class: "block text-sm font-medium text-gray-700" %>
|
||||
<%= select_tag :genre_action,
|
||||
options_for_select([
|
||||
["Don't Change", ""],
|
||||
["Add Genres", "add"],
|
||||
["Remove Genres", "remove"],
|
||||
["Replace Genres", "replace"]
|
||||
]),
|
||||
class: "mt-1 block w-full rounded-md border-gray-300 shadow-sm focus:border-indigo-500 focus:ring-indigo-500" %>
|
||||
</div>
|
||||
|
||||
<div class="space-y-2 max-h-48 overflow-y-auto border border-gray-300 rounded-md p-3 bg-gray-50">
|
||||
<% @genres.each do |genre| %>
|
||||
<div class="inline-block mr-4">
|
||||
<%= check_box_tag "genre_ids[]", genre.id, false,
|
||||
id: "genre_ids_#{genre.id}",
|
||||
class: "rounded border-gray-300 text-indigo-600 focus:ring-indigo-500" %>
|
||||
<%= label_tag "genre_ids_#{genre.id}", genre.name, class: "ml-2 text-sm text-gray-700" %>
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="flex justify-between pt-6 border-t">
|
||||
<%= submit_tag "Update #{pluralize(@games.count, 'Game')}",
|
||||
class: "px-6 py-2 bg-indigo-600 text-white rounded-md hover:bg-indigo-700",
|
||||
data: { confirm: "Are you sure you want to update #{@games.count} game(s)?" } %>
|
||||
<%= link_to "Cancel", games_path, class: "px-6 py-2 bg-gray-200 text-gray-700 rounded-md hover:bg-gray-300" %>
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
Reference in New Issue
Block a user