app/controllers/pulitzer/posts_controller.rb in pulitzer-0.4.8 vs app/controllers/pulitzer/posts_controller.rb in pulitzer-0.4.9
- old
+ new
@@ -1,7 +1,8 @@
class Pulitzer::PostsController < Pulitzer::ApplicationController
- before_filter :get_post, only: [:show, :edit, :update, :processing_preview]
+ before_filter :get_post, only: [:show, :edit, :edit_slug, :update,
+ :update_slug, :processing_preview]
def index
@post_type = Pulitzer::PostType.find params[:post_type_id]
@posts = Pulitzer::Post.where post_type: @post_type
end
@@ -33,9 +34,24 @@
end
def destroy
@post.destroy
render head :ok
+ end
+
+ def edit_slug
+ if request.xhr?
+ render partial: 'form_slug', locals: { post: @post }
+ end
+ end
+
+ def show_slug
+ render partial: 'show_slug', locals: { post: @post }
+ end
+
+ def update_slug
+ @post.update_attributes(post_params)
+ render partial: 'show_slug', locals: { post: @post }
end
protected
def post_params