diff options
Diffstat (limited to 'app')
-rw-r--r-- | app/assets/javascripts/pokeviewer/pokemon.js.coffee | 12 | ||||
-rw-r--r-- | app/assets/stylesheets/pokeviewer/pokemon.css.scss | 46 | ||||
-rw-r--r-- | app/jobs/pokeviewer/extract_save_data_job.rb | 18 | ||||
-rw-r--r-- | app/models/pokeviewer/revision.rb | 298 | ||||
-rw-r--r-- | app/views/pokeviewer/pokemon/index.html.haml | 8 | ||||
-rw-r--r-- | app/views/pokeviewer/pokemon/show.html.haml | 13 |
6 files changed, 367 insertions, 28 deletions
diff --git a/app/assets/javascripts/pokeviewer/pokemon.js.coffee b/app/assets/javascripts/pokeviewer/pokemon.js.coffee index f82f196..28a1ec1 100644 --- a/app/assets/javascripts/pokeviewer/pokemon.js.coffee +++ b/app/assets/javascripts/pokeviewer/pokemon.js.coffee | |||
@@ -1,7 +1,7 @@ | |||
1 | $ -> | 1 | $ -> |
2 | $(".pc-pokemon").mouseover -> | 2 | $(".pkv-has-hover").mouseover -> |
3 | $(this).children(".pc-data").show() | 3 | $(this).children(".pkv-hover").show() |
4 | $(".pc-pokemon").mouseout -> | 4 | $(".pkv-has-hover").mouseout -> |
5 | $(this).children(".pc-data").hide() | 5 | $(this).children(".pkv-hover").hide() |
6 | $(".pc-pokemon").mousemove (event) -> | 6 | $(".pkv-has-hover").mousemove (event) -> |
7 | $(this).children(".pc-data").offset({left: event.pageX + 16, top: event.pageY - 16}) | 7 | $(this).children(".pkv-hover").offset({left: event.pageX + 16, top: event.pageY - 16}) |
diff --git a/app/assets/stylesheets/pokeviewer/pokemon.css.scss b/app/assets/stylesheets/pokeviewer/pokemon.css.scss index 2a75730..f44b499 100644 --- a/app/assets/stylesheets/pokeviewer/pokemon.css.scss +++ b/app/assets/stylesheets/pokeviewer/pokemon.css.scss | |||
@@ -152,21 +152,19 @@ body { | |||
152 | } | 152 | } |
153 | } | 153 | } |
154 | 154 | ||
155 | .pc-pokemon { | 155 | .pkv-hover { |
156 | .pc-data { | 156 | display: none; |
157 | display: none; | 157 | background-color: #111; |
158 | background-color: #111; | 158 | color: #fff; |
159 | color: #fff; | 159 | z-index: 1; |
160 | z-index: 1; | 160 | padding: .5em; |
161 | padding: .5em; | 161 | box-shadow: 0px 0px 2px 1px #B3B3B3; |
162 | box-shadow: 0px 0px 2px 1px #B3B3B3; | 162 | border-radius: 4px; |
163 | border-radius: 4px; | 163 | position: absolute; |
164 | position: absolute; | 164 | |
165 | 165 | .pc-data-name { | |
166 | .pc-data-name { | 166 | font-weight: bold; |
167 | font-weight: bold; | 167 | white-space: pre; |
168 | white-space: pre; | ||
169 | } | ||
170 | } | 168 | } |
171 | } | 169 | } |
172 | 170 | ||
@@ -203,7 +201,6 @@ body { | |||
203 | 201 | ||
204 | .pd-details { | 202 | .pd-details { |
205 | color: white; | 203 | color: white; |
206 | font-size: bold; | ||
207 | padding: .25em .5em; | 204 | padding: .25em .5em; |
208 | } | 205 | } |
209 | 206 | ||
@@ -355,4 +352,21 @@ body { | |||
355 | stroke-linejoin: butt; | 352 | stroke-linejoin: butt; |
356 | } | 353 | } |
357 | } | 354 | } |
355 | |||
356 | .pokemon-ribbons { | ||
357 | .pd-details { | ||
358 | background-color: #ffc8c8; | ||
359 | } | ||
360 | |||
361 | ul { | ||
362 | display: flex; | ||
363 | flex-wrap: wrap; | ||
364 | padding: 0; | ||
365 | margin: 0.5em; | ||
366 | |||
367 | li { | ||
368 | display: block; | ||
369 | } | ||
370 | } | ||
371 | } | ||
358 | } | 372 | } |
diff --git a/app/jobs/pokeviewer/extract_save_data_job.rb b/app/jobs/pokeviewer/extract_save_data_job.rb index be8f64d..f7b8f8f 100644 --- a/app/jobs/pokeviewer/extract_save_data_job.rb +++ b/app/jobs/pokeviewer/extract_save_data_job.rb | |||
@@ -109,6 +109,24 @@ module Pokeviewer | |||
109 | rev.move_4_pp_bonuses = param["moves"][3]["ppBonuses"] | 109 | rev.move_4_pp_bonuses = param["moves"][3]["ppBonuses"] |
110 | end | 110 | end |
111 | 111 | ||
112 | rev.cool_ribbons = param["coolRibbons"] | ||
113 | rev.beauty_ribbons = param["beautyRibbons"] | ||
114 | rev.cute_ribbons = param["cuteRibbons"] | ||
115 | rev.smart_ribbons = param["smartRibbons"] | ||
116 | rev.tough_ribbons = param["toughRibbons"] | ||
117 | rev.champion_ribbon = param.fetch "championRibbon", false | ||
118 | rev.winning_ribbon = param.fetch "winningRibbon", false | ||
119 | rev.victory_ribbon = param.fetch "victoryRibbon", false | ||
120 | rev.artist_ribbon = param.fetch "artistRibbon", false | ||
121 | rev.effort_ribbon = param.fetch "effortRibbon", false | ||
122 | rev.marine_ribbon = param.fetch "marineRibbon", false | ||
123 | rev.land_ribbon = param.fetch "landRibbon", false | ||
124 | rev.sky_ribbon = param.fetch "skyRibbon", false | ||
125 | rev.country_ribbon = param.fetch "countryRibbon", false | ||
126 | rev.national_ribbon = param.fetch "nationalRibbon", false | ||
127 | rev.earth_ribbon = param.fetch "earthRibbon", false | ||
128 | rev.world_ribbon = param.fetch "worldRibbon", false | ||
129 | |||
112 | if pk.revisions.empty? or rev.diff?(pk.revisions.last) | 130 | if pk.revisions.empty? or rev.diff?(pk.revisions.last) |
113 | rev.save! | 131 | rev.save! |
114 | end | 132 | end |
diff --git a/app/models/pokeviewer/revision.rb b/app/models/pokeviewer/revision.rb index 44388ca..4481bf0 100644 --- a/app/models/pokeviewer/revision.rb +++ b/app/models/pokeviewer/revision.rb | |||
@@ -8,7 +8,11 @@ module Pokeviewer | |||
8 | :special_attack, :special_defense, :speed, :coolness, :beauty, :cuteness, | 8 | :special_attack, :special_defense, :speed, :coolness, :beauty, :cuteness, |
9 | :smartness, :toughness, :sheen, :hold_item, :move_1_id, :move_2_id, | 9 | :smartness, :toughness, :sheen, :hold_item, :move_1_id, :move_2_id, |
10 | :move_3_id, :move_4_id, :move_1_pp_bonuses, :move_2_pp_bonuses, | 10 | :move_3_id, :move_4_id, :move_1_pp_bonuses, :move_2_pp_bonuses, |
11 | :move_3_pp_bonuses, :move_4_pp_bonuses | 11 | :move_3_pp_bonuses, :move_4_pp_bonuses, :cool_ribbons, :beauty_ribbons, |
12 | :cute_ribbons, :smart_ribbons, :tough_ribbons, :champion_ribbon, | ||
13 | :winning_ribbon, :victory_ribbon, :artist_ribbon, :effort_ribbon, | ||
14 | :marine_ribbon, :land_ribbon, :sky_ribbon, :country_ribbon, | ||
15 | :national_ribbon, :earth_ribbon, :world_ribbon | ||
12 | 16 | ||
13 | belongs_to :pokemon | 17 | belongs_to :pokemon |
14 | acts_as_sequenced scope: :pokemon_id | 18 | acts_as_sequenced scope: :pokemon_id |
@@ -103,5 +107,297 @@ module Pokeviewer | |||
103 | greater_than_or_equal_to: 0, | 107 | greater_than_or_equal_to: 0, |
104 | less_than_or_equal_to: 3, | 108 | less_than_or_equal_to: 3, |
105 | only_integer: true} | 109 | only_integer: true} |
110 | |||
111 | validates :cool_ribbons, presence: true, | ||
112 | numericality: { | ||
113 | greater_than_or_equal_to: 0, | ||
114 | less_than_or_equal_to: 4, | ||
115 | only_integer: true} | ||
116 | |||
117 | validates :beauty_ribbons, presence: true, | ||
118 | numericality: { | ||
119 | greater_than_or_equal_to: 0, | ||
120 | less_than_or_equal_to: 4, | ||
121 | only_integer: true} | ||
122 | |||
123 | validates :cute_ribbons, presence: true, | ||
124 | numericality: { | ||
125 | greater_than_or_equal_to: 0, | ||
126 | less_than_or_equal_to: 4, | ||
127 | only_integer: true} | ||
128 | |||
129 | validates :smart_ribbons, presence: true, | ||
130 | numericality: { | ||
131 | greater_than_or_equal_to: 0, | ||
132 | less_than_or_equal_to: 4, | ||
133 | only_integer: true} | ||
134 | |||
135 | validates :tough_ribbons, presence: true, | ||
136 | numericality: { | ||
137 | greater_than_or_equal_to: 0, | ||
138 | less_than_or_equal_to: 4, | ||
139 | only_integer: true} | ||
140 | |||
141 | def ribbons | ||
142 | result = [] | ||
143 | |||
144 | if cool_ribbons >= 1 | ||
145 | result << { | ||
146 | filename: "cool-ribbon.png", | ||
147 | name: "Cool Ribbon", | ||
148 | description: "Cool Contest Normal Rank Winner!" | ||
149 | } | ||
150 | end | ||
151 | |||
152 | if cool_ribbons >= 2 | ||
153 | result << { | ||
154 | filename: "cool-ribbon-super.png", | ||
155 | name: "Cool Ribbon Super", | ||
156 | description: "Cool Contest Super Rank Winner!" | ||
157 | } | ||
158 | end | ||
159 | |||
160 | if cool_ribbons >= 3 | ||
161 | result << { | ||
162 | filename: "cool-ribbon-hyper.png", | ||
163 | name: "Cool Ribbon Hyper", | ||
164 | description: "Cool Contest Hyper Rank Winner!" | ||
165 | } | ||
166 | end | ||
167 | |||
168 | if cool_ribbons == 4 | ||
169 | result << { | ||
170 | filename: "cool-ribbon-master.png", | ||
171 | name: "Cool Ribbon Master", | ||
172 | description: "Cool Contest Master Rank Winner!" | ||
173 | } | ||
174 | end | ||
175 | |||
176 | if beauty_ribbons >= 1 | ||
177 | result << { | ||
178 | filename: "beauty-ribbon.png", | ||
179 | name: "Beauty Ribbon", | ||
180 | description: "Beauty Contest Normal Rank Winner!" | ||
181 | } | ||
182 | end | ||
183 | |||
184 | if beauty_ribbons >= 2 | ||
185 | result << { | ||
186 | filename: "beauty-ribbon-super.png", | ||
187 | name: "Beauty Ribbon Super", | ||
188 | description: "Beauty Contest Super Rank Winner!" | ||
189 | } | ||
190 | end | ||
191 | |||
192 | if beauty_ribbons >= 3 | ||
193 | result << { | ||
194 | filename: "beauty-ribbon-hyper.png", | ||
195 | name: "Beauty Ribbon Hyper", | ||
196 | description: "Beauty Contest Hyper Rank Winner!" | ||
197 | } | ||
198 | end | ||
199 | |||
200 | if beauty_ribbons == 4 | ||
201 | result << { | ||
202 | filename: "beauty-ribbon-master.png", | ||
203 | name: "Beauty Ribbon Master", | ||
204 | description: "Beauty Contest Master Rank Winner!" | ||
205 | } | ||
206 | end | ||
207 | |||
208 | if cute_ribbons >= 1 | ||
209 | result << { | ||
210 | filename: "cute-ribbon.png", | ||
211 | name: "Cute Ribbon", | ||
212 | description: "Cute Contest Normal Rank Winner!" | ||
213 | } | ||
214 | end | ||
215 | |||
216 | if cute_ribbons >= 2 | ||
217 | result << { | ||
218 | filename: "cute-ribbon-super.png", | ||
219 | name: "Cute Ribbon Super", | ||
220 | description: "Cute Contest Super Rank Winner!" | ||
221 | } | ||
222 | end | ||
223 | |||
224 | if cute_ribbons >= 3 | ||
225 | result << { | ||
226 | filename: "cute-ribbon-hyper.png", | ||
227 | name: "Cute Ribbon Hyper", | ||
228 | description: "Cute Contest Hyper Rank Winner!" | ||
229 | } | ||
230 | end | ||
231 | |||
232 | if cute_ribbons == 4 | ||
233 | result << { | ||
234 | filename: "cute-ribbon-master.png", | ||
235 | name: "Cute Ribbon Master", | ||
236 | description: "Cute Contest Master Rank Winner!" | ||
237 | } | ||
238 | end | ||
239 | |||
240 | if smart_ribbons >= 1 | ||
241 | result << { | ||
242 | filename: "smart-ribbon.png", | ||
243 | name: "Smart Ribbon", | ||
244 | description: "Smart Contest Normal Rank Winner!" | ||
245 | } | ||
246 | end | ||
247 | |||
248 | if smart_ribbons >= 2 | ||
249 | result << { | ||
250 | filename: "smart-ribbon-super.png", | ||
251 | name: "Smart Ribbon Super", | ||
252 | description: "Smart Contest Super Rank Winner!" | ||
253 | } | ||
254 | end | ||
255 | |||
256 | if smart_ribbons >= 3 | ||
257 | result << { | ||
258 | filename: "smart-ribbon-hyper.png", | ||
259 | name: "Smart Ribbon Hyper", | ||
260 | description: "Smart Contest Hyper Rank Winner!" | ||
261 | } | ||
262 | end | ||
263 | |||
264 | if smart_ribbons == 4 | ||
265 | result << { | ||
266 | filename: "smart-ribbon-master.png", | ||
267 | name: "Smart Ribbon Master", | ||
268 | description: "Smart Contest Master Rank Winner!" | ||
269 | } | ||
270 | end | ||
271 | |||
272 | if tough_ribbons >= 1 | ||
273 | result << { | ||
274 | filename: "tough-ribbon.png", | ||
275 | name: "Tough Ribbon", | ||
276 | description: "Tough Contest Normal Rank Winner!" | ||
277 | } | ||
278 | end | ||
279 | |||
280 | if tough_ribbons >= 2 | ||
281 | result << { | ||
282 | filename: "tough-ribbon-super.png", | ||
283 | name: "Tough Ribbon Super", | ||
284 | description: "Tough Contest Super Rank Winner!" | ||
285 | } | ||
286 | end | ||
287 | |||
288 | if tough_ribbons >= 3 | ||
289 | result << { | ||
290 | filename: "tough-ribbon-hyper.png", | ||
291 | name: "Tough Ribbon Hyper", | ||
292 | description: "Tough Contest Hyper Rank Winner!" | ||
293 | } | ||
294 | end | ||
295 | |||
296 | if tough_ribbons == 4 | ||
297 | result << { | ||
298 | filename: "tough-ribbon-master.png", | ||
299 | name: "Tough Ribbon Master", | ||
300 | description: "Tough Contest Master Rank Winner!" | ||
301 | } | ||
302 | end | ||
303 | |||
304 | if champion_ribbon | ||
305 | result << { | ||
306 | filename: "champion-ribbon.png", | ||
307 | name: "Champion Ribbon", | ||
308 | description: "Champion-beating, Hall of Fame Member Ribbon" | ||
309 | } | ||
310 | end | ||
311 | |||
312 | if winning_ribbon | ||
313 | result << { | ||
314 | filename: "winning-ribbon.png", | ||
315 | name: "Winning Ribbon", | ||
316 | description: "Ribbon for clearing LV50 at the Battle Tower." | ||
317 | } | ||
318 | end | ||
319 | |||
320 | if victory_ribbon | ||
321 | result << { | ||
322 | filename: "victory-ribbon.png", | ||
323 | name: "Victory Ribbon", | ||
324 | description: "Won for clearing LV100 at the Battle Tower." | ||
325 | } | ||
326 | end | ||
327 | |||
328 | if artist_ribbon | ||
329 | result << { | ||
330 | filename: "artist-ribbon.png", | ||
331 | name: "Artist Ribbon", | ||
332 | description: "Ribbon for being chosen as a super sketch model." | ||
333 | } | ||
334 | end | ||
335 | |||
336 | if effort_ribbon | ||
337 | result << { | ||
338 | filename: "effort-ribbon.png", | ||
339 | name: "Effort Ribbon", | ||
340 | description: "Ribbon awarded for being a hard worker." | ||
341 | } | ||
342 | end | ||
343 | |||
344 | if marine_ribbon | ||
345 | result << { | ||
346 | filename: "marine-ribbon.png", | ||
347 | name: "Marine Ribbon", | ||
348 | description: "" | ||
349 | } | ||
350 | end | ||
351 | |||
352 | if land_ribbon | ||
353 | result << { | ||
354 | filename: "land-ribbon.png", | ||
355 | name: "Land Ribbon", | ||
356 | description: "" | ||
357 | } | ||
358 | end | ||
359 | |||
360 | if sky_ribbon | ||
361 | result << { | ||
362 | filename: "sky-ribbon.png", | ||
363 | name: "Sky Ribbon", | ||
364 | description: "" | ||
365 | } | ||
366 | end | ||
367 | |||
368 | if country_ribbon | ||
369 | result << { | ||
370 | filename: "country-ribbon.png", | ||
371 | name: "Country Ribbon", | ||
372 | description: "" | ||
373 | } | ||
374 | end | ||
375 | |||
376 | if national_ribbon | ||
377 | result << { | ||
378 | filename: "national-ribbon.png", | ||
379 | name: "National Ribbon", | ||
380 | description: "" | ||
381 | } | ||
382 | end | ||
383 | |||
384 | if earth_ribbon | ||
385 | result << { | ||
386 | filename: "earth-ribbon.png", | ||
387 | name: "Earth Ribbon", | ||
388 | description: "" | ||
389 | } | ||
390 | end | ||
391 | |||
392 | if world_ribbon | ||
393 | result << { | ||
394 | filename: "world-ribbon.png", | ||
395 | name: "World Ribbon", | ||
396 | description: "" | ||
397 | } | ||
398 | end | ||
399 | |||
400 | result | ||
401 | end | ||
106 | end | 402 | end |
107 | end | 403 | end |
diff --git a/app/views/pokeviewer/pokemon/index.html.haml b/app/views/pokeviewer/pokemon/index.html.haml index 7cee27a..f16f0bc 100644 --- a/app/views/pokeviewer/pokemon/index.html.haml +++ b/app/views/pokeviewer/pokemon/index.html.haml | |||
@@ -17,12 +17,12 @@ | |||
17 | - box.contents.each_slice(6) do |row| | 17 | - box.contents.each_slice(6) do |row| |
18 | %tr | 18 | %tr |
19 | - row.each do |p| | 19 | - row.each do |p| |
20 | %td.pc-pokemon | 20 | %td.pc-pokemon.pkv-has-hover |
21 | - if p.nil? | 21 | - if p.nil? |
22 | .spacer | 22 | .spacer |
23 | - else | 23 | - else |
24 | = link_to image_tag(p.icon_path), p | 24 | = link_to image_tag(p.icon_path), p |
25 | .pc-data | 25 | .pc-data.pkv-hover |
26 | .pc-data-name= p.revisions.last.nickname | 26 | .pc-data-name= p.revisions.last.nickname |
27 | .pc-data-ot | 27 | .pc-data-ot |
28 | OT/ | 28 | OT/ |
@@ -33,9 +33,9 @@ | |||
33 | %h2 Pokémon Not In Any Game | 33 | %h2 Pokémon Not In Any Game |
34 | %ul.pokemon-list | 34 | %ul.pokemon-list |
35 | - @unaccounted.each do |p| | 35 | - @unaccounted.each do |p| |
36 | %li.pc-pokemon | 36 | %li.pc-pokemon.pkv-has-hover |
37 | = link_to image_tag(p.icon_path), p | 37 | = link_to image_tag(p.icon_path), p |
38 | .pc-data | 38 | .pc-data.pkv-hover |
39 | .pc-data-name= p.revisions.last.nickname | 39 | .pc-data-name= p.revisions.last.nickname |
40 | .pc-data-ot | 40 | .pc-data-ot |
41 | OT/ | 41 | OT/ |
diff --git a/app/views/pokeviewer/pokemon/show.html.haml b/app/views/pokeviewer/pokemon/show.html.haml index 3a04914..e90148e 100644 --- a/app/views/pokeviewer/pokemon/show.html.haml +++ b/app/views/pokeviewer/pokemon/show.html.haml | |||
@@ -76,4 +76,15 @@ | |||
76 | %span.pokemon-nature<= @pokemon.nature.titlecase | 76 | %span.pokemon-nature<= @pokemon.nature.titlecase |
77 | nature. | 77 | nature. |
78 | %p= @pokemon.display_met | 78 | %p= @pokemon.display_met |
79 | = condition_diagram @pokemon.revisions.last | 79 | .pokemon-contest |
80 | .pd-details Contest Condition | ||
81 | = condition_diagram @pokemon.revisions.last | ||
82 | .pokemon-ribbons | ||
83 | .pd-details Ribbons | ||
84 | %ul | ||
85 | - @pokemon.revisions.last.ribbons.each do |ribbon| | ||
86 | %li.pkv-has-hover | ||
87 | = image_tag("pokeviewer/ribbons/#{ribbon[:filename]}") | ||
88 | .pkv-hover | ||
89 | .pc-data-name= ribbon[:name] | ||
90 | = ribbon[:description] | ||