forked from ManageIQ/manageiq-ui-classic
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use the fonticon picker component to pick custom button icons
- Loading branch information
Showing
4 changed files
with
56 additions
and
10 deletions.
There are no files selected for viewing
3 changes: 3 additions & 0 deletions
3
app/assets/javascripts/angular_modules/module_fonticon_picker.js
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 |
---|---|---|
@@ -0,0 +1,3 @@ | ||
miqHttpInject( | ||
angular.module('ManageIQ.fonticonPicker', ['miqStaticAssets.fonticonPicker']) | ||
); |
18 changes: 18 additions & 0 deletions
18
app/assets/javascripts/controllers/fonticon_picker_controller.js
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 |
---|---|---|
@@ -0,0 +1,18 @@ | ||
/* global add_flash */ | ||
(function() { | ||
var CONTROLLER_NAME = 'fonticonPickerController'; | ||
|
||
var FonticonPickerController = function($element) { | ||
var vm = this; | ||
// This is an ugly hack to be able to use this component in a non-angular context with miq-observe | ||
// FIXME: Remove this when the form is converted to angular | ||
var hidden = $($element[0]).find('input[type="hidden"]'); | ||
vm.select = function(icon) { | ||
hidden.val(icon); | ||
hidden.trigger('change'); | ||
}; | ||
}; | ||
|
||
FonticonPickerController.$inject = ['$element']; | ||
window.miqHttpInject(angular.module('ManageIQ.fonticonPicker')).controller(CONTROLLER_NAME, FonticonPickerController); | ||
})(); |
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