Class: Katalyst::Content::ItemsController
- Inherits:
-
Object
- Object
- Katalyst::Content::ItemsController
- Defined in:
- app/controllers/katalyst/content/items_controller.rb
Instance Attribute Summary collapse
-
#container ⇒ Object
readonly
Returns the value of attribute container.
-
#editor ⇒ Object
readonly
Returns the value of attribute editor.
-
#item ⇒ Object
readonly
Returns the value of attribute item.
Instance Method Summary collapse
Instance Attribute Details
#container ⇒ Object (readonly)
Returns the value of attribute container.
10 11 12 |
# File 'app/controllers/katalyst/content/items_controller.rb', line 10 def container @container end |
#editor ⇒ Object (readonly)
Returns the value of attribute editor.
10 11 12 |
# File 'app/controllers/katalyst/content/items_controller.rb', line 10 def editor @editor end |
#item ⇒ Object (readonly)
Returns the value of attribute item.
10 11 12 |
# File 'app/controllers/katalyst/content/items_controller.rb', line 10 def item @item end |
Instance Method Details
#create ⇒ Object
22 23 24 25 26 27 28 29 30 |
# File 'app/controllers/katalyst/content/items_controller.rb', line 22 def create if item.save render :update, locals: { editor:, item:, previous: @container.items.build(type: item.type) } else (item) render_editor status: :unprocessable_entity end end |
#edit ⇒ Object
18 19 20 |
# File 'app/controllers/katalyst/content/items_controller.rb', line 18 def edit render_editor end |
#new ⇒ Object
14 15 16 |
# File 'app/controllers/katalyst/content/items_controller.rb', line 14 def new render_editor end |
#update ⇒ Object
32 33 34 35 36 37 38 39 40 41 42 43 44 45 |
# File 'app/controllers/katalyst/content/items_controller.rb', line 32 def update @item.attributes = item_params if @item.valid? previous = @item @item = @item.dup.tap(&:save!) render locals: { editor:, item:, previous: } else (item) render_editor status: :unprocessable_entity end end |