Sha256: e3340f452cd3204eb32885c478ae3778c2b2f017afe53ad213cbcabfed2e4289

Contents?: true

Size: 633 Bytes

Versions: 4

Compression:

Stored size: 633 Bytes

Contents

module Miniblog
  module Admin
    class TransitionsController < Miniblog::Admin::BaseController
      before_filter :load_post, only: [:create]

      def create
        namespace = '_as_publisher' if current_user.is_publisher?
        @post.send "#{params[:transition]}#{namespace}"
        status = @post.status_change_records.build(user: current_user, state: params[:transition])
        status.save
        redirect_to admin_posts_path
      end

      private

      def load_post
        post  = Post.scoped_for(current_user).find(params[:id])
        @post = PostPresenter.new(post, current_user)
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
miniblog-1.0.2 app/controllers/miniblog/admin/transitions_controller.rb
miniblog-1.0.1 app/controllers/miniblog/admin/transitions_controller.rb
miniblog-1.0.0 app/controllers/miniblog/admin/transitions_controller.rb
miniblog-1.0.0.beta app/controllers/miniblog/admin/transitions_controller.rb