porkchopclub/porkchop

View on GitHub
app/views/players/show.html.haml

Summary

Maintainability
Test Coverage
.page-header
  .page-header-inner
    %h1.page-header-title= @player.name
    - if @player == current_player
      .page-header-links
        = link_to "Edit Player", edit_player_registration_path

.outer-container
  .player-summary.porkbox-light
    - if @player.profile_picture?
      = image_tag @player.profile_picture.url, class: "player-summary-avatar"
    .player-summary-content
      - if @player.nickname.present?
        %p= "Nickname: #{@player.nickname}"
      %ul
        %li
          %strong Elo:
          = @player.elo
        - if @player.current_streak
          %li
            %strong Streak:
            = "#{@player.current_streak.streak_type}#{@player.current_streak.streak_length}"

  - if last_played_match = @player.matches.finalized.last
    = cache [@player.id, last_played_match] do
      = render "players/stats", player: @player
  - else
    .porkbox-light
      %p This player hasn't even played a game yet. What were you expecting to see?