mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-03-11 03:40:20 +00:00
Adding images to registration process
This commit is contained in:
@@ -27,9 +27,9 @@ module Api
|
||||
end
|
||||
|
||||
def update
|
||||
authorize! :update, Enterprise
|
||||
|
||||
@enterprise = Enterprise.find(params[:id])
|
||||
authorize! :update, @enterprise
|
||||
|
||||
if @enterprise.update_attributes(params[:enterprise])
|
||||
render text: @enterprise.id, :status => 200
|
||||
else
|
||||
@@ -37,6 +37,19 @@ module Api
|
||||
end
|
||||
end
|
||||
|
||||
def update_image
|
||||
@enterprise = Enterprise.find(params[:id])
|
||||
authorize! :update, @enterprise
|
||||
|
||||
if params[:logo] && @enterprise.update_attributes( { logo: params[:logo] } )
|
||||
render text: @enterprise.logo.url(:medium), :status => 200
|
||||
elsif params[:promo] && @enterprise.update_attributes( { promo_image: params[:promo] } )
|
||||
render text: @enterprise.promo_image.url(:medium), :status => 200
|
||||
else
|
||||
invalid_resource!(@enterprise)
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def override_owner
|
||||
|
||||
Reference in New Issue
Block a user