1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/ihatemoney_ynh.git synced 2024-09-03 19:26:15 +02:00

Add a 'sumbit and add a new one' button for new bills. Fix #53

This commit is contained in:
Alexis Metaireau 2011-11-28 01:42:02 +01:00
parent 46f9807806
commit 3a2958a44e
4 changed files with 12 additions and 4 deletions

View file

@ -110,7 +110,8 @@ class BillForm(Form):
amount = CommaDecimalField(_("Amount paid"), validators=[Required()])
payed_for = SelectMultipleField(_("For whom?"),
validators=[Required()], widget=select_multi_checkbox, coerce=int)
submit = SubmitField(_("Send the bill"))
submit = SubmitField(_("Submit"))
submit2 = SubmitField(_("Submit and add a new one"))
def save(self, bill, project):
bill.payer_id=self.payer.data

View file

@ -84,7 +84,10 @@
{{ input(form.amount) }}
{{ input(form.payed_for) }}
</fieldset>
{{ submit(form.submit, cancel=True) }}
<div class="actions">
{{ form.submit(class="btn primary") }}
{% if not edit %} {{ form.submit2(class="btn") }}{% endif %}
</div>
{% endmacro %}

View file

@ -22,6 +22,8 @@
$('#bill-form').modal('hide');
});
{% if add_bill %} $('#new-bill').click(); {% endif %}
// ask for confirmation before removing an user
$('.action').each(function(){
$(this).hide();

View file

@ -245,9 +245,11 @@ def list_bills():
if 'last_selected_payer' in session:
bill_form.payer.data = session['last_selected_payer']
bills = g.project.get_bills()
return render_template("list_bills.html",
bills=bills, member_form=MemberForm(g.project),
bill_form=bill_form
bill_form=bill_form,
add_bill='add_bill' in request.values
)
@main.route("/<project_id>/members/add", methods=["GET", "POST"])
@ -298,7 +300,7 @@ def add_bill():
db.session.commit()
flash(_("The bill has been added"))
return redirect(url_for('.list_bills'))
return redirect(url_for('.list_bills', add_bill=form.submit2.data))
return render_template("add_bill.html", form=form)