This commit is contained in:
Alexis Métaireau 2024-11-16 11:55:10 +01:00 committed by GitHub
commit 42cac8827e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
25 changed files with 145 additions and 143 deletions

View file

@ -5,6 +5,7 @@ include_trailing_comma=True
force_grid_wrap=0 force_grid_wrap=0
line_length=88 line_length=88
combine_as_imports=True combine_as_imports=True
profile = "black"
# If set, imports will be sorted within their section independent to the import_type. # If set, imports will be sorted within their section independent to the import_type.
force_sort_within_sections=True force_sort_within_sections=True

View file

@ -46,3 +46,4 @@ SUPPORTED_LANGUAGES = [
"uk", "uk",
"zh_Hans", "zh_Hans",
] ]
SHOWCASE_LANGUAGES = ["en", "fr"]

Binary file not shown.

After

Width:  |  Height:  |  Size: 102 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 66 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 66 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 56 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 75 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 77 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 70 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 66 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 89 KiB

View file

Before

Width:  |  Height:  |  Size: 108 KiB

After

Width:  |  Height:  |  Size: 108 KiB

View file

Before

Width:  |  Height:  |  Size: 79 KiB

After

Width:  |  Height:  |  Size: 79 KiB

View file

Before

Width:  |  Height:  |  Size: 77 KiB

After

Width:  |  Height:  |  Size: 77 KiB

View file

Before

Width:  |  Height:  |  Size: 72 KiB

After

Width:  |  Height:  |  Size: 72 KiB

View file

Before

Width:  |  Height:  |  Size: 84 KiB

After

Width:  |  Height:  |  Size: 84 KiB

View file

Before

Width:  |  Height:  |  Size: 114 KiB

After

Width:  |  Height:  |  Size: 114 KiB

View file

Before

Width:  |  Height:  |  Size: 89 KiB

After

Width:  |  Height:  |  Size: 89 KiB

View file

Before

Width:  |  Height:  |  Size: 92 KiB

After

Width:  |  Height:  |  Size: 92 KiB

View file

Before

Width:  |  Height:  |  Size: 130 KiB

After

Width:  |  Height:  |  Size: 130 KiB

View file

@ -1,90 +1,81 @@
{% extends "layout.html" %} {% extends "layout.html" %}
{% block body %} {% block body %}
<header id="header" class="row"> <header id="header" class="row">
<div class="col-xs-12 col-sm-5 offset-md-2"> <div class="col-xs-12 col-sm-5 offset-md-2">
<h2>{{ _("Manage your shared <br />expenses, easily") }}</h2> <h2>
{{ _("Manage your shared <br />expenses, easily") }}
</h2>
{% if is_demo_project_activated %} {% if is_demo_project_activated %}
<a href="{{ url_for('.demo') }}" class="tryout btn"> <a href="{{ url_for(".demo") }}" class="tryout btn">{{ _("Try out the demo") }}</a>
{{ _("Try out the demo") }}
</a>
{% endif %} {% endif %}
{% if g.lang == 'fr' %} {% if g.lang == 'fr' or g.lang == 'en' %}
ou {{ _("or") }}
<span class="side-to-side"> <span class="side-to-side">
<a class="showcase btn" onclick="javascript:showGallery(); return false;">Voir la BD explicative</a> <a class="showcase btn"
<img class="showcaseimg" src="{{ url_for("static", filename='images/indicate.svg') }}" /> onclick="javascript:showGallery(); return false;">{{ _("See the explicative comics") }}</a>
<img class="showcaseimg"
src="{{ url_for("static", filename='images/indicate.svg') }}" />
</span> </span>
{% endif %} {% endif %}
</div> </div>
<div class="col-xs-12 col-sm-4"> <div class="col-xs-12 col-sm-4">
<table class="additional-content"><tr> <table class="additional-content">
<tr>
<td> <td>
{{ _("You're sharing a house?") }}<br /> {{ _("You're sharing a house?") }}
{{ _("Going on holidays with friends?") }}<br /> <br />
{{ _("Simply sharing money with others?") }} <br /> {{ _("Going on holidays with friends?") }}
<br />
{{ _("Simply sharing money with others?") }}
<br />
<strong>{{ _("We can help!") }}</strong> <strong>{{ _("We can help!") }}</strong>
</td> </td>
<td> <td>
<img class="shareimg" src="{{ url_for("static", filename='images/share.svg') }}" /> <img class="shareimg"
src="{{ url_for("static", filename='images/share.svg') }}" />
</td> </td>
</tr></table> </tr>
</table>
</div> </div>
</header> </header>
<main class="row home"> <main class="row home">
<div class="card-deck ml-auto mr-auto"> <div class="card-deck ml-auto mr-auto">
<div class="card"> <div class="card">
<div class="card-header"> <div class="card-header">{{ _("Log in to an existing project") }}</div>
{{ _("Log in to an existing project") }}
</div>
<div class="card-body"> <div class="card-body">
<form <form id="authentication-form"
id="authentication-form"
class="form-horizontal" class="form-horizontal"
action="{{ url_for('.authenticate') }}" action="{{ url_for(".authenticate") }}"
method="post"> method="post">
<fieldset class="form-group"> <fieldset class="form-group">
<legend></legend> <legend></legend>
{{ forms.authenticate(auth_form, home=True) }} {{ forms.authenticate(auth_form, home=True) }}
</fieldset> </fieldset>
<div class="controls"> <div class="controls">
<button class="btn btn-primary btn-block" type="submit"> <button class="btn btn-primary btn-block" type="submit">{{ _("Log in") }}</button>
{{ _("Log in") }} <a class="password-reminder btn btn-link"
</button> href="{{ url_for(".remind_password") }}">{{ _("can't remember your password?") }}</a>
<a
class="password-reminder btn btn-link"
href="{{ url_for('.remind_password') }}"
>{{ _("can't remember your password?") }}</a
>
</div> </div>
</form> </form>
</div> </div>
</div> </div>
<div class="card"> <div class="card">
<div class="card-header"> <div class="card-header">{{ _("Create a new project") }}</div>
{{ _("Create a new project") }}
</div>
<div class="card-body"> <div class="card-body">
{% if is_public_project_creation_allowed %} {% if is_public_project_creation_allowed %}
<form <form id="creation-form"
id="creation-form"
class="form-horizontal" class="form-horizontal"
action="{{ url_for('.create_project') }}" action="{{ url_for(".create_project") }}"
method="post" method="post">
>
<fieldset class="form-group"> <fieldset class="form-group">
{{ forms.create_project(project_form, home=True) }} {{ forms.create_project(project_form, home=True) }}
</fieldset> </fieldset>
<div class="controls"> <div class="controls">
<button class="btn btn-primary btn-block" type="submit"> <button class="btn btn-primary btn-block" type="submit">{{ _("Create") }}</button>
{{ _("Create") }}
</button>
</div> </div>
</form> </form>
{% else %} {% else %}
<a href="{{ url_for('.create_project') }}"> <a href="{{ url_for(".create_project") }}">{{ _("Create a new project") }}</a>
{{ _("Create a new project") }}
</a>
{% endif %} {% endif %}
</div> </div>
</div> </div>

View file

@ -46,7 +46,7 @@
</script> </script>
</head> </head>
<body class="d-flex flex-column h-100"> <body class="d-flex flex-column h-100">
{% if g.lang == 'fr' %}{% include "showcase.html" %}{% endif %} {% if display_showcase %}{% include "showcase.html" %}{% endif %}
<nav class="navbar navbar-expand-lg fixed-top navbar-dark bg-dark"> <nav class="navbar navbar-expand-lg fixed-top navbar-dark bg-dark">
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarToggler" aria-controls="navbarToggler" aria-expanded="false" aria-label="Toggle navigation"> <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> <span class="navbar-toggler-icon"></span>

View file

@ -1,4 +1,8 @@
<div id="pswp" class="hiddenpswp" tabindex="-1" role="dialog" aria-hidden="true"> <div id="pswp"
class="hiddenpswp"
tabindex="-1"
role="dialog"
aria-hidden="true">
<div class="pswp__bg"></div> <div class="pswp__bg"></div>
<div class="pswp__scroll-wrap"> <div class="pswp__scroll-wrap">
<div class="pswp__container"> <div class="pswp__container">
@ -18,13 +22,10 @@
</div> </div>
</div> </div>
</div> </div>
<button class="pswp__button pswp__button--arrow--left"
<button class="pswp__button pswp__button--arrow--left" title="Suivant (flèche droite)"> title="Suivant (flèche droite)"></button>
</button> <button class="pswp__button pswp__button--arrow--right"
title="Précédent (flèche gauche)"></button>
<button class="pswp__button pswp__button--arrow--right" title="Précédent (flèche gauche)">
</button>
<div class="pswp__caption"> <div class="pswp__caption">
<div class="pswp__caption__center"></div> <div class="pswp__caption__center"></div>
</div> </div>
@ -32,18 +33,26 @@
</div> </div>
</div> </div>
<script type="text/javascript"> <script type="text/javascript">
var pswpElement = document.getElementById('pswp'); var pswpElement = document.getElementById("pswp");
var items = JSON.parse('[{"h": 2450, "src": "{{ url_for("static", filename="showcase/1.webp") }}", "w": 2450}, {"h": 2509, "src": "{{ url_for("static", filename="showcase/2.webp") }}", "w": 2221}, {"h": 2536, "src": "{{ url_for("static", filename="showcase/3.webp") }}", "w": 2101}, {"h": 2722, "src": "{{ url_for("static", filename="showcase/4.webp") }}", "w": 2348}, {"h": 2745, "src": "{{ url_for("static", filename="showcase/5.webp") }}", "w": 1804}, {"h": 3307, "src": "{{ url_for("static", filename="showcase/6.webp") }}", "w": 2897}, {"h": 2321, "src": "{{ url_for("static", filename="showcase/7.webp") }}", "w": 2239}, {"h": 2470, "src": "{{ url_for("static", filename="showcase/8.webp") }}", "w": 2419}, {"h": 3307, "src": "{{ url_for("static", filename="showcase/9.webp") }}", "w": 2602}]');
var options = { var options = {
index: 0, index: 0,
loop: false, loop: false,
}; };
function showGallery(){ function showGallery(){
let items = [
{"h": 2450, "src": "{{ url_for('static', filename='showcase/' + g.lang + '/1.webp') }}", "w": 2450},
{"h": 2509, "src": "{{ url_for('static', filename='showcase/' + g.lang + '/2.webp') }}", "w": 2221},
{"h": 2536, "src": "{{ url_for('static', filename='showcase/' + g.lang + '/3.webp') }}", "w": 2101},
{"h": 2722, "src": "{{ url_for('static', filename='showcase/' + g.lang + '/4.webp') }}", "w": 2348},
{"h": 2745, "src": "{{ url_for('static', filename='showcase/' + g.lang + '/5.webp') }}", "w": 1804},
{"h": 3307, "src": "{{ url_for('static', filename='showcase/' + g.lang + '/6.webp') }}", "w": 2897},
{"h": 2321, "src": "{{ url_for('static', filename='showcase/' + g.lang + '/7.webp') }}", "w": 2239},
{"h": 2470, "src": "{{ url_for('static', filename='showcase/' + g.lang + '/8.webp') }}", "w": 2419},
{"h": 3307, "src": "{{ url_for('static', filename='showcase/' + g.lang + '/9.webp') }}", "w": 2602}
];
/* the CSS and JS for photoswipe is loaded dynamically // CSS and JS are loaded dynamically when the gallery opens
* so that they are not loaded if the gallery is not open */
$('head').append('<link rel="stylesheet" type="text/css" href="{{ url_for("static", filename="photoswipe/default-skin/default-skin.css") }}">'); $('head').append('<link rel="stylesheet" type="text/css" href="{{ url_for("static", filename="photoswipe/default-skin/default-skin.css") }}">');
$('head').append('<link rel="stylesheet" type="text/css" href="{{ url_for("static", filename="photoswipe/photoswipe.css") }}">'); $('head').append('<link rel="stylesheet" type="text/css" href="{{ url_for("static", filename="photoswipe/photoswipe.css") }}">');
@ -63,5 +72,4 @@ function showGallery(){
}; };
document.body.appendChild(script); document.body.appendChild(script);
} }
</script> </script>

View file

@ -1030,9 +1030,7 @@ class TestBudget(IhatemoneyTestCase):
assert """<thead> assert """<thead>
<tr> <tr>
<th>Project</th> <th>Project</th>
<th>Number of participants</th>""" in resp.data.decode( <th>Number of participants</th>""" in resp.data.decode("utf-8")
"utf-8"
)
def test_dashboard_project_deletion(self): def test_dashboard_project_deletion(self):
self.post_project("raclette") self.post_project("raclette")

View file

@ -296,12 +296,14 @@ def home():
is_public_project_creation_allowed = current_app.config[ is_public_project_creation_allowed = current_app.config[
"ALLOW_PUBLIC_PROJECT_CREATION" "ALLOW_PUBLIC_PROJECT_CREATION"
] ]
display_showcase = g.lang in current_app.config["SHOWCASE_LANGUAGES"]
return render_template( return render_template(
"home.html", "home.html",
project_form=project_form, project_form=project_form,
is_demo_project_activated=is_demo_project_activated, is_demo_project_activated=is_demo_project_activated,
is_public_project_creation_allowed=is_public_project_creation_allowed, is_public_project_creation_allowed=is_public_project_creation_allowed,
display_showcase=display_showcase,
auth_form=auth_form, auth_form=auth_form,
session=session, session=session,
) )
@ -678,6 +680,7 @@ def list_bills():
csrf_form=csrf_form, csrf_form=csrf_form,
add_bill=request.values.get("add_bill", False), add_bill=request.values.get("add_bill", False),
current_view="list_bills", current_view="list_bills",
display_showcase=g.lang in current_app.config["SHOWCASE_LANGUAGES"],
) )