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

USH-4329: Make anchored submit button sticky #34490

Merged
merged 12 commits into from
May 1, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Original file line number Diff line number Diff line change
Expand Up @@ -392,8 +392,6 @@ hqDefine("cloudcare/js/form_entry/form_ui", function () {
self.hasSubmitAttempted = ko.observable(false);
self.isSubmitting = ko.observable(false);
self.isAnchoredSubmitStyle = hqImport('hqwebapp/js/toggles').toggleEnabled('WEB_APPS_ANCHORED_SUBMIT');
self.submitClass = constants.FULL_WIDTH + ' text-center' +
(self.isAnchoredSubmitStyle ? ' anchored-submit' : ' nonanchored-submit');

self.currentIndex = ko.observable("0");
self.atLastIndex = ko.observable(false);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -163,20 +163,19 @@ <h1 class="title" data-bind="text: title, visible: !showInFormNavigation()"></h1
</div>
</div>
{% endif %}
<div id="submit-button" class="form-actions form-group noprint-sub-container" data-bind="visible: showSubmitButton">
<div data-bind="
css: submitClass,
style: {
'bottom':isAnchoredSubmitStyle && {{ request.couch_user.can_edit_data|yesno:'true,false' }} {% if environment != "web-apps" %} && false {% endif %} ? '30px' : '' {# data preview bar #}
}">
<div id="submit-button" class="form-actions form-group noprint-sub-container"
data-bind="visible: showSubmitButton,
css: { 'sticky-submit': isAnchoredSubmitStyle },
style: {
'bottom':isAnchoredSubmitStyle && {{ request.couch_user.can_edit_data|yesno:'true,false' }} {% if environment != "web-apps" %} && false {% endif %} ? '30px' : '0' {# data preview bar #}
Jtang-1 marked this conversation as resolved.
Show resolved Hide resolved
}"
>
<div class="col-12 text-center submit">
<button class="submit btn btn-primary"
type="submit"
data-bind="
enable: enableSubmitButton,
css: {
'btn-lg': !isAnchoredSubmitStyle,
'btn-sm': isAnchoredSubmitStyle,
}">
">
<i class="fa fa-spin fa-refresh"
data-bind="visible: !enableSubmitButton(){% if environment == "web-apps" %} && erroredQuestions.length != 0{% endif %}"
></i>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,22 +31,15 @@
background-color: lighten(@cc-brand-hi, 10);
.border-bottom-radius(0);

.nonanchored-submit .btn {
.submit .btn {
font-size: 20px;
padding: 13px 24px;
.transition(all .5s);
}
}

.anchored-submit {
background-color: @call-to-action-low;
width: 100vw;
padding-top: 5px;
padding-bottom: 5px;
position: fixed;
bottom: 0px;
left: 0;
z-index: @zindex-formplayer-anchored-submit;
MartinRiese marked this conversation as resolved.
Show resolved Hide resolved
}
.sticky-submit {
position: sticky;
}

// Bootstrap introduces -10px left/right margin for row classes. This causes element to overflow parent.
Expand Down
Loading