diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index e6ad47db..47f9ff29 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -111,6 +111,7 @@ In a separate terminal, run the tests: ```bash cd tests/end-to-end npm install +npx playwright install chromium npm run test ``` diff --git a/examples/official-site/sqlpage/migrations/73_form_buttons_icons.sql b/examples/official-site/sqlpage/migrations/73_form_buttons_icons.sql new file mode 100644 index 00000000..889327fa --- /dev/null +++ b/examples/official-site/sqlpage/migrations/73_form_buttons_icons.sql @@ -0,0 +1,7 @@ +INSERT INTO parameter(component, name, description, type, top_level, optional) SELECT 'form', * FROM (VALUES + -- top level + ('validate_icon', 'Name of an icon to be displayed on the left side of the submit button.', 'ICON', TRUE, TRUE), + ('reset_icon', 'Name of an icon to be displayed on the left side of the reset button.', 'ICON', TRUE, TRUE), + ('reset_color', 'The color of the button at the bottom of the form that resets the form to its original state. Omit this property to use the default color.', 'COLOR', TRUE, TRUE) + ) + diff --git a/sqlpage/templates/form.handlebars b/sqlpage/templates/form.handlebars index fdaaed7b..a7d4c4b1 100644 --- a/sqlpage/templates/form.handlebars +++ b/sqlpage/templates/form.handlebars @@ -163,23 +163,32 @@ {{/each_row}} {{#if (and (ne validate '') (not auto_submit))}} - + type="submit"> + {{~#if validate_icon~}} + {{~icon_img validate_icon~}} + {{~/if~}} + {{#if validate}}{{validate}}{{else}}Submit Query{{/if}} + + {{/if}} {{#if reset}} - + type="reset"> + {{~#if reset_icon~}} + {{~icon_img reset_icon~}} + {{~/if~}} + {{reset}} + {{/if}}