<% title('Decks') %>
<% if user_signed_in? %>

<%= 'My ' if params[:action] == 'mine' %>Decks

<% if params[:action] == 'mine' %> <%= link_to 'All Decks', decks_path, class: 'btn btn-sm btn-primary' %> <% else %> <%= link_to 'My Decks', my_decks_path, class: 'btn btn-sm btn-primary' %> <% end %> <%= link_to 'New Deck', new_deck_path, class: 'btn btn-sm btn-success' %>
<% else %>

Decks

<% end %>
<%= search_form_for(@q, enforce_utf8: false, url: request.path, class: 'form form-inline search-form d-flex justify-content-center mx-2 my-3') do |f| %> <%= f.collection_select :rule_id_eq, Rule.all.sort_by(&:name), :id, :name, { include_blank: 'Filter by Rule' }, class: 'form-control form-control-sm'%> <%= f.grouped_collection_select :npc_id_eq, Location.all.includes(:alphabetical_npcs), :alphabetical_npcs, :name, :id, :name, { include_blank: 'Filter by NPC' }, class: 'form-control form-control-sm' %>
<%= check_box_tag :general, 1, params[:general], class: 'form-check-input checkbox' %> <%= label_tag :general, 'General Use', class: 'form-check-label' %> <%= check_box_tag :updated, 1, params[:updated], class: 'form-check-input checkbox' %> <%= label_tag :updated, 'Only Updated', class: 'form-check-label' %>
<%= f.submit 'Search', name: nil, class: 'btn btn-secondary btn-sm' %> <% end %> <% if user_signed_in? %> <% end %> <% @decks.each do |deck| %> <% if user_signed_in? %> <% end %> <% end %>
Purpose Rating Created by CardsUsableUpdated
<%= purpose(deck) %> <%= deck.rating %> <%= deck.user.username.truncate(20) %>
<% deck.cards.each do |card| %> <%= link_to(card_path(card), data: { toggle: 'tooltip', title: "#{card.name}" }, class: ('card-missing' if @user_cards.present? && !@user_cards.include?(card.id))) do %> <%= small_image(card) %> <% end %> <% end %>
<%= usable?(deck, @user_cards) %> <%= deck_patch(deck) %> <% if deck.user_id == current_user&.id %> <%= link_to fa_icon('pencil', class: 'btn btn-secondary btn-sm'), edit_deck_path(deck) %> <% end %> <%= link_to fa_icon('list', class: 'btn btn-secondary btn-sm'), deck_path(deck) %>
<% if will_paginate(@decks) %> <% end %>