mirror of
https://github.com/YunoHost-Apps/ihatemoney_ynh.git
synced 2024-09-03 19:26:15 +02:00
Merge branch 'flask0.9' of github.com:aavenel/ihatemoney
This commit is contained in:
commit
b410e48851
10 changed files with 35 additions and 29 deletions
|
@ -1,6 +1,6 @@
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
from flask import Blueprint, request
|
from flask import Blueprint, request
|
||||||
from flask_rest import RESTResource, need_auth
|
from flask.ext.rest import RESTResource, need_auth
|
||||||
|
|
||||||
from models import db, Project, Person, Bill
|
from models import db, Project, Person, Bill
|
||||||
from forms import (ProjectForm, EditProjectForm, MemberForm,
|
from forms import (ProjectForm, EditProjectForm, MemberForm,
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
from flaskext.wtf import DateField, DecimalField, Email, Form, PasswordField, \
|
from flask.ext.wtf import DateField, DecimalField, Email, Form, PasswordField, \
|
||||||
Required, SelectField, SelectMultipleField, SubmitField, TextAreaField, \
|
Required, SelectField, SelectMultipleField, SubmitField, TextAreaField, \
|
||||||
TextField, ValidationError
|
TextField, ValidationError
|
||||||
from flaskext.babel import lazy_gettext as _
|
from flask.ext.babel import lazy_gettext as _
|
||||||
from flask import request
|
from flask import request
|
||||||
|
|
||||||
from wtforms.widgets import html_params
|
from wtforms.widgets import html_params
|
||||||
|
@ -19,16 +19,14 @@ def select_multi_checkbox(field, ul_class='', **kwargs):
|
||||||
choice_id = u'toggleField'
|
choice_id = u'toggleField'
|
||||||
js_function = u'toggle();'
|
js_function = u'toggle();'
|
||||||
options = dict(kwargs, id=choice_id, onclick=js_function)
|
options = dict(kwargs, id=choice_id, onclick=js_function)
|
||||||
label = _("Select All/None")
|
html.append(u'<p><a id="selectall" onclick="selectall()">%s</a> | <a id="selectnone" onclick="selectnone()">%s</a></p>'% (_("Select all"), _("Select none")))
|
||||||
html.append(u'<li><label for="%s">%s<span>%s</span></label></li>'
|
|
||||||
% (choice_id, '<input %s /> ' % html_params(**options), label))
|
|
||||||
|
|
||||||
for value, label, checked in field.iter_choices():
|
for value, label, checked in field.iter_choices():
|
||||||
choice_id = u'%s-%s' % (field_id, value)
|
choice_id = u'%s-%s' % (field_id, value)
|
||||||
options = dict(kwargs, name=field.name, value=value, id=choice_id)
|
options = dict(kwargs, name=field.name, value=value, id=choice_id)
|
||||||
if checked:
|
if checked:
|
||||||
options['checked'] = '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))
|
% (choice_id, '<input %s /> ' % html_params(**options), label))
|
||||||
html.append(u'</ul>')
|
html.append(u'</ul>')
|
||||||
return u''.join(html)
|
return u''.join(html)
|
||||||
|
@ -189,6 +187,6 @@ class InviteForm(Form):
|
||||||
|
|
||||||
|
|
||||||
class CreateArchiveForm(Form):
|
class CreateArchiveForm(Form):
|
||||||
start_date = DateField(_("Start date"), validators=[Required(), ])
|
name = TextField(_("Name for this archive (optional)"), validators=[])
|
||||||
end_date = DateField(_("End date"), validators=[Required(), ])
|
start_date = DateField(_("Start date"), validators=[Required()])
|
||||||
name = TextField(_("Name for this archive (optional)"))
|
end_date = DateField(_("End date"), validators=[Required()], default=datetime.now)
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
from collections import defaultdict
|
from collections import defaultdict
|
||||||
|
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
from flask_sqlalchemy import SQLAlchemy, BaseQuery
|
from flask.ext.sqlalchemy import SQLAlchemy, BaseQuery
|
||||||
from flask import g
|
from flask import g
|
||||||
|
|
||||||
from sqlalchemy import orm
|
from sqlalchemy import orm
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
flask
|
flask>=0.9
|
||||||
flask-wtf
|
flask-wtf
|
||||||
flask-sqlalchemy
|
flask-sqlalchemy
|
||||||
flask-mail
|
flask-mail
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
from flask import Flask, g, request, session
|
from flask import Flask, g, request, session
|
||||||
from flaskext.babel import Babel
|
from flask.ext.babel import Babel
|
||||||
from raven.contrib.flask import Sentry
|
from raven.contrib.flask import Sentry
|
||||||
|
|
||||||
from web import main, db, mail
|
from web import main, db, mail
|
||||||
|
|
|
@ -189,6 +189,10 @@ tr.payer_line .balance-name{
|
||||||
position: absolute;
|
position: absolute;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.modal-body {
|
||||||
|
max-height:455px;
|
||||||
|
}
|
||||||
|
|
||||||
/* Fluid Offsets for Boostrap */
|
/* Fluid Offsets for Boostrap */
|
||||||
|
|
||||||
.row-fluid > [class*="span"]:not([class*="offset"]):first-child{margin-left:0;}
|
.row-fluid > [class*="span"]:not([class*="offset"]):first-child{margin-left:0;}
|
||||||
|
|
|
@ -1,17 +1,18 @@
|
||||||
// Add a script to select all or non of the checkboxes in the add_bill form
|
// Add scripts to select all or non of the checkboxes in the add_bill form
|
||||||
function toggle()
|
function selectall()
|
||||||
{
|
{
|
||||||
var els = document.getElementsByName('payed_for');
|
var els = document.getElementsByName('payed_for');
|
||||||
for(var i =0;i<els.length;i++)
|
for(var i =0;i<els.length;i++)
|
||||||
{
|
{
|
||||||
if(document.getElementById('toggleField').checked)
|
els[i].checked=true;
|
||||||
{
|
}
|
||||||
els[i].checked=true;
|
}
|
||||||
}
|
function selectnone()
|
||||||
else
|
{
|
||||||
{
|
var els = document.getElementsByName('payed_for');
|
||||||
els[i].checked=false;
|
for(var i =0;i<els.length;i++)
|
||||||
}
|
{
|
||||||
|
els[i].checked=false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -108,6 +108,7 @@
|
||||||
<fieldset>
|
<fieldset>
|
||||||
<legend>{{ _("Create an archive") }}</legend>
|
<legend>{{ _("Create an archive") }}</legend>
|
||||||
{{ form.hidden_tag() }}
|
{{ form.hidden_tag() }}
|
||||||
|
{{ input(form.name) }}
|
||||||
{{ input(form.start_date) }}
|
{{ input(form.start_date) }}
|
||||||
{{ input(form.end_date) }}
|
{{ input(form.end_date) }}
|
||||||
</fieldset>
|
</fieldset>
|
||||||
|
|
|
@ -22,9 +22,11 @@ class TestCase(unittest.TestCase):
|
||||||
run.app.config['SQLALCHEMY_DATABASE_URI'] = "sqlite:///memory"
|
run.app.config['SQLALCHEMY_DATABASE_URI'] = "sqlite:///memory"
|
||||||
run.app.config['CSRF_ENABLED'] = False # simplify the tests
|
run.app.config['CSRF_ENABLED'] = False # simplify the tests
|
||||||
self.app = run.app.test_client()
|
self.app = run.app.test_client()
|
||||||
|
try:
|
||||||
models.db.init_app(run.app)
|
models.db.init_app(run.app)
|
||||||
run.mail.init_app(run.app)
|
run.mail.init_app(run.app)
|
||||||
|
except:
|
||||||
|
pass
|
||||||
|
|
||||||
models.db.app = run.app
|
models.db.app = run.app
|
||||||
models.db.create_all()
|
models.db.create_all()
|
||||||
|
|
|
@ -11,8 +11,8 @@ and `add_project_id` for a quick overview)
|
||||||
|
|
||||||
from flask import Blueprint, current_app, flash, g, redirect, \
|
from flask import Blueprint, current_app, flash, g, redirect, \
|
||||||
render_template, request, session, url_for
|
render_template, request, session, url_for
|
||||||
from flaskext.mail import Mail, Message
|
from flask.ext.mail import Mail, Message
|
||||||
from flaskext.babel import get_locale, gettext as _
|
from flask.ext.babel import get_locale, gettext as _
|
||||||
from smtplib import SMTPRecipientsRefused
|
from smtplib import SMTPRecipientsRefused
|
||||||
import werkzeug
|
import werkzeug
|
||||||
|
|
||||||
|
@ -390,7 +390,7 @@ def settle_bill():
|
||||||
return render_template("settle_bill.html", bills=bills)
|
return render_template("settle_bill.html", bills=bills)
|
||||||
|
|
||||||
|
|
||||||
@main.route("/<project_id>/archives/create")
|
@main.route("/<project_id>/archives/create", methods=["GET", "POST"])
|
||||||
def create_archive():
|
def create_archive():
|
||||||
form = CreateArchiveForm()
|
form = CreateArchiveForm()
|
||||||
if request.method == "POST":
|
if request.method == "POST":
|
||||||
|
|
Loading…
Add table
Reference in a new issue