Class: ThinkFeelDoEngine::Coach::SiteMessagesController
Overview
Manage messages from the site to Participants.
Constant Summary
ApplicationController::CSRF_COOKIE_NAME, ApplicationController::CSRF_HEADER_NAME, ApplicationController::INACTIVE_MESSAGE, ApplicationController::ROOT_URI
Instance Method Summary
collapse
#access_denied_resource_path, #after_sign_in_path_for, #after_sign_out_path_for, #raise_not_found!, #render_not_found
Instance Method Details
#create ⇒ Object
29
30
31
32
33
34
35
36
37
38
39
|
# File 'app/controllers/think_feel_do_engine/coach/site_messages_controller.rb', line 29
def create
if @site_message.save
SiteMessageMailer.general(@site_message).deliver_now
redirect_to coach_group_site_message_path(@group, @site_message),
notice: "Site message was successfully created."
else
set_participants
render :new
end
end
|
#index ⇒ Object
11
12
13
14
15
16
17
|
# File 'app/controllers/think_feel_do_engine/coach/site_messages_controller.rb', line 11
def index
authorize! :index, SiteMessage
participant_ids = current_user.participants_for_group(@group).ids
@site_messages =
SiteMessage
.where(participant_id: participant_ids)
end
|
#new ⇒ Object
22
23
24
25
26
27
|
# File 'app/controllers/think_feel_do_engine/coach/site_messages_controller.rb', line 22
def new
set_participants
redirect_to(coach_group_site_messages_path(@group),
alert: "A group must have participants in order "\
" to send site message.") if @participants.empty?
end
|
#show ⇒ Object
19
20
|
# File 'app/controllers/think_feel_do_engine/coach/site_messages_controller.rb', line 19
def show
end
|