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

Merge pull request #97 from aavenel/cosmetics

Small changes for UI
This commit is contained in:
Alexis Metaireau 2013-01-10 15:11:56 -08:00
commit 64385e0fa3
6 changed files with 36 additions and 31 deletions

View file

@ -19,16 +19,14 @@ def select_multi_checkbox(field, ul_class='', **kwargs):
choice_id = u'toggleField'
js_function = u'toggle();'
options = dict(kwargs, id=choice_id, onclick=js_function)
label = _("Select All/None")
html.append(u'<li><label for="%s">%s<span>%s</span></label></li>'
% (choice_id, '<input %s /> ' % html_params(**options), label))
html.append(u'<p><a id="selectall" onclick="selectall()">%s</a> | <a id="selectnone" onclick="selectnone()">%s</a></p>'% (_("Select all"), _("Select none")))
for value, label, checked in field.iter_choices():
choice_id = u'%s-%s' % (field_id, value)
options = dict(kwargs, name=field.name, value=value, id=choice_id)
if checked:
options['checked'] = 'checked'
html.append(u'<li><label for="%s">%s<span>%s</span></label></li>'
html.append(u'<p><label for="%s">%s<span>%s</span></label></p>'
% (choice_id, '<input %s /> ' % html_params(**options), label))
html.append(u'</ul>')
return u''.join(html)
@ -189,6 +187,6 @@ class InviteForm(Form):
class CreateArchiveForm(Form):
start_date = DateField(_("Start date"), validators=[Required(), ])
end_date = DateField(_("End date"), validators=[Required(), ])
name = TextField(_("Name for this archive (optional)"))
name = TextField(_("Name for this archive (optional)"), validators=[])
start_date = DateField(_("Start date"), validators=[Required()])
end_date = DateField(_("End date"), validators=[Required()], default=datetime.now)

View file

@ -189,6 +189,10 @@ tr.payer_line .balance-name{
position: absolute;
}
.modal-body {
max-height:455px;
}
/* Fluid Offsets for Boostrap */
.row-fluid > [class*="span"]:not([class*="offset"]):first-child{margin-left:0;}

View file

@ -1,17 +1,18 @@
// Add a script to select all or non of the checkboxes in the add_bill form
function toggle()
// Add scripts to select all or non of the checkboxes in the add_bill form
function selectall()
{
var els = document.getElementsByName('payed_for');
for(var i =0;i<els.length;i++)
{
if(document.getElementById('toggleField').checked)
{
els[i].checked=true;
}
else
{
els[i].checked=false;
}
els[i].checked=true;
}
}
function selectnone()
{
var els = document.getElementsByName('payed_for');
for(var i =0;i<els.length;i++)
{
els[i].checked=false;
}
}

View file

@ -1,20 +1,21 @@
{% extends "layout.html" %}
{% block content %}
<table id="bill_table" class="list_bills common-table zebra-striped">
<table id="bill_table" class="table table-striped">
<thead><tr><th>{{ _("Project") }}</th><th>{{ _("Number of members") }}</th><th>{{ _("Number of bills") }}</th><th>{{_("Newest bill")}}</th><th>{{_("Oldest bill")}}</th></tr></thead>
<tbody>{% for project in projects %}
<tr>
<td>{{ project.name }}</td><td>{{ project.members | count }}</td><td>{{ project.get_bills().count() }}</td>
{% if project.has_bills() %}
<td>{{ project.get_bills().all()[0].date }}</td>
<td>{{ project.get_bills().all()[-1].date }}</td>
{% else %}
<td></td>
<td></td>
{% endif %}
</tr>
{% endfor %}</tbody>
<tbody>{% for project in projects|sort(attribute='name') %}
<tr class="{{ loop.cycle("odd", "even") }}">
<td>{{ project.name }}</td><td>{{ project.members | count }}</td><td>{{ project.get_bills().count() }}</td>
{% if project.has_bills() %}
<td>{{ project.get_bills().all()[0].date }}</td>
<td>{{ project.get_bills().all()[-1].date }}</td>
{% else %}
<td></td>
<td></td>
{% endif %}
</tr>
{% endfor %}
</tbody>
</table>
{% endblock %}

View file

@ -108,6 +108,7 @@
<fieldset>
<legend>{{ _("Create an archive") }}</legend>
{{ form.hidden_tag() }}
{{ input(form.name) }}
{{ input(form.start_date) }}
{{ input(form.end_date) }}
</fieldset>

View file

@ -389,7 +389,7 @@ def compute_bills():
return render_template("compute_bills.html")
@main.route("/<project_id>/archives/create")
@main.route("/<project_id>/archives/create", methods=["GET", "POST"])
def create_archive():
form = CreateArchiveForm()
if request.method == "POST":