Commits

Rael Max committed 0ad62f7

formulario de registro para o curso faltando apenas o ajax e a integracao com pagseguro

Comments (0)

Files changed (4)

 # -*- coding: utf-8 -*-
 import sqlite3
+from datetime import datetime
 from bottle import route, view, run, request, redirect, static_file
 
 
     return redirect('/?form_success=false')
 
 
+@route('/inscricao', method='POST')
+def register():
+    name = request.POST.get('name', 0)
+    email = request.POST.get('email', 0)
+    phone = request.POST.get('phone', 0)
+    cpf = request.POST.get('cpf', 0)
+
+    if name and email and phone and cpf:
+        conn = sqlite3.connect('base.db')
+        conn.text_factory = str
+        c = conn.cursor()
+        c.execute("INSERT INTO cadastros (name, email, phone, cpf, date) VALUES (?, ?, ?, ?, ?)", (name, email, phone, cpf, datetime.now()))
+        conn.commit()
+        c.close()
+        return redirect('/?form_success=true')
+    return redirect('/?form_success=false')
+
 @route('/favicon.ico')
 def server_fav():
     return static_file('favicon.ico', root='./')

base.db

Binary file modified.

static/css/style.css

   margin: 0;
 }
 
-#python-topics h3 {
+#python-topics h3,
+#pagsegurobox h2 {
   margin: 10px 0 5px;
   color: #A90000;
 }
     -moz-box-shadow: inset 0 0 8px 4px #548c29, 0 1px 0 0 #eeeeee;
     box-shadow: inset 0 0 8px 4px #548c29, 0 1px 0 0 #eeeeee; }
 
-
+#pagsegurobox {
+  width: 350px
+}
+#pagsegurobox form {
+  width: 250px;
+  margin: 0 auto;
+}
+#pagsegurobox .input-text {
+  margin: 10px 0;
+  width: 250px;
+}
+#pagsegurobox label {
+  width: 100%;
+  float: left;
+}
+#pagsegurobox .input-text input {
+  height: 30px;
+  width: 250px;
+}
 
 @media only screen and (min-width: 35em) {
 
         </ul>
         <h3>Vagas limitadas, inscreva-se!</h3>
         <p>O curso tem o limite de 12 alunos por turma, então é bom correr! Inscreva-se e parcele seu pagamento em até 18x pelo PagSeguro.</p>
-        <a href="#" class="cupid-green">INSCREVA-SE</a>
+        <a href="#pagsegurobox" class="cupid-green fancybox">INSCREVA-SE</a>
+        <div style="display:none">
+          <div id="pagsegurobox">
+            <h2>Inscreva-se</h2>
+            <form action="/inscricao" method="post">
+              <div class="input-text">
+                <label>Nome completo</label>
+                <input type="text" name="name">
+              </div>
+              <div class="input-text">
+                <label>Email</label>
+                <input type="email" name="email">
+              </div>
+              <div class="input-text">
+                <label>Telefone</label>
+                <input type="tel" name="phone">
+              </div>
+              <div class="input-text">
+                <label>CPF</label>
+                <input type="text" name="cpf">
+              </div>
+              <input type="submit" name="enviar">
+            </form>
+          </div>
+        </div>
       </div>
     </section>
     <section id="contact" class="site-page">