From 7ab44b764ecd1afdcedb7a64254b6f0a55726069 Mon Sep 17 00:00:00 2001 From: Lance Edgar Date: Mon, 9 Jul 2012 06:14:40 -0500 Subject: [PATCH] add FieldSet.allow_continue, updated template --- edbob/pyramid/forms/formalchemy.py | 1 + edbob/pyramid/static/css/edbob.css | 2 ++ edbob/pyramid/templates/forms/fieldset.mako | 7 +++++++ 3 files changed, 10 insertions(+) diff --git a/edbob/pyramid/forms/formalchemy.py b/edbob/pyramid/forms/formalchemy.py index 9fad2d7..bd73b19 100644 --- a/edbob/pyramid/forms/formalchemy.py +++ b/edbob/pyramid/forms/formalchemy.py @@ -80,6 +80,7 @@ class FieldSet(formalchemy.FieldSet): self.route_name = route_name or (self.class_name + 's') self.url_action = url_action or url(self.route_name) self.url_cancel = url_cancel or url(self.route_name) + self.allow_continue = kwargs.pop('allow_continue', False) def get_display_text(self): return unicode(self.model) diff --git a/edbob/pyramid/static/css/edbob.css b/edbob/pyramid/static/css/edbob.css index d10b9e0..bcdecb0 100644 --- a/edbob/pyramid/static/css/edbob.css +++ b/edbob/pyramid/static/css/edbob.css @@ -390,8 +390,10 @@ div.field-couple div.field select { width: 320px; } +/* unbound checkbox field, e.g. 'add another' */ div.checkbox { margin: 15px 0px; + padding-left: 3px; } table.fieldset tbody tr { diff --git a/edbob/pyramid/templates/forms/fieldset.mako b/edbob/pyramid/templates/forms/fieldset.mako index 890083b..ec858dd 100644 --- a/edbob/pyramid/templates/forms/fieldset.mako +++ b/edbob/pyramid/templates/forms/fieldset.mako @@ -35,6 +35,13 @@ % endfor + % if fieldset.allow_continue: +
+ ${h.checkbox('add-another', checked=True)} + +
+ % endif +
${h.submit('submit', "Save")}