From d18a7da044b8fdb4ded49e05865b3dc743c4fb58 Mon Sep 17 00:00:00 2001 From: Kelly Rauchenberger Date: Wed, 27 Sep 2017 20:07:58 -0400 Subject: Continued working on design, added moves MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Still a very early design Also, for Pokémon that have Natures that don't benefit and hinder the same stat, there is now a + next to the stat that the Nature benefits, and a - next to the stat it hinders. --- app/assets/stylesheets/pokeviewer/pokemon.css.scss | 99 +++++++++++++++++++--- app/models/pokeviewer/pokemon.rb | 32 +++++++ app/views/layouts/pokeviewer/application.html.erb | 14 --- app/views/layouts/pokeviewer/application.html.haml | 15 ++++ app/views/pokeviewer/pokemon/show.html.haml | 95 +++++++++++++++------ 5 files changed, 203 insertions(+), 52 deletions(-) delete mode 100644 app/views/layouts/pokeviewer/application.html.erb create mode 100644 app/views/layouts/pokeviewer/application.html.haml diff --git a/app/assets/stylesheets/pokeviewer/pokemon.css.scss b/app/assets/stylesheets/pokeviewer/pokemon.css.scss index 766a0e0..077aaf7 100644 --- a/app/assets/stylesheets/pokeviewer/pokemon.css.scss +++ b/app/assets/stylesheets/pokeviewer/pokemon.css.scss @@ -3,10 +3,34 @@ They will automatically be included in application.css. */ +body { + +} + +#left-sidebar, #right-sidebar { + flex: 3 0px; +} + +#container { + display: flex; + +} + +#banner { + box-sizing: border-box; + height: 10em; + margin: 0 auto; + width: 60%; +} + +#content { + flex: 10 0px; +} + .trainer { margin: 1em; font-family: 'Power Green'; - width: 758px; +/* width: 758px;*/ box-sizing: border-box; background-color: #f7f7f7; border: 1px solid #999; @@ -70,6 +94,7 @@ .pc-boxes { display: flex; flex-wrap: wrap; + justify-content: space-between; .party { margin: 0; @@ -192,32 +217,86 @@ margin: .5em; } - .pokemon-memo { + .pokemon-column { + display: flex; + flex-direction: column; border-left: 1px solid #aaa; + + &>div + div { + border-top: 1px solid #aaa; + } + } + + .pokemon-row { + display: flex; + flex: 1 0px; + + &>div + div { + border-left: 1px solid #aaa; + } + } + + .pokemon-memo { background-color: #e7e8ff; + flex-grow: 1; .pd-details { - background-color: #2068e0; + background-color: #be3ff8; /*#d078f8;*/ + } + } + + .pokemon-moves { + flex-grow: 1; + + .pd-details { + background-color: #3fb5f8; + } + + ul { + display: flex; + flex-direction: column; + justify-content: space-between; + margin: 0; + padding: 0; + + li { + display: block; + padding: 0.25em; + box-sizing: border-box; + } } } .pokemon-stats { - border-left: 1px solid #aaa; + background-color: #d7f4f6; .pd-details { - background-color: #d078f8; + background-color: #2068e0; + border-bottom: 1px solid #A9C6C8; + } + + .nature-benefit { + color: green; + } + + .nature-hinder { + color: red; } table { - margin: 0 1em; + border-collapse: collapse; + border-style: hidden; + table-layout: fixed; - th { + th, td { text-align: center; - padding-right: .5em; + border: 1px solid #A9C6C8; + padding: 0.25em 0.25em; + width: 16.67%; } - td { - text-align: right; + th { + background-color: #bfdfff; } } } diff --git a/app/models/pokeviewer/pokemon.rb b/app/models/pokeviewer/pokemon.rb index 7a1d088..6c33406 100644 --- a/app/models/pokeviewer/pokemon.rb +++ b/app/models/pokeviewer/pokemon.rb @@ -137,6 +137,38 @@ module Pokeviewer end end + def nature_benefits?(stat) + if stat == :attack + [:lonely, :brave, :adamant, :naughty].include? nature.intern + elsif stat == :defense + [:bold, :relaxed, :impish, :lax].include? nature.intern + elsif stat == :speed + [:timid, :hasty, :jolly, :naive].include? nature.intern + elsif stat == :special_attack + [:modest, :mild, :quiet, :rash].include? nature.intern + elsif stat == :special_defense + [:calm, :gentle, :sassy, :careful].include? nature.intern + else + false + end + end + + def nature_hinders?(stat) + if stat == :attack + [:bold, :timid, :modest, :calm].include? nature.intern + elsif stat == :defense + [:lonely, :hasty, :mild, :gentle].include? nature.intern + elsif stat == :speed + [:brave, :relaxed, :quiet, :sassy].include? nature.intern + elsif stat == :special_attack + [:adamant, :impish, :jolly, :careful].include? nature.intern + elsif stat == :special_defense + [:naughty, :lax, :naive, :rash].include? nature.intern + else + false + end + end + private def set_uuid diff --git a/app/views/layouts/pokeviewer/application.html.erb b/app/views/layouts/pokeviewer/application.html.erb deleted file mode 100644 index 192490c..0000000 --- a/app/views/layouts/pokeviewer/application.html.erb +++ /dev/null @@ -1,14 +0,0 @@ - - - - Pokeviewer - <%= stylesheet_link_tag "pokeviewer/application", media: "all" %> - <%= javascript_include_tag "pokeviewer/application" %> - <%= csrf_meta_tags %> - - - -<%= yield %> - - - diff --git a/app/views/layouts/pokeviewer/application.html.haml b/app/views/layouts/pokeviewer/application.html.haml new file mode 100644 index 0000000..6bce8b9 --- /dev/null +++ b/app/views/layouts/pokeviewer/application.html.haml @@ -0,0 +1,15 @@ +!!! 5 +%html + %head + %title Pokeviewer + = stylesheet_link_tag "pokeviewer/application", media: "all" + = javascript_include_tag "pokeviewer/application" + = csrf_meta_tags + %body + %header#banner Pokéviewer + #container + #left-sidebar + Sidebar stuff + #content= yield + #right-sidebar + Sidebar stuff diff --git a/app/views/pokeviewer/pokemon/show.html.haml b/app/views/pokeviewer/pokemon/show.html.haml index 18a6788..232d6bc 100644 --- a/app/views/pokeviewer/pokemon/show.html.haml +++ b/app/views/pokeviewer/pokemon/show.html.haml @@ -9,31 +9,70 @@ %span{ class: @pokemon.ot_gender }>= @pokemon.ot_name .pokemon-id= "ID/#{@pokemon.display_ot_number}" .pokemon-level= "Lv. #{@pokemon.revisions.last.level}" - .pokemon-memo - .pd-details Trainer Memo - .pd-contents - %p - %span.pokemon-nature<= @pokemon.nature.titlecase - nature. - %p= @pokemon.display_met - .pokemon-stats - .pd-details Stats - %table.pd-contents - %tr - %th HP - %td= @pokemon.revisions.last.hp - %tr - %th Attack - %td= @pokemon.revisions.last.attack - %tr - %th Defense - %td= @pokemon.revisions.last.defense - %tr - %th Sp. Atk - %td= @pokemon.revisions.last.special_attack - %tr - %th Sp. Def - %td= @pokemon.revisions.last.special_defense - %tr - %th Speed - %td= @pokemon.revisions.last.speed + .pokemon-column + .pokemon-stats + .pd-details Stats + %table.pd-contents + %tr + %th HP + %th + Attack + - if @pokemon.nature_benefits?(:attack) + %span.nature-benefit + + - if @pokemon.nature_hinders?(:attack) + %span.nature-hinder - + %th + Defense + - if @pokemon.nature_benefits?(:defense) + %span.nature-benefit + + - if @pokemon.nature_hinders?(:defense) + %span.nature-hinder - + %th + Sp. Atk + - if @pokemon.nature_benefits?(:special_attack) + %span.nature-benefit + + - if @pokemon.nature_hinders?(:special_attack) + %span.nature-hinder - + %th + Sp. Def + - if @pokemon.nature_benefits?(:special_defense) + %span.nature-benefit + + - if @pokemon.nature_hinders?(:special_defense) + %span.nature-hinder - + %th + Speed + - if @pokemon.nature_benefits?(:speed) + %span.nature-benefit + + - if @pokemon.nature_hinders?(:speed) + %span.nature-hinder - + %tr + %td= @pokemon.revisions.last.hp + %td= @pokemon.revisions.last.attack + %td= @pokemon.revisions.last.defense + %td= @pokemon.revisions.last.special_attack + %td= @pokemon.revisions.last.special_defense + %td= @pokemon.revisions.last.speed + .pokemon-row + .pokemon-moves + .pd-details Moves + %ul + %li= @pokemon.revisions.last.move_1.name + - if @pokemon.revisions.last.move_2 + %li= @pokemon.revisions.last.move_2.name + - else + %li - + - if @pokemon.revisions.last.move_3 + %li= @pokemon.revisions.last.move_3.name + - else + %li - + - if @pokemon.revisions.last.move_4 + %li= @pokemon.revisions.last.move_4.name + - else + %li - + .pokemon-memo + .pd-details Trainer Memo + .pd-contents + %p + %span.pokemon-nature<= @pokemon.nature.titlecase + nature. + %p= @pokemon.display_met -- cgit 1.4.1