Browse Source

the traditional way of doing things is done; starting with the spa part

master
Julio Biason 10 years ago
parent
commit
ec04e0a08d
  1. 16
      spa/server.py
  2. 30
      spa/templates/base.html
  3. 47
      spa/templates/traditional.html

16
spa/server.py

@ -6,12 +6,26 @@
from flask import Flask from flask import Flask
from flask import render_template from flask import render_template
from flask import request
app = Flask(__name__) app = Flask(__name__)
@app.route('/traditional') @app.route('/traditional')
def traditional(): def traditional():
return render_template('traditional.html') contador = request.values.get('contador', 0)
contador = int(contador) + 1
return render_template('traditional.html',
contador=contador)
@app.route('/spa')
def spa():
return render_template('spa.html')
@app.route('/spa/counter')
def spa_counter():
contador = request.values.get('contador', 1)
contador = int(contador) + 1
return render_template('spa-counter.html', contador=contador)
if __name__ == '__main__': if __name__ == '__main__':

30
spa/templates/base.html

@ -0,0 +1,30 @@
<!doctype html>
<html class="no-js" lang="en" dir="ltr">
<head>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Apresentação tradicional</title>
<link rel="stylesheet" href="{{ url_for('static', filename='css/normalize.css') }}" type="text/css" media="screen" title="no title" charset="utf-8">
<link rel="stylesheet" href="{{ url_for('static', filename='css/foundation.min.css') }}" type="text/css" media="screen" title="no title" charset="utf-8">
</head>
<body>
<nav class="top-bar docs-bar hide-for-small" data-topbar>
<ul class="title-area">
<li class="name">
<h1><a href="http://foundation.zurb.com/">Foundation</a></h1>
</li>
</ul>
</nav>
{% block content %}
{% endblock content %}
</body>
<script src="{{ url_for('static', filename='js/vendor/jquery.js') }}" type="text/javascript" charset="utf-8"></script>
<script src="{{ url_for('static', filename='js/foundation.min.js') }}" type="text/javascript" charset="utf-8"></script>
{% block scripts %}{% endblock scripts %}
</html>

47
spa/templates/traditional.html

@ -1,30 +1,31 @@
<!doctype html> {% extends "base.html" %}
<html class="no-js" lang="en" dir="ltr">
<head>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Apresentação tradicional</title>
<link rel="stylesheet" href="{{ url_for('static', filename='css/normalize.css') }}" type="text/css" media="screen" title="no title" charset="utf-8">
<link rel="stylesheet" href="{{ url_for('static', filename='css/foundation.min.css') }}" type="text/css" media="screen" title="no title" charset="utf-8">
</head>
<body>
<nav class="top-bar docs-bar hide-for-small" data-topbar>
<ul class="title-area">
<li class="name">
<h1><a href="http://foundation.zurb.com/">Foundation</a></h1>
</li>
</ul>
</nav>
{% block content %}
<div class='row'> <div class='row'>
<div class='small-12 columns'> <div class='small-12 columns'>
Hello. <p class='text-center'>
Contador: {{ contador }}
</p>
</div> </div>
</div> </div>
</body>
<script src="{{ url_for('static', filename='js/vendor/jquery.js') }}" type="text/javascript" charset="utf-8"></script> <div class='row'>
<script src="{{ url_for('static', filename='js/foundation.min.js') }}" type="text/javascript" charset="utf-8"></script> <div class='small-12 columns'>
</html> <p class='text-center'>
<a id='contador' href='{{ url_for('traditional', contador=contador) }}' class='button radius small'>Incrementar</a>
</p>
</div>
</div>
{% endblock content %}
{% block scripts %}
<script>
$(function() {
console.log({{ contador }});
if ({{ contador }} > 1 && {{ contador }} < 10000000) {
console.log('valid');
$('#contador')[0].click();
}
});
</script>
{% endblock scripts %}

Loading…
Cancel
Save