mirror of
https://github.com/spiral-project/ihatemoney.git
synced 2025-04-28 09:22:38 +02:00
Make the identifier clearer to the end-user.
- Send an email to the user with the summary of the created project containing a reminder of the identifier, password and a link. - Add flash message with the identifier in the /invite page/ - Add a small note containing the identifier in the upper right corner of the project main page.
This commit is contained in:
parent
88cd2f8675
commit
89e1bbe134
10 changed files with 44 additions and 13 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -1,2 +1,3 @@
|
|||
budget/budget.db
|
||||
budget/memory
|
||||
*.pyc
|
||||
|
|
|
@ -50,7 +50,7 @@ class ProjectForm(Form):
|
|||
to log in and for the URL of the project.
|
||||
<br />
|
||||
We tried to generate an identifier for you but
|
||||
a projet with this identifier already exists.
|
||||
a project with this identifier already exists.
|
||||
<br />
|
||||
Please create a new identifier you will be able
|
||||
to remember.
|
||||
|
|
|
@ -88,3 +88,8 @@ div.topbar ul.secondary-nav { padding-right: 75px; }
|
|||
background-color: #fff;
|
||||
opacity: 0.8;
|
||||
}
|
||||
|
||||
.identifier{
|
||||
text-align: right;
|
||||
margin-top: -15px;
|
||||
}
|
||||
|
|
|
@ -19,10 +19,10 @@
|
|||
|
||||
{% macro submit(field, cancel=False, home=False) -%}
|
||||
<div class="actions">
|
||||
{% if home %}
|
||||
<a href="{{ url_for(".home") }}" class="btn">Back Home</a>
|
||||
{% endif %}
|
||||
<button type="submit" class="btn primary">{{ field.name }}</button>
|
||||
{% if home %}
|
||||
<a href="{{ url_for(".home") }}">Go back Home</a>
|
||||
{% endif %}
|
||||
{% if cancel %}
|
||||
<button id="cancel-form" type="reset" class="btn">Cancel</button>
|
||||
{% endif %}
|
||||
|
@ -36,7 +36,7 @@
|
|||
{{ input(form.id) }}
|
||||
{{ input(form.password) }}
|
||||
{% if not home %}
|
||||
{{ submit(form.submit) }}
|
||||
{{ submit(form.submit, home=True) }}
|
||||
{% endif %}
|
||||
|
||||
{% endmacro %}
|
||||
|
@ -84,7 +84,7 @@
|
|||
{{ form.hidden_tag() }}
|
||||
{{ input(form.emails) }}
|
||||
<div class="actions">
|
||||
<button class="btn">Send the invitations</button>
|
||||
<button class="btn primary">Send the invitations</button>
|
||||
<a href="{{ url_for(".list_bills") }}">No, thanks</a>
|
||||
</div>
|
||||
{% endmacro %}
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
Hi,
|
||||
|
||||
Someone using the email adress {{ g.project.contact_email }} invited you to share your expenses for "{{ g.project.name }}".
|
||||
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") }}, the password is "{{ g.project.password }}".
|
||||
You can access it here: {{ config['SITE_URL'] }}{{ url_for(".list_bills") }}, the private code is "{{ g.project.password }}".
|
||||
|
||||
Enjoy,
|
||||
Some weird guys
|
||||
Some weird guys (with beards)
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
$(".flash").fadeOut("slow", function () {
|
||||
$(".flash").remove();
|
||||
});
|
||||
}, 2000);
|
||||
}, 4000);
|
||||
$("body").bind("click", function(e) {
|
||||
$("ul.menu-dropdown").hide();
|
||||
$('a.menu').parent("li").removeClass("open").children("ul.menu-dropdown").hide();
|
||||
|
|
|
@ -60,6 +60,8 @@
|
|||
{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
<div class="identifier">The project identifier is <a href="{{ url_for(".list_bills") }}">{{ g.project.id }}</a>, remember it or add this page to you bookmarks!</div>
|
||||
<br /><br />
|
||||
<a id="new-bill" href="{{ url_for(".add_bill") }}" class="primary">Add a new bill</a>
|
||||
<form id="bill-form" action="{{ url_for(".add_bill") }}" method="post" style="display: none">
|
||||
<a id="hide-bill-form" href="#">hide this form</a>
|
||||
|
|
9
budget/templates/reminder_mail
Normal file
9
budget/templates/reminder_mail
Normal file
|
@ -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)
|
|
@ -66,8 +66,9 @@ class BudgetTestCase(TestCase):
|
|||
self.app.post("/raclette/invite", data=
|
||||
{"emails": 'alexis@notmyidea.org'})
|
||||
|
||||
self.assertEqual(len(outbox), 1)
|
||||
self.assertEqual(outbox[0].recipients, ["alexis@notmyidea.org"])
|
||||
self.assertEqual(len(outbox), 2)
|
||||
self.assertEqual(outbox[0].recipients, ["raclette@notmyidea.org"])
|
||||
self.assertEqual(outbox[1].recipients, ["alexis@notmyidea.org"])
|
||||
|
||||
# sending a message to multiple persons
|
||||
with run.mail.record_messages() as outbox:
|
||||
|
|
|
@ -82,7 +82,7 @@ def authenticate(project_id=None):
|
|||
if request.method == "POST":
|
||||
if form.validate():
|
||||
if not form.password.data == project.password:
|
||||
form.errors['password'] = ["The password is not the right one"]
|
||||
form.errors['password'] = ["This private code is not the right one"]
|
||||
else:
|
||||
# maintain a list of visited projects
|
||||
if "projects" not in session:
|
||||
|
@ -127,7 +127,20 @@ def create_project():
|
|||
session[project.id] = project.password
|
||||
session.update()
|
||||
|
||||
# send reminder email
|
||||
g.project = project
|
||||
|
||||
message_title = "You have just created '%s' to share your expenses" % g.project.name
|
||||
|
||||
message_body = render_template("reminder_mail")
|
||||
|
||||
msg = Message(message_title,
|
||||
body=message_body,
|
||||
recipients=[project.contact_email])
|
||||
mail.send(msg)
|
||||
|
||||
# redirect the user to the next step (invite)
|
||||
flash("The project identifier is %s" % project.id)
|
||||
return redirect(url_for(".invite", project_id=project.id))
|
||||
|
||||
return render_template("create_project.html", form=form)
|
||||
|
|
Loading…
Reference in a new issue