Bulk Edit <%= pluralize(@games.count, "Game") %>

Tip: Only fill in the fields you want to update. Empty fields will be left unchanged.

Selected Games

<% @games.each do |game| %>
• <%= game.title %> (<%= game.platform.name %>)
<% end %>
<%= 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 %>
<%= 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" %>
<%= 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" %>
<%= 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" %>

Will update all selected games to this location

Collections

<%= 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" %>

Add: Adds to existing collections | Remove: Removes from selected collections | Replace: Sets to only selected collections

<% if @collections.any? %>
<% @collections.each do |collection| %>
<%= 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 %> <%= collection.name %> <% if collection.subcollection? %> (subcollection of <%= collection.parent_collection.name %>) <% end %> <% end %>
<% end %>
<% else %>

No collections yet. <%= link_to "Create a collection", new_collection_path, class: "text-indigo-600 hover:text-indigo-800" %> first.

<% end %>

Genres

<%= 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" %>
<% @genres.each do |genre| %>
<%= 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" %>
<% end %>
<%= 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" %>
<% end %>