about summary refs log tree commit diff stats
path: root/app/models
diff options
context:
space:
mode:
authorKelly Rauchenberger <fefferburbia@gmail.com>2017-09-30 08:23:48 -0400
committerKelly Rauchenberger <fefferburbia@gmail.com>2017-09-30 08:23:48 -0400
commita7060addea52af313ed85336dc37949ad8e69f05 (patch)
treee2a65669c9f30788c22635800180f5393c9ec49c /app/models
parent6dff23b065bd933ff2f571d2264c86902173d40b (diff)
downloadpokeviewer-a7060addea52af313ed85336dc37949ad8e69f05.tar.gz
pokeviewer-a7060addea52af313ed85336dc37949ad8e69f05.tar.bz2
pokeviewer-a7060addea52af313ed85336dc37949ad8e69f05.zip
Added gift ribbon descriptions
This is basically just for completeness because it is unknown whether
gift ribbons other than the National Ribbon and Earth Ribbon from
Pokémon Colosseum were ever distributed.
Diffstat (limited to 'app/models')
-rw-r--r--app/models/pokeviewer/gift_ribbon.rb5
-rw-r--r--app/models/pokeviewer/revision.rb14
-rw-r--r--app/models/pokeviewer/trainer.rb18
3 files changed, 30 insertions, 7 deletions
diff --git a/app/models/pokeviewer/gift_ribbon.rb b/app/models/pokeviewer/gift_ribbon.rb new file mode 100644 index 0000000..f8f4fa5 --- /dev/null +++ b/app/models/pokeviewer/gift_ribbon.rb
@@ -0,0 +1,5 @@
1module Pokeviewer
2 class GiftRibbon < ApplicationRecord
3 validates :description, presence: true
4 end
5end
diff --git a/app/models/pokeviewer/revision.rb b/app/models/pokeviewer/revision.rb index 4481bf0..ab4dfd3 100644 --- a/app/models/pokeviewer/revision.rb +++ b/app/models/pokeviewer/revision.rb
@@ -345,7 +345,7 @@ module Pokeviewer
345 result << { 345 result << {
346 filename: "marine-ribbon.png", 346 filename: "marine-ribbon.png",
347 name: "Marine Ribbon", 347 name: "Marine Ribbon",
348 description: "" 348 description: pokemon.trainer.gift_ribbon_description(:marine_ribbon)
349 } 349 }
350 end 350 end
351 351
@@ -353,7 +353,7 @@ module Pokeviewer
353 result << { 353 result << {
354 filename: "land-ribbon.png", 354 filename: "land-ribbon.png",
355 name: "Land Ribbon", 355 name: "Land Ribbon",
356 description: "" 356 description: pokemon.trainer.gift_ribbon_description(:land_ribbon)
357 } 357 }
358 end 358 end
359 359
@@ -361,7 +361,7 @@ module Pokeviewer
361 result << { 361 result << {
362 filename: "sky-ribbon.png", 362 filename: "sky-ribbon.png",
363 name: "Sky Ribbon", 363 name: "Sky Ribbon",
364 description: "" 364 description: pokemon.trainer.gift_ribbon_description(:sky_ribbon)
365 } 365 }
366 end 366 end
367 367
@@ -369,7 +369,7 @@ module Pokeviewer
369 result << { 369 result << {
370 filename: "country-ribbon.png", 370 filename: "country-ribbon.png",
371 name: "Country Ribbon", 371 name: "Country Ribbon",
372 description: "" 372 description: pokemon.trainer.gift_ribbon_description(:country_ribbon)
373 } 373 }
374 end 374 end
375 375
@@ -377,7 +377,7 @@ module Pokeviewer
377 result << { 377 result << {
378 filename: "national-ribbon.png", 378 filename: "national-ribbon.png",
379 name: "National Ribbon", 379 name: "National Ribbon",
380 description: "" 380 description: pokemon.trainer.gift_ribbon_description(:national_ribbon)
381 } 381 }
382 end 382 end
383 383
@@ -385,7 +385,7 @@ module Pokeviewer
385 result << { 385 result << {
386 filename: "earth-ribbon.png", 386 filename: "earth-ribbon.png",
387 name: "Earth Ribbon", 387 name: "Earth Ribbon",
388 description: "" 388 description: pokemon.trainer.gift_ribbon_description(:earth_ribbon)
389 } 389 }
390 end 390 end
391 391
@@ -393,7 +393,7 @@ module Pokeviewer
393 result << { 393 result << {
394 filename: "world-ribbon.png", 394 filename: "world-ribbon.png",
395 name: "World Ribbon", 395 name: "World Ribbon",
396 description: "" 396 description: pokemon.trainer.gift_ribbon_description(:world_ribbon)
397 } 397 }
398 end 398 end
399 399
diff --git a/app/models/pokeviewer/trainer.rb b/app/models/pokeviewer/trainer.rb index f890d61..7862c1e 100644 --- a/app/models/pokeviewer/trainer.rb +++ b/app/models/pokeviewer/trainer.rb
@@ -16,6 +16,14 @@ module Pokeviewer
16 enumerize :game, in: [:ruby, :sapphire, :firered, :leafgreen, :emerald], 16 enumerize :game, in: [:ruby, :sapphire, :firered, :leafgreen, :emerald],
17 predicates: true 17 predicates: true
18 18
19 belongs_to :marine_ribbon, class_name: "GiftRibbon", optional: true
20 belongs_to :land_ribbon, class_name: "GiftRibbon", optional: true
21 belongs_to :sky_ribbon, class_name: "GiftRibbon", optional: true
22 belongs_to :country_ribbon, class_name: "GiftRibbon", optional: true
23 belongs_to :national_ribbon, class_name: "GiftRibbon", optional: true
24 belongs_to :earth_ribbon, class_name: "GiftRibbon", optional: true
25 belongs_to :world_ribbon, class_name: "GiftRibbon", optional: true
26
19 def display_number 27 def display_number
20 number.to_s.rjust(5, '0') 28 number.to_s.rjust(5, '0')
21 end 29 end
@@ -23,5 +31,15 @@ module Pokeviewer
23 def party 31 def party
24 pokemon.where(box: nil).order("slot ASC") 32 pokemon.where(box: nil).order("slot ASC")
25 end 33 end
34
35 def gift_ribbon_description(ribbon)
36 gift_ribbon = send ribbon
37
38 if gift_ribbon.nil?
39 ""
40 else
41 gift_ribbon.description
42 end
43 end
26 end 44 end
27end 45end