Refactor supplier settings
This commit is contained in:
@@ -12,18 +12,24 @@ class SupplierController < ApplicationController
|
||||
end
|
||||
|
||||
def current
|
||||
respond_to do |format|
|
||||
format.json { render json: {supplier: current_supplier.as_json} }
|
||||
end
|
||||
render json: SupplierSupplierSerializer.new(current_supplier).as_json
|
||||
end
|
||||
|
||||
# POST /supplier/settings
|
||||
def update
|
||||
@supplier = current_supplier
|
||||
if current_supplier.update_attributes(supplier_params)
|
||||
redirect_to supplier_root_path
|
||||
else
|
||||
render action: :edit
|
||||
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 nothing: true
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -119,6 +125,29 @@ class SupplierController < ApplicationController
|
||||
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)
|
||||
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
|
||||
|
||||
Reference in New Issue
Block a user