Skip to content

Commit 3d0d76b

Browse files
committed
Remove narrative_image attribute when possible
1 parent c483358 commit 3d0d76b

File tree

1 file changed

+10
-7
lines changed

1 file changed

+10
-7
lines changed

app/resources/card_resource.rb

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -167,14 +167,17 @@ def images(id, face_index = nil)
167167
url_prefix = Rails.configuration.x.printing_images.nrdb_classic_prefix
168168
face_suffix = "-#{face_index}" unless face_index.nil?
169169
has_narrative_image = :narrative_text.presence && !face_index.nil?
170+
image_sizes = {
171+
'tiny' => "#{url_prefix}/tiny/#{id}#{face_suffix}.jpg",
172+
'small' => "#{url_prefix}/small/#{id}#{face_suffix}.jpg",
173+
'medium' => "#{url_prefix}/medium/#{id}#{face_suffix}.jpg",
174+
'large' => "#{url_prefix}/large/#{id}#{face_suffix}.jpg"
175+
}
176+
177+
image_sizes.narrative = "#{url_prefix}/large/#{id}#{face_suffix}-narrative.jpg" if has_narrative_image
178+
170179
{
171-
'nrdb_classic' => {
172-
'tiny' => "#{url_prefix}/tiny/#{id}#{face_suffix}.jpg",
173-
'small' => "#{url_prefix}/small/#{id}#{face_suffix}.jpg",
174-
'medium' => "#{url_prefix}/medium/#{id}#{face_suffix}.jpg",
175-
'large' => "#{url_prefix}/large/#{id}#{face_suffix}.jpg",
176-
'narrative' => has_narrative_image ? "#{url_prefix}/large/#{id}#{face_suffix}-narrative.jpg" : nil
177-
}
180+
'nrdb_classic' => image_sizes
178181
}
179182
end
180183
end

0 commit comments

Comments
 (0)