Skip to content

Commit

Permalink
registration page next parameter was overridden by default value; add…
Browse files Browse the repository at this point in the history
…_action() and action_button_html() were misaligned when side-by-side; added additional tests
  • Loading branch information
jhpyle committed Dec 24, 2024
1 parent 4dd9b92 commit 5e67ba9
Show file tree
Hide file tree
Showing 8 changed files with 290 additions and 10 deletions.
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# Change Log

## [1.6.2] - 2024-12-24

### Fixed
- The `next` parameter on the registration page was not being
followed.
- HTML generated by `add_action()` and `action_button_html()` was not
consistent.

## [1.6.1] - 2024-12-07

### Fixed
Expand Down
3 changes: 2 additions & 1 deletion docassemble_base/docassemble/base/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -2983,7 +2983,7 @@ def add_action(self, label=None, message=None, url_only=False, icon='plus-circle
message = word(str(message))
if url_only:
return docassemble.base.functions.url_action('_da_list_add', list=self.instanceName)
return '<a href="' + docassemble.base.functions.url_action('_da_list_add', list=self.instanceName) + '" class="btn' + size + block + ' ' + server.button_class_prefix + color + classname + '">' + icon + str(message) + '</a>'
return '<a href="' + docassemble.base.functions.url_action('_da_list_add', list=self.instanceName) + '" class="btn' + size + block + ' ' + server.button_class_prefix + color + ' btn-darevisit' + classname + '">' + icon + str(message) + '</a>'

def hook_on_gather(self, *pargs, **kwargs):
"""Code that runs just before a list is marked as gathered."""
Expand Down Expand Up @@ -10300,6 +10300,7 @@ def action_button_html(url, icon=None, color='success', size='sm', block=False,
classname = ''
else:
classname = ' ' + str(classname)

if isinstance(icon, str):
icon = re.sub(r'^(fa[a-z])-fa-', r'\1 fa-', icon)
if not re.search(r'^fa[a-z] fa-', icon):
Expand Down
4 changes: 1 addition & 3 deletions docassemble_demo/docassemble/demo/accordion.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,7 @@ def _section_start(section_id, section, showing):
return f"""\
<div class="accordion-item">
<h2 class="accordion-header">
<button class="accordion-button{collapsed}" type="button" data-bs-toggle="collapse" data-bs-target="#collapse-{section_id}" aria-expanded="{expanded}" aria-controls="collapse-{section_id}">
{section}
</button>
<button class="accordion-button{collapsed}" type="button" data-bs-toggle="collapse" data-bs-target="#collapse-{section_id}" aria-expanded="{expanded}" aria-controls="collapse-{section_id}">{section}</button>
</h2>
<div id="collapse-{section_id}" class="accordion-collapse collapse{show}" data-bs-parent="#{section_id}">
<div class="accordion-body">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,6 @@ metadata:
---
question: |
Please fill in the following information.
subquestion: |
Try setting "Favorite fruit" to
"apple" or "mango" (and unfocus the
field) to see what happens.
fields:
- Favorite fruit: fruit
- Favorite vegetable: vegetable
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ review:
- Edit: favorite_cat
button: |
You said your favorite cat was
**${ favorite_fruit }**.
**${ favorite_cat }**.
- Edit: favorite_vegetable
button: |
You said your favorite dog was
Expand Down
4 changes: 3 additions & 1 deletion docassemble_webapp/docassemble/webapp/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -901,7 +901,9 @@ def custom_register():
return redirect(safe_reg_next)

# Auto-login after register or redirect to login page
if 'reg_next' in request.args:
if register_form.next.data:
safe_reg_next = user_manager.make_safe_url_function(register_form.next.data)
elif register_form.reg_next.data:
safe_reg_next = user_manager.make_safe_url_function(register_form.reg_next.data)
else:
safe_reg_next = _endpoint_url(user_manager.after_confirm_endpoint)
Expand Down
1 change: 1 addition & 0 deletions docassemble_webapp/docassemble/webapp/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@
if not daconfig.get('allow registration', True):
app.config['USER_REQUIRE_INVITATION'] = True
app.config['MAX_CONTENT_LENGTH'] = daconfig.get('maximum content length', 16 * 1024 * 1024)
app.config['MAX_FORM_MEMORY_SIZE'] = app.config['MAX_CONTENT_LENGTH']
app.config['USE_X_SENDFILE'] = daconfig.get('xsendfile', True) if daconfig.get('web server', 'nginx') == 'apache' else False
# if daconfig.get('behind https load balancer', False):
# app.config['PREFERRED_URL_SCHEME'] = 'https'
Expand Down
274 changes: 274 additions & 0 deletions tests/features/TestExamples.feature

Large diffs are not rendered by default.

0 comments on commit 5e67ba9

Please sign in to comment.