<% title('Decks') %> <%= form_for(@deck, html: { class: 'form deck-submit' }) do |f| %>
Organize Deck
<%= render partial: 'builder_card', collection: @deck.cards, as: :card %>

Click cards to remove them from your deck. Drag to reorder.

Finalize Deck
<%= f.hidden_field :card_ids, value: @deck.cards.map(&:id).join(',') %>
<%= f.label :rule_id, 'Select a rule', class: 'mb-1' %> <%= f.collection_select :rule_id, Rule.all.sort_by(&:name), :id, :name, { include_blank: true }, class: 'form-control form-control-sm' %>
<%= f.label :npc_id, 'or an NPC', class: 'mb-1' %> <%= f.grouped_collection_select :npc_id, Location.all.includes(:alphabetical_npcs), :alphabetical_npcs, :name, :id, :name, { include_blank: true }, class: 'form-control form-control-sm' %>
or just create a general purpose deck.
<%= f.submit 'Publish Deck', class: 'btn btn-primary btn-sm', disabled: @deck.cards.size != 5 %>
Notes
<%= f.text_area :notes, { rows: 3, maxlength: 1000, class: 'form-control' } %>
<% end %>
Find Cards
<%= search_form_for(@q, class: 'form form-inline search-form d-flex justify-content-center mx-2 my-3', url: new_deck_path, enforce_utf8: false) do |f| %> <%= f.search_field "name_#{I18n.locale}_cont", placeholder: 'Name', size: 30, class: 'form-control form-control-sm' %> <%= f.search_field 'order_eq', placeholder: 'Number', size: 10, class: 'form-control form-control-sm' %> <%= f.collection_select :card_type_id_eq, CardType.all, :id, :name, { include_blank: 'All Types' }, class: 'form-control form-control-sm' %> <%= f.select :stars_eq, rarity_options, { include_blank: 'All Rarities' }, class: 'form-control form-control-sm' %> <%= submit_tag 'Search', name: nil, class: 'btn btn-secondary btn-sm' %> <% end %> <%= render 'cards/table_data', cards: @cards, skip_source: true, deck: @deck.cards.map(&:id) %>
# Name Type Rarity Stats