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 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
Original file line number Diff line number Diff line change
Expand Up @@ -410,8 +410,6 @@ hqDefine("cloudcare/js/form_entry/form_ui", [
self.hasSubmitAttempted = ko.observable(false);
self.isSubmitting = ko.observable(false);
self.isAnchoredSubmitStyle = 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 @@ -42,20 +42,18 @@ <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 #}
}"
>
<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,
}">
data-bind="enable: enableSubmitButton">
<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 @@ -42,20 +42,18 @@ <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"> {# todo B5: css:form-group #}
<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" {# todo B5: css:form-group #}
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 #}
}"
>
<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,
}">
data-bind="enable: enableSubmitButton">
<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 @@ -28,25 +28,18 @@
margin-right: -@form-text-indent;
}

background-color: lighten(@cc-brand-hi, 10);
background-color: @call-to-action-extra-hi;
.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
Original file line number Diff line number Diff line change
Expand Up @@ -28,25 +28,18 @@
margin-right: -@form-text-indent;
}

background-color: lighten(@cc-brand-hi, 10);
background-color: var(--bsprimary-bg-subtle);
.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;
.sticky-submit {
position: sticky;
}

// Bootstrap introduces -10px left/right margin for row classes. This causes element to overflow parent.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,6 @@
@zindex-formplayer-progress: 990;
@zindex-cloudcare-debugger: 1005;
@zindex-formplayer-scroll-to-bottom: 5;
@zindex-formplayer-anchored-submit: 2;


@input-border-radius-large: 5px;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,6 @@ $zindex-persistent-tile-cloudcare: 993;
$zindex-formplayer-progress: 990;
$zindex-cloudcare-debugger: 1005;
$zindex-formplayer-scroll-to-bottom: 5;
$zindex-formplayer-anchored-submit: 2;
$zindex-select2-results: 1056; // higher than $zindex-modal so select2s can be used in modals

$cursor-disabled: 'not-allowed';
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,12 @@
</div>
</div>
{% endif %}
- <div id="submit-button" class="form-actions form-group noprint-sub-container" data-bind="visible: showSubmitButton">
+ <div id="submit-button" class="form-actions form-group noprint-sub-container" data-bind="visible: showSubmitButton"> {# todo B5: css:form-group #}
<div data-bind="
css: submitClass,
style: {
@@ -69,10 +69,10 @@
- <div id="submit-button" class="form-actions form-group noprint-sub-container"
+ <div id="submit-button" class="form-actions form-group noprint-sub-container" {# todo B5: css:form-group #}
data-bind="
visible: showSubmitButton,
css: { 'sticky-submit': isAnchoredSubmitStyle },
@@ -67,10 +67,10 @@
{% if environment == "web-apps" %}
{% if request|ui_notify_enabled:"JUMP_TO_INVALID_QUESTIONS_WEBAPPS" %}
<div class="alert alert-ui-notify alert-dismissible helpbubble helpbubble-purple helpbubble-bottom-left fade in"
Expand All @@ -40,7 +40,7 @@
<span aria-hidden="true">&times;</span>
</button>
<p class="lead">{% trans 'Navigate Across Required Questions' %}</p>
@@ -87,7 +87,7 @@
@@ -85,7 +85,7 @@
</div>
{% endif %}
{% endif %}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
---
+++
@@ -28,7 +28,7 @@
margin-right: -@form-text-indent;
}

- background-color: @call-to-action-extra-hi;
+ background-color: var(--bsprimary-bg-subtle);
.border-bottom-radius(0);

.submit .btn {
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
+++
@@ -1,124 +1,225 @@
@@ -1,123 +1,225 @@
-@import "@{b3-import-variables}";
-
-// Nunito Sans is used on dimagi.com and embedded in hqwebapp/base.html
Expand Down Expand Up @@ -198,7 +198,6 @@
-@zindex-formplayer-progress: 990;
-@zindex-cloudcare-debugger: 1005;
-@zindex-formplayer-scroll-to-bottom: 5;
-@zindex-formplayer-anchored-submit: 2;
-
-
-@input-border-radius-large: 5px;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
+++
@@ -1,124 +1,70 @@
@@ -1,123 +1,69 @@
-@import "@{b3-import-variables}";
+/*
+These are Boostrap 3 variables that were carried over in the
Expand Down Expand Up @@ -161,7 +161,6 @@
-@zindex-formplayer-progress: 990;
-@zindex-cloudcare-debugger: 1005;
-@zindex-formplayer-scroll-to-bottom: 5;
-@zindex-formplayer-anchored-submit: 2;
+$zindex-navbar: 1000;
+$zindex-report-loading: 100;
+$zindex-app-preview: 998;
Expand All @@ -170,7 +169,6 @@
+$zindex-formplayer-progress: 990;
+$zindex-cloudcare-debugger: 1005;
+$zindex-formplayer-scroll-to-bottom: 5;
+$zindex-formplayer-anchored-submit: 2;
+$zindex-select2-results: 1056; // higher than $zindex-modal so select2s can be used in modals

-
Expand Down
Loading