File tree Expand file tree Collapse file tree 2 files changed +11
-13
lines changed
controllers/better_together Expand file tree Collapse file tree 2 files changed +11
-13
lines changed Original file line number Diff line number Diff line change 55module BetterTogether
66 # Responds to requests for navigation items
77 class NavigationItemsController < FriendlyResourceController # rubocop:todo Metrics/ClassLength
8- before_action :set_navigation_area
8+ before_action :navigation_area
99 before_action :set_pages , only : %i[ new edit create update ]
10- before_action :set_navigation_item , only : %i[ show edit update destroy ]
10+ before_action :navigation_item , only : %i[ show edit update destroy ]
1111
1212 helper_method :available_parent_items
1313
@@ -103,14 +103,14 @@ def set_pages
103103 )
104104 end
105105
106- def set_navigation_area
106+ def navigation_area
107107 @navigation_area ||= find_by_translatable (
108108 translatable_type : ::BetterTogether ::NavigationArea . name ,
109109 friendly_id : params [ :navigation_area_id ]
110110 )
111111 end
112112
113- def set_navigation_item
113+ def navigation_item
114114 @navigation_item = set_resource_instance
115115 end
116116
Original file line number Diff line number Diff line change @@ -71,16 +71,14 @@ def optimized_profile_image
7171 if profile_image . content_type == 'image/svg+xml'
7272 # If SVG, return the original without transformation
7373 profile_image
74+
75+ # For other formats, analyze to determine transparency
76+ elsif profile_image . content_type == 'image/png'
77+ # If PNG with transparency, return the optimized PNG variant
78+ profile_image . variant ( :optimized_png ) . processed
7479 else
75- # For other formats, analyze to determine transparency
76- metadata = profile_image . metadata
77- if profile_image . content_type == 'image/png'
78- # If PNG with transparency, return the optimized PNG variant
79- profile_image . variant ( :optimized_png ) . processed
80- else
81- # Otherwise, use the optimized JPG variant
82- profile_image . variant ( :optimized_jpeg ) . processed
83- end
80+ # Otherwise, use the optimized JPG variant
81+ profile_image . variant ( :optimized_jpeg ) . processed
8482 end
8583 end
8684
You can’t perform that action at this time.
0 commit comments