pboksz/steam-card-tracker

View on GitHub
app/views/admin/games/index.haml

Summary

Maintainability
Test Coverage
.admin.games
  #flash-messages
    - flash.each do |type, message|
      %div{ class: type }= message

  .header
    %h1
      Admin Panel
      = link_to admin_logout_path, class: "logout" do
        = icon('fas', 'sign-out-alt')

  %h2 Add a new game
  = form_for game, url: admin_games_path, method: :post do |f|
    = f.text_field :name, placeholder: 'New Game Title'
    = f.submit 'Save'

  %h2 Already in the database
  - games.each do |game|
    = form_for game, url: admin_game_path(game), method: :put do |f|
      .game
        %span.updated= "#{game.updated_at.to_date} | #{game.items.count.to_s.rjust(2, "0")} Items"
        = f.text_field :name
        = f.submit 'Update'