Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Formulario cadastro #156

Open
wants to merge 8 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
54 changes: 54 additions & 0 deletions app/controllers/womans.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
module.exports = app => {

const index = (req, res) => {
res.render('womans/index')
}

const register = (req, res) => {
res.render('womans/new')
}

const create = (req, res) => {

if (!req.body.name || !req.body.email) {
res.send({
status: false,
message: 'Nome e e-mail são obrigatórios!'
})
} else {
const fs = require('fs')
const jsonPath = '././public/mulheres.json'

fs.exists(jsonPath, function (exists) {
fs.readFile(jsonPath, function readFileCallback(err, data) {
let array = JSON.parse(data);
array.mulheres.push({
"name": req.body.name,
"interests": req.body.qualitys,
"location": req.body.location,
"photo": req.body.name,
"email": req.body.email,
"linkedin": req.body.linkeDin,
"github": req.body.gitHub,
"twitter": req.body.twitter,
"fb": req.body.faceBook,
"behance": req.body.behance,
"site": req.body.site
})
let json = JSON.stringify(array);
fs.writeFile(jsonPath, json);
});
});

res.send({
status: true
})
}
}

return {
index,
register,
create
}
}
3 changes: 3 additions & 0 deletions app/views/template/footer.ejs
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<footer itemscope itemtype="http://schema.org/WPFooter">
<img src="img/logo.png" alt="js4girls logo">
</footer>
43 changes: 43 additions & 0 deletions app/views/template/header.ejs
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
<!DOCTYPE html>
<html lang="pt-br">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Mulheres Palestrantes</title>
<link rel="icon" type="image/png" href="img/favicon-32x32.png" sizes="32x32" />
<link rel="icon" type="image/png" href="img/favicon-16x16.png" sizes="16x16" />

<meta name="description" content="Lista de mulheres que palestram sobre programação, design, empreendedorismo e tecnologia.">
<meta name="keywords" content="mulheres palestrantes, programação, design, empreendedorismo, tecnologia, insideout project brasil, inside out, insideout">

<!-- Open Graph Data -->
<meta property="og:type" content="website">
<meta property="og:title" content="Mulheres Palestrantes | InsideOut Project Brasil">
<meta property="og:description" content="Lista de mulheres que palestram sobre programação, design, empreendedorismo e tecnologia.">
<meta property="og:url" content="http://insideoutproject.xyz/mulheres-palestrantes">
<meta property="og:image" content="http://insideoutproject.xyz/images/insideout-600x600.png">

<!-- Twitter Card -->
<meta name="twitter:card" content="summary">
<meta name="twitter:title" content="Mulheres Palestrantes | InsideOut Project Brasil">
<meta name="twitter:description" content="Lista de mulheres que palestram sobre programação, design, empreendedorismo e tecnologia.">
<meta name="twitter:url" content="http://insideoutproject.xyz/mulheres-palestrantes">
<meta name="twitter:image" content="http://insideoutproject.xyz/images/insideout-600x600.png">

<link rel="stylesheet" type="text/css" href="css/style.css">
<link href='http://fonts.googleapis.com/css?family=Open+Sans:400,300' rel='stylesheet' type='text/css'>
<link href="https://fonts.googleapis.com/css?family=Codystar" rel="stylesheet">
<link rel="stylesheet" href="css/font-awesome.min.css">
<link href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" rel="stylesheet" type="text/css">
</head>
<body itemscope itemtype="http://schema.org/WebPage">
<a href="#main" accesskey="1" class="sr-only">Ir para conteúdo principal (Alt + 1)</a>

<a href="https://github.com/insideoutprojectbr/mulheres-palestrantes">
<img class="fork-me" src="img/fork-me.png" alt="Fork me on GitHub" data-canonical-src="https://s3.amazonaws.com/github/ribbons/forkme_right_white_ffffff.png">
</a>

<header itemscope itemtype="http://schema.org/WPHeader">
<h1 class="logo-css"><u>Mulheres</u> <i>Palestrantes</i></h1>
<p><a class="contribute" target="_blank" href="https://github.com/insideoutprojectbr/mulheres-palestrantes#como-contribuir-com-o-projeto"><i>Quero meu nome aqui!</i> :) <br>Como posso fazer isso?</a></p>
</header>
34 changes: 34 additions & 0 deletions app/views/template/scripts.ejs
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
<script src="http://pure.github.io/pure/libs/pure.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/blueimp-md5/1.1.1/js/md5.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/sweetalert/2.1.2/sweetalert.min.js"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js"></script>
<script type="text/javascript" src="js/app.js"></script>
<script>
window.twttr = (function(d, s, id) {
var js, fjs = d.getElementsByTagName(s)[0],
t = window.twttr || {};
if (d.getElementById(id)) return t;
js = d.createElement(s);
js.id = id;
js.src = "https://platform.twitter.com/widgets.js";
fjs.parentNode.insertBefore(js, fjs);

t._e = [];
t.ready = function(f) {
t._e.push(f);
};

return t;
}(document, "script", "twitter-wjs"));
</script>
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-68652979-1', 'auto');
ga('send', 'pageview');
</script>
</body>
</html>
39 changes: 39 additions & 0 deletions app/views/womans/index.ejs
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
<%- include ../template/header.ejs %>
<main class="main" id="main">
<div class="headline">
<p>Procurando mulheres para palestrar em seu evento?</p>
<h2>O <strong>Mulheres Palestrantes</strong> é uma lista de mulheres que falam sobre assuntos relacionados a programação, design, empreendedorismo e tecnologia num geral.</h2>
</div>

<p>Hoje temos um total de <span class="counter"></span> mulheres cadastradas.</p>

<form action="#" class="search-form" role="search">
<label for="search" class="sr-only">Pesquisar</label>
<input class="search" type="text" placeholder="Busque por nome, cidade ou tag" id="search" autocomplete="on" autofocus>
</form>

<div id="speakers-mention-tweet" style="display: none">Entre em contato com estas palestrantes via Twitter: <span class="twitter-button"></span></div>

<article class="card" itemscope itemtype="http://schema.org/Person">
<img src="" class="photo" alt="" itemprop="image" onerror="this.onerror = null; this.src='http://insideoutproject.xyz/mulheres-palestrantes/img/placeholder-female.jpg';">
<h3 itemprop="name"></h3>
<h4 class="sr-only">Área de interesse para palestras</h4>
<ul class="tags">
<li></li>
</ul>
<div class="after-tags">
<p class="location" itemprop="homeLocation"></p>
<ul class="social-media">
<li class="fb"><a target="_blank"><i aria-label="Facebook" class="fa fa-facebook-square fa-2x"></i></a></li>
<li class="twitter"><a target="_blank"><i aria-label="Twitter" class="fa fa-twitter-square fa-2x"></i></a></li>
<li class="github"><a target="_blank"><i aria-label="GitHub" class="fa fa-github-square fa-2x"></i></a></li>
<li class="behance"><a target="_blank"><i aria-label="Behance" class="fa fa-behance-square fa-2x"></i></a></li>
<li class="linkedin"><a target="_blank"><i aria-label="Linkedin" class="fa fa-linkedin-square fa-2x"></i></a></li>
<li class="site"><a target="_blank"><i aria-label="Link externo" class="fa fa-external-link-square fa-2x"></i></a></li>
</ul>
</div>
</article>
</main>
<%- include ../template/footer.ejs %>
<%- include ../template/scripts.ejs %>

47 changes: 47 additions & 0 deletions app/views/womans/new.ejs
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
<%- include ../template/header.ejs %>
<body itemscope itemtype="http://schema.org/WebPage">
<a href="#main" accesskey="1" class="sr-only">Ir para conteúdo principal (Alt + 1)</a>

<a href="https://github.com/insideoutprojectbr/mulheres-palestrantes">
<img class="fork-me" src="img/fork-me.png" alt="Fork me on GitHub" data-canonical-src="https://s3.amazonaws.com/github/ribbons/forkme_right_white_ffffff.png">
</a>

<main class="main" id="main">
<div class="headline">
<p>Quer ter seu nome na lista? Agora ficou mais fácil, basta cadastrar-se!</p>
</div>

<form class="search-form" id="register-form">
<input class="search" type="text" required placeholder="Nome completo" autocomplete="on" autofocus>
<input class="search" type="text" placeholder="Cidade/UF que reside (Exemplo: Goiania/GO, São Paulo/SP, Guarapuava/PR)" autocomplete="on">
<input class="search" type="text" placeholder="URL da sua foto" autocomplete="on">
<input class="search" type="email" required placeholder="Seu e-mail" autocomplete="on">
<input class="search" type="text" placeholder="Seu usuário no linkedin (se possuir)" autocomplete="on">
<input class="search" type="text" placeholder="Seu usuário no behance (se possuir)" autocomplete="on">
<input class="search" type="text" placeholder="Seu usuário no github (se possuir)" autocomplete="on">
<input class="search" type="text" placeholder="Seu usuário no twitter (se possuir)" autocomplete="on">
<input class="search" type="text" placeholder="Seu usuário no facebook (se possuir)" autocomplete="on">
<input class="search" type="text" placeholder="Link do seu site (se possuir)" autocomplete="on">
<div class="row">
<div class="col-md-9">
<input class="search half" type="text" placeholder="Suas qualidades?" autocomplete="on">
</div>
<div class="col-md-3">
<button type="button" id="register-new-quality">+</button>
</div>
</div>

<div id="qualitys-list"></div>

<button type="submit" class="search">Enviar!</button>

</form>
</main>
<%- include ../template/footer.ejs %>
<script
src="https://code.jquery.com/jquery-3.4.1.slim.min.js"
integrity="sha256-pasqAKBDmFT4eHoN2ndd6lN370kFiGUFyTiUHWhU7k8="
crossorigin="anonymous"></script>
<script src="js/register.js"></script>
<%- include ../template/scripts.ejs %>

7 changes: 7 additions & 0 deletions config/routes.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
module.exports = app => {
app.get('/', app.app.controllers.womans.index)

app.get('/cadastrar', app.app.controllers.womans.register)

app.post('/woman', app.app.controllers.womans.create)
}
18 changes: 18 additions & 0 deletions config/server.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
const express = require('express');
const consign = require('consign');
const bodyParser = require('body-parser');

const app = express();

app.set('view engine', 'ejs');
app.set('views', 'app/views');

app.use(express.static('public'));
app.use(bodyParser.urlencoded({extended: true}));

consign()
.include('app/controllers')
.then('config/routes.js')
.into(app);

module.exports = app;
116 changes: 0 additions & 116 deletions index.html

This file was deleted.

6 changes: 6 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
const app = require('./config/server');
const port = 80;

const server = app.listen(port, function(){
console.log(`Servidor online na porta ${port}`);
});
7 changes: 7 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,5 +26,12 @@
"homepage": "https://github.com/insideoutprojectbr/mulheres-palestrantes#readme",
"devDependencies": {
"http-server": "^0.11.1"
},
"dependencies": {
"body-parser": "^1.19.0",
"consign": "^0.1.6",
"ejs": "^2.6.2",
"express": "^4.17.1",
"fs": "0.0.1-security"
}
}
File renamed without changes.
Loading