Class: HelpCenter::SupportPostsController
Instance Method Summary
collapse
#is_moderator?, #is_moderator_or_owner?, #page_number, #require_mod_or_author_for_post!, #require_mod_or_author_for_thread!
Instance Method Details
#create ⇒ Object
8
9
10
11
12
13
14
15
16
17
18
|
# File 'app/controllers/help_center/support_posts_controller.rb', line 8
def create
@support_post = @support_thread.support_posts.new(support_post_params)
@support_post.user_id = current_user.id
if @support_post.save
HelpCenter::SupportPostNotificationJob.perform_later(@support_post)
redirect_to help_center.support_thread_path(@support_thread, anchor: "support_post_#{@support_post.id}")
else
render template: "help_center/support_threads/show"
end
end
|
#destroy ⇒ Object
31
32
33
34
|
# File 'app/controllers/help_center/support_posts_controller.rb', line 31
def destroy
@support_post.destroy!
redirect_to help_center.support_thread_path(@support_thread)
end
|
#edit ⇒ Object
20
21
|
# File 'app/controllers/help_center/support_posts_controller.rb', line 20
def edit
end
|
#solved ⇒ Object
36
37
38
39
40
41
42
43
44
|
# File 'app/controllers/help_center/support_posts_controller.rb', line 36
def solved
@support_post = @support_thread.support_posts.find(params[:id])
@support_thread.support_posts.update_all(solved: false)
@support_post.update_column(:solved, true)
@support_thread.update_column(:solved, true)
redirect_to help_center.support_thread_path(@support_thread, anchor: ActionView::RecordIdentifier.dom_id(@support_post))
end
|
#unsolved ⇒ Object
46
47
48
49
50
51
52
53
|
# File 'app/controllers/help_center/support_posts_controller.rb', line 46
def unsolved
@support_post = @support_thread.support_posts.find(params[:id])
@support_thread.support_posts.update_all(solved: false)
@support_thread.update_column(:solved, false)
redirect_to help_center.support_thread_path(@support_thread, anchor: ActionView::RecordIdentifier.dom_id(@support_post))
end
|
#update ⇒ Object
23
24
25
26
27
28
29
|
# File 'app/controllers/help_center/support_posts_controller.rb', line 23
def update
if @support_post.update(support_post_params)
redirect_to help_center.support_thread_path(@support_thread)
else
render action: :edit
end
end
|