From 3e4e4583fb751fb47013580ce86e2cc3a0e8353b Mon Sep 17 00:00:00 2001 From: Kelly Rauchenberger Date: Tue, 26 Sep 2017 17:47:16 -0400 Subject: Added section on homepage for Pokémon not in any game MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/assets/stylesheets/pokeviewer/pokemon.css.scss | 54 ++++++++++++++-------- app/controllers/pokeviewer/pokemon_controller.rb | 1 + app/models/pokeviewer/pokemon.rb | 2 +- app/views/pokeviewer/pokemon/index.html.haml | 13 ++++++ 4 files changed, 51 insertions(+), 19 deletions(-) diff --git a/app/assets/stylesheets/pokeviewer/pokemon.css.scss b/app/assets/stylesheets/pokeviewer/pokemon.css.scss index 83fac45..766a0e0 100644 --- a/app/assets/stylesheets/pokeviewer/pokemon.css.scss +++ b/app/assets/stylesheets/pokeviewer/pokemon.css.scss @@ -47,6 +47,14 @@ background-color: #4E8234; } + &.unaccounted { + background-color: black; + + h2 { + color: white; + } + } + h2 { margin: 0; display: inline-block; @@ -114,29 +122,39 @@ width: 32px; height: 32px; } - - .pc-pokemon { - .pc-data { - display: none; - background-color: #111; - color: #fff; - z-index: 1; - padding: .5em; - box-shadow: 0px 0px 2px 1px #B3B3B3; - border-radius: 4px; - position: absolute; - - .pc-data-name { - font-weight: bold; - white-space: pre; - } - } - } } } } } +.pc-pokemon { + .pc-data { + display: none; + background-color: #111; + color: #fff; + z-index: 1; + padding: .5em; + box-shadow: 0px 0px 2px 1px #B3B3B3; + border-radius: 4px; + position: absolute; + + .pc-data-name { + font-weight: bold; + white-space: pre; + } + } +} + +.pokemon-list { + display: flex; + flex-wrap: wrap; + padding: 0 1em; + + li { + display: block; + } +} + .pokemon { font-family: 'Power Green'; display: flex; diff --git a/app/controllers/pokeviewer/pokemon_controller.rb b/app/controllers/pokeviewer/pokemon_controller.rb index 44ee791..17bd83d 100644 --- a/app/controllers/pokeviewer/pokemon_controller.rb +++ b/app/controllers/pokeviewer/pokemon_controller.rb @@ -4,6 +4,7 @@ module Pokeviewer class PokemonController < ApplicationController def index @trainers = Trainer.all + @unaccounted = Pokemon.where(trainer: nil) end def show diff --git a/app/models/pokeviewer/pokemon.rb b/app/models/pokeviewer/pokemon.rb index e493c66..7a1d088 100644 --- a/app/models/pokeviewer/pokemon.rb +++ b/app/models/pokeviewer/pokemon.rb @@ -102,7 +102,7 @@ module Pokeviewer end def outsider? - (ot_name != trainer.name) or (ot_number != trainer.number) + (trainer.nil?) or (ot_name != trainer.name) or (ot_number != trainer.number) end def location diff --git a/app/views/pokeviewer/pokemon/index.html.haml b/app/views/pokeviewer/pokemon/index.html.haml index 436f48a..7cee27a 100644 --- a/app/views/pokeviewer/pokemon/index.html.haml +++ b/app/views/pokeviewer/pokemon/index.html.haml @@ -27,3 +27,16 @@ .pc-data-ot OT/ %span{ class: p.ot_gender }>= p.ot_name +- if @unaccounted.any? + .trainer + .trainer-info.unaccounted + %h2 Pokémon Not In Any Game + %ul.pokemon-list + - @unaccounted.each do |p| + %li.pc-pokemon + = link_to image_tag(p.icon_path), p + .pc-data + .pc-data-name= p.revisions.last.nickname + .pc-data-ot + OT/ + %span{ class: p.ot_gender }>= p.ot_name -- cgit 1.4.1