Skip to content

Commit

Permalink
[FIX] formio: Solve Form height resizing issues.
Browse files Browse the repository at this point in the history
Solve Form height resizing issues, by applying the iFrame Resizer
`bodyMargin` option.

Eg. ensure the rendering of select component at the bottom of a Form
won't break anymore.

- Update iFrame Resizer (JS) library to version 4.3.2 (Dec 2021).
- Add configurable `iframe_resizer_body_margin` field in Form Builder,
  with a (sensible) default value.
- Change Form templates (backend, portal) to apply the configurable
  iFrame Resizer `bodyMargin`.
- Add callable template `formio.form_iframe` (with options: `src`,
  `bodyMargin`, `form`), which applies the iFrame Resizer (with fallback
  on `form` its Form Builder).

Resolves #20
  • Loading branch information
bobslee committed Jan 24, 2023
1 parent d4a982c commit 6adf656
Show file tree
Hide file tree
Showing 16 changed files with 2,820 additions and 19 deletions.
11 changes: 11 additions & 0 deletions formio/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,16 @@
# Changelog

## 11.1

Solve Form height resizing issues, by applying the iFrame Resizer `bodyMargin` option.\
Eg. ensure the rendering of select component at the bottom of a Form won't break anymore.\
Issue: [\#20](https://github.com/novacode-nl/odoo-formio/issues/20)

- Update iFrame Resizer (JS) library to version 4.3.2 (Dec 2021).
- Add configurable `iframe_resizer_body_margin` field in Form Builder, with a (sensible) default value.
- Change Form templates (backend, portal) to apply the configurable iFrame Resizer `bodyMargin`.
- Add callable template `formio.form_iframe` (with options: `src`, `bodyMargin`, `form`), which applies the iFrame Resizer (with fallback on `form` its Form Builder).

### 11.0

- Add Form (JS) `apiUrl` property (backend, portal, public).
Expand Down
2 changes: 1 addition & 1 deletion formio/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
{
'name': 'Forms',
'summary': 'Form Builder & integration of professional and versatile Forms to collect any information you need for your business.',
'version': '11.0',
'version': '11.1',
'license': 'LGPL-3',
'author': 'Nova Code',
'website': 'https://www.novacode.nl',
Expand Down
4 changes: 4 additions & 0 deletions formio/models/formio_builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,10 @@ class Builder(models.Model):
show_form_state = fields.Boolean("Show Form State", tracking=True, help="Show the state in the Form header.", default=True)
show_form_user_metadata = fields.Boolean(
"Show User Metadata", tracking=True, help="Show submission and assigned user metadata in the Form header.", default=True)
iframe_resizer_body_margin = fields.Char(
"iFrame Resizer bodyMargin", default="0px 0px 260px 0px", tracking=True,
help="Override the default body margin style in the iFrame. A string can be any valid value for the CSS margin attribute. A number is converted into px."
)
wizard = fields.Boolean("Wizard", tracking=True)
wizard_on_next_page_save_draft = fields.Boolean("Wizard on Next Page Save Draft", tracking=True)
submission_url_add_query_params_from = fields.Selection(
Expand Down
4 changes: 4 additions & 0 deletions formio/models/formio_form.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,10 @@ class Form(models.Model):
show_id = fields.Boolean("Show ID")
show_uuid = fields.Boolean("Show UUID")
show_user_metadata = fields.Boolean("Show User Metadata")
iframe_resizer_body_margin = fields.Char(
"iFrame Resizer bodyMargin", related="builder_id.iframe_resizer_body_margin",
help="Override the default body margin style in the iFrame. A string can be any valid value for the CSS margin attribute. A number is converted into px."
)
languages = fields.One2many('res.lang', related='builder_id.languages', string='Languages')
allow_unlink = fields.Boolean("Allow delete", compute='_compute_access')
allow_force_update_state = fields.Boolean("Allow force update State", compute='_compute_access')
Expand Down
2 changes: 1 addition & 1 deletion formio/static/lib/iframe-resizer/LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
The MIT License (MIT)

Copyright (c) 2013-2019 David J. Bradshaw
Copyright (c) 2013-2021 David J. Bradshaw

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
Loading

0 comments on commit 6adf656

Please sign in to comment.