diff --git a/app/assets/javascripts/colourPreview.js b/app/assets/javascripts/colourPreview.js index da9546ba7..58f975e4f 100644 --- a/app/assets/javascripts/colourPreview.js +++ b/app/assets/javascripts/colourPreview.js @@ -9,7 +9,10 @@ this.start = component => { this.$input = $('input', component); - this.$preview = $('.textbox-colour-preview', component); + + $(component).append( + this.$preview = $('') + ); this.$input .on('change keyup', this.update) diff --git a/app/templates/components/textbox.html b/app/templates/components/textbox.html index e723b9a41..fc14d6dc4 100644 --- a/app/templates/components/textbox.html +++ b/app/templates/components/textbox.html @@ -4,6 +4,7 @@ hint=False, highlight_tags=False, autofocus=False, + colour_preview=False, help_link=None, help_link_text=None, width='2-3', @@ -11,7 +12,10 @@ safe_error_message=False, rows=8 ) %} -
+
{% endmacro %} - -{% macro colour_textbox( - field, - width='2-3' -) %} -
- - {% set field_class = 'form-control-{} {}'.format(width, 'textbox-right-aligned' if suffix else '') %} - {% set field_class = 'form-control ' + field_class + (' form-control-error' if field.errors else '') %} - {{ field( - class=field_class, - data_module='', - rows='1', - **kwargs - ) }} - -
-{% endmacro %} diff --git a/app/templates/views/email-branding/manage-branding.html b/app/templates/views/email-branding/manage-branding.html index f191d2a2d..26d219fa3 100644 --- a/app/templates/views/email-branding/manage-branding.html +++ b/app/templates/views/email-branding/manage-branding.html @@ -1,7 +1,7 @@ {% extends "views/platform-admin/_base_template.html" %} {% from "components/file-upload.html" import file_upload %} {% from "components/page-footer.html" import page_footer %} -{% from "components/textbox.html" import textbox, colour_textbox %} +{% from "components/textbox.html" import textbox %} {% block service_page_title %} {{ '{} email branding'.format('Update' if email_branding else 'Create')}} @@ -22,9 +22,9 @@
{{textbox(form.name)}}
{{textbox(form.text)}}
- {{colour_textbox(form.colour, width='1-4', colour=email_branding.colour if email_branding)}} - {{colour_textbox(form.banner_colour, width='1-4', colour=email_branding.banner_colour if email_branding)}} - {{colour_textbox(form.single_id_colour, width='1-4', colour=email_branding.single_id_colour if email_branding)}} + {{ textbox(form.colour, width='1-4', colour_preview=True) }} + {{ textbox(form.banner_colour, width='1-4', colour_preview=True) }} + {{ textbox(form.single_id_colour, width='1-4', colour_preview=True) }}
{{textbox(form.domain)}}
{{ page_footer( 'Save', diff --git a/app/templates/views/organisations/organisation/settings/edit-name/index.html b/app/templates/views/organisations/organisation/settings/edit-name/index.html index 2c3df4084..1e710f166 100644 --- a/app/templates/views/organisations/organisation/settings/edit-name/index.html +++ b/app/templates/views/organisations/organisation/settings/edit-name/index.html @@ -1,6 +1,6 @@ {% extends "org_template.html" %} {% from "components/page-footer.html" import page_footer %} -{% from "components/textbox.html" import textbox, colour_textbox %} +{% from "components/textbox.html" import textbox %} {% block org_page_title %} Change organisation name