|
2 | 2 |
|
3 | 3 | module BetterTogether |
4 | 4 | # Helps with rendering images for various entities |
5 | | - module ImageHelper |
| 5 | + module ImageHelper # rubocop:todo Metrics/ModuleLength |
6 | 6 | # rubocop:todo Metrics/PerceivedComplexity |
7 | 7 | # rubocop:todo Metrics/CyclomaticComplexity |
8 | 8 | # rubocop:todo Metrics/AbcSize |
@@ -46,36 +46,36 @@ def card_image_tag(entity, options = {}) # rubocop:todo Metrics/MethodLength, Me |
46 | 46 | image_alt = options[:alt] || 'Card Image' |
47 | 47 | image_title = options[:title] || 'Card Image' |
48 | 48 | image_tag_attributes = { |
49 | | - class: image_classes, |
50 | | - style: image_style, |
51 | | - alt: image_alt, |
52 | | - title: image_title |
| 49 | + class: image_classes, |
| 50 | + style: image_style, |
| 51 | + alt: image_alt, |
| 52 | + title: image_title |
53 | 53 | } |
54 | 54 |
|
55 | 55 | # Determine if entity has a card image |
56 | 56 | if entity.respond_to?(:card_image) && entity.card_image.attached? |
57 | | - attachment = if entity.respond_to?(:optimized_card_image) |
58 | | - entity.optimized_card_image |
59 | | - else |
60 | | - entity.card_image_variant(image_width, image_height) |
61 | | - end |
| 57 | + attachment = if entity.respond_to?(:optimized_card_image) |
| 58 | + entity.optimized_card_image |
| 59 | + else |
| 60 | + entity.card_image_variant(image_width, image_height) |
| 61 | + end |
62 | 62 |
|
63 | | - image_tag(attachment.url, **image_tag_attributes) |
| 63 | + image_tag(attachment.url, **image_tag_attributes) |
64 | 64 | else |
65 | | - # Use a default image based on the entity type |
66 | | - default_image = default_card_image(entity, image_format) |
67 | | - image_tag(image_url(default_image), **image_tag_attributes) |
| 65 | + # Use a default image based on the entity type |
| 66 | + default_image = default_card_image(entity, image_format) |
| 67 | + image_tag(image_url(default_image), **image_tag_attributes) |
68 | 68 | end |
69 | 69 | end |
70 | 70 |
|
71 | 71 | def default_card_image(entity, image_format) |
72 | 72 | case entity.class.name |
73 | 73 | when 'BetterTogether::Person' |
74 | | - "card_images/default_card_image_person.#{image_format}" |
| 74 | + "card_images/default_card_image_person.#{image_format}" |
75 | 75 | when 'BetterTogether::Community' |
76 | | - "card_images/default_card_image_community.#{image_format}" |
| 76 | + "card_images/default_card_image_community.#{image_format}" |
77 | 77 | else |
78 | | - "card_images/default_card_image_generic.#{image_format}" |
| 78 | + "card_images/default_card_image_generic.#{image_format}" |
79 | 79 | end |
80 | 80 | end |
81 | 81 | # rubocop:enable Metrics/AbcSize |
|
0 commit comments