Merge pull request #54 from ZeusWPI/print-css

Print css
This commit is contained in:
Feliciaan De Palmenaer 2015-06-05 13:53:26 +02:00
commit 798e2fd0e7
7 changed files with 49 additions and 20 deletions

15
app/static/css/print.css Normal file
View file

@ -0,0 +1,15 @@
@media print {
nav, form, footer, .btn, #form, #debts {
display: none;
}
#items {
display: flex;
}
#items-list {
order: 2;
}
#items-ordered {
order: 1;
margin-right: 50px;
}
}

View file

@ -20,7 +20,7 @@
{% else %} {% else %}
<h4>No orders available.</h4> <h4>No orders available.</h4>
{% if not current_user.is_anonymous() %} {% if not current_user.is_anonymous() %}
To create an order, fill in the form on the right. To create an order, fill in the form <a href="{{ url_for("order_bp.orders") }}">here</a>.
{% else %} {% else %}
Login to create an order, or ask someone else. Login to create an order, or ask someone else.
{% endif %} {% endif %}

View file

@ -1,5 +1,6 @@
{% extends "bootstrap/base.html" %} {% extends "bootstrap/base.html" %}
{% import "bootstrap/utils.html" as utils %} {% import "bootstrap/utils.html" as utils %}
{% import "bootstrap/google.html" as google %}
{% set navbar = [ {% set navbar = [
('home', 'Home'), ('home', 'Home'),
@ -18,11 +19,13 @@
{% block styles %} {% block styles %}
{{ super() }} {{ super() }}
<link rel="stylesheet" href="{{ url_for('static', filename='css/main.css') }}"> <link rel="stylesheet" href="{{ url_for('static', filename='css/main.css') }}" media="screen">
<link rel="stylesheet" href="{{ url_for('static', filename='css/print.css') }}" media="print">
{% endblock %} {% endblock %}
{% block scripts %} {% block scripts %}
{{ super() }} {{ super() }}
{{ google.uanalytics('UA-25444917-9') }}
<script src="{{ url_for('static', filename='js/timer.js') }}"></script> <script src="{{ url_for('static', filename='js/timer.js') }}"></script>
<script async defer id="github-bjs" src="https://buttons.github.io/buttons.js"></script> <script async defer id="github-bjs" src="https://buttons.github.io/buttons.js"></script>
{% endblock %} {% endblock %}
@ -51,7 +54,7 @@
{% if current_user.is_anonymous() %} {% if current_user.is_anonymous() %}
<li><a href="{{ url_for('login') }}">Login</a></li> <li><a href="{{ url_for('login') }}">Login</a></li>
{% else %} {% else %}
<li><a href="#">{{ current_user.username }}</a></li> <li><a href="{{ url_for('profile') }}">{{ current_user.username }}</a></li>
<li><a href="{{ url_for('logout') }}">Logout</a></li> <li><a href="{{ url_for('logout') }}">Logout</a></li>
{% endif %} {% endif %}
</ul> </ul>

View file

@ -7,8 +7,8 @@
{% block container %} {% block container %}
<div class="row"> <div class="row">
<div class="col-md-push-1 col-md-10 darker"><!-- Shitty html--> <div class="col-md-push-1 col-md-10 darker" id="info"><!-- Shitty html-->
<h3>Order {{ order.id }} <h3 id="order-title">Order {{ order.id }}
{% if courier_or_admin -%} {% if courier_or_admin -%}
<a class="btn btn-danger pull-right" href="{{ url_for('.close_order', id=order.id) }}">Close</a><br/> <a class="btn btn-danger pull-right" href="{{ url_for('.close_order', id=order.id) }}">Close</a><br/>
<a class="btn btn-warning pull-right" href="{{ url_for('.order_edit', id=order.id) }}">Edit</a> <a class="btn btn-warning pull-right" href="{{ url_for('.order_edit', id=order.id) }}">Edit</a>
@ -26,7 +26,7 @@
total price: {{ total_price|euro }} {% if courier_or_admin %}- remaining debts: {{ debts|euro }}{% endif %} total price: {{ total_price|euro }} {% if courier_or_admin %}- remaining debts: {{ debts|euro }}{% endif %}
</div> </div>
{% if form -%} {% if form -%}
<div class="col-md-push-1 col-md-10 darker"> <div class="col-md-push-1 col-md-10 darker" id="form">
<h4>Order:</h4> <h4>Order:</h4>
<form method="post" action="{{ url_for('.order_item_create', id=order.id) }}"> <form method="post" action="{{ url_for('.order_item_create', id=order.id) }}">
{{ form.csrf_token }} {{ form.csrf_token }}
@ -49,8 +49,8 @@
</div> </div>
{%- endif %} {%- endif %}
</div> </div>
<div class="row"> <div class="row" id="items">
<div class="col-md-push-1 col-md-5 darker"> <div class="col-md-push-1 col-md-5 darker" id="items-list">
<h3>Items</h3> <h3>Items</h3>
<table class="table table-hover table-condensed"> <table class="table table-hover table-condensed">
<thead> <thead>
@ -69,7 +69,7 @@
</tbody> </tbody>
</table> </table>
</div> </div>
<div class="col-md-push-2 col-md-4 darker"> <div class="col-md-push-2 col-md-4 darker" id="items-ordered">
<h3>Ordered products:</h3> <h3>Ordered products:</h3>
{% for key, value in order.group_by_product().items() -%} {% for key, value in order.group_by_product().items() -%}
{{ key }} - {{ value }}<br/> {{ key }} - {{ value }}<br/>
@ -77,7 +77,7 @@
</div> </div>
</div> </div>
<div class="row"> <div class="row">
<div class="col-md-push-1 col-md-5 darker"> <div class="col-md-push-1 col-md-5 darker" id="debts">
<h3>Debts</h3> <h3>Debts</h3>
<table class="table table-hover table-condensed"> <table class="table table-hover table-condensed">
<thead> <thead>
@ -102,6 +102,7 @@
{{ super() }} {{ super() }}
<link href="//cdnjs.cloudflare.com/ajax/libs/select2/4.0.0-rc.2/css/select2.min.css" rel="stylesheet" /> <link href="//cdnjs.cloudflare.com/ajax/libs/select2/4.0.0-rc.2/css/select2.min.css" rel="stylesheet" />
<link rel="stylesheet" href="{{ url_for('static', filename='css/select2-bootstrap.min.css') }}"> <link rel="stylesheet" href="{{ url_for('static', filename='css/select2-bootstrap.min.css') }}">
<link rel="stylesheet" href="{{ url_for('static', filename='css/print.css') }}">
{% endblock %} {% endblock %}
{% block scripts %} {% block scripts %}
{{ super() }} {{ super() }}

View file

@ -0,0 +1,6 @@
{% extends "layout.html" -%}
{% set active_page = "profile" -%}
{% block container %}
<h1>{{ current_user.username }}</h1>
{% endblock %}

View file

@ -26,6 +26,11 @@ def about():
def stats(): def stats():
return render_template('stats.html') return render_template('stats.html')
@app.route('/profile/')
@login_required
def profile():
return render_template('profile.html')
if app.debug: # add route information if app.debug: # add route information
@app.route('/routes') @app.route('/routes')

View file

@ -1,18 +1,17 @@
certifi==14.5.14
Flask==0.10.1 Flask==0.10.1
Flask-Admin==1.0.9 Flask-Admin==1.1.0
Flask-Bootstrap==3.3.2.1 Flask-Bootstrap==3.3.4.1
Flask-Login==0.2.11 Flask-Login==0.2.11
Flask-OAuthlib==0.8.0 Flask-OAuthlib==0.9.1
Flask-SQLAlchemy==2.0 Flask-SQLAlchemy==2.0
Flask-WTF==0.10.3 Flask-WTF==0.11
Flask-Migrate==1.4.0 Flask-Migrate==1.4.0
itsdangerous==0.24 itsdangerous==0.24
Jinja2==2.7.2 Jinja2==2.7.3
MarkupSafe==0.23 MarkupSafe==0.23
oauthlib==0.7.2 oauthlib==0.7.2
PyMySQL==0.6.6 PyMySQL==0.6.6
requests==2.4.0 requests==2.7.0
SQLAlchemy==0.9.8 SQLAlchemy==1.0.4
Werkzeug==0.9.6 Werkzeug==0.10.4
WTForms==2.0 WTForms==2.0.2