Class: Pulitzer::ContentElementsController

Inherits:
ApplicationController show all
Defined in:
app/controllers/pulitzer/content_elements_controller.rb

Instance Method Summary collapse

Instance Method Details

#editObject



8
9
10
# File 'app/controllers/pulitzer/content_elements_controller.rb', line 8

def edit
  render partial: 'form', locals: { content_element: @content_element }
end

#showObject



4
5
6
# File 'app/controllers/pulitzer/content_elements_controller.rb', line 4

def show
  render partial: 'show', locals: { content_element: @content_element }
end

#updateObject



12
13
14
15
# File 'app/controllers/pulitzer/content_elements_controller.rb', line 12

def update
  @content_element.update content_element_params
  render partial: 'show', locals: { content_element: @content_element }
end

#update_allObject



17
18
19
20
21
22
23
24
# File 'app/controllers/pulitzer/content_elements_controller.rb', line 17

def update_all
  content_elements = Pulitzer::ContentElement.find params[:content_element]
  content_elements.each do |ce|
    new_sort_order = params[:content_element].index(ce.id.to_s)
    ce.update_attribute(:sort_order, new_sort_order)
  end
  head :ok
end