Fix long lines

This commit is contained in:
Luis Ramos
2020-10-16 16:50:14 +01:00
parent b6dc46a911
commit 7cc7c62232
7 changed files with 20 additions and 12 deletions

View File

@@ -4,10 +4,10 @@ module Api
module Admin
class EnterpriseSerializer < ActiveModel::Serializer
attributes :name, :id, :is_primary_producer, :is_distributor, :sells, :category, :permalink,
:payment_method_ids, :shipping_method_ids, :producer_profile_only, :long_description,
:payment_method_ids, :shipping_method_ids, :producer_profile_only,
:long_description, :preferred_product_selection_from_inventory_only,
:preferred_shopfront_message, :preferred_shopfront_closed_message,
:preferred_shopfront_taxon_order, :preferred_shopfront_order_cycle_order,
:preferred_product_selection_from_inventory_only,
:preferred_show_customer_names_to_suppliers, :owner, :contact, :users, :tag_groups,
:default_tag_group, :require_login, :allow_guest_orders, :allow_order_changes,
:logo, :promo_image, :terms_and_conditions,
@@ -36,7 +36,7 @@ module Api
end
def tag_groups
object.tag_rules.prioritised.reject(&:is_default).each_with_object([]) do |tag_rule, tag_groups|
prioritized_tag_rules.each_with_object([]) do |tag_rule, tag_groups|
tag_group = find_match(tag_groups, tag_rule.preferred_customer_tags.
split(",").
map{ |t| { text: t } })
@@ -66,6 +66,10 @@ module Api
private
def prioritized_tag_rules
object.tag_rules.prioritised.reject(&:is_default)
end
# Returns a hash of URLs for specified versions of an attachment.
#
# Example:

View File

@@ -5,8 +5,8 @@ require 'open_food_network/enterprise_issue_validator'
module Api
module Admin
class IndexEnterpriseSerializer < ActiveModel::Serializer
attributes :name, :id, :permalink, :is_primary_producer, :sells, :producer_profile_only, :owned,
:edit_path, :issues, :warnings
attributes :name, :id, :permalink, :is_primary_producer, :sells,
:producer_profile_only, :owned, :edit_path, :issues, :warnings
def owned
return true if options[:spree_current_user].admin?

View File

@@ -6,7 +6,8 @@ module Api
module Admin
class OrderCycleSerializer < ActiveModel::Serializer
attributes :id, :name, :orders_open_at, :orders_close_at, :coordinator_id, :exchanges,
:editable_variants_for_incoming_exchanges, :editable_variants_for_outgoing_exchanges,
:editable_variants_for_incoming_exchanges,
:editable_variants_for_outgoing_exchanges,
:visible_variants_for_outgoing_exchanges,
:viewing_as_coordinator, :schedule_ids, :subscriptions_count

View File

@@ -6,8 +6,8 @@ module Api
attributes :id, :number, :user_id, :full_name, :email, :phone, :completed_at, :display_total,
:edit_path, :state, :payment_state, :shipment_state,
:payments_path, :ready_to_ship, :ready_to_capture, :created_at,
:distributor_name, :special_instructions,
:item_total, :adjustment_total, :payment_total, :total, :display_outstanding_balance
:distributor_name, :special_instructions, :display_outstanding_balance,
:item_total, :adjustment_total, :payment_total, :total
has_one :distributor, serializer: Api::Admin::IdSerializer
has_one :order_cycle, serializer: Api::Admin::IdSerializer

View File

@@ -50,7 +50,9 @@ module Api
end
class FilterOrderCyclesSerializer < BaseSerializer
attributes :preferred_matched_order_cycles_visibility, :preferred_exchange_tags, :exchange_tags
attributes :preferred_matched_order_cycles_visibility,
:preferred_exchange_tags,
:exchange_tags
def exchange_tags
object.preferred_exchange_tags.split(",")

View File

@@ -3,8 +3,8 @@
module Api
module Admin
class VariantOverrideSerializer < ActiveModel::Serializer
attributes :id, :hub_id, :variant_id, :sku, :price, :count_on_hand, :on_demand, :default_stock,
:resettable, :tag_list, :tags, :import_date
attributes :id, :hub_id, :variant_id, :sku, :price, :count_on_hand, :on_demand,
:default_stock, :resettable, :tag_list, :tags, :import_date
def tag_list
object.tag_list.join(",")

View File

@@ -25,7 +25,8 @@ module Api
end
def price
# Decimals are passed to json as strings, we need to run parseFloat.toFixed(2) on the client.
# Decimals are passed to json as strings,
# we need to run parseFloat.toFixed(2) on the client.
object.price.nil? ? 0.to_f : object.price
end