app/controllers/pulitzer/versions_controller.rb in pulitzer-0.5.5 vs app/controllers/pulitzer/versions_controller.rb in pulitzer-0.5.6
- old
+ new
@@ -15,14 +15,19 @@
processing_version = @version
flash_message = processing_version.errors.first
status = :conflict
else
processing_version = status_updater.call
- if processing_version.errors.empty?
- status = :ok
- flash_message = "The new version of #{@post.title} has been activated."
+ if processing_version
+ if processing_version.errors.empty?
+ status = :ok
+ flash_message = "The new version of #{@post.title} has been activated."
+ else
+ status = :conflict
+ end
else
- status = :conflict
+ flash[:notice] = "The post was successfully removed."
+ render json: {class_triggers: {"hooch.ReloadPage" => posts_path(post_type_id: @version.post.post_type.id) }} and return
end
end
render json: {html: render_to_string(partial: '/pulitzer/versions/edit', locals: {version: processing_version}),
flash_message: flash_message}, status: status
end