Poltergeist in the green, and resourceful refactor
This commit is contained in:
@@ -1,46 +1,7 @@
|
||||
class SupplierController < Suppliers::ApplicationController
|
||||
def home
|
||||
end
|
||||
|
||||
def menu
|
||||
end
|
||||
|
||||
# GET /supplier/settings
|
||||
def edit
|
||||
@supplier = current_supplier
|
||||
end
|
||||
|
||||
def current
|
||||
[current_supplier].include_relations(sections: :tables, product_categories: :products)
|
||||
render json: Suppliers::SupplierSerializer.new(current_supplier).as_json
|
||||
end
|
||||
|
||||
# POST /supplier/settings
|
||||
def update
|
||||
@supplier = current_supplier
|
||||
respond_to do |format|
|
||||
format.html do
|
||||
if current_supplier.update_attributes(supplier_params)
|
||||
redirect_to supplier_root_path
|
||||
else
|
||||
render action: :edit
|
||||
end
|
||||
end
|
||||
format.json do
|
||||
current_supplier.update_attributes(supplier_params)
|
||||
render json: Suppliers::SupplierSerializer.new(current_supplier).as_json
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def mark_as_open
|
||||
current_supplier.mark_as_open!
|
||||
head :ok
|
||||
end
|
||||
def mark_as_closed
|
||||
current_supplier.mark_as_closed!
|
||||
head :ok
|
||||
end
|
||||
=begin
|
||||
# GET /suppliers/1/active_orders
|
||||
# GET /suppliers/1/active_orders.json
|
||||
def active_orders
|
||||
@@ -95,38 +56,5 @@ class SupplierController < Suppliers::ApplicationController
|
||||
end
|
||||
|
||||
#POST /supplier/remove_list_needs_payment
|
||||
def remove_list_needs_payment
|
||||
@list = List.find_by_supplier_id_and_id(current_supplier.id, params[:list_id])
|
||||
@list.remove_needs_payment!
|
||||
render nothing: true
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def supplier_params
|
||||
params.require(:supplier).permit(
|
||||
:name,
|
||||
:email,
|
||||
:open,
|
||||
:time_zone,
|
||||
:night_offset,
|
||||
:location,
|
||||
:lat,
|
||||
:lng,
|
||||
:offer_wifi,
|
||||
:wifi_ssid,
|
||||
:wifi_type,
|
||||
:wifi_password,
|
||||
:iens_profile,
|
||||
:address,
|
||||
:house_number,
|
||||
:house_number_addition,
|
||||
:postal_code,
|
||||
:city,
|
||||
:country,
|
||||
:facebook_promotion_url,
|
||||
:created_at,
|
||||
:updated_at
|
||||
)
|
||||
end
|
||||
=end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user