mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-01-24 20:36:49 +00:00
Fix long lines
This commit is contained in:
@@ -76,7 +76,11 @@ Spree::Api::ProductsController.class_eval do
|
||||
end
|
||||
|
||||
def render_paged_products(products)
|
||||
render text: { products: ActiveModel::ArraySerializer.new(products, each_serializer: Api::Admin::ProductSerializer), pages: products.num_pages }.to_json
|
||||
end
|
||||
serializer = ActiveModel::ArraySerializer.new(
|
||||
products,
|
||||
each_serializer: Api::Admin::ProductSerializer
|
||||
)
|
||||
|
||||
render text: { products: serializer, pages: products.num_pages }.to_json
|
||||
end
|
||||
end
|
||||
|
||||
@@ -9,11 +9,19 @@ class Api::Admin::ProductSerializer < ActiveModel::Serializer
|
||||
has_one :master, serializer: Api::Admin::VariantSerializer
|
||||
|
||||
def image_url
|
||||
object.images.present? ? object.images.first.attachment.url(:product) : "/assets/noimage/product.png"
|
||||
if object.images.present?
|
||||
object.images.first.attachment.url(:product)
|
||||
else
|
||||
"/assets/noimage/product.png"
|
||||
end
|
||||
end
|
||||
|
||||
def thumb_url
|
||||
object.images.present? ? object.images.first.attachment.url(:mini) : "/assets/noimage/mini.png"
|
||||
if object.images.present?
|
||||
object.images.first.attachment.url(:mini)
|
||||
else
|
||||
"/assets/noimage/mini.png"
|
||||
end
|
||||
end
|
||||
|
||||
def on_hand
|
||||
|
||||
Reference in New Issue
Block a user