Sha256: 925488abfe14fbbaa6ba0a47005484e289dd433bd2d6d15c1337ea318a6364d0
Contents?: true
Size: 989 Bytes
Versions: 16
Compression:
Stored size: 989 Bytes
Contents
class Pulitzer::ContentElementsController < Pulitzer::ApplicationController before_filter :set_content_element, only: [:show, :edit, :update] def show render partial: 'show', locals: { content_element: @content_element } end def edit render partial: 'form', locals: { content_element: @content_element } end def update @content_element.update content_element_params render partial: 'show', locals: { content_element: @content_element } end 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 render nothing: true end protected def content_element_params params[:content_element].nil? ? {} : params[:content_element].permit! end def set_content_element @content_element = Pulitzer::ContentElement.find(params[:id]) end end
Version data entries
16 entries across 16 versions & 1 rubygems