about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorKelly Rauchenberger <fefferburbia@gmail.com>2017-09-27 20:07:58 -0400
committerKelly Rauchenberger <fefferburbia@gmail.com>2017-09-27 20:07:58 -0400
commitd18a7da044b8fdb4ded49e05865b3dc743c4fb58 (patch)
treed82c290e5badbe76a09e1a3e05267dfcf5599abd
parent3e4e4583fb751fb47013580ce86e2cc3a0e8353b (diff)
downloadpokeviewer-d18a7da044b8fdb4ded49e05865b3dc743c4fb58.tar.gz
pokeviewer-d18a7da044b8fdb4ded49e05865b3dc743c4fb58.tar.bz2
pokeviewer-d18a7da044b8fdb4ded49e05865b3dc743c4fb58.zip
Continued working on design, added moves
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.
-rw-r--r--app/assets/stylesheets/pokeviewer/pokemon.css.scss99
-rw-r--r--app/models/pokeviewer/pokemon.rb32
-rw-r--r--app/views/layouts/pokeviewer/application.html.erb14
-rw-r--r--app/views/layouts/pokeviewer/application.html.haml15
-rw-r--r--app/views/pokeviewer/pokemon/show.html.haml95
5 files changed, 203 insertions, 52 deletions
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 @@
3 They will automatically be included in application.css. 3 They will automatically be included in application.css.
4*/ 4*/
5 5
6body {
7
8}
9
10#left-sidebar, #right-sidebar {
11 flex: 3 0px;
12}
13
14#container {
15 display: flex;
16
17}
18
19#banner {
20 box-sizing: border-box;
21 height: 10em;
22 margin: 0 auto;
23 width: 60%;
24}
25
26#content {
27 flex: 10 0px;
28}
29
6.trainer { 30.trainer {
7 margin: 1em; 31 margin: 1em;
8 font-family: 'Power Green'; 32 font-family: 'Power Green';
9 width: 758px; 33/* width: 758px;*/
10 box-sizing: border-box; 34 box-sizing: border-box;
11 background-color: #f7f7f7; 35 background-color: #f7f7f7;
12 border: 1px solid #999; 36 border: 1px solid #999;
@@ -70,6 +94,7 @@
70 .pc-boxes { 94 .pc-boxes {
71 display: flex; 95 display: flex;
72 flex-wrap: wrap; 96 flex-wrap: wrap;
97 justify-content: space-between;
73 98
74 .party { 99 .party {
75 margin: 0; 100 margin: 0;
@@ -192,32 +217,86 @@
192 margin: .5em; 217 margin: .5em;
193 } 218 }
194 219
195 .pokemon-memo { 220 .pokemon-column {
221 display: flex;
222 flex-direction: column;
196 border-left: 1px solid #aaa; 223 border-left: 1px solid #aaa;
224
225 &>div + div {
226 border-top: 1px solid #aaa;
227 }
228 }
229
230 .pokemon-row {
231 display: flex;
232 flex: 1 0px;
233
234 &>div + div {
235 border-left: 1px solid #aaa;
236 }
237 }
238
239 .pokemon-memo {
197 background-color: #e7e8ff; 240 background-color: #e7e8ff;
241 flex-grow: 1;
198 242
199 .pd-details { 243 .pd-details {
200 background-color: #2068e0; 244 background-color: #be3ff8; /*#d078f8;*/
245 }
246 }
247
248 .pokemon-moves {
249 flex-grow: 1;
250
251 .pd-details {
252 background-color: #3fb5f8;
253 }
254
255 ul {
256 display: flex;
257 flex-direction: column;
258 justify-content: space-between;
259 margin: 0;
260 padding: 0;
261
262 li {
263 display: block;
264 padding: 0.25em;
265 box-sizing: border-box;
266 }
201 } 267 }
202 } 268 }
203 269
204 .pokemon-stats { 270 .pokemon-stats {
205 border-left: 1px solid #aaa; 271 background-color: #d7f4f6;
206 272
207 .pd-details { 273 .pd-details {
208 background-color: #d078f8; 274 background-color: #2068e0;
275 border-bottom: 1px solid #A9C6C8;
276 }
277
278 .nature-benefit {
279 color: green;
280 }
281
282 .nature-hinder {
283 color: red;
209 } 284 }
210 285
211 table { 286 table {
212 margin: 0 1em; 287 border-collapse: collapse;
288 border-style: hidden;
289 table-layout: fixed;
213 290
214 th { 291 th, td {
215 text-align: center; 292 text-align: center;
216 padding-right: .5em; 293 border: 1px solid #A9C6C8;
294 padding: 0.25em 0.25em;
295 width: 16.67%;
217 } 296 }
218 297
219 td { 298 th {
220 text-align: right; 299 background-color: #bfdfff;
221 } 300 }
222 } 301 }
223 } 302 }
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
137 end 137 end
138 end 138 end
139 139
140 def nature_benefits?(stat)
141 if stat == :attack
142 [:lonely, :brave, :adamant, :naughty].include? nature.intern
143 elsif stat == :defense
144 [:bold, :relaxed, :impish, :lax].include? nature.intern
145 elsif stat == :speed
146 [:timid, :hasty, :jolly, :naive].include? nature.intern
147 elsif stat == :special_attack
148 [:modest, :mild, :quiet, :rash].include? nature.intern
149 elsif stat == :special_defense
150 [:calm, :gentle, :sassy, :careful].include? nature.intern
151 else
152 false
153 end
154 end
155
156 def nature_hinders?(stat)
157 if stat == :attack
158 [:bold, :timid, :modest, :calm].include? nature.intern
159 elsif stat == :defense
160 [:lonely, :hasty, :mild, :gentle].include? nature.intern
161 elsif stat == :speed
162 [:brave, :relaxed, :quiet, :sassy].include? nature.intern
163 elsif stat == :special_attack
164 [:adamant, :impish, :jolly, :careful].include? nature.intern
165 elsif stat == :special_defense
166 [:naughty, :lax, :naive, :rash].include? nature.intern
167 else
168 false
169 end
170 end
171
140 private 172 private
141 173
142 def set_uuid 174 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 @@
1<!DOCTYPE html>
2<html>
3<head>
4 <title>Pokeviewer</title>
5 <%= stylesheet_link_tag "pokeviewer/application", media: "all" %>
6 <%= javascript_include_tag "pokeviewer/application" %>
7 <%= csrf_meta_tags %>
8</head>
9<body>
10
11<%= yield %>
12
13</body>
14</html>
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 @@
1!!! 5
2%html
3 %head
4 %title Pokeviewer
5 = stylesheet_link_tag "pokeviewer/application", media: "all"
6 = javascript_include_tag "pokeviewer/application"
7 = csrf_meta_tags
8 %body
9 %header#banner Pokéviewer
10 #container
11 #left-sidebar
12 Sidebar stuff
13 #content= yield
14 #right-sidebar
15 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 @@
9 %span{ class: @pokemon.ot_gender }>= @pokemon.ot_name 9 %span{ class: @pokemon.ot_gender }>= @pokemon.ot_name
10 .pokemon-id= "ID/#{@pokemon.display_ot_number}" 10 .pokemon-id= "ID/#{@pokemon.display_ot_number}"
11 .pokemon-level= "Lv. #{@pokemon.revisions.last.level}" 11 .pokemon-level= "Lv. #{@pokemon.revisions.last.level}"
12 .pokemon-memo 12 .pokemon-column
13 .pd-details Trainer Memo 13 .pokemon-stats
14 .pd-contents 14 .pd-details Stats
15 %p 15 %table.pd-contents
16 %span.pokemon-nature<= @pokemon.nature.titlecase 16 %tr
17 nature. 17 %th HP
18 %p= @pokemon.display_met 18 %th
19 .pokemon-stats 19 Attack
20 .pd-details Stats 20 - if @pokemon.nature_benefits?(:attack)
21 %table.pd-contents 21 %span.nature-benefit +
22 %tr 22 - if @pokemon.nature_hinders?(:attack)
23 %th HP 23 %span.nature-hinder -
24 %td= @pokemon.revisions.last.hp 24 %th
25 %tr 25 Defense
26 %th Attack 26 - if @pokemon.nature_benefits?(:defense)
27 %td= @pokemon.revisions.last.attack 27 %span.nature-benefit +
28 %tr 28 - if @pokemon.nature_hinders?(:defense)
29 %th Defense 29 %span.nature-hinder -
30 %td= @pokemon.revisions.last.defense 30 %th
31 %tr 31 Sp. Atk
32 %th Sp. Atk 32 - if @pokemon.nature_benefits?(:special_attack)
33 %td= @pokemon.revisions.last.special_attack 33 %span.nature-benefit +
34 %tr 34 - if @pokemon.nature_hinders?(:special_attack)
35 %th Sp. Def 35 %span.nature-hinder -
36 %td= @pokemon.revisions.last.special_defense 36 %th
37 %tr 37 Sp. Def
38 %th Speed 38 - if @pokemon.nature_benefits?(:special_defense)
39 %td= @pokemon.revisions.last.speed 39 %span.nature-benefit +
40 - if @pokemon.nature_hinders?(:special_defense)
41 %span.nature-hinder -
42 %th
43 Speed
44 - if @pokemon.nature_benefits?(:speed)
45 %span.nature-benefit +
46 - if @pokemon.nature_hinders?(:speed)
47 %span.nature-hinder -
48 %tr
49 %td= @pokemon.revisions.last.hp
50 %td= @pokemon.revisions.last.attack
51 %td= @pokemon.revisions.last.defense
52 %td= @pokemon.revisions.last.special_attack
53 %td= @pokemon.revisions.last.special_defense
54 %td= @pokemon.revisions.last.speed
55 .pokemon-row
56 .pokemon-moves
57 .pd-details Moves
58 %ul
59 %li= @pokemon.revisions.last.move_1.name
60 - if @pokemon.revisions.last.move_2
61 %li= @pokemon.revisions.last.move_2.name
62 - else
63 %li -
64 - if @pokemon.revisions.last.move_3
65 %li= @pokemon.revisions.last.move_3.name
66 - else
67 %li -
68 - if @pokemon.revisions.last.move_4
69 %li= @pokemon.revisions.last.move_4.name
70 - else
71 %li -
72 .pokemon-memo
73 .pd-details Trainer Memo
74 .pd-contents
75 %p
76 %span.pokemon-nature<= @pokemon.nature.titlecase
77 nature.
78 %p= @pokemon.display_met