From 23b7e397f2f9e62b961096daa03b0b04546b4b03 Mon Sep 17 00:00:00 2001 From: eMerzh Date: Sun, 5 Apr 2020 23:39:50 +0200 Subject: [PATCH 1/5] fix(Home): correct responsive width of cards (#549) --- ihatemoney/static/css/main.css | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/ihatemoney/static/css/main.css b/ihatemoney/static/css/main.css index a646b175..32c267ea 100644 --- a/ihatemoney/static/css/main.css +++ b/ihatemoney/static/css/main.css @@ -150,6 +150,11 @@ body { margin-bottom: 20px; margin-left: 25px; } +@media (max-width: 400px) { + .home .card { + min-width: unset; + } +} /* Other */ #bills { @@ -320,13 +325,15 @@ footer .footer-left { background: url("../images/see.png") no-repeat right; } -#bill_table, #monthly_stats { +#bill_table, +#monthly_stats { margin-top: 30px; margin-bottom: 30px; } @media (min-width: 768px) { - .split_bills, #table_overflow.statistics { + .split_bills, + #table_overflow.statistics { /* The table is shifted to left, so add the spacer width on the right to match */ width: calc(100% + 15px); } From 4b79efe18a9952268d65b98813e3929a8179ed2c Mon Sep 17 00:00:00 2001 From: Charles Rose <33735833+rosechar@users.noreply.github.com> Date: Tue, 7 Apr 2020 11:09:33 -0400 Subject: [PATCH 2/5] updated web.py to make session permanent (#547) * moved making session permanent to after authentication in web.py Co-authored-by: Charlie Rose --- ihatemoney/web.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/ihatemoney/web.py b/ihatemoney/web.py index 1b80ab62..a3b10726 100644 --- a/ihatemoney/web.py +++ b/ihatemoney/web.py @@ -235,6 +235,8 @@ def authenticate(project_id=None): # add the project on the top of the list session["projects"].insert(0, (project_id, project.name)) session[project_id] = True + # Set session to permanent to make language choice persist + session.permanent = True session.update() setattr(g, "project", project) return redirect(url_for(".list_bills")) From 03251c090e64082acfe301e844610f64c8f8fdef Mon Sep 17 00:00:00 2001 From: eMerzh Date: Wed, 8 Apr 2020 14:00:24 +0200 Subject: [PATCH 3/5] merge settings and import to avoid clutter (#550) --- ihatemoney/forms.py | 5 ++- ihatemoney/static/css/main.css | 12 ++++++- ihatemoney/templates/edit_project.html | 43 ++++++++++++++++++++------ ihatemoney/templates/layout.html | 1 - ihatemoney/templates/upload_json.html | 10 ------ ihatemoney/web.py | 42 ++++++++++++------------- 6 files changed, 70 insertions(+), 43 deletions(-) delete mode 100644 ihatemoney/templates/upload_json.html diff --git a/ihatemoney/forms.py b/ihatemoney/forms.py index 88afd296..62c21444 100644 --- a/ihatemoney/forms.py +++ b/ihatemoney/forms.py @@ -114,8 +114,11 @@ class EditProjectForm(FlaskForm): class UploadForm(FlaskForm): file = FileField( - "JSON", validators=[FileRequired(), FileAllowed(["json", "JSON"], "JSON only!")] + "JSON", + validators=[FileRequired(), FileAllowed(["json", "JSON"], "JSON only!")], + description=_("Import previously exported JSON file"), ) + submit = SubmitField(_("Import")) class ProjectForm(EditProjectForm): diff --git a/ihatemoney/static/css/main.css b/ihatemoney/static/css/main.css index 32c267ea..fe8eec20 100644 --- a/ihatemoney/static/css/main.css +++ b/ihatemoney/static/css/main.css @@ -185,7 +185,7 @@ footer { padding: 45px 50px; } -@media (min-width: 768px) { +@media (min-width: 1024px) { footer { padding-left: calc(25% + 50px); } @@ -523,3 +523,13 @@ footer .icon svg { text-align: right; width: 200px; } + +/* edit settings */ + +.edit-project form { + margin-top: 1em; + margin-bottom: 3em; +} +.edit-project .custom-file { + margin-bottom: 2em; +} diff --git a/ihatemoney/templates/edit_project.html b/ihatemoney/templates/edit_project.html index dcbbbc86..b7861c51 100644 --- a/ihatemoney/templates/edit_project.html +++ b/ihatemoney/templates/edit_project.html @@ -5,18 +5,43 @@ { $(this).html("{{_("you sure?")}}"); }); + + $('.custom-file-input').on('change', function(event) { + var filename = [].slice.call(this.files).map(function (file) { return file.name}).join(',') + var $labelElement = $(this).parents('.custom-file').find('.custom-file-label') + $labelElement.text(filename) + }) {% endblock %} {% block content %} -

{{ _("Edit project") }}

-

-

- {{ forms.edit_project(edit_form) }} -
-

+
-

{{ _("Download project's data") }}

-

+

{{ _("Edit project") }}

+
+ {{ forms.edit_project(edit_form) }} +
+ + +

{{ _("Import JSON") }}

+
+ {{ import_form.hidden_tag() }} + +
+
+ {{ import_form.file(class="custom-file-input") }} + + {{ import_form.file.description }} + +
+ +
+ +
+ {{ import_form.submit(class="btn btn-primary") }} +
+
+ +

{{ _("Download project's data") }}

@@ -51,5 +76,5 @@

{{ _('Download the list of transactions needed to settle the current bills.') }}

-

+
{% endblock %} diff --git a/ihatemoney/templates/layout.html b/ihatemoney/templates/layout.html index dc3d32f6..8609779c 100644 --- a/ihatemoney/templates/layout.html +++ b/ihatemoney/templates/layout.html @@ -46,7 +46,6 @@ - {% endblock %} {% endif %} diff --git a/ihatemoney/templates/upload_json.html b/ihatemoney/templates/upload_json.html deleted file mode 100644 index 64aca0fe..00000000 --- a/ihatemoney/templates/upload_json.html +++ /dev/null @@ -1,10 +0,0 @@ -{% extends "layout.html" %} - -{% block content %} -

{{ _("Import JSON") }}

-

-

- {{ forms.upload_json(form) }} -
-

-{% endblock %} diff --git a/ihatemoney/web.py b/ihatemoney/web.py index a3b10726..8e0bca6c 100644 --- a/ihatemoney/web.py +++ b/ihatemoney/web.py @@ -384,36 +384,36 @@ def reset_password(): @main.route("//edit", methods=["GET", "POST"]) def edit_project(): edit_form = EditProjectForm() - if request.method == "POST": - if edit_form.validate(): - project = edit_form.update(g.project) - db.session.add(project) - db.session.commit() + import_form = UploadForm() + # Import form + if import_form.validate_on_submit(): + try: + import_project(import_form.file.data.stream, g.project) + flash(_("Project successfully uploaded")) - return redirect(url_for(".list_bills")) + return redirect(url_for("main.list_bills")) + except ValueError: + flash(_("Invalid JSON"), category="error") + + # Edit form + if edit_form.validate_on_submit(): + project = edit_form.update(g.project) + db.session.add(project) + db.session.commit() + + return redirect(url_for("main.list_bills")) else: edit_form.name.data = g.project.name edit_form.contact_email.data = g.project.contact_email return render_template( - "edit_project.html", edit_form=edit_form, current_view="edit_project" + "edit_project.html", + edit_form=edit_form, + import_form=import_form, + current_view="edit_project", ) -@main.route("//upload_json", methods=["GET", "POST"]) -def upload_json(): - form = UploadForm() - if form.validate_on_submit(): - try: - import_project(form.file.data.stream, g.project) - flash(_("Project successfully uploaded")) - except ValueError: - flash(_("Invalid JSON"), category="error") - return redirect(url_for("main.list_bills")) - - return render_template("upload_json.html", form=form) - - def import_project(file, project): json_file = json.load(file) From da89c353905bb04c337ca489c4b5751facba1cb7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Allan=20Nordh=C3=B8y?= Date: Sun, 12 Apr 2020 07:58:00 +0000 Subject: [PATCH 4/5] Spelling in documentation fixed, Weblate link (#551) --- docs/contributing.rst | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/docs/contributing.rst b/docs/contributing.rst index a810d121..f35a3c8f 100644 --- a/docs/contributing.rst +++ b/docs/contributing.rst @@ -1,14 +1,14 @@ Contributing ############ -Setup a dev environment +Set up a dev environment ======================= -You must develop on top of the git master branch:: +You must develop on top of the Git master branch:: git clone https://github.com/spiral-project/ihatemoney.git -Then you need to build your dev environments. Choose your way… +Then you need to build your dev environment. Choose your way… The quick way ------------- @@ -43,7 +43,7 @@ It's as simple as that! Updating -------- -In case you want to update to newer versions (from git), you can just run the "update" command:: +In case you want to update to newer versions (from Git), you can just run the "update" command:: make update @@ -57,7 +57,7 @@ database revision file:: make create-database-revision If your changes are simple enough, the generated script will be populated with -the necessary migrations steps. You can edit the generated script. eg: to add +the necessary migrations steps. You can edit the generated script. e.g: To add data migrations. For complex migrations, it is recommended to start from an empty revision file @@ -101,7 +101,7 @@ To do so:: make test We are using the `black `_ formatter -for all the python files in this project. Be sure to run it locally on your +for all the Python files in this project. Be sure to run it locally on your files. To do so, just run:: black ihatemoney @@ -112,16 +112,16 @@ hook, for instance). As a designer / Front-end developer ----------------------------------- -Feel free to provide us mockups or to involve yourself into the discussions -hapenning on the github issue tracker. All ideas are welcome. Of course, if you +Feel free to provide mockups, or to involve yourself in the discussions +hapenning on the GitHub issue tracker. All ideas are welcome. Of course, if you know how to implement them, feel free to fork and make a pull request. As a translator --------------- If you're able to translate Ihatemoney in your own language, -head over to `the website we use for translations `_ -and start translating! +head over to `the website we use for translations `_ +and start translating. All the heavy lifting will be done automatically, and your strings will eventually be integrated. @@ -134,7 +134,7 @@ End-user You are using the application and found a bug? You have some ideas about how to improve the project? Please tell us `by filling a new issue `_. -Or, if you prefer, you can send me an email to `alexis@notmyidea.org` and I +Or, if you prefer, you can send me an e-mail to `alexis@notmyidea.org` and I will update the issue tracker with your feedback. Thanks again! @@ -150,7 +150,7 @@ Install doc dependencies (within the virtualenv, if any):: pip install -r docs/requirements.txt -And to produce html doc in `docs/_output` folder:: +And to produce a HTML doc in the `docs/_output` folder:: cd docs/ make html From 91ef80ebb712b06b6c48336beeb7f60219b0f062 Mon Sep 17 00:00:00 2001 From: Glandos Date: Sun, 12 Apr 2020 10:45:35 +0200 Subject: [PATCH 5/5] Fix spelling (#552) --- docs/contributing.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/contributing.rst b/docs/contributing.rst index f35a3c8f..b053f8b6 100644 --- a/docs/contributing.rst +++ b/docs/contributing.rst @@ -113,7 +113,7 @@ As a designer / Front-end developer ----------------------------------- Feel free to provide mockups, or to involve yourself in the discussions -hapenning on the GitHub issue tracker. All ideas are welcome. Of course, if you +happening on the GitHub issue tracker. All ideas are welcome. Of course, if you know how to implement them, feel free to fork and make a pull request. As a translator