Class: ThinkFeelDoEngine::Coach::SiteMessagesController

Inherits:
ApplicationController show all
Defined in:
app/controllers/think_feel_do_engine/coach/site_messages_controller.rb

Overview

Manage messages from the site to Participants.

Constant Summary

Constants inherited from ApplicationController

ApplicationController::CSRF_COOKIE_NAME, ApplicationController::CSRF_HEADER_NAME, ApplicationController::INACTIVE_MESSAGE, ApplicationController::ROOT_URI

Instance Method Summary collapse

Methods inherited from ApplicationController

#access_denied_resource_path, #after_sign_in_path_for, #after_sign_out_path_for

Instance Method Details

#createObject



25
26
27
28
29
30
31
32
33
34
# File 'app/controllers/think_feel_do_engine/coach/site_messages_controller.rb', line 25

def create
  if @site_message.save
    SiteMessageMailer.general(@site_message).deliver

    redirect_to coach_group_site_message_path(@group, @site_message),
                notice: "Site message was successfully created."
  else
    render :new
  end
end

#indexObject



10
11
12
13
14
15
16
# File 'app/controllers/think_feel_do_engine/coach/site_messages_controller.rb', line 10

def index
  authorize! :index, SiteMessage
  participant_ids = current_user.participants_for_group(@group).ids
  @site_messages =
    SiteMessage
    .where(participant_id: participant_ids)
end

#newObject



21
22
23
# File 'app/controllers/think_feel_do_engine/coach/site_messages_controller.rb', line 21

def new
  @participants = current_user.participants_for_group(@group)
end

#showObject



18
19
# File 'app/controllers/think_feel_do_engine/coach/site_messages_controller.rb', line 18

def show
end