Commit 754110b6 authored by Vytor Calixto's avatar Vytor Calixto 👾

Message ao cancelar o upload

parent 97b50e45
<html>
<% include partials/head %>
<body>
<% if (message.length > 0) { message = JSON.parse(message); %>
<script>
swal('<%= message.title %>', '<%= message.message %>', '<%= message.type %>');
</script>
<% } %>
<div class="page-wrap">
<div class="clearfix padding-horizontal">
<div class="float-right">
......
......@@ -2,6 +2,11 @@
<html>
<% include partials/head %>
<body>
<% if (message.length > 0) { message = JSON.parse(message); %>
<script>
swal('<%= message.title %>', '<%= message.message %>', '<%= message.type %>');
</script>
<% } %>
<% include partials/basic-header %>
<section class="card clearfix margin">
<h1>Upload</h1>
......
......@@ -18,7 +18,7 @@
<%= (arquivo.substitutiva) ? 'Substitutiva' : ''%>
<%= arquivo.numero %> - <%= arquivo.ano %>/<%= arquivo.semestre %>
<h3>As informações estão corretas?</h3>
<a href="/" class="button normal">Confirmar</a>
<a href="/upload" class="button normal">Confirmar</a>
<a href="/upload/cancel/<%= arquivo._id %>" class="button red">Cancelar</a>
</div>
</div>
......
......@@ -44,7 +44,7 @@ router.get('/', function(req, res) {
delete user.hashedPassword
delete user.salt
}
res.render('index', {user: user})
res.render('index', {user: user, message: req.flash('indexMessage')})
})
router.get('/login', function(req, res) {
......@@ -106,7 +106,7 @@ router.get('/upload', role.isLoggedIn(), function(req, res) {
if(!err) {
Professor.find(function(err, professores) {
if(!err) {
res.render('upload', {user: req.user, materias: materias, professores: professores})
res.render('upload', {user: req.user, materias: materias, professores: professores, message: req.flash('uploadMessage')})
}
})
}
......@@ -177,6 +177,11 @@ router.get('/upload/cancel/:id', role.isLoggedIn(), role.isVerificado(), functio
fs.unlink(arquivo.arquivo, function() {
if(err) console.log(err)
})
req.flash('uploadMessage', JSON.stringify({
title: 'Cancelado',
message: 'O upload do arquivo foi cancelado',
type: 'info'
}))
res.redirect('/upload')
})
})
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment