<%= mount.name %>
<%= mount.description %>
diff --git a/app/views/wow_pets/index.html.erb b/app/views/wow_pets/index.html.erb
index 65b57ac..01a1f79 100644
--- a/app/views/wow_pets/index.html.erb
+++ b/app/views/wow_pets/index.html.erb
@@ -1,20 +1,17 @@
Pet list
-
-
-
- | <%= t('wow_pets.pet_list.name') %> |
- <%= t('wow_pets.pet_list.description') %> |
- <%= t('wow_pets.pet_list.owned') %> |
-
-
-
- <% @wow_pets.each do |pet| %>
-
- | <%= link_to pet.name, pet %> |
- <%= pet.description %> |
- |
-
- <% end %>
-
-
+
+<% @wow_pets.each do |pet| %>
+
+
+

class="card-img-top" alt="pet-<%= pet.id %>-zoom-image">
+
+
<%= pet.name %>
+
<%= pet.description %>
+ <%= link_to 'Detail', pet, class: "btn btn-primary" %>
+
+
+
+<% end %>
+<%== pagy_bootstrap_nav(@pagy) %>
+
diff --git a/app/views/wow_pets/show.html.erb b/app/views/wow_pets/show.html.erb
index 7dfccf1..89fee86 100644
--- a/app/views/wow_pets/show.html.erb
+++ b/app/views/wow_pets/show.html.erb
@@ -2,7 +2,7 @@
<% if @wow_pet.icon %>
-

class="card-img-top" alt="pet-icon-image">
+

class="card-img-top" alt="pet-icon-image">
<% end %>
<%= @wow_pet.name %>
diff --git a/app/workers/wow_pet_detail_worker.rb b/app/workers/wow_pet_detail_worker.rb
index f2753ad..688dd9b 100644
--- a/app/workers/wow_pet_detail_worker.rb
+++ b/app/workers/wow_pet_detail_worker.rb
@@ -31,6 +31,14 @@ class WowPetDetailWorker < WowSidekiqWorker
end
end
+ unless pet.creature_display_id
+ creature = RBattlenet::Wow::Creature.find(pet.creature_id)
+ pet.creature_display_id = creature.creature_displays.first.id if creature.status_code == 200
+ end
+
+ creature_media = RBattlenet::Wow::CreatureMedia.find(pet.creature_display_id)
+ pet.media_zoom_url = creature_media.assets.first.value if creature_media.status_code == 200
+
if result.abilities
result.abilities.each do |ability|
next unless (local_ability = WowPetAbility.where(ability_id: ability.ability.id).first)
diff --git a/db/migrate/20210429132126_update_wow_pet_model.rb b/db/migrate/20210429132126_update_wow_pet_model.rb
new file mode 100644
index 0000000..c8b36c5
--- /dev/null
+++ b/db/migrate/20210429132126_update_wow_pet_model.rb
@@ -0,0 +1,6 @@
+class UpdateWowPetModel < ActiveRecord::Migration[6.1]
+ def change
+ add_column :wow_pets, :creature_display_id, :integer
+ add_column :wow_pets, :media_zoom_url, :string
+ end
+end
diff --git a/db/schema.rb b/db/schema.rb
index 86e05ce..09d5662 100644
--- a/db/schema.rb
+++ b/db/schema.rb
@@ -10,7 +10,7 @@
#
# It's strongly recommended that you check this file into your version control system.
-ActiveRecord::Schema.define(version: 2021_04_24_192800) do
+ActiveRecord::Schema.define(version: 2021_04_29_132126) do
# These are extensions that must be enabled in order to support this database
enable_extension "plpgsql"
@@ -197,6 +197,8 @@ ActiveRecord::Schema.define(version: 2021_04_24_192800) do
t.integer "creature_id"
t.datetime "created_at", precision: 6, null: false
t.datetime "updated_at", precision: 6, null: false
+ t.integer "creature_display_id"
+ t.string "media_zoom_url"
t.index ["pet_id"], name: "index_wow_pets_on_pet_id", unique: true
end