mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-02-26 01:33:22 +00:00
Adding properties tab to admin enterprise edit form
This commit is contained in:
@@ -12,6 +12,8 @@ module Admin
|
||||
before_filter :check_can_change_bulk_owner, only: :bulk_update
|
||||
before_filter :check_can_change_managers, only: :update
|
||||
before_filter :strip_new_properties, only: [:create, :update]
|
||||
before_filter :load_properties, only: [:edit, :update]
|
||||
before_filter :setup_property, only: [:edit]
|
||||
|
||||
|
||||
helper 'spree/products'
|
||||
@@ -172,6 +174,14 @@ module Admin
|
||||
end
|
||||
end
|
||||
|
||||
def load_properties
|
||||
@properties = Spree::Property.pluck(:name)
|
||||
end
|
||||
|
||||
def setup_property
|
||||
@enterprise.producer_properties.build
|
||||
end
|
||||
|
||||
# Overriding method on Spree's resource controller
|
||||
def location_after_save
|
||||
if params[:enterprise].key? :producer_properties_attributes
|
||||
|
||||
Reference in New Issue
Block a user