mirror of
https://github.com/YunoHost/pepettes.git
synced 2024-09-03 20:06:20 +02:00
Compare commits
6 commits
Author | SHA1 | Date | |
---|---|---|---|
|
7c318b3d6c | ||
|
bd7b91b9a7 | ||
|
7dd7202d81 | ||
|
4efabca559 | ||
|
afaf1019aa | ||
|
a40de29ebe |
8 changed files with 49 additions and 30 deletions
|
@ -24,7 +24,7 @@ python3 -m pip install -r requirements.txt
|
|||
|
||||
Create a settings.py file with :
|
||||
|
||||
```text
|
||||
```python
|
||||
ENV = 'development'
|
||||
PORT = 8000
|
||||
DOMAIN = 'http://localhost:8000'
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<html lang="{{ lang }}">
|
||||
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
|
@ -9,7 +9,7 @@
|
|||
|
||||
<link rel="icon" href="{{ favicon }}" type="image/x-icon" />
|
||||
<link href="./css/bootstrap-5.3.3.min.css" rel="stylesheet"
|
||||
integrity="sha384-QWTKZyjpPEjISv5WaRU9OFeRpok6YctnYmDr5pNlyT2bRjXh0JMhjY6hW+ALEwIH" crossorigin="anonymous">
|
||||
integrity="sha384-QWTKZyjpPEjISv5WaRU9OFeRpok6YctnYmDr5pNlyT2bRjXh0JMhjY6hW+ALEwIH" crossorigin="anonymous" />
|
||||
<link href="./css/global.css" rel="stylesheet" />
|
||||
<script src="./darkmode.js" defer></script>
|
||||
</head>
|
||||
|
@ -17,7 +17,7 @@
|
|||
<body class="text-center">
|
||||
<main class="form-donate">
|
||||
<div>
|
||||
<img src="{{ logo }}" class="mb-4" alt="{{ _('%(name)s Logo', name=name) }}" max-width="7em" />
|
||||
<img src="{{ logo }}" class="mb-4" alt="{{ _('%(name)s Logo', name=name) }}" />
|
||||
|
||||
<h1 class="h3 mb-3 fw-normal">{{ _('Your payment was canceled') }}</h1>
|
||||
|
||||
|
|
|
@ -16,6 +16,10 @@ body {
|
|||
}
|
||||
}
|
||||
|
||||
img {
|
||||
max-width: 13em
|
||||
}
|
||||
|
||||
.form-donate {
|
||||
width: 100%;
|
||||
max-width: 330px;
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<html lang="{{ lang }}">
|
||||
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
|
@ -9,7 +9,7 @@
|
|||
|
||||
<link rel="icon" href="{{ favicon }}" type="image/x-icon" />
|
||||
<link href="./css/bootstrap-5.3.3.min.css" rel="stylesheet"
|
||||
integrity="sha384-QWTKZyjpPEjISv5WaRU9OFeRpok6YctnYmDr5pNlyT2bRjXh0JMhjY6hW+ALEwIH" crossorigin="anonymous">
|
||||
integrity="sha384-QWTKZyjpPEjISv5WaRU9OFeRpok6YctnYmDr5pNlyT2bRjXh0JMhjY6hW+ALEwIH" crossorigin="anonymous" />
|
||||
<link href="./css/global.css" rel="stylesheet" />
|
||||
<script src="https://js.stripe.com/v3/"></script>
|
||||
<script src="./index.js" defer></script>
|
||||
|
@ -19,14 +19,15 @@
|
|||
<body class="text-center">
|
||||
<main class="form-donate">
|
||||
<div>
|
||||
<img src="{{ logo }}" class="mb-4" alt="{{ _('%(name)s Logo', name=name) }}" max-width="7em" />
|
||||
<img src="{{ logo }}" class="mb-4" alt="{{ _('%(name)s Logo', name=name) }}" />
|
||||
<h1 class="h3 mb-3 fw-normal">{{ _('I want to give to %(name)s', name=name) }}</h1>
|
||||
|
||||
<div class="input-group mb-3">
|
||||
<input type="hidden" id="csrf" value="{{ csrf }}" />
|
||||
<input type="hidden" id="public_key" value="{{ stripe_publishable_key }}" />
|
||||
|
||||
<input type="number" min="0" max="9999" class="form-control" id="quantity" value="10" aria-label="Amount">
|
||||
<input type="number" min="0" max="9999" class="form-control" id="quantity" value="10"
|
||||
aria-label="{{ _('Amount') }}">
|
||||
|
||||
<select class="form-select" id="currency" style="width:40px" aria-label="{{ _('Currency') }}">
|
||||
{% for iso, symbol in currencies %}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<html lang="{{ lang }}">
|
||||
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
|
@ -9,7 +9,7 @@
|
|||
|
||||
<link rel="icon" href="{{ favicon }}" type="image/x-icon" />
|
||||
<link href="./css/bootstrap-5.3.3.min.css" rel="stylesheet"
|
||||
integrity="sha384-QWTKZyjpPEjISv5WaRU9OFeRpok6YctnYmDr5pNlyT2bRjXh0JMhjY6hW+ALEwIH" crossorigin="anonymous">
|
||||
integrity="sha384-QWTKZyjpPEjISv5WaRU9OFeRpok6YctnYmDr5pNlyT2bRjXh0JMhjY6hW+ALEwIH" crossorigin="anonymous" />
|
||||
<link href="./css/global.css" rel="stylesheet" />
|
||||
<script src="./darkmode.js" defer></script>
|
||||
</head>
|
||||
|
@ -17,7 +17,7 @@
|
|||
<body class="text-center">
|
||||
<main class="form-donate">
|
||||
<div>
|
||||
<img src="{{ logo }}" class="mb-4" alt="{{ _('%(name)s Logo', name=name) }}" max-width="7em" />
|
||||
<img src="{{ logo }}" class="mb-4" alt="{{ _('%(name)s Logo', name=name) }}" />
|
||||
|
||||
<h1 class="h3 mb-3 fw-normal">{{ _('Thanks for your donation 🙂') }}</h1>
|
||||
|
||||
|
|
|
@ -7,7 +7,7 @@ msgid ""
|
|||
msgstr ""
|
||||
"Project-Id-Version: PROJECT VERSION\n"
|
||||
"Report-Msgid-Bugs-To: EMAIL@ADDRESS\n"
|
||||
"POT-Creation-Date: 2024-05-22 04:12+0200\n"
|
||||
"POT-Creation-Date: 2024-05-22 04:43+0200\n"
|
||||
"PO-Revision-Date: 2021-02-18 23:33+0100\n"
|
||||
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
||||
"Language: en\n"
|
||||
|
@ -23,7 +23,7 @@ msgstr ""
|
|||
msgid "Donate to %(name)s"
|
||||
msgstr ""
|
||||
|
||||
#: assets/canceled.html:20 assets/index.html:21 assets/success.html:20
|
||||
#: assets/canceled.html:20 assets/index.html:22 assets/success.html:20
|
||||
#, python-format
|
||||
msgid "%(name)s Logo"
|
||||
msgstr ""
|
||||
|
@ -36,32 +36,36 @@ msgstr ""
|
|||
msgid "Go back to the donate form"
|
||||
msgstr ""
|
||||
|
||||
#: assets/index.html:22
|
||||
#: assets/index.html:23
|
||||
#, python-format
|
||||
msgid "I want to give to %(name)s"
|
||||
msgstr ""
|
||||
|
||||
#: assets/index.html:30
|
||||
msgid "Amount"
|
||||
msgstr ""
|
||||
|
||||
#: assets/index.html:32
|
||||
msgid "Currency"
|
||||
msgstr ""
|
||||
|
||||
#: assets/index.html:36
|
||||
#: assets/index.html:38
|
||||
msgid "Frequency"
|
||||
msgstr ""
|
||||
|
||||
#: assets/index.html:37
|
||||
#: assets/index.html:39
|
||||
msgid "/ month"
|
||||
msgstr ""
|
||||
|
||||
#: assets/index.html:38
|
||||
#: assets/index.html:40
|
||||
msgid "one time"
|
||||
msgstr ""
|
||||
|
||||
#: assets/index.html:43
|
||||
#: assets/index.html:45
|
||||
msgid "Donate"
|
||||
msgstr ""
|
||||
|
||||
#: assets/index.html:46
|
||||
#: assets/index.html:48
|
||||
msgid "If you want to cancel a monthly donation, please contact us"
|
||||
msgstr ""
|
||||
|
||||
|
|
|
@ -7,7 +7,7 @@ msgid ""
|
|||
msgstr ""
|
||||
"Project-Id-Version: PROJECT VERSION\n"
|
||||
"Report-Msgid-Bugs-To: EMAIL@ADDRESS\n"
|
||||
"POT-Creation-Date: 2024-05-22 04:12+0200\n"
|
||||
"POT-Creation-Date: 2024-05-22 04:43+0200\n"
|
||||
"PO-Revision-Date: 2021-02-18 23:33+0100\n"
|
||||
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
||||
"Language: fr\n"
|
||||
|
@ -23,7 +23,7 @@ msgstr ""
|
|||
msgid "Donate to %(name)s"
|
||||
msgstr "Donner à %(name)s"
|
||||
|
||||
#: assets/canceled.html:20 assets/index.html:21 assets/success.html:20
|
||||
#: assets/canceled.html:20 assets/index.html:22 assets/success.html:20
|
||||
#, python-format
|
||||
msgid "%(name)s Logo"
|
||||
msgstr "Logo de %(name)s"
|
||||
|
@ -36,32 +36,37 @@ msgstr "Votre paiement a été annulé"
|
|||
msgid "Go back to the donate form"
|
||||
msgstr "Retourner au formulaire de don"
|
||||
|
||||
#: assets/index.html:22
|
||||
#: assets/index.html:23
|
||||
#, python-format
|
||||
msgid "I want to give to %(name)s"
|
||||
msgstr "Je veux donner à %(name)s"
|
||||
|
||||
#: assets/index.html:30
|
||||
#, fuzzy
|
||||
msgid "Amount"
|
||||
msgstr "Montant"
|
||||
|
||||
#: assets/index.html:32
|
||||
msgid "Currency"
|
||||
msgstr "Devise"
|
||||
|
||||
#: assets/index.html:36
|
||||
#: assets/index.html:38
|
||||
msgid "Frequency"
|
||||
msgstr "Fréquence"
|
||||
|
||||
#: assets/index.html:37
|
||||
#: assets/index.html:39
|
||||
msgid "/ month"
|
||||
msgstr "/ mois"
|
||||
|
||||
#: assets/index.html:38
|
||||
#: assets/index.html:40
|
||||
msgid "one time"
|
||||
msgstr "une fois"
|
||||
|
||||
#: assets/index.html:43
|
||||
#: assets/index.html:45
|
||||
msgid "Donate"
|
||||
msgstr "Donner"
|
||||
|
||||
#: assets/index.html:46
|
||||
#: assets/index.html:48
|
||||
msgid "If you want to cancel a monthly donation, please contact us"
|
||||
msgstr ""
|
||||
"Si vous souhaitez mettre fin à votre don mensuel, contactez-nous s'il "
|
||||
|
|
11
server.py
11
server.py
|
@ -12,8 +12,8 @@ import os
|
|||
import random
|
||||
import string
|
||||
|
||||
from flask import Flask, render_template, jsonify, request, send_from_directory, session
|
||||
from flask_babel import Babel, _
|
||||
from flask import Flask, render_template, jsonify, request, session
|
||||
from flask_babel import Babel
|
||||
from flask_simple_csrf import CSRF
|
||||
|
||||
|
||||
|
@ -40,7 +40,12 @@ def before_request():
|
|||
|
||||
@babel.localeselector
|
||||
def get_locale():
|
||||
return "fr" # request.accept_languages.best_match(app.config['LANGUAGES'])
|
||||
return request.accept_languages.best_match(app.config["LANGUAGES"])
|
||||
|
||||
|
||||
@app.context_processor
|
||||
def utility_processor():
|
||||
return dict(lang=babel.locale_selector_func())
|
||||
|
||||
|
||||
@app.route("/", methods=["GET"])
|
||||
|
|
Loading…
Add table
Reference in a new issue