Class: Katalyst::Content::ItemsController
- Inherits:
- 
      Object
      
        - Object
- Katalyst::Content::ItemsController
 
- Defined in:
- app/controllers/katalyst/content/items_controller.rb
Direct Known Subclasses
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.
| 11 12 13 | # File 'app/controllers/katalyst/content/items_controller.rb', line 11 def container @container end | 
#editor ⇒ Object (readonly)
Returns the value of attribute editor.
| 11 12 13 | # File 'app/controllers/katalyst/content/items_controller.rb', line 11 def editor @editor end | 
#item ⇒ Object (readonly)
Returns the value of attribute item.
| 11 12 13 | # File 'app/controllers/katalyst/content/items_controller.rb', line 11 def item @item end | 
Instance Method Details
#create ⇒ Object
| 23 24 25 26 27 28 29 30 31 | # File 'app/controllers/katalyst/content/items_controller.rb', line 23 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
| 19 20 21 | # File 'app/controllers/katalyst/content/items_controller.rb', line 19 def edit render_editor end | 
#new ⇒ Object
| 15 16 17 | # File 'app/controllers/katalyst/content/items_controller.rb', line 15 def new render_editor end | 
#update ⇒ Object
| 33 34 35 36 37 38 39 40 41 42 43 44 45 46 | # File 'app/controllers/katalyst/content/items_controller.rb', line 33 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 |