Adding properties tab to admin enterprise edit form

This commit is contained in:
Rob Harrington
2015-04-02 11:30:32 +11:00
parent 8926e3765e
commit 3aa5f6e023
6 changed files with 46 additions and 14 deletions

View File

@@ -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