<% title('Decks') %> <% description("#{purpose(@deck)} deck by #{@deck.user.username}") %>
Details
<% if current_user&.id == @deck.user_id %> <%= link_to 'Edit', edit_deck_path(@deck), class: 'btn btn-secondary btn-sm' %> <% end %> <% if current_user&.id == @deck.user_id || current_user&.admin? %> <%= link_to 'Delete', deck_path(@deck), method: :delete, class: 'btn btn-danger btn-sm', data: { confirm: 'Are you sure you want to delete this deck?' } %> <% end %>
Purpose
<%= purpose(@deck) %>
Rating
<%= @deck.rating %>
<% if user_signed_in? %>
Usable
<%= usable?(@deck, @user_cards) %>
<% end %>
Updated
<%= deck_patch(@deck) %>
Created by
<%= @deck.user.username %>
Cards
<% if user_signed_in? %> <% if voted?(@deck) %> <%= link_to fa_icon('check-circle', text: 'Voted'), deck_downvote_path(@deck), method: :post, class: 'btn btn-success btn-sm vote-down' %> <% else %> <%= link_to fa_icon('arrow-circle-up', text: 'Vote'), deck_upvote_path(@deck), method: :post, class: 'btn btn-primary btn-sm vote-up' %> <% end %> <% end %>
<%= render partial: 'cards/large', layout: 'card', collection: @deck.cards, as: :card %>
<% if @deck.notes.present? %>
Notes
<%= @deck.notes.gsub("\r\n", '
').html_safe %>
<% end %> <% if user_signed_in? %>
Card Finder
<% @deck.cards.each_with_index do |card, i| %>

<%= link_to(card.name, card_path(card), class: 'unstyled') %>: <%= card_position(card, @user_card_ids) %>

<% end %>
<% end %>