Skip to content

Commit 57d6c37

Browse files
committed
Merge pull request #139 from formio/FIO-10462
FIO-10462: updated circle-remove to circle-xmark for font-awesome icons
1 parent d425165 commit 57d6c37

10 files changed

Lines changed: 36 additions & 11 deletions

File tree

Changelog.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@ All notable changes to this project will be documented in this file
44
The format is based on [Keep a Changelog](http://keepachangelog.com/)
55
and this project adheres to [Semantic Versioning](http://semver.org/).
66

7+
## [Unreleased: 3.0.2-rc.6]
8+
### Changed
9+
- Re-implement fallback
10+
711
## 3.0.2-rc.5
812
### Changed
913
- Revert fallback

src/templates/bootstrap3/datagrid/form.ejs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@
5050
{% if (ctx.hasRemoveButtons) { %}
5151
<td class="col-md-1">
5252
<button type="button" class="btn btn-default formio-button-remove-row" ref="{{ctx.datagridKey}}-removeRow">
53-
<i class="{{ctx.iconClass('circle-xmark')}}"></i>
53+
<i class="{{ctx.iconClass('remove-circle')}}"></i>
5454
</button>
5555
</td>
5656
{% } %}

src/templates/bootstrap3/iconClass.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ export default (iconset, name, spinning) => {
1313
case 'question-sign':
1414
name = 'question-circle';
1515
break;
16-
case 'circle-xmark':
16+
case 'remove-circle':
1717
name = 'times-circle-o';
1818
break;
1919
case 'new-window':

src/templates/bootstrap3/multiValueRow/form.ejs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
{% if (!ctx.disabled) { %}
66
<td>
77
<button type="button" class="btn btn-default" ref="removeRow">
8-
<i class="{{ctx.iconClass('circle-xmark')}}"></i>
8+
<i class="{{ctx.iconClass('remove-circle')}}"></i>
99
</button>
1010
</td>
1111
{% } %}

src/templates/bootstrap4/datagrid/form.ejs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@
5151
{% if (ctx.hasRemoveButtons) { %}
5252
<td class="col-1">
5353
<button type="button" class="btn btn-secondary formio-button-remove-row" ref="{{ctx.datagridKey}}-removeRow" tabindex="{{ctx.tabIndex}}" aria-label="{{ctx.t('remove')}}">
54-
<i class="{{ctx.iconClass('circle-xmark')}}"></i>
54+
<i class="{{ctx.iconClass('remove-circle')}}"></i>
5555
</button>
5656
</td>
5757
{% } %}

src/templates/bootstrap4/iconClass.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ export default (iconset, name, spinning) => {
1313
case 'question-sign':
1414
name = 'question-circle';
1515
break;
16-
case 'circle-xmark':
16+
case 'remove-circle':
1717
name = 'times-circle-o';
1818
break;
1919
case 'new-window':

src/templates/bootstrap4/multiValueRow/form.ejs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
{% if (!ctx.disabled) { %}
66
<td>
77
<button type="button" class="btn btn-secondary" ref="removeRow">
8-
<i class="{{ctx.iconClass('circle-xmark')}}"></i>
8+
<i class="{{ctx.iconClass('remove-circle')}}"></i>
99
</button>
1010
</td>
1111
{% } %}

src/templates/bootstrap5/datagrid/form.ejs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@
5151
{% if (ctx.hasRemoveButtons) { %}
5252
<td class="col-1">
5353
<button type="button" class="btn btn-secondary formio-button-remove-row" ref="{{ctx.datagridKey}}-removeRow" tabindex="{{ctx.tabIndex}}" aria-label="{{ctx.t('remove')}}">
54-
<i class="{{ctx.iconClass('circle-xmark')}}"></i>
54+
<i class="{{ctx.iconClass('remove-circle')}}"></i>
5555
</button>
5656
</td>
5757
{% } %}

src/templates/bootstrap5/iconClass.ts

Lines changed: 24 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
export default (iconset, name, spinning) => {
1+
type iconset = 'bi' | 'fa';
2+
3+
export default (iconset: iconset, name: string, spinning: boolean) => {
24
let biName = name;
35
switch (name) {
46
case 'cog':
@@ -107,7 +109,8 @@ export default (iconset, name, spinning) => {
107109
name = 'question-circle';
108110
biName = 'question-circle';
109111
break;
110-
case 'circle-xmark':
112+
case 'remove-circle':
113+
name = 'circle-xmark';
111114
biName = 'x-circle';
112115
break;
113116
case 'new-window':
@@ -164,5 +167,23 @@ export default (iconset, name, spinning) => {
164167
biName = 'arrow-clockwise';
165168
break;
166169
}
167-
return spinning ? 'spinner-border spinner-border-sm' : `${iconset} ${iconset}-${name}`;
170+
171+
function generateIconClass() {
172+
if (spinning){
173+
return 'spinner-border spinner-border-sm';
174+
}
175+
const iconName = iconset === 'bi' ? biName : name;
176+
// Handles legacy icons names. For example, fa-remove-circle was changed to fa-circle-xmark in a major version
177+
// update of font-awesome. To handle cases where customers are still on a very old version of font-awesome add
178+
// a fallback if statement to handle such cases
179+
function handleLegacyIconNames() {
180+
if (iconset === 'fa' && name === 'circle-xmark'){
181+
return `${iconset}-${name} ${iconset}-remove-circle`
182+
}
183+
return `${iconset}-${iconName}`;
184+
}
185+
186+
return `${iconset} ${handleLegacyIconNames()}`
187+
}
188+
return generateIconClass();
168189
};

src/templates/bootstrap5/multiValueRow/form.ejs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
{% if (!ctx.disabled) { %}
66
<td>
77
<button type="button" class="btn btn-secondary" ref="removeRow">
8-
<i class="{{ctx.iconClass('circle-xmark')}}"></i>
8+
<i class="{{ctx.iconClass('remove-circle')}}"></i>
99
</button>
1010
</td>
1111
{% } %}

0 commit comments

Comments
 (0)