Merge pull request #2658 from alphagov/sticky-footer-edit

Use sticky footer on edit template page
This commit is contained in:
Chris Hill-Scott
2019-01-16 11:26:53 +00:00
committed by GitHub
5 changed files with 26 additions and 12 deletions

View File

@@ -32,12 +32,20 @@
}; };
this.resize = () => this.$textbox.height( this.resize = () => {
Math.max(
this.initialHeight, this.$textbox.height(
this.$background.outerHeight() Math.max(
) this.initialHeight,
); this.$background.outerHeight()
)
);
if ('stickAtBottomWhenScrolling' in GOVUK) {
GOVUK.stickAtBottomWhenScrolling.recalculate();
}
};
this.escapedMessage = () => $('<div/>').text(this.$textbox.val()).html(); this.escapedMessage = () => $('<div/>').text(this.$textbox.val()).html();

View File

@@ -35,3 +35,9 @@
{% endif %} {% endif %}
</div> </div>
{% endmacro %} {% endmacro %}
{% macro sticky_page_footer(button_text=None) %}
<div class="js-stick-at-bottom-when-scrolling">
{{ page_footer(button_text) }}
</div>
{% endmacro %}

View File

@@ -1,6 +1,6 @@
{% extends "withnav_template.html" %} {% extends "withnav_template.html" %}
{% from "components/textbox.html" import textbox %} {% from "components/textbox.html" import textbox %}
{% from "components/page-footer.html" import page_footer %} {% from "components/page-footer.html" import sticky_page_footer %}
{% from "components/radios.html" import radios %} {% from "components/radios.html" import radios %}
{% from "components/form.html" import form_wrapper %} {% from "components/form.html" import form_wrapper %}
@@ -23,7 +23,7 @@
{% if current_user.platform_admin %} {% if current_user.platform_admin %}
{{ radios(form.process_type) }} {{ radios(form.process_type) }}
{% endif %} {% endif %}
{{ page_footer( {{ sticky_page_footer(
'Save' 'Save'
) }} ) }}
</div> </div>

View File

@@ -1,6 +1,6 @@
{% extends "withnav_template.html" %} {% extends "withnav_template.html" %}
{% from "components/textbox.html" import textbox %} {% from "components/textbox.html" import textbox %}
{% from "components/page-footer.html" import page_footer %} {% from "components/page-footer.html" import sticky_page_footer %}
{% from "components/radios.html" import radios %} {% from "components/radios.html" import radios %}
{% from "components/form.html" import form_wrapper %} {% from "components/form.html" import form_wrapper %}
@@ -23,7 +23,7 @@
{% endif %} {% endif %}
{{ textbox(form.subject, width='1-1', highlight_tags=True, rows=2) }} {{ textbox(form.subject, width='1-1', highlight_tags=True, rows=2) }}
{{ textbox(form.template_content, highlight_tags=True, width='1-1', rows=8) }} {{ textbox(form.template_content, highlight_tags=True, width='1-1', rows=8) }}
{{ page_footer( {{ sticky_page_footer(
'Save' 'Save'
) }} ) }}
</div> </div>

View File

@@ -1,6 +1,6 @@
{% extends "withnav_template.html" %} {% extends "withnav_template.html" %}
{% from "components/textbox.html" import textbox %} {% from "components/textbox.html" import textbox %}
{% from "components/page-footer.html" import page_footer %} {% from "components/page-footer.html" import sticky_page_footer %}
{% from "components/radios.html" import radios %} {% from "components/radios.html" import radios %}
{% from "components/form.html" import form_wrapper %} {% from "components/form.html" import form_wrapper %}
@@ -24,7 +24,7 @@
{% if current_user.platform_admin %} {% if current_user.platform_admin %}
{{ radios(form.process_type) }} {{ radios(form.process_type) }}
{% endif %} {% endif %}
{{ page_footer( {{ sticky_page_footer(
'Save' 'Save'
) }} ) }}
</div> </div>