...
 
Commits (13)
......@@ -7,6 +7,8 @@ name = "pypi"
flask = "*"
libsass = "*"
cssmin = "*"
fpdf = "*"
flask-tryton = "*"
[dev-packages]
......
This diff is collapsed.
import '../styles/main.scss';
import 'jquery';
import 'bootstrap';
import $ from 'jquery';
jQuery(function() {
$(function() {
$('#inputForm').change(function() {
const submitButton = $(':submit', this);
let submitEnabled = true;
......@@ -11,4 +12,4 @@ jQuery(function() {
});
submitButton.prop('disabled', !submitEnabled);
});
})
});
......@@ -5,7 +5,8 @@ module.exports = {
entry: './assets/scripts/index.js',
output: {
filename: 'main.js',
path: path.resolve(__dirname, 'build/')
path: path.resolve(__dirname, 'build/'),
publicPath: '/assets/',
},
module: {
rules: [
......@@ -34,15 +35,6 @@ module.exports = {
}, {
loader: 'sass-loader' // compiles Sass to CSS
}]
}, {
test: require.resolve('jquery'),
use: [{
loader: 'expose-loader',
options: 'jQuery'
}, {
loader: 'expose-loader',
options: '$'
}]
}
]},
plugins: [
......
import os
from flask import Flask
......@@ -8,6 +6,7 @@ def create_app(test_config=None):
app = Flask(__name__, instance_relative_config=True, static_folder='../frontend/build/', static_url_path='/assets/')
app.config.from_mapping(
SECRET_KEY='dev',
TRYTON_DATABASE='tryton'
)
if test_config is None:
......@@ -24,6 +23,9 @@ def create_app(test_config=None):
except OSError:
pass
from .extensions import tryton
tryton.init_app(app)
from . import main
app.register_blueprint(main.bp)
app.add_url_rule('/', endpoint='index')
......
from flask_tryton import Tryton
tryton = Tryton()
\ No newline at end of file
from flask import (
Blueprint, flash, g, redirect, render_template, request, url_for
)
from werkzeug.exceptions import abort
from .extensions import tryton
bp = Blueprint('main', __name__)
......@@ -11,6 +11,31 @@ def index():
return render_template('main/index.html')
@bp.route('/new')
@tryton.transaction()
@bp.route('/new', methods=['GET', 'POST'])
def new():
return render_template('main/new.html')
if request.method == 'GET':
return render_template('main/new.html')
member = {
'name': request.form.get('inputName'),
'surname': request.form.get('inputSurname'),
'birthDate': request.form.get('inputBirthDate'),
'birthPlace': request.form.get('inputBirthPlace'),
'fiscalCode': request.form.get('inputFiscalCode'),
'telephone': request.form.get('inputTelephone'),
'email': request.form.get('inputEmail'),
'username': request.form.get('inputUsername'),
'privacy': request.form.get('inputPrivacy'),
'statute': request.form.get('inputStatute'),
}
if False:
# Handle errors
return render_template('main/new.html')
Party = tryton.pool.get('party.party')
p = Party()
p.name = member['name'] + " " + member['surname']
return render_template('main/welcome.html', **member)
......@@ -4,7 +4,7 @@
{% block content %}
<main role="main" class="inner cover">
<h1 class="cover-heading">Benvenuti su m-ship!</h1>
<h1 class="cover-heading">Benvenuto su m-ship!</h1>
<div class="row">
<div class="col-md">
<p class="lead">Vuoi diventare socio Mittelab?</p>
......
......@@ -8,58 +8,58 @@
<p>
Hai scelto di far parte della famiglia Mittelab! Prima di mandare la tua richiesta di associazione, abbiamo bisogno di alcune informazioni.
</p>
<form method="post">
<form id="inputForm" method="post">
<fieldset>
<legend>I tuoi dati personali</legend>
<div class="form-row">
<div class="form-group col">
<label for="inputName">Nome</label>
<input type="text" name="inputName" id="inputName" class="form-control" placeholder="Tizio">
<input type="text" name="inputName" id="inputName" class="form-control" required>
</div>
<div class="form-group col">
<label for="inputSurname">Cognome</label>
<input type="text" name="inputSurname" id="InputSurname" class="form-control" placeholder="Caio">
<input type="text" name="inputSurname" id="InputSurname" class="form-control" required>
</div>
</div>
<div class="form-row">
<div class="form-group col-md-3">
<label for="InputBirthDate">Data di nascita</label>
<input type="date" name="inputBirthDate" id="inputBirthDate" class="form-control" placeholder="">
<input type="date" name="inputBirthDate" id="inputBirthDate" class="form-control" required>
</div>
<div class="form-group col-md-5">
<label for="inputBirthPlace">Luogo di nascita</label>
<input type="text" name="inputBirthPlace" id="inputBirthPlace" class="form-control" placeholder="">
<input type="text" name="inputBirthPlace" id="inputBirthPlace" class="form-control" required>
</div>
<div class="form-group col-md-4">
<label for="inputFiscalCode">Codice Fiscale</label>
<input type="text" name="inputFiscalCode" id="inputFiscalCode" class="form-control" minlength="16" maxlength="16" placeholder="">
<input type="text" name="inputFiscalCode" id="inputFiscalCode" class="form-control" minlength="16" maxlength="16" required>
</div>
</div>
</fieldset>
<fieldset>
<legend>Dove abiti?</legend>
<div class="form-row">
<div class="form-group col-md-10">
<div class="form-group col-8 col-md-10">
<label for="inputAddress">Indirizzo</label>
<input type="text" class="form-control" id="inputAddress" placeholder="Via dei Matti">
<input type="text" class="form-control" id="inputAddress" required>
</div>
<div class="form-group col-md-2">
<div class="form-group col-4 col-md-2">
<label for="inputNumber">N&ordm;</label>
<input type="text" class="form-control" id="inputNumber" placeholder="28">
<input type="text" class="form-control" id="inputNumber" required>
</div>
</div>
<div class="form-row">
<div class="form-group col-md-2">
<div class="form-group col-md-2 col-sm-4">
<label for="inputZip">C.A.P.</label>
<input type="text" class="form-control" id="inputZip">
<input type="text" class="form-control" id="inputZip" required>
</div>
<div class="form-group col-md-6">
<div class="form-group col-md-6 col-sm-8">
<label for="inputCity">Città</label>
<input type="text" class="form-control" id="inputCity">
<input type="text" class="form-control" id="inputCity" required>
</div>
<div class="form-group col-md-4">
<label for="inputState">Stato</label>
<select id="inputState" class="form-control">
<select id="inputState" class="form-control" required>
<option selected>Choose...</option>
<option>...</option>
</select>
......@@ -74,17 +74,17 @@
<input type="tel"
name="inputTelephone" id="inputTelephone" class="form-control" placeholder=""
aria-describedby="helpTelephone">
<small id="helpTelephone" class="text-muted">Il numero di delefono dove possiamo contattarti</small>
<small id="helpTelephone" class="text-muted">Il numero di telefono dove possiamo contattarti</small>
</div>
<div class="form-group col">
<label for="inputEmail">E-mail</label>
<input type="email" name="inputEmail" id="inputEmail" class="form-control" placeholder="me@mittelab.org">
<input type="email" name="inputEmail" id="inputEmail" class="form-control" required>
</div>
</div>
<div class="form-row">
<div class="form-group col">
<label for="inputUsername">Username desiderato</label>
<input type="text" name="inputUsername" id="inputUsername" class="form-control" placeholder="t1z10">
<input type="text" name="inputUsername" id="inputUsername" class="form-control" required>
<small id="usernameHelp" class="form-text text-muted">L'username che vuoi usare nell'infrastruttura Mittelab.</small>
</div>
</div>
......
{% extends "base.html" %}
{% block title %}Benvenuto, {{ " ".join([name, surname]) }}{% endblock %}
{% block content %}
<main class="container">
<h1 class="color-loving">Benvenuto, {{ " ".join([name, surname]) }}!</h1>
<p>La tua richiesta è stata registrata con successo.</p>
</main>
{% endblock %}