-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
♻️ [#454] Remove custom hardcoded styles for add-button
Instead, style the edit grid to be display flex (column) and make gap customizable.
- Loading branch information
1 parent
cd6eeae
commit 9d260fc
Showing
3 changed files
with
50 additions
and
55 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,55 +1,57 @@ | ||
<div class="openforms-editgrid"> | ||
{% ctx.rows.forEach(function(row, rowIndex) { %} | ||
<div class="utrecht-form-fieldset openforms-editgrid__item" ref="{{ctx.ref.row}}"> | ||
<fieldset class="utrecht-form-fieldset__fieldset utrecht-form-fieldset--html-fieldset"> | ||
{% if (!!ctx.component.groupLabel) { %} | ||
<legend class="utrecht-form-fieldset__legend utrecht-form-fieldset__legend--html-legend openforms-editgrid__item-heading"> | ||
{{ ctx.t(ctx.component.groupLabel, { _userInput: true }) }} {{ rowIndex + 1 }} | ||
</legend> | ||
{% } %} | ||
|
||
<div>{{row}}</div> | ||
|
||
{% if (ctx.openRows[rowIndex] && !ctx.readOnly) { %} | ||
<p class="utrecht-button-group utrecht-button-group--openforms-editgrid" role="group"> | ||
|
||
<button | ||
class="openforms-button openforms-button--primary utrecht-button utrecht-button--html-button utrecht-button--primary-action" | ||
ref="{{ctx.ref.saveRow}}" | ||
> | ||
{{ctx.t(ctx.component.saveRow || 'Save', { _userInput: true })}} | ||
</button> | ||
|
||
{% if (ctx.component.removeRow) { %} | ||
<div> | ||
{% ctx.rows.forEach(function(row, rowIndex) { %} | ||
<div class="utrecht-form-fieldset openforms-editgrid__item" ref="{{ctx.ref.row}}"> | ||
<fieldset class="utrecht-form-fieldset__fieldset utrecht-form-fieldset--html-fieldset"> | ||
{% if (!!ctx.component.groupLabel) { %} | ||
<legend class="utrecht-form-fieldset__legend utrecht-form-fieldset__legend--html-legend openforms-editgrid__item-heading"> | ||
{{ ctx.t(ctx.component.groupLabel, { _userInput: true }) }} {{ rowIndex + 1 }} | ||
</legend> | ||
{% } %} | ||
|
||
<div>{{row}}</div> | ||
|
||
{% if (ctx.openRows[rowIndex] && !ctx.readOnly) { %} | ||
<p class="utrecht-button-group utrecht-button-group--openforms-editgrid" role="group"> | ||
|
||
<button | ||
class="openforms-button openforms-button--danger utrecht-button utrecht-button--html-button utrecht-button--secondary-action utrecht-button--danger" | ||
ref="{{ctx.ref.cancelRow}}" | ||
class="openforms-button openforms-button--primary utrecht-button utrecht-button--html-button utrecht-button--primary-action" | ||
ref="{{ctx.ref.saveRow}}" | ||
> | ||
{{ctx.t(ctx.component.removeRow || 'Cancel', { _userInput: true })}} | ||
{{ctx.t(ctx.component.saveRow || 'Save', { _userInput: true })}} | ||
</button> | ||
{% } %} | ||
</p> | ||
{% } %} | ||
|
||
<!-- Formio needs a div with class="has-error" with inside a div with class="editgrid-row-error" --> | ||
<div class="openforms-errors has-error"> | ||
<div class="editgrid-row-error">{{ctx.errors[rowIndex]}}</div> | ||
</div> | ||
{% if (ctx.component.removeRow) { %} | ||
<button | ||
class="openforms-button openforms-button--danger utrecht-button utrecht-button--html-button utrecht-button--secondary-action utrecht-button--danger" | ||
ref="{{ctx.ref.cancelRow}}" | ||
> | ||
{{ctx.t(ctx.component.removeRow || 'Cancel', { _userInput: true })}} | ||
</button> | ||
{% } %} | ||
</p> | ||
{% } %} | ||
|
||
<!-- Formio needs a div with class="has-error" with inside a div with class="editgrid-row-error" --> | ||
<div class="openforms-errors has-error"> | ||
<div class="editgrid-row-error">{{ctx.errors[rowIndex]}}</div> | ||
</div> | ||
|
||
</fieldset> | ||
</div> | ||
</fieldset> | ||
</div> | ||
|
||
{% }) %} | ||
{% }) %} | ||
</div> | ||
|
||
{% if (!ctx.readOnly && ctx.hasAddButton) { %} | ||
<div class="openforms-editgrid__add-button"> | ||
<p class="utrecht-button-group"> | ||
<button | ||
class="openforms-button openforms-button--primary utrecht-button utrecht-button--html-button utrecht-button--primary-action" | ||
ref="{{ctx.ref.addRow}}" | ||
> | ||
<i class="{{ctx.iconClass('plus')}}"></i> | ||
{{ctx.t(ctx.component.addAnother || 'Add Another', { _userInput: true })}} | ||
</button> | ||
</div> | ||
</p> | ||
{% } %} | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters