Skip to content
Snippets Groups Projects
Commit a4ffbca0 authored by Marcela Ribeiro de Oliveira's avatar Marcela Ribeiro de Oliveira
Browse files

created teacher mailer

parent a9cc387c
No related branches found
No related tags found
No related merge requests found
......@@ -80,6 +80,7 @@ class V1::UsersController < ApplicationController
def teacher_request
authorize current_user
if current_user.update(submitter_request: User.submitter_requests[:requested])
TeacherMailer.new_teacher_received(teacher_params).deliver_now
render status: :ok
else
render status: :forbidden
......@@ -192,6 +193,10 @@ class V1::UsersController < ApplicationController
])
end
def teacher_params
params.permit(:name, :cpf, :phone, :school, :city, :uf)
end
def approve_params
params.require(:approves)
end
......
# Copyright (C) 2015 Centro de Computacao Cientifica e Software Livre
# Departamento de Informatica - Universidade Federal do Parana
#
# This file is part of portalmec.
#
# portalmec is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# portalmec is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with portalmec. If not, see <http://www.gnu.org/licenses/>.
class TeacherMailer < ApplicationMailer
default to: 'integrada.contato@mec.gov.br'
def new_teacher_received(teacher_info)
@teacher = teacher_info
mail(subject: "Novo professor cadastrado")
end
end
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<style>/* Email styles need to be inline */</style>
</head>
<body>
<h2>Nome do professor: <%= @teacher[:name] %></h1>
<h2>CPF: <%= @teacher[:cpf] %></h1>
<h2>Nome da Escola: <%= @teacher[:school] %></h1>
<h2>Telefone da Escola: <%= @teacher[:phone] %></h1>
<h2>Municipio: <%= @teacher[:city] %></h1>
<h2>UF: <%= @teacher[:uf] %></h1>
</body>
</html>
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment