deform2: fix inline version RadioChoiceWidget and CheckboxChoiceWidget #182

Merged
merged 2 commits into from Oct 3, 2013

2 participants

@dairiki

This fixes the inline version of the RadioChoiceWidget and CheckboxChoiceWidget (in the deform2 branch).
Also adds terse documentation about the inline attribute of said widgets.

It also changes the markup for the stacked choice displays to match the examples in the bootstrap documentation.
E.g. <div class="radio"><label>...</label></div> instead of just <label class="radio">...</label>.

@mcdonc mcdonc commented on the diff Oct 3, 2013
deform/templates/checkbox_choice.pt
+ <div tal:repeat="choice values | field.widget.values"
+ tal:omit-tag="inline"
+ class="checkbox">
+ <label for="${oid}-${repeat.choice.index}"
+ tal:define="(value, title) choice"
+ tal:attributes="class inline and 'checkbox-inline'">
+ <input tal:attributes="checked value in cstruct;
+ class css_class"
+ type="checkbox"
+ name="checkbox"
+ value="${value}"
+ id="${oid}-${repeat.choice.index}"/>
+ ${title}
+ </label>
+ </div>
+ ${field.end_sequence()}
</div>
@mcdonc
Pylons Project member
mcdonc added a note Oct 3, 2013

Curious about why the divs are retained if the checkbox group is not inline. Is that intentional? It seems to look ok without them.

@dairiki
dairiki added a note Oct 4, 2013

You mean the div.checkbox divs? I think I did it that way because that’s what the bootstrap docs say to do.
Playing around with it just now, if you omit that, the labels come out bold and the margins are tweaked a bit.

@mcdonc
Pylons Project member
mcdonc added a note Oct 4, 2013

Yes those are the divs I meant. I see. Thanks for looking into it!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
@mcdonc mcdonc merged commit 5a8d6eb into Pylons:deform2 Oct 3, 2013
@mcdonc
Pylons Project member

I've merged this, thank you! It'd be nice to see what you thought about my comment above, but it's not critical.

@dairiki dairiki deleted the dairiki:inline-choice-widgets branch Oct 4, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment