Class: Blogit::Admin::PostsController
Instance Attribute Summary collapse
Instance Method Summary
collapse
blogit_conf, #blogit_conf
Instance Attribute Details
#post ⇒ Object
Returns the value of attribute post.
18
19
20
|
# File 'app/controllers/blogit/admin/posts_controller.rb', line 18
def post
@post
end
|
Instance Method Details
#create ⇒ Object
35
36
37
38
39
40
41
42
43
|
# File 'app/controllers/blogit/admin/posts_controller.rb', line 35
def create
set_new_blogger_post_from_params
if post.save
redirect_to post,
notice: t(:blog_post_was_successfully_created, scope: 'blogit.admin.posts')
else
render action: "new"
end
end
|
#destroy ⇒ Object
59
60
61
62
63
64
|
# File 'app/controllers/blogit/admin/posts_controller.rb', line 59
def destroy
set_post_from_id(false)
post.destroy
redirect_to posts_url,
notice: t(:blog_post_was_successfully_destroyed, scope: 'blogit.admin.posts')
end
|
#edit ⇒ Object
45
46
47
|
# File 'app/controllers/blogit/admin/posts_controller.rb', line 45
def edit
set_post_from_id(false)
end
|
#index ⇒ Object
20
21
22
23
|
# File 'app/controllers/blogit/admin/posts_controller.rb', line 20
def index
set_posts
end
|
#new ⇒ Object
31
32
33
|
# File 'app/controllers/blogit/admin/posts_controller.rb', line 31
def new
set_new_blogger_post_from_params
end
|
#post_params ⇒ Object
66
67
68
69
70
71
72
|
# File 'app/controllers/blogit/admin/posts_controller.rb', line 66
def post_params
if params[:post]
params.require(:post).permit(:title, :body, :tag_list, :state, :description)
else
{}
end
end
|
#show ⇒ Object
25
26
27
28
29
|
# File 'app/controllers/blogit/admin/posts_controller.rb', line 25
def show
Blogit::configuration. = :disqus
set_post_from_id(false)
end
|
#update ⇒ Object
49
50
51
52
53
54
55
56
57
|
# File 'app/controllers/blogit/admin/posts_controller.rb', line 49
def update
set_post_from_id(false)
if post.update_attributes(post_params)
redirect_to post,
notice: t(:blog_post_was_successfully_updated, scope: 'blogit.admin.posts')
else
render action: "edit"
end
end
|