aboutsummaryrefslogtreecommitdiff
path: root/ihatemoney/templates
diff options
context:
space:
mode:
authorAlexis Metaireau <alexis@notmyidea.org>2017-07-07 00:06:56 +0200
committerGitHub <noreply@github.com>2017-07-07 00:06:56 +0200
commit3a4282fd75e3b3317b2b08b4aa2e6ac154310e73 (patch)
tree9470c907ba1f884246af87d26d55c3aaac6d6dc5 /ihatemoney/templates
parent0e374cd5e0ef5a9be67084365f91de2ab84f636c (diff)
downloadihatemoney-mirror-3a4282fd75e3b3317b2b08b4aa2e6ac154310e73.zip
ihatemoney-mirror-3a4282fd75e3b3317b2b08b4aa2e6ac154310e73.tar.gz
ihatemoney-mirror-3a4282fd75e3b3317b2b08b4aa2e6ac154310e73.tar.bz2
Absolute imports & some other improvements (#243)
* Use absolute imports and rename package to ihatemoney * Add a ihatemoney command * Factorize application creation logic * Refactor the tests * Update the wsgi.py module with the new create_app() function * Fix some styling thanks to Flake8. * Automate Flake8 check in the CI.
Diffstat (limited to 'ihatemoney/templates')
-rw-r--r--ihatemoney/templates/add_bill.html17
-rw-r--r--ihatemoney/templates/add_member.html9
-rw-r--r--ihatemoney/templates/authenticate.html19
-rw-r--r--ihatemoney/templates/create_project.html8
-rw-r--r--ihatemoney/templates/dashboard.html21
-rw-r--r--ihatemoney/templates/debug.html1
-rw-r--r--ihatemoney/templates/display_errors.html5
-rw-r--r--ihatemoney/templates/edit_member.html17
-rw-r--r--ihatemoney/templates/edit_project.html19
-rw-r--r--ihatemoney/templates/forms.html168
-rw-r--r--ihatemoney/templates/home.html56
-rw-r--r--ihatemoney/templates/invitation_mail.en10
-rw-r--r--ihatemoney/templates/invitation_mail.fr9
-rw-r--r--ihatemoney/templates/layout.html98
-rw-r--r--ihatemoney/templates/list_bills.html128
-rw-r--r--ihatemoney/templates/password_reminder.en8
-rw-r--r--ihatemoney/templates/password_reminder.fr7
-rw-r--r--ihatemoney/templates/password_reminder.html8
-rw-r--r--ihatemoney/templates/recent_projects.html8
-rw-r--r--ihatemoney/templates/reminder_mail.en9
-rw-r--r--ihatemoney/templates/reminder_mail.fr8
-rw-r--r--ihatemoney/templates/send_invites.html20
-rw-r--r--ihatemoney/templates/settle_bills.html34
-rw-r--r--ihatemoney/templates/sidebar_table_layout.html14
24 files changed, 701 insertions, 0 deletions
diff --git a/ihatemoney/templates/add_bill.html b/ihatemoney/templates/add_bill.html
new file mode 100644
index 0000000..595f363
--- /dev/null
+++ b/ihatemoney/templates/add_bill.html
@@ -0,0 +1,17 @@
+{% extends "layout.html" %}
+
+{% block js %}
+ $('#cancel-form').click(function(){location.href={{ url_for(".list_bills") }};});
+{% endblock %}
+
+
+{% block top_menu %}
+<a href="{{ url_for(".list_bills") }}">{{ _("Back to the list") }}</a>
+{% endblock %}
+
+{% block content %}
+
+<form class="form-horizontal" method="post">
+ {{ forms.add_bill(form, edit) }}
+</form>
+{% endblock %}
diff --git a/ihatemoney/templates/add_member.html b/ihatemoney/templates/add_member.html
new file mode 100644
index 0000000..8ddfd52
--- /dev/null
+++ b/ihatemoney/templates/add_member.html
@@ -0,0 +1,9 @@
+{% extends "layout.html" %}
+{% block js %}
+ auto_hide_default_text('#name');
+{% endblock %}
+{% block content %}
+ <form class="form-horizontal" action="{{ url_for(".add_member") }}" method="post">
+ {{ forms.add_member(form) }}
+ </form>
+{% endblock %}
diff --git a/ihatemoney/templates/authenticate.html b/ihatemoney/templates/authenticate.html
new file mode 100644
index 0000000..f241c48
--- /dev/null
+++ b/ihatemoney/templates/authenticate.html
@@ -0,0 +1,19 @@
+{% extends "layout.html" %}
+{% block content %}
+<h2>Authentication</h2>
+
+{% if create_project %}
+<p class="info">{{ _("The project you are trying to access do not exist, do you want
+to") }} <a href="{{ url_for(".create_project", project_id=create_project) }}">{{ _("create it") }}</a>{{ _("?") }}
+</p>
+{% endif %}
+{% if admin_auth %}
+<form class="form-horizontal" method="POST" accept-charset="utf-8">
+ {{ forms.admin(form) }}
+</form>
+{% else %}
+<form class="form-horizontal" method="POST" accept-charset="utf-8">
+ {{ forms.authenticate(form) }}
+</form>
+{% endif %}
+{% endblock %}
diff --git a/ihatemoney/templates/create_project.html b/ihatemoney/templates/create_project.html
new file mode 100644
index 0000000..9d4fde9
--- /dev/null
+++ b/ihatemoney/templates/create_project.html
@@ -0,0 +1,8 @@
+{% extends "layout.html" %}
+
+{% block content %}
+<h2>{{ _("Create a new project") }}</h2>
+<form class="form-horizontal" method="post">
+ {{ forms.create_project(form) }}
+</form>
+{% endblock %}
diff --git a/ihatemoney/templates/dashboard.html b/ihatemoney/templates/dashboard.html
new file mode 100644
index 0000000..3f50915
--- /dev/null
+++ b/ihatemoney/templates/dashboard.html
@@ -0,0 +1,21 @@
+{% extends "layout.html" %}
+{% block content %}
+
+<table id="bill_table" class="table table-striped">
+ <thead><tr><th>{{ _("Project") }}</th><th>{{ _("Number of members") }}</th><th>{{ _("Number of bills") }}</th><th>{{_("Newest bill")}}</th><th>{{_("Oldest bill")}}</th></tr></thead>
+ <tbody>{% for project in projects|sort(attribute='name') %}
+ <tr class="{{ loop.cycle("odd", "even") }}">
+ <td>{{ project.name }}</td><td>{{ project.members | count }}</td><td>{{ project.get_bills().count() }}</td>
+ {% if project.has_bills() %}
+ <td>{{ project.get_bills().all()[0].date }}</td>
+ <td>{{ project.get_bills().all()[-1].date }}</td>
+ {% else %}
+ <td></td>
+ <td></td>
+ {% endif %}
+ </tr>
+ {% endfor %}
+ </tbody>
+</table>
+{% endblock %}
+
diff --git a/ihatemoney/templates/debug.html b/ihatemoney/templates/debug.html
new file mode 100644
index 0000000..6f97667
--- /dev/null
+++ b/ihatemoney/templates/debug.html
@@ -0,0 +1 @@
+Yeah
diff --git a/ihatemoney/templates/display_errors.html b/ihatemoney/templates/display_errors.html
new file mode 100644
index 0000000..9e19605
--- /dev/null
+++ b/ihatemoney/templates/display_errors.html
@@ -0,0 +1,5 @@
+{% for field_name, field_errors in form.errors.items() if field_errors %}
+ {% for error in field_errors %}
+ <p class="alert alert-danger"><strong>{{ form[field_name].label.text }}:</strong> {{ error }}</p>
+ {% endfor %}
+{% endfor %}
diff --git a/ihatemoney/templates/edit_member.html b/ihatemoney/templates/edit_member.html
new file mode 100644
index 0000000..5f097f9
--- /dev/null
+++ b/ihatemoney/templates/edit_member.html
@@ -0,0 +1,17 @@
+{% extends "layout.html" %}
+
+{% block js %}
+ $('#cancel-form').click(function(){location.href={{ url_for(".list_bills") }};});
+{% endblock %}
+
+
+{% block top_menu %}
+<a href="{{ url_for(".list_bills") }}">{{ _("Back to the list") }}</a>
+{% endblock %}
+
+{% block content %}
+
+<form class="form-horizontal" method="post">
+ {{ forms.edit_member(form, edit) }}
+</form>
+{% endblock %}
diff --git a/ihatemoney/templates/edit_project.html b/ihatemoney/templates/edit_project.html
new file mode 100644
index 0000000..a5e85c3
--- /dev/null
+++ b/ihatemoney/templates/edit_project.html
@@ -0,0 +1,19 @@
+{% extends "layout.html" %}
+
+{% block js %}
+ $('#delete-project').click(function ()
+ {
+ $(this).html("<a style='color:red; ' href='{{ url_for('.delete_project') }}' >{{_("you sure?")}}</a>");
+ });
+{% endblock %}
+
+{% block content %}
+<h2>{{ _("Edit this project") }}</h2>
+<form class="form-horizontal" method="post">
+{{ forms.edit_project(edit_form) }}
+</form></br>
+<h2>{{ _("Download this project's data") }}</h2>
+<form class="form-horizontal" method="post">
+{{ forms.export_project(export_form) }}
+</form>
+{% endblock %}
diff --git a/ihatemoney/templates/forms.html b/ihatemoney/templates/forms.html
new file mode 100644
index 0000000..ffdd165
--- /dev/null
+++ b/ihatemoney/templates/forms.html
@@ -0,0 +1,168 @@
+{% macro input(field, multiple=False, class='form-control', inline=False) -%}
+ <div class="form-group{% if inline %} row{% endif %}">
+ {% if field.type != "SubmitField" %}
+ {% if inline %}
+ {{ field.label(class="col-3") }}
+ {% else %}
+ {{ field.label() }}
+ {% endif %}
+ {% endif %}
+ <div class="controls{% if inline %} col-9{% endif %}">
+ {% if multiple == True %}
+ {{ field(multiple=True, class=class) }}
+ {% else %}
+ {{ field(class=class) | safe }}
+ {% endif %}
+ {% if field.description %}
+ <p class="help-inline">{{ field.description }}</p>
+ {% endif %}
+ </div>
+ </div>
+{% endmacro %}
+
+{% macro submit(field, cancel=False, home=False) -%}
+ <div class="actions">
+ <button type="submit" class="btn btn-primary">{{ field.name }}</button>
+ {% if home %}
+ <a href="{{ url_for(".remind_password") }}">{{ _("Can't remember the password?") }}</a>
+ {% endif %}
+ {% if cancel %}
+ <button type="reset" class="btn">{{ _("Cancel") }}</button>
+ {% endif %}
+ </div>
+{% endmacro %}
+
+{% macro authenticate(form, home=False) %}
+
+ {% include "display_errors.html" %}
+
+ {{ form.hidden_tag() }}
+ {{ input(form.id) }}
+ {{ input(form.password) }}
+ {% if not home %}
+ {{ submit(form.submit, home=True) }}
+ {% endif %}
+
+{% endmacro %}
+
+{% macro admin(form) %}
+
+ {% include "display_errors.html" %}
+
+ {{ form.hidden_tag() }}
+ {{ input(form.admin_password) }}
+ {{ submit(form.submit) }}
+
+{% endmacro %}
+
+{% macro create_project(form, home=False) %}
+
+ {% include "display_errors.html" %}
+ {{ form.hidden_tag() }}
+ {% if not home %}
+ {{ input(form.id) }}
+ {% endif %}
+ {{ input(form.name) }}
+ {{ input(form.password) }}
+ {{ input(form.contact_email) }}
+ {% if not home %}
+ {{ submit(form.submit, home=True) }}
+ {% endif %}
+
+{% endmacro %}
+
+{% macro edit_project(form) %}
+
+ {% include "display_errors.html" %}
+ {{ form.hidden_tag() }}
+ {{ input(form.name) }}
+ {{ input(form.password) }}
+ {{ input(form.contact_email) }}
+ <div class="actions">
+ <button class="btn btn-primary">{{ _("Edit the project") }}</button>
+ <a id="delete-project" style="color:red; margin-left:10px; cursor:pointer; ">{{ _("delete") }}</a>
+ </div>
+
+{% endmacro %}
+
+{% macro add_bill(form, edit=False, title=True) %}
+
+ <fieldset>
+ {% if title %}<legend>{% if edit %}{{ _("Edit this bill") }} {% else %}{{ _("Add a bill") }} {% endif %}</legend>{% endif %}
+ {% include "display_errors.html" %}
+ {{ form.hidden_tag() }}
+ {{ input(form.date, class="form-control datepicker", inline=True) }}
+ {{ input(form.what, inline=True) }}
+ {{ input(form.payer, inline=True, class="form-control custom-select") }}
+ {{ input(form.amount, inline=True) }}
+
+ <div class="form-group row">
+ <label class="col-3" for="payed_for">{{ _("For whom?") }}</label>
+ <div class="controls col-9">
+ <ul id="payed_for" class="inputs-list">
+ <p><a href="#" id="selectall" onclick="selectall()">{{ _("Select all") }}</a> | <a href="#" id="selectnone" onclick="selectnone()">{{_("Select none")}}</a></p>
+ {% for key, value, checked in form.payed_for.iter_choices() %}
+ <p class="form-check"><label for="payed_for-{{key}}" class="form-check-label"><input name="payed_for" type="checkbox" {% if checked %}checked{% endif %} class="form-check-input" value="{{key}}" id="payed_for-{{key}}"/><span>{{value}}</span></label></p>
+ {% endfor %}
+ </ul>
+ </div>
+ </div>
+ </fieldset>
+ <div class="actions">
+ {{ form.submit(class="btn btn-primary") }}
+ {% if not edit %} {{ form.submit2(class="btn") }}{% endif %}
+ </div>
+
+{% endmacro %}
+
+{% macro add_member(form) %}
+{{ form.hidden_tag() }}
+ <div class="input-group">
+ <label class="sr-only" for="name">_("Type user name here")</label>
+ {{ form.name(placeholder=_("Type user name here"), class="form-control") }}
+ <button class=" input-group-addon btn">{{ _("Add") }}</button>
+ </div>
+{% endmacro %}
+
+{% macro edit_member(form, title=True) %}
+ <fieldset>
+ {% if title %}<legend>{{ _("Edit this member") }}</legend>{% endif %}
+ {% include "display_errors.html" %}
+ {{ form.hidden_tag() }}
+ {{ input(form.name) }}
+ {{ input(form.weight) }}
+ </fieldset>
+ <div class="actions">
+ {{ form.submit(class="btn btn-primary") }}
+ </div>
+{% endmacro %}
+
+
+{% macro invites(form) %}
+ {{ form.hidden_tag() }}
+ {{ input(form.emails) }}
+ <div class="actions">
+ <button class="btn btn-primary">{{ _("Send the invitations") }}</button>
+ <a href="{{ url_for(".list_bills") }}">{{ _("No, thanks") }}</a>
+ </div>
+{% endmacro %}
+
+{% macro export_project(form) %}
+ <fieldset>
+ {{ form.hidden_tag() }}
+ {{ input(form.export_type) }}
+ {{ input(form.export_format) }}
+ </fieldset>
+ <div class="actions">
+ <button class="btn btn-primary">{{ _("Download") }}</button>
+ </div>
+{% endmacro %}
+
+{% macro remind_password(form) %}
+
+ {% include "display_errors.html" %}
+ {{ form.hidden_tag() }}
+ {{ input(form.id) }}
+ {{ submit(form.submit) }}
+
+{% endmacro %}
diff --git a/ihatemoney/templates/home.html b/ihatemoney/templates/home.html
new file mode 100644
index 0000000..9bfe467
--- /dev/null
+++ b/ihatemoney/templates/home.html
@@ -0,0 +1,56 @@
+{% extends "layout.html" %}
+
+
+{% block body %}
+ <header id="header" class="row">
+ <div class="col-xs-12 col-sm-5 offset-md-2">
+ <h2>{{ _("Manage your shared <br>expenses, easily") }}</h2>
+ {% if is_demo_project_activated %}
+ <a href="{{ url_for(".demo") }}" class="tryout btn">{{ _("Try out the demo") }}</a>
+ {% endif %}
+ </div>
+ <div class="col-xs-12 col-sm-4">
+ <p class="additional-content">{{ _("You're sharing a house?") }}<br /> {{ _("Going on holidays with friends?") }}<br /> {{ _("Simply sharing money with others?") }} <br /><strong>{{ _("We can help!") }}</strong></p>
+ </div>
+ </header>
+
+ <main class="row home">
+ <div class="col-xs-12 col-sm-5 col-md-4 offset-md-2">
+ <form id="authentication-form" class="form-horizontal" action="{{ url_for(".authenticate") }}" method="post">
+ <fieldset class="form-group">
+ <legend>{{ _("Log to an existing project") }}...</legend>
+ {{ forms.authenticate(auth_form, home=True) }}
+ </fieldset>
+ <div class="controls">
+ <button class="btn" type="submit">{{ _("log in") }}</button>
+ <a class="password-reminder" href="{{ url_for(".remind_password") }}">{{ _("can't remember your password?") }}</a>
+ </div>
+ </form>
+ </div>
+ <div class="col-xs-12 col-sm-5 col-md-3 offset-sm-1">
+ {% if is_admin_mode_enabled %}
+ <a href="{{ url_for(".create_project") }}">...{{ _("or create a new one") }}</a>
+ {% else %}
+ <form id="creation-form" class="form-horizontal" action="{{ url_for(".create_project") }}" method="post">
+ <fieldset class="form-group">
+ <legend>...{{ _("or create a new one") }}</legend>
+ {{ forms.create_project(project_form, home=True) }}
+ </fieldset>
+ <div class="controls">
+ <button class="btn" type="submit">{{ _("let's get started") }}</button>
+ </div>
+ </form>
+ {% endif %}
+ </main>
+ </div>
+{% endblock %}
+
+{% block js %}
+
+$('#creation-form #password').tooltip({
+ title: '{{ _("This access code will be sent to your friends. It is stored as-is by the server, so don\\'t reuse a personal password!") }}',
+ trigger: 'focus',
+ placement: 'right'
+});
+
+{% endblock %}
diff --git a/ihatemoney/templates/invitation_mail.en b/ihatemoney/templates/invitation_mail.en
new file mode 100644
index 0000000..03f5141
--- /dev/null
+++ b/ihatemoney/templates/invitation_mail.en
@@ -0,0 +1,10 @@
+Hi,
+
+Someone using the email address {{ g.project.contact_email }} invited you to share your expenses for "{{ g.project.name }}".
+
+It's as simple as saying what did you paid for, for who, and how much did it cost you, we are caring about the rest.
+
+You can access it here: {{ config['SITE_URL'] }}{{ url_for(".list_bills") }} and the private code is "{{ g.project.password }}".
+
+Enjoy,
+Some weird guys (with beards)
diff --git a/ihatemoney/templates/invitation_mail.fr b/ihatemoney/templates/invitation_mail.fr
new file mode 100644
index 0000000..53698dd
--- /dev/null
+++ b/ihatemoney/templates/invitation_mail.fr
@@ -0,0 +1,9 @@
+Salut,
+
+Quelqu'un avec l'addresse email "{{ g.project.contact_email }}" vous à invité à partager vos dépenses pour "{{ g.project.name }}".
+
+C'est aussi simple que de dire qui à payé pour quoi, pour qui, et combien celà à coûté, on s'occuppe du reste.
+
+Vous pouvez accéder à la page ici: {{ config['SITE_URL'] }}{{ url_for(".list_bills") }} et le code est "{{ g.project.password }}".
+
+Have fun,
diff --git a/ihatemoney/templates/layout.html b/ihatemoney/templates/layout.html
new file mode 100644
index 0000000..6ecff41
--- /dev/null
+++ b/ihatemoney/templates/layout.html
@@ -0,0 +1,98 @@
+{% import "forms.html" as forms %}
+<!DOCTYPE html>
+<html>
+<head>
+ <title>{{ _("Account manager") }}{% block title %}{% endblock %}</title>
+ <meta http-equiv="content-type" content="text/html; charset=utf-8">
+ <meta name="viewport" content="width=device-width, initial-scale=1">
+ <link rel=stylesheet type=text/css href="{{ url_for("static", filename='css/main.css') }}">
+ <script src="{{ url_for("static", filename="js/jquery-3.1.1.min.js") }}"></script>
+ <script src="{{ url_for("static", filename="js/ihatemoney.js") }}"></script>
+ <script src="{{ url_for("static", filename="js/tether.min.js") }}"></script>
+ <script src="{{ url_for("static", filename="js/bootstrap.min.js") }}"></script>
+ {% block head %}{% endblock %}
+ <script type="text/javascript" charset="utf-8">
+ $(document).ready(function(){
+ var left = window.innerWidth/2-$('.flash').width()/2;
+ $(".flash").css({ "left": left+"px", "top":"0.6rem" });
+ setTimeout(function(){
+ $(".flash").fadeOut("slow", function () {
+ $(".flash").remove();
+ });
+ }, 4000);
+
+ $('.datepicker').datepicker({
+ format: 'yyyy-mm-dd',
+ weekStart: 1,
+ autoclose: true,
+ language: '{{ g.lang }}'
+ });
+
+ $('.dropdown-toggle').dropdown();
+
+ {% block js %}{% endblock %}
+ });
+ </script>
+</head>
+<body>
+ <div class="container">
+ <nav class="navbar navbar-toggleable-sm fixed-top navbar-inverse bg-inverse">
+ <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarToggler" aria-controls="navbarToggler" aria-expanded="false" aria-label="Toggle navigation">
+ <span class="navbar-toggler-icon"></span>
+ </button>
+ <div class="collapse navbar-collapse" id="navbarToggler">
+ <h1><a class="navbar-brand" href="{{ url_for(".home") }}">#! money?</a></h1>
+ <ul class="navbar-nav ml-auto mr-auto">
+ {% if g.project %}
+ {% block navbar %}
+ <li class="nav-item{% if current_view == 'list_bills' %} active{% endif %}"><a class="nav-link" href="{{ url_for(".list_bills") }}">{{ _("Bills") }}</a></li>
+ <li class="nav-item{% if current_view == 'settle_bill' %} active{% endif %}"><a class="nav-link" href="{{ url_for(".settle_bill") }}">{{ _("Settle") }}</a></li>
+ {% endblock %}
+ {% endif %}
+ </ul>
+ <ul class="navbar-nav secondary-nav">
+ {% if g.project %}
+ <li class="nav-item dropdown">
+ <a href="#" class="nav-link dropdown-toggle" id="navbarDropdownMenuLink" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"><strong>{{ g.project.name }}</strong> {{ _("options") }} <b class="caret"></b></a>
+ <ul class="dropdown-menu" aria-labelledby="navbarDropdownMenuLink">
+ <li><a class="dropdown-item" href="{{ url_for(".edit_project") }}">{{ _("Project settings") }}</a></li>
+ <li class="dropdown-divider"></li>
+ {% for id, name in session['projects'] %}
+ {% if id != g.project.id %}
+ <li><a class="dropdown-item" href="{{ url_for(".list_bills", project_id=id) }}">{{ _("switch to") }} {{ name }}</a></li>
+ {% endif %}
+ {% endfor %}
+ <li><a class="dropdown-item" href="{{ url_for(".create_project") }}">{{ _("Start a new project") }}</a></li>
+ <li class="dropdown-divider"></li>
+ <li><a class="dropdown-item" href="{{ url_for(".exit") }}">{{ _("Logout") }}</a></li>
+ </ul>
+ </li>
+ {% endif %}
+ <li class="nav-item{% if g.lang == "fr" %} active{% endif %}"><a class="nav-link" href="{{ url_for(".change_lang", lang="fr") }}">fr</a></li>
+ <li class="nav-item{% if g.lang == "en" %} active{% endif %}"><a class="nav-link" href="{{ url_for(".change_lang", lang="en") }}">en</a></li>
+ </ul>
+ </div>
+ </nav>
+ </div>
+
+<div class="container-fluid">
+{% block body %}
+ {% block sidebar %}{% endblock %}
+ <main class="content offset-1 col-10">
+ {% block content %}{% endblock %}
+ </main>
+</div>
+{% endblock %}
+
+{% for message in get_flashed_messages() %}
+<div class="flash alert alert-success">{{ message }}</div>
+{% endfor %}
+
+{% block footer %}
+<footer>
+ <p><a href="https://github.com/spiral-project/ihatemoney">{{ _("This is a free software") }}</a>, {{ _("you can contribute and improve it!") }}</p>
+</footer>
+{% endblock %}
+
+</body>
+</html>
diff --git a/ihatemoney/templates/list_bills.html b/ihatemoney/templates/list_bills.html
new file mode 100644
index 0000000..4029bc9
--- /dev/null
+++ b/ihatemoney/templates/list_bills.html
@@ -0,0 +1,128 @@
+{% extends "sidebar_table_layout.html" %}
+
+{% block title %} - {{ g.project.name }}{% endblock %}
+{% block head %}
+ <script src="{{ url_for("static", filename="js/bootstrap-datepicker.js") }}"></script>
+ <script src="{{ url_for("static", filename="js/locales/bootstrap-datepicker.fr.min.js") }}" charset="utf-8"></script>
+{% endblock %}
+{% block js %}
+ {% if add_bill %} $('#new-bill').click(); {% endif %}
+
+ // Hide all members actions
+ $('.action').each(function(){
+ $(this).hide();
+ });
+
+ // ask for confirmation before removing an user
+ $('.action.delete').each(function(){
+ var link = $(this).find('button');
+ link.click(function(){
+ if ($(this).hasClass("confirm")){
+ return true;
+ }
+ $(this).html("{{_("you sure?")}}");
+ $(this).addClass("confirm");
+ return false;
+ });
+ });
+
+ // display the remove button on mouse over (and hide them per default)
+ $('.balance tr').hover(function(){
+ $(this).find('.action').show();
+ }, function(){
+ $(this).find('.action').hide();
+ });
+
+ var highlight_owers = function(){
+ var ower_ids = $(this).attr("owers").split(',');
+ var payer_id = $(this).attr("payer");
+ $.each(ower_ids, function(i, val){
+ $('#bal-member-'+val).addClass("ower_line");
+ });
+ $("#bal-member-"+payer_id).addClass("payer_line");
+ };
+
+ var unhighlight_owers = function(){
+ $('[id^="bal-member-"]').removeClass("ower_line payer_line");
+ };
+
+ $('#bill_table tbody tr').hover(highlight_owers, unhighlight_owers);
+
+{% endblock %}
+
+{% block sidebar %}
+ <form id="add-member-form" action="{{ url_for(".add_member") }}" method="post" class="form-inline">
+ {{ forms.add_member(member_form) }}
+ </form>
+
+ <div id="table_overflow">
+ <table class="balance table">
+ {% set balance = g.project.balance %}
+ {% for member in g.project.members | sort(attribute='name') if member.activated or balance[member.id]|round(2) != 0 %}
+ <tr id="bal-member-{{ member.id }}" action={% if member.activated %}delete{% else %}reactivate{% endif %}>
+ <td class="balance-name">{{ member.name }}
+ <span class="light{% if not g.project.uses_weights %} extra-info{% endif %}">(x{{ member.weight|minimal_round(1) }})</span>
+ </td>
+ {% if member.activated %}
+ <td>
+ <form class="action delete" action="{{ url_for(".remove_member", member_id=member.id) }}" method="POST">
+ <button type="submit">{{ _("deactivate") }}</button></form>
+ <form class="action edit" action="{{ url_for(".edit_member", member_id=member.id) }}" method="GET">
+ <button type="submit">{{ _("edit") }}</button></form>
+ </td>
+ {% else %}
+ <td>
+ <form class="action reactivate" action="{{ url_for(".reactivate", member_id=member.id) }}" method="POST">
+ <button type="submit">{{ _("reactivate") }}</button></form></td>
+ {% endif %}
+ <td class="balance-value {% if balance[member.id]|round(2) > 0 %}positive{% elif balance[member.id]|round(2) < 0 %}negative{% endif %}">
+ {% if balance[member.id]|round(2) > 0 %}+{% endif %}{{ "%.2f" | format(balance[member.id]) }}
+ </td>
+ </tr>
+ {% endfor %}
+ </table>
+ </div>
+{% endblock %}
+
+{% block content %}
+<div class="identifier">{{ _("The project identifier is") }} <a href="{{ url_for(".list_bills") }}">{{ g.project.id }}</a>, {{ _("remember it!") }}</div>
+<a id="new-bill" href="{{ url_for(".add_bill") }}" class="btn btn-primary" data-toggle="modal" data-target="#bill-form">{{ _("Add a new bill") }}</a>
+
+ <div id="bill-form" class="modal fade show" role="dialog">
+ <div class="modal-dialog" role="document">
+ <div class="modal-content">
+ <div class="modal-header">
+ <h3 class="modal-title">{{ _('Add a bill') }}</h3>
+ <a href="#" class="close" data-dismiss="modal">&times;</a>
+ </div>
+ <form action="{{ url_for(".add_bill") }}" method="post" class="modal-body container">
+ {{ forms.add_bill(bill_form, title=False) }}
+ </form>
+ </div>
+ </div>
+ </div>
+
+ {% if bills.count() > 0 %}
+ <table id="bill_table" class="col table table-striped table-hover">
+ <thead><tr><th>{{ _("When?") }}</th><th>{{ _("Who paid?") }}</th><th>{{ _("For what?") }}</th><th>{{ _("For whom?") }}</th><th>{{ _("How much?") }}</th><th>{{ _("Actions") }}</th></tr></thead>
+ <tbody>
+ {% for bill in bills %}
+ <tr owers="{{bill.owers|join(',','id')}}" payer="{{bill.payer.id}}">
+ <td>{{ bill.date }}</td>
+ <td>{{ bill.payer }}</td>
+ <td>{{ bill.what }}</td>
+ <td>{{ bill.owers|join(', ', 'name') }} </td>
+ <td>{{ "%0.2f"|format(bill.amount) }} ({{ "%0.2f"|format(bill.pay_each()) }} {{ _("each") }})</td>
+ <td class="bill-actions">
+ <a class="edit" href="{{ url_for(".edit_bill", bill_id=bill.id) }}" title="{{ _("edit") }}">{{ _('edit') }}</a>
+ <a class="delete" href="{{ url_for(".delete_bill", bill_id=bill.id) }}" title="{{ _("delete") }}">{{ _('delete') }}</a>
+ </td>
+ </tr>
+ {% endfor %}
+ </tbody>
+ </table>
+
+ {% else %}
+ <p>{{ _("Nothing to list yet. You probably want to") }} <a href="{{ url_for(".add_bill") }}" data-toggle="modal" data-target="#bill-form">{{ _("add a bill") }}</a> ?</p>
+ {% endif %}
+{% endblock %}
diff --git a/ihatemoney/templates/password_reminder.en b/ihatemoney/templates/password_reminder.en
new file mode 100644
index 0000000..31210aa
--- /dev/null
+++ b/ihatemoney/templates/password_reminder.en
@@ -0,0 +1,8 @@
+Hi,
+
+You requested to be reminded about your password for "{{ project.name }}".
+
+You can access it here: {{ config['SITE_URL'] }}{{ url_for(".list_bills", project_id=project.id) }}, the private code is "{{ project.password }}".
+
+Hope this helps,
+Some weird guys (with beards)
diff --git a/ihatemoney/templates/password_reminder.fr b/ihatemoney/templates/password_reminder.fr
new file mode 100644
index 0000000..58f04e3
--- /dev/null
+++ b/ihatemoney/templates/password_reminder.fr
@@ -0,0 +1,7 @@
+Salut,
+
+Vous avez demandez des informations sur votre mot de passe pour "{{ project.name }}".
+
+Vous pouvez y accéder ici {{ config['SITE_URL'] }}{{ url_for(".list_bills", project_id=project.id) }}, le code d'accès est "{{ project.password }}".
+
+Faites en bon usage !
diff --git a/ihatemoney/templates/password_reminder.html b/ihatemoney/templates/password_reminder.html
new file mode 100644
index 0000000..8f46289
--- /dev/null
+++ b/ihatemoney/templates/password_reminder.html
@@ -0,0 +1,8 @@
+{% extends "layout.html" %}
+
+{% block content %}
+<h2>{{ _("Password reminder") }}</h2>
+<form class="form-horizontal" method="post">
+{{ forms.remind_password(form) }}
+</form>
+{% endblock %}
diff --git a/ihatemoney/templates/recent_projects.html b/ihatemoney/templates/recent_projects.html
new file mode 100644
index 0000000..df4972d
--- /dev/null
+++ b/ihatemoney/templates/recent_projects.html
@@ -0,0 +1,8 @@
+{% if 'projects' in session %}
+<h3>{{ _("Your projects") }}</h3>
+ <ul>
+ {% for id, name in session['projects'] %}
+ <li><a href="{{ url_for("list_bills", project_id=id) }}">{{ name }}</a></li>
+ {% endfor %}
+ </ul>
+{% endif %}
diff --git a/ihatemoney/templates/reminder_mail.en b/ihatemoney/templates/reminder_mail.en
new file mode 100644
index 0000000..fe57be2
--- /dev/null
+++ b/ihatemoney/templates/reminder_mail.en
@@ -0,0 +1,9 @@
+Hi,
+
+You have just (or someone else using your email address) created the project "{{ g.project.name }}" to share your expenses.
+
+You can access it here: {{ config['SITE_URL'] }}{{ url_for(".list_bills") }} (the identifier is {{ g.project.id }}),
+and the private code is "{{ g.project.password }}".
+
+Enjoy,
+Some weird guys (with beards)
diff --git a/ihatemoney/templates/reminder_mail.fr b/ihatemoney/templates/reminder_mail.fr
new file mode 100644
index 0000000..8130218
--- /dev/null
+++ b/ihatemoney/templates/reminder_mail.fr
@@ -0,0 +1,8 @@
+Hey,
+
+Vous venez de créer le projet "{{ g.project.name }}" pour partager vos dépenses.
+
+Vous pouvez y accéder ici: {{ config['SITE_URL'] }}{{ url_for(".list_bills") }} (l'identifieur est {{ g.project.id }}),
+et le code d'accès "{{ g.project.password }}".
+
+Faites en bon usage !
diff --git a/ihatemoney/templates/send_invites.html b/ihatemoney/templates/send_invites.html
new file mode 100644
index 0000000..7b3bdc5
--- /dev/null
+++ b/ihatemoney/templates/send_invites.html
@@ -0,0 +1,20 @@
+{% extends "layout.html" %}
+
+{% block sidebar %}
+<ol>
+ <li>{{ _("Create the project") }}</li>
+ <li><strong>{{ _("Invite people") }}</strong></li>
+ <li><a href="{{ url_for(".list_bills") }}">{{ _("Use it!") }}</a></li>
+</ol>
+{% endblock %}
+{% block content %}
+<h2>{{ _("Invite people to join this project") }}</h2>
+<p>{{ _("Specify a (comma separated) list of email adresses you want to notify about the
+creation of this budget management project and we will send them an email for you.") }}</p>
+<p>{{ _("If you prefer, you can") }} <a href="{{ url_for(".list_bills") }}">{{ _("skip this step") }}</a> {{ _("and notify them yourself") }}</p>
+
+{% include "display_errors.html" %}
+<form class="invites form-horizontal" method="post" accept-charset="utf-8">
+ {{ forms.invites(form) }}
+</form>
+{% endblock %}
diff --git a/ihatemoney/templates/settle_bills.html b/ihatemoney/templates/settle_bills.html
new file mode 100644
index 0000000..b67a9b8
--- /dev/null
+++ b/ihatemoney/templates/settle_bills.html
@@ -0,0 +1,34 @@
+{% extends "sidebar_table_layout.html" %}
+
+{% block sidebar %}
+ <div id="table_overflow">
+ <table class="balance table">
+ {% set balance = g.project.balance %}
+ {% for member in g.project.members | sort(attribute='name') if member.activated or balance[member.id]|round(2) != 0 %}
+ <tr id="bal-member-{{ member.id }}" action={% if member.activated %}delete{% else %}reactivate{% endif %}>
+ <td class="balance-name">{{ member.name }}</td>
+ <td class="balance-value {% if balance[member.id]|round(2) > 0 %}positive{% elif balance[member.id]|round(2) < 0 %}negative{% endif %}">
+ {% if balance[member.id]|round(2) > 0 %}+{% endif %}{{ "%.2f" | format(balance[member.id]) }}
+ </td>
+ </tr>
+ {% endfor %}
+ </table>
+ </div>
+{% endblock %}
+
+
+{% block content %}
+ <table id="bill_table" class="split_bills table table-striped">
+ <thead><tr><th>{{ _("Who pays?") }}</th><th>{{ _("To whom?") }}</th><th>{{ _("How much?") }}</th></tr></thead>
+ <tbody>
+ {% for bill in bills %}
+ <tr class="{{ loop.cycle("odd", "even") }}" receiver={{bill.receiver.id}}>
+ <td>{{ bill.ower }}</td>
+ <td>{{ bill.receiver }}</td>
+ <td>{{ "%0.2f"|format(bill.amount) }}</td>
+ </tr>
+ {% endfor %}
+ </tbody>
+ </table>
+
+{% endblock %}
diff --git a/ihatemoney/templates/sidebar_table_layout.html b/ihatemoney/templates/sidebar_table_layout.html
new file mode 100644
index 0000000..239acb3
--- /dev/null
+++ b/ihatemoney/templates/sidebar_table_layout.html
@@ -0,0 +1,14 @@
+{% extends "layout.html" %}
+
+{% block body %}
+<div class="row" style="height: 100%">
+<aside id="sidebar" class="sidebar col-xs-12 col-md-3 " style="height: 100%">
+ {% block sidebar %}{% endblock %}
+</aside>
+
+<main class="offset-md-3 col-xs-12 col-md-9">
+ {% block content %}{% endblock %}
+</main>
+
+</div>
+{% endblock %}