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

added demo for sequence of accordion mappings and form item inside pa… #48

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 29 additions & 0 deletions deformdemo/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2684,6 +2684,35 @@ class Schema(colander.Schema):

return self.render_form(deform.Form(Schema(), buttons=('submit',)))

@view_config(renderer='templates/form.pt',
name='accordion_as_sequenze_item_and_form_element_inside_mapping_header')
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
name='accordion_as_sequenze_item_and_form_element_inside_mapping_header')
name='accordion_as_sequence_item_and_form_element_inside_mapping_header')

@demonstrate('accordion as sequenze item and form element inside mapping header')
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
@demonstrate('accordion as sequenze item and form element inside mapping header')
@demonstrate('accordion as sequence item and form element inside mapping header')

def custom_classes_on_outermost_html_element(self):

class Application(colander.Schema):
applications = ['dummy1', 'dummy2']
slot = colander.SchemaNode(colander.Integer(), widget=deform.widget.TextInputWidget(item_css_class="col-xs-2"))
application = colander.SchemaNode(colander.String(),
widget=deform.widget.AutocompleteInputWidget(values=applications,
min_length=1,
item_css_class="col-xs-10",
))

class Mapping(colander.Schema):
# application is inside panel header
application = Application()
title = 'open' # to open the accordion
# text is iside panel body
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
# text is iside panel body
# text is inside panel body

text = colander.SchemaNode(colander.String())

class Applications(colander.SequenceSchema):
application = Mapping(widget=deform.widget.MappingWidget(template='mapping_accordion', open=False))

class Schema(colander.Schema):
applications = Applications(widget=deform.widget.SequenceWidget(min_len=1, orderable=True))

return self.render_form(deform.Form(Schema(), buttons=('submit',)))

class MemoryTmpStore(dict):
""" Instances of this class implement the
:class:`deform.interfaces.FileUploadTempStore` interface"""
Expand Down