Skip to content

Commit e37e69c

Browse files
committed
Replaced the angular fonticon picker with react in custom buttons
1 parent 3e5d098 commit e37e69c

File tree

3 files changed

+6
-37
lines changed

3 files changed

+6
-37
lines changed

app/javascript/components/fonticon-picker/index.jsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,10 +77,10 @@ const FontIconPicker = ({ iconTypes, selected, onChangeURL }) => {
7777
onClick={onModalApply}
7878
disabled={selectedIcon === activeIcon || activeIcon === undefined}
7979
>
80-
Apply
80+
{ __('Apply') }
8181
</Button>
8282
<Button id="cancel-icon-picker-modal" bsStyle="default" className="btn-cancel" onClick={hideModal}>
83-
Cancel
83+
{ __('Cancel') }
8484
</Button>
8585
</Modal.Footer>
8686
</Modal>

app/views/shared/buttons/_ab_options_form.html.haml

Lines changed: 2 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -45,11 +45,8 @@
4545
.form-group
4646
%label.control-label.col-md-2
4747
= _('Icon')
48-
.col-md-8#button-icon-picker{'ng-controller' => 'fonticonPickerController as vm'}
49-
%miq-fonticon-picker{'input-name' => 'button_icon', :selected => @edit[:new][:button_icon], 'icon-changed' => 'vm.select(selected);'}
50-
%miq-fonticon-family{:selector => 'ff', :title => 'Font Fabulous'}
51-
%miq-fonticon-family{:selector => 'pficon', :title => 'PatternFly'}
52-
%miq-fonticon-family{:selector => 'fa', :title => 'Font Awesome'}
48+
.col-md-8#button-icon-picker
49+
= react 'FonticonPicker', :selected => @edit[:new][:button_icon], :onChangeURL => url
5350
.form-group
5451
%label.control-label.col-md-2
5552
= _('Icon Color')
@@ -102,15 +99,3 @@
10299
miqSelectPickerEvent('dialog_id', '#{url}');
103100
miqSelectPickerEvent('display_for', '#{url}');
104101
miqSelectPickerEvent('submit_how', '#{url}');
105-
miq_bootstrap('#button-icon-picker');
106-
107-
// This is an ugly hack to be able to use this component in a non-angular context with miq-observe
108-
// FIXME: Remove this when the form is converted to angular
109-
$(function() {
110-
$('#button-icon-picker input[type="hidden"]').on('change', _.debounce(function() {
111-
miqObserveRequest('#{url}', {
112-
no_encoding: true,
113-
data: 'button_icon' + '=' + $(this).val(),
114-
});
115-
}, 700, {leading: true, trailing: true}));
116-
});

app/views/shared/buttons/_group_form.html.haml

Lines changed: 2 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -31,11 +31,8 @@
3131
.form-group
3232
%label.control-label.col-md-2
3333
= _('Icon')
34-
.col-md-8#button-icon-picker{'ng-controller' => 'fonticonPickerController as vm'}
35-
%miq-fonticon-picker{'input-name' => 'button_icon', :selected => @edit[:new][:button_icon], 'icon-changed' => 'vm.select(selected);'}
36-
%miq-fonticon-family{:selector => 'ff', :title => 'Font Fabulous'}
37-
%miq-fonticon-family{:selector => 'pficon', :title => 'PatternFly'}
38-
%miq-fonticon-family{:selector => 'fa', :title => 'Font Awesome'}
34+
.col-md-8#button-icon-picker
35+
= react 'FonticonPicker', :selected => @edit[:new][:button_icon], :onChangeURL => url
3936
.form-group
4037
%label.control-label.col-md-2
4138
= _('Icon Color')
@@ -51,16 +48,3 @@
5148
%h3
5249
= _('Assign Buttons')
5350
= render :partial => "shared/buttons/column_lists"
54-
55-
:javascript
56-
miq_bootstrap('#button-icon-picker');
57-
// This is an ugly hack to be able to use this component in a non-angular context with miq-observe
58-
// FIXME: Remove this when the form is converted to angular
59-
$(function() {
60-
$('#button-icon-picker input[type="hidden"]').on('change', _.debounce(function() {
61-
miqObserveRequest('#{url}', {
62-
no_encoding: true,
63-
data: 'button_icon' + '=' + $(this).val(),
64-
});
65-
}, 700, {leading: true, trailing: true}));
66-
});

0 commit comments

Comments
 (0)