Skip to content

Commit

Permalink
floating label fix; GoogleAPI loads unconditionally because ARM suppo…
Browse files Browse the repository at this point in the history
…rt appears to be available; Share button copies to clipboard; CodeMirror 5 to 6; pygments dark mode
  • Loading branch information
jhpyle committed Sep 5, 2024
1 parent 396cfb5 commit 78f30ca
Show file tree
Hide file tree
Showing 464 changed files with 34,421 additions and 103,599 deletions.
16 changes: 16 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,21 @@
# Change Log

## [1.5.7] - 2024-09-05

### Changed
- Migrated from CodeMirror 5 to CodeMirror 6. Searching is now
accomplished with Ctrl-f. Dark mode support is improved. The
mixed-mode syntax highlighting of Python code in `code` blocks is no
longer available. (CodeMirror 6 is a complete rewrite.) Pressing F11
for full-screen mode and Ctrl-space for autocomplete are still
available.
- The `GoogleAPI` class can now be used with ARM processors.
- The "Share" button in the Playground now copies the hyperlink to the
clipboard when you click it.

### Fixed
- The `floating label` labels are now visible on comboboxes.

## [1.5.6] - 2024-09-01

### Added
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -536,6 +536,7 @@
"License": Null
"Liechtenstein": Null
"Limited Permissions": Null
"Link copied to clipboard.": Null
"Linked folder": Null
"link": Null
"Links": Null
Expand Down Expand Up @@ -631,7 +632,6 @@
"New Username": Null
"New Zealand": Null
"Next": Null
"Next result": Null
"Next will be": Null
"Nicaragua": Null
"Nickname": Null
Expand Down Expand Up @@ -774,7 +774,6 @@
"Press one of the following buttons:": Null
"Press the Publish button to publish the package on PyPI.": Null
"Preview": Null
"Previous result": Null
"Privilege": Null
"Privileges": Null
"Problem detected.": Null
Expand Down Expand Up @@ -1205,7 +1204,6 @@
"Valid characters are: A-Z, a-z, 0-9, hyphen": Null
"Valid characters are: A-Z, a-z, 0-9": Null
"Vanuatu": Null
"Variables, etc. from": Null
"Variables": Null
"Venezuela, Bolivarian Republic of": Null
"Verification code": Null
Expand Down
39 changes: 25 additions & 14 deletions docassemble_base/docassemble/base/standardformatter.py
Original file line number Diff line number Diff line change
Expand Up @@ -1471,6 +1471,7 @@ def as_html(status, debug, root, validation_rules, field_error, the_progress_bar
helptext_end = ''
if hasattr(field, 'disableothers') and field.disableothers and hasattr(field, 'saveas'):
onchange.append(safeid('_field_' + str(field.number)))
label_saveas = ''
if hasattr(field, 'saveas'):
varnames[safeid('_field_' + str(field.number))] = field.saveas
# the_saveas = status.saveas_to_use[field.saveas]
Expand Down Expand Up @@ -1808,18 +1809,24 @@ def as_html(status, debug, root, validation_rules, field_error, the_progress_bar
fieldlist.append(field_item(field, grid_info, pre=style_def + data_def, classes='dayesnospacing ' + side_note_parent + field_class + ' da-field-container-nolabel' + class_def, hidden_message=word("Check if applicable"), grid_type='wide', content_classes='dafieldpart', content=input_for(status, field), side_note=side_note, under_text=under_text, use_fieldset=use_fieldset, required=is_required))
# fieldlist.append(' <div ' + style_def + data_def + 'class="da-form-group row dayesnospacing ' + side_note_parent + field_class + ' da-field-container-nolabel' + class_def + '">\n <span class="visually-hidden">' + word("Check if applicable") + '</span>\n <div class="col dawidecol dafieldpart">' + input_for(status, field) + '</div>' + side_note + '\n </div>\n')
elif floating_labels or (hasattr(field, 'floating_label') and status.extras['floating_label'][field.number]):
if hasattr(field, 'inputtype') and field.inputtype in ['yesno', 'noyes']:
fieldlist.append(field_item(field, grid_info, pre=style_def + data_def, row=False, classes='dayesnospacing' + side_note_parent + field_class + ' da-field-container-nolabel' + class_def, hidden_message=word("Check if applicable"), grid_type='offset', content_classes='dafieldpart', content=input_for(status, field), side_note=side_note, under_text=under_text, label_content='', use_fieldset=use_fieldset, required=is_required))
# fieldlist.append(' <div ' + style_def + data_def + 'class="da-form-group dayesnospacing' + side_note_parent + field_class + ' da-field-container-nolabel' + class_def + '">\n <span class="visually-hidden">' + word("Check if applicable") + '</span>\n <div class="dafieldpart">' + input_for(status, field) + side_note + '</div>\n </div>\n')
elif status.labels[field.number] == '':
fieldlist.append(field_item(field, grid_info, pre=style_def + data_def, row=False, classes='da-form-group' + side_note_parent + req_tag + field_class + ' da-field-container-emptylabel' + class_def, hidden_message=word("Answer here"), content_classes='dafieldpart', content=input_for(status, field), side_note=side_note, under_text=under_text, use_fieldset=use_fieldset, required=is_required))
# fieldlist.append(' <div ' + style_def + data_def + 'class="da-form-group' + side_note_parent + req_tag + field_class + ' da-field-container-emptylabel' + class_def + '">\n <span class="visually-hidden">' + word("Answer here") + '</span>\n <div class="dafieldpart">' + input_for(status, field) + side_note + '</div>\n </div>\n')
else:
floating_label = markdown_to_html(status.labels[field.number], trim=True, status=status, strip_newlines=True)
# logmessage("field is " + repr(field.number) + " and status labels is " + repr(status.labels[field.number]))
# logmessage("field is " + repr(field.number) + " and floating_label is " + repr(floating_label))
fieldlist.append(field_item(field, grid_info, pre=style_def + data_def, row=False, floating=True, classes=side_note_parent + req_tag + field_class + class_def, content=input_for(status, field, floating_label=strip_quote(to_text(floating_label, {}, []).strip())), side_note=side_note, label_for=label_for, label_content=floating_label, under_text=under_text, use_fieldset=use_fieldset, required=is_required))
# fieldlist.append(' <div ' + style_def + data_def + 'class="da-form-group-floating form-floating mb-3' + side_note_parent + req_tag + field_class + class_def + '">\n ' + input_for(status, field, floating_label=strip_quote(to_text(floating_label, {}, []).strip())) + side_note + '\n <label ' + label_for + '>' + floating_label + '</label>\n </div>\n')
if (hasattr(field, 'datatype') and field.datatype in ['file', 'files', 'camera', 'user', 'environment', 'camcorder', 'microphone']):
if status.labels[field.number] == '':
fieldlist.append(field_item(field, grid_info, pre=style_def + data_def, row=False, classes=side_note_parent + req_tag + field_class + ' da-field-container-emptylabel' + class_def, hidden_message=word("Answer here"), content_classes='dafieldpart', content=input_for(status, field), side_note=side_note, under_text=under_text, use_fieldset=use_fieldset, required=is_required))
else:
fieldlist.append(field_item(field, grid_info, pre=style_def + data_def, row=False, classes=side_note_parent + req_tag + field_class + class_def, label_for=label_for, label_classes='form-label da-top-label', label_content=markdown_to_html(status.labels[field.number], trim=True, status=status, strip_newlines=True) + helptext_start + helptext_end, content_classes='dafieldpart', content=input_for(status, field), side_note=side_note, under_text=under_text, use_fieldset=use_fieldset, required=is_required))
else:
if hasattr(field, 'inputtype') and field.inputtype in ['yesno', 'noyes']:
fieldlist.append(field_item(field, grid_info, pre=style_def + data_def, row=False, classes='dayesnospacing' + side_note_parent + field_class + ' da-field-container-nolabel' + class_def, hidden_message=word("Check if applicable"), grid_type='offset', content_classes='dafieldpart', content=input_for(status, field), side_note=side_note, under_text=under_text, label_content='', use_fieldset=use_fieldset, required=is_required))
# fieldlist.append(' <div ' + style_def + data_def + 'class="da-form-group dayesnospacing' + side_note_parent + field_class + ' da-field-container-nolabel' + class_def + '">\n <span class="visually-hidden">' + word("Check if applicable") + '</span>\n <div class="dafieldpart">' + input_for(status, field) + side_note + '</div>\n </div>\n')
elif status.labels[field.number] == '':
fieldlist.append(field_item(field, grid_info, pre=style_def + data_def, row=False, classes='da-form-group' + side_note_parent + req_tag + field_class + ' da-field-container-emptylabel' + class_def, hidden_message=word("Answer here"), content_classes='dafieldpart', content=input_for(status, field), side_note=side_note, under_text=under_text, use_fieldset=use_fieldset, required=is_required))
# fieldlist.append(' <div ' + style_def + data_def + 'class="da-form-group' + side_note_parent + req_tag + field_class + ' da-field-container-emptylabel' + class_def + '">\n <span class="visually-hidden">' + word("Answer here") + '</span>\n <div class="dafieldpart">' + input_for(status, field) + side_note + '</div>\n </div>\n')
else:
floating_label = markdown_to_html(status.labels[field.number], trim=True, status=status, strip_newlines=True)
# logmessage("field is " + repr(field.number) + " and status labels is " + repr(status.labels[field.number]))
# logmessage("field is " + repr(field.number) + " and floating_label is " + repr(floating_label))
fieldlist.append(field_item(field, grid_info, pre=style_def + data_def, row=False, floating=True, classes=side_note_parent + req_tag + field_class + class_def, content=input_for(status, field, floating_label=strip_quote(to_text(floating_label, {}, []).strip())), side_note=side_note, label_for=label_for, label_content=floating_label, under_text=under_text, use_fieldset=use_fieldset, required=is_required))
# fieldlist.append(' <div ' + style_def + data_def + 'class="da-form-group-floating form-floating mb-3' + side_note_parent + req_tag + field_class + class_def + '">\n ' + input_for(status, field, floating_label=strip_quote(to_text(floating_label, {}, []).strip())) + side_note + '\n <label ' + label_for + '>' + floating_label + '</label>\n </div>\n')
elif labels_above or (hasattr(field, 'label_above_field') and status.extras['label_above_field'][field.number]):
if hasattr(field, 'inputtype') and field.inputtype in ['yesno', 'noyes']:
fieldlist.append(field_item(field, grid_info, pre=style_def + data_def, row=False, classes='dayesnospacing' + side_note_parent + field_class + ' da-field-container-nolabel' + class_def, hidden_message=word("Check if applicable"), content_classes='dafieldpart', content=input_for(status, field), side_note=side_note, under_text=under_text, use_fieldset=use_fieldset, required=is_required))
Expand Down Expand Up @@ -1945,6 +1952,7 @@ def as_html(status, debug, root, validation_rules, field_error, the_progress_bar
if status.question.question_variety in ["radio", "dropdown", "combobox"]:
if hasattr(status.question.fields[0], 'saveas'):
varnames[safeid('_field_' + str(status.question.fields[0].number))] = status.question.fields[0].saveas
inner_fieldlist = []
if status.question.question_variety == "radio":
verb = 'check'
output += ' <fieldset class="da-field-' + status.question.question_variety + '">\n <legend class="visually-hidden">' + word("Choices (choose one):") + "</legend>\n"
Expand Down Expand Up @@ -3177,7 +3185,10 @@ def input_for(status, field, embedded=False, floating_label=None):
emb_text += 'title=' + fix_double_quote(str(label_text)) + ' '
else:
if hasattr(field, 'inputtype') and field.inputtype == 'combobox':
emb_text = 'class="form-control dasingleselect combobox' + daobject + '" '
emb_text = 'class="form-control dasingleselect combobox' + daobject
if floating_label:
emb_text += ' da-combobox-floating'
emb_text += '" '
else:
emb_text = 'class="form-select dasingleselect' + daobject + '" '
if embedded:
Expand Down Expand Up @@ -3483,7 +3494,7 @@ def input_for(status, field, embedded=False, floating_label=None):
default_val = ''
if embedded:
output += '<span class="da-inline-error-wrapper">'
output += '<select data-action=' + fix_double_quote(field.combobox_action['action']) + ' data-trig="' + str(field.combobox_action['trig']) + '" alt="' + word("Input box") + '" class="form-control da-ajax-combobox' + extra_class + '"' + extra_style + title_text + ' name="' + escape_id(saveas_string) + '" id="' + escape_id(saveas_string) + '"' + req_attr + disabled_attr + '><option' + defaultstring + ' selected="selected">' + option_escape(default_val) + '</option></select>'
output += '<select data-action=' + fix_double_quote(field.combobox_action['action']) + ' data-trig="' + str(field.combobox_action['trig']) + '" alt="' + word("Input box") + '" class="form-control da-ajax-combobox' + (' da-combobox-floating' if floating_label else '') + extra_class + '"' + extra_style + title_text + ' name="' + escape_id(saveas_string) + '" id="' + escape_id(saveas_string) + '"' + req_attr + disabled_attr + '><option' + defaultstring + ' selected="selected">' + option_escape(default_val) + '</option></select>'
if embedded:
if field.datatype == 'currency':
output += '</span></span>'
Expand Down
7 changes: 2 additions & 5 deletions docassemble_webapp/docassemble/webapp/backend.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
import math
import os
import pickle
import platform
import re
import sys
import time
Expand Down Expand Up @@ -47,8 +46,7 @@
import docassemble.webapp.setup
import docassemble.webapp.user_database
import docassemble.webapp.worker
if platform.machine() == 'x86_64':
import docassemble.webapp.google_api
import docassemble.webapp.google_api

if DEBUG_BOOT:
boot_log("backend: starting")
Expand Down Expand Up @@ -626,8 +624,7 @@ def cloud_custom(provider, config):
docassemble.base.functions.update_server(cloud=cloud,
cloud_custom=cloud_custom)

if platform.machine() == 'x86_64':
docassemble.base.functions.update_server(google_api=docassemble.webapp.google_api)
docassemble.base.functions.update_server(google_api=docassemble.webapp.google_api)

if DEBUG_BOOT:
boot_log("backend: finished obtaining cloud object")
Expand Down
5 changes: 0 additions & 5 deletions docassemble_webapp/docassemble/webapp/retrieve_js_and_css.sh
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,6 @@ rm -rf bootstrap-fileinput/.git*
rm -r bootstrap-slider
git clone https://github.com/seiyria/bootstrap-slider
rm -rf bootstrap-slider/.git*
rm -rf codemirror
wget http://codemirror.net/codemirror.zip
unzip codemirror.zip
rm -f codemirror.zip
mv codemirror-* codemirror
# need to use old version of jquery-labelauty
# rm -rf jquery-labelauty
# git clone https://github.com/fntneves/jquery-labelauty
Loading

0 comments on commit 78f30ca

Please sign in to comment.