Class: Workarea::Admin::CommentsController
Instance Method Summary
collapse
#current_user, #find_sort, #wrap_in_view_model, wrap_in_view_model
Methods included from Publishing
#allow_publishing!, #allow_publishing?, #set_publishing_options
Methods included from Visiting
#most_visited
Instance Method Details
#create ⇒ Object
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
|
# File 'app/controllers/workarea/admin/comments_controller.rb', line 16
def create
if params[:subscribed_user_ids].present?
.add_subscription(params[:subscribed_user_ids])
.add_subscription(current_user.id)
end
if .save
flash[:success] = t('workarea.admin.comments.flash_messages.added')
send_notifications
redirect_to (.to_global_id)
else
.remove_subscription(params[:subscribed_user_ids])
flash[:error] = t('workarea.admin.comments.flash_messages.added_error')
render :index, status: :unprocessable_entity
end
end
|
#destroy ⇒ Object
45
46
47
48
49
|
# File 'app/controllers/workarea/admin/comments_controller.rb', line 45
def destroy
.destroy
flash[:success] = t('workarea.admin.comments.flash_messages.removed')
redirect_to (.to_global_id)
end
|
#edit ⇒ Object
33
|
# File 'app/controllers/workarea/admin/comments_controller.rb', line 33
def edit; end
|
#index ⇒ Object
12
|
# File 'app/controllers/workarea/admin/comments_controller.rb', line 12
def index; end
|
#show ⇒ Object
14
|
# File 'app/controllers/workarea/admin/comments_controller.rb', line 14
def show; end
|
#subscribe ⇒ Object
51
52
53
54
55
56
57
58
|
# File 'app/controllers/workarea/admin/comments_controller.rb', line 51
def subscribe
.add_subscription(current_user.id)
flash[:success] = t(
'workarea.admin.comments.flash_messages.comment_subscribed',
commentable: .name
)
redirect_to (.to_global_id)
end
|
#unsubscribe ⇒ Object
60
61
62
63
64
65
66
67
|
# File 'app/controllers/workarea/admin/comments_controller.rb', line 60
def unsubscribe
.remove_subscription(current_user.id)
flash[:success] = t(
'workarea.admin.comments.flash_messages.comment_unsubscribed',
commentable: .name
)
redirect_to (.to_global_id)
end
|
#update ⇒ Object
35
36
37
38
39
40
41
42
43
|
# File 'app/controllers/workarea/admin/comments_controller.rb', line 35
def update
if .update_attributes()
flash[:success] = t('workarea.admin.comments.flash_messages.saved')
redirect_to (.to_global_id)
else
flash[:error] = t('workarea.admin.comments.flash_messages.saved_error')
render :edit, status: :unprocessable_entity
end
end
|