Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ordering buttons doesn't appear in nested sequences #276

Closed
tonthon opened this issue Jul 17, 2015 · 3 comments
Closed

Ordering buttons doesn't appear in nested sequences #276

tonthon opened this issue Jul 17, 2015 · 3 comments
Labels

Comments

@tonthon
Copy link
Contributor

tonthon commented Jul 17, 2015

The following Form Schema

import colander
import deform

class Comment(colander.MappingSchema):
    content = colander.SchemaNode(colander.String())

class Comments(colander.SequenceSchema):
    comment = Comment()

class Line(colander.MappingSchema):
    label = colander.SchemaNode(colander.String())
    comments = Comments(widget=deform.widget.SequenceWidget(orderable=True))

class Lines(colander.SequenceSchema):
    line = Line()

class FormSchema(colander.Schema):
    lines = Lines()

form = deform.Form(FormSchema())

If we initialize the form with one line containing multiple comments, the deformOrderbuttons will not appear.
This is due to the way we retrieve the buttons in deform.processSequenceButtons

// Here we collect the deformSeqContainer of the nested sequence
var $ul = oid_node.find('.deformSeqContainer'); 
var $lis = $ul.find('.deformSeqItem');
...
$lis.find('.deformOrderbutton')

A fix could be

// Only list containers that are not nested in a sub-sequence
var $ul = oid_node.find('.deformSeqContainer:not(.deformSeq .deformSeqContainer)');
// Only the container's children that are not nested in a sub-sequence
var $li = $ul.find('.deformSeqItem:not(.deformSeq .deformSeqItem)');
tonthon pushed a commit to CroissanceCommune/autonomie that referenced this issue Aug 4, 2015
Allows us to fix :
Pylons/deform#276
Pylons/deform#275 ( for task forms only )
@miohtama
Copy link
Contributor

miohtama commented Dec 6, 2016

Still want to PR?

@tonthon
Copy link
Contributor Author

tonthon commented Dec 8, 2016

I try too if I find some time, probably not before january.
I'd be glad to participate to the deform "revival" :)

@tonthon
Copy link
Contributor Author

tonthon commented Mar 28, 2017

For me it has been fixed with the following modifications
3579e29

@tonthon tonthon closed this as completed Mar 28, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants