Skip to content

Commit 2840e1a

Browse files
authored
add form buttons icons, closes #821 (#1210)
1 parent 198ff6d commit 2840e1a

File tree

3 files changed

+23
-6
lines changed

3 files changed

+23
-6
lines changed

CONTRIBUTING.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,7 @@ In a separate terminal, run the tests:
111111
```bash
112112
cd tests/end-to-end
113113
npm install
114+
npx playwright install chromium
114115
npm run test
115116
```
116117

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
INSERT INTO parameter(component, name, description, type, top_level, optional) SELECT 'form', * FROM (VALUES
2+
-- top level
3+
('validate_icon', 'Name of an icon to be displayed on the left side of the submit button.', 'ICON', TRUE, TRUE),
4+
('reset_icon', 'Name of an icon to be displayed on the left side of the reset button.', 'ICON', TRUE, TRUE),
5+
('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)
6+
)
7+

sqlpage/templates/form.handlebars

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -163,23 +163,32 @@
163163
{{/each_row}}
164164
</div>
165165
{{#if (and (ne validate '') (not auto_submit))}}
166-
<input class="btn
166+
<button class="btn
167167
btn-{{default validate_color "primary"}}
168168
{{#if validate_shape}} btn-{{validate_shape}} {{/if}}
169169
{{#if validate_outline}} btn-outline-{{validate_outline}} {{/if}}
170170
{{#if validate_size}} btn-{{validate_size}} {{/if}}"
171171
{{flush_delayed}}
172-
type="submit"
173-
{{#if validate}}value="{{validate}}"{{/if}}>
172+
type="submit">
173+
{{~#if validate_icon~}}
174+
<span {{~#if (not narrow)}} class="me-1"{{/if}}>{{~icon_img validate_icon~}}</span>
175+
{{~/if~}}
176+
<span>{{#if validate}}{{validate}}{{else}}Submit Query{{/if}}</span>
177+
</button>
178+
174179
{{/if}}
175180
{{#if reset}}
176-
<input class="btn
181+
<button class="btn
177182
{{#if reset_color}} btn-{{reset_color}} {{/if}}
178183
{{#if reset_shape}} btn-{{reset_shape}} {{/if}}
179184
{{#if reset_outline}} btn-outline-{{reset_outline}} {{/if}}
180185
{{#if reset_size}} btn-{{reset_size}} {{/if}}"
181-
type="reset"
182-
value="{{reset}}">
186+
type="reset">
187+
{{~#if reset_icon~}}
188+
<span {{~#if (not narrow)}} class="me-1"{{/if}}>{{~icon_img reset_icon~}}</span>
189+
{{~/if~}}
190+
<span>{{reset}}</span>
191+
</button>
183192
{{/if}}
184193
</fieldset>
185194
</form>

0 commit comments

Comments
 (0)