Sha256: a21a88345a9dbebf3ebca840a9ee0b1f67668469f53cd5fb2d1112b386041bba
Contents?: true
Size: 1.44 KB
Versions: 30
Compression:
Stored size: 1.44 KB
Contents
require_dependency "think_feel_do_engine/application_controller" module ThinkFeelDoEngine module Coach # Manage messages from the site to Participants. class SiteMessagesController < ApplicationController before_action :authenticate_user!, :set_group load_and_authorize_resource except: [:index] def index authorize! :index, SiteMessage participant_ids = current_user.participants_for_group(@group).ids @site_messages = SiteMessage .where(participant_id: participant_ids) end def show end def new @participants = current_user.participants_for_group(@group) redirect_to(coach_group_site_messages_path(@group), alert: "A group must have participants in order "\ " to send site message.") if @participants.empty? end 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 private def site_message_params params .require(:site_message) .permit( :participant_id, :subject, :body ) end def set_group @group = Group.find(params[:group_id]) end end end end
Version data entries
30 entries across 30 versions & 1 rubygems