Sha256: 68cab8737f0c9504e2e11b0fa149b6fb75026b7621f0eff78e8881732aaf230f
Contents?: true
Size: 1.57 KB
Versions: 61
Compression:
Stored size: 1.57 KB
Contents
module Pageflow class StorylinesController < Pageflow::ApplicationController respond_to :json before_action :authenticate_user! def create entry = DraftEntry.find(params[:entry_id]) storyline = entry.storylines.build(storyline_params) authorize!(:create, storyline) verify_edit_lock!(entry.to_model) storyline.save respond_with(storyline) end def scaffold entry = DraftEntry.find(params[:entry_id]) storyline_scaffold = StorylineScaffold.build(entry, storyline_params, params.slice(:depth)) authorize!(:create, storyline_scaffold.to_model) verify_edit_lock!(entry.to_model) storyline_scaffold.save! respond_with(storyline_scaffold) end def update storyline = Storyline.find(params[:id]) authorize!(:update, storyline) verify_edit_lock!(storyline.entry) storyline.update_attributes(storyline_params) respond_with(storyline) end def order entry = DraftEntry.find(params[:entry_id]) authorize!(:edit_outline, entry.to_model) verify_edit_lock!(entry) params.require(:ids).each_with_index do |id, index| entry.storylines.update(id, position: index) end head :no_content end def destroy storyline = Storyline.find(params[:id]) authorize!(:destroy, storyline) verify_edit_lock!(storyline.entry) storyline.destroy respond_with(storyline) end private def storyline_params {configuration: params.dig(:storyline, :configuration).try(:permit!)} end end end
Version data entries
61 entries across 61 versions & 1 rubygems