Class: Pulitzer::VersionsController

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

Instance Method Summary collapse

Instance Method Details

#editObject



4
5
6
7
8
9
10
# File 'app/controllers/pulitzer/versions_controller.rb', line 4

def edit
  if @version.preview?
    route                       = "pulitzer_preview_#{@post.post_type.name.parameterize('_')}_path"
    @preview_path               = main_app.public_send(route, @post.slug) if main_app.respond_to?(route)
  end
  render_ajax locals: {version: @version}
end

#updateObject



12
13
14
15
16
17
# File 'app/controllers/pulitzer/versions_controller.rb', line 12

def update
  processing_version = Pulitzer::UpdateVersionStatus.new(@version,@status).call

  render json: {html: render_to_string(partial: '/pulitzer/versions/edit', locals: {version: processing_version}),
                flash_message: "The new version of #{@post.title} has been activated."}
end