aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArnaud Bos <arnaud.tlse@gmail.com>2011-09-14 01:16:25 +0200
committerArnaud Bos <arnaud.tlse@gmail.com>2011-09-14 01:16:25 +0200
commit89e1bbe134bc770d4a3f999a1329bd07522b07cf (patch)
tree818f77883e6c756bcd1e797af7868c40cba97e00
parent88cd2f86751621d73574ac56a9d6c4bedcbdd3d5 (diff)
downloadihatemoney-mirror-89e1bbe134bc770d4a3f999a1329bd07522b07cf.zip
ihatemoney-mirror-89e1bbe134bc770d4a3f999a1329bd07522b07cf.tar.gz
ihatemoney-mirror-89e1bbe134bc770d4a3f999a1329bd07522b07cf.tar.bz2
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.
-rw-r--r--.gitignore1
-rw-r--r--budget/forms.py2
-rw-r--r--budget/static/main.css5
-rw-r--r--budget/templates/forms.html8
-rw-r--r--budget/templates/invitation_mail6
-rw-r--r--budget/templates/layout.html2
-rw-r--r--budget/templates/list_bills.html2
-rw-r--r--budget/templates/reminder_mail9
-rw-r--r--budget/tests.py5
-rw-r--r--budget/web.py15
10 files changed, 43 insertions, 12 deletions
diff --git a/.gitignore b/.gitignore
index d65e677..b034990 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,2 +1,3 @@
budget/budget.db
+budget/memory
*.pyc
diff --git a/budget/forms.py b/budget/forms.py
index 3ab5f45..bb19142 100644
--- a/budget/forms.py
+++ b/budget/forms.py
@@ -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.
diff --git a/budget/static/main.css b/budget/static/main.css
index aa2be62..3b67195 100644
--- a/budget/static/main.css
+++ b/budget/static/main.css
@@ -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;
+}
diff --git a/budget/templates/forms.html b/budget/templates/forms.html
index ba915e8..f516e40 100644
--- a/budget/templates/forms.html
+++ b/budget/templates/forms.html
@@ -19,10 +19,10 @@
{% macro submit(field, cancel=False, home=False) -%}
<div class="actions">
+ <button type="submit" class="btn primary">{{ field.name }}</button>
{% if home %}
- <a href="{{ url_for(".home") }}" class="btn">Back Home</a>
+ <a href="{{ url_for(".home") }}">Go back Home</a>
{% endif %}
- <button type="submit" class="btn primary">{{ field.name }}</button>
{% 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 %}
diff --git a/budget/templates/invitation_mail b/budget/templates/invitation_mail
index f041db0..4f5bbf0 100644
--- a/budget/templates/invitation_mail
+++ b/budget/templates/invitation_mail
@@ -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)
diff --git a/budget/templates/layout.html b/budget/templates/layout.html
index afdda85..c45a193 100644
--- a/budget/templates/layout.html
+++ b/budget/templates/layout.html
@@ -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();
diff --git a/budget/templates/list_bills.html b/budget/templates/list_bills.html
index 545de6a..63a8916 100644
--- a/budget/templates/list_bills.html
+++ b/budget/templates/list_bills.html
@@ -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>
diff --git a/budget/templates/reminder_mail b/budget/templates/reminder_mail
new file mode 100644
index 0000000..b2e3a65
--- /dev/null
+++ b/budget/templates/reminder_mail
@@ -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/budget/tests.py b/budget/tests.py
index db37e46..65ef40c 100644
--- a/budget/tests.py
+++ b/budget/tests.py
@@ -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:
diff --git a/budget/web.py b/budget/web.py
index cb8c4ac..6b3a01c 100644
--- a/budget/web.py
+++ b/budget/web.py
@@ -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)