Class: Admin::AttributesController
- Inherits:
-
BaseController
- Object
- BaseController
- Admin::AttributesController
- Defined in:
- app/controllers/admin/attributes_controller.rb
Overview
This Controller Manage Attributes and his association with Attribute Values
Instance Method Summary collapse
- #access_method ⇒ Object
-
#create ⇒ Object
Create an attribute ==== Params * attribute = Hash of attribute’s attributes.
-
#destroy ⇒ Object
Destroy an attribute ==== Params * id = attribute’s id.
- #duplicate ⇒ Object
-
#edit ⇒ Object
Edit an attribute ==== Params * id = attribute’s id.
-
#index ⇒ Object
List attributes.
- #new ⇒ Object
- #show ⇒ Object
- #update ⇒ Object
Instance Method Details
#access_method ⇒ Object
76 77 78 |
# File 'app/controllers/admin/attributes_controller.rb', line 76 def access_method render :text => Forgeos::url_generator(params[:access_method]) end |
#create ⇒ Object
Create an attribute
Params
-
attribute = Hash of attribute’s attributes
34 35 36 37 38 39 40 41 42 |
# File 'app/controllers/admin/attributes_controller.rb', line 34 def create if @attribute.save flash[:notice] = I18n.t('attribute.create.success').capitalize redirect_to([forgeos_commerce, :edit, :admin, @attribute]) else flash[:error] = I18n.t('attribute.create.failed').capitalize render :action => :new end end |
#destroy ⇒ Object
Destroy an attribute
Params
-
id = attribute’s id
62 63 64 65 66 67 68 69 70 71 72 73 74 |
# File 'app/controllers/admin/attributes_controller.rb', line 62 def destroy if @attribute.destroy flash[:notice] = I18n.t('attribute.destroy.success').capitalize else flash[:error] = I18n.t('attribute.destroy.failed').capitalize end respond_to do |wants| wants.html do redirect_to([forgeos_commerce, :admin, :attributes]) end wants.js end end |
#duplicate ⇒ Object
26 27 28 29 |
# File 'app/controllers/admin/attributes_controller.rb', line 26 def duplicate @attribute = @attribute.clone render :new end |
#edit ⇒ Object
Edit an attribute
Params
-
id = attribute’s id
47 48 |
# File 'app/controllers/admin/attributes_controller.rb', line 47 def edit end |
#index ⇒ Object
List attributes
10 11 12 13 14 15 16 17 18 |
# File 'app/controllers/admin/attributes_controller.rb', line 10 def index respond_to do |format| format.html format.json do sort render :layout => false end end end |
#new ⇒ Object
23 24 |
# File 'app/controllers/admin/attributes_controller.rb', line 23 def new end |
#show ⇒ Object
20 21 |
# File 'app/controllers/admin/attributes_controller.rb', line 20 def show end |
#update ⇒ Object
50 51 52 53 54 55 56 57 |
# File 'app/controllers/admin/attributes_controller.rb', line 50 def update if @attribute.update_attributes(params[:attribute]) flash[:notice] = I18n.t('attribute.update.success').capitalize else flash[:error] = I18n.t('attribute.update.failed').capitalize end render :action => :edit end |