Skip to content

Commit

Permalink
widget_famultibutton: Added data-warn-icon
Browse files Browse the repository at this point in the history
  • Loading branch information
knowthelist committed Aug 14, 2018
1 parent d9d043e commit 71095cb
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGED
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
FHEM Tablet UI last change:
2018-08-14
- widget_weather: Fixed Proplanta Umlaute issue
- widget_famultibutton: Added data-warn-icon
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,7 @@ General attribute meaning
- **data-warn-off** : value(s) that hide the warn badge (default 'false|off|0')
- **data-warn-color** : forecolor for warn badge (default '#aaa')
- **data-warn-background-color** : background color for warn badge (default '#aa2200')
- **data-warn-icon** : name of the font-awesome icon to be shown instead of the warn text. (default: '')
- **data-hide** : name of the reading to hide/show the widget (default 'STATE')
- **data-hide-on** : value for HIDE (default 'true|1|on')
- **data-hide-off** : value for SHOW (default '!on')
Expand Down
2 changes: 1 addition & 1 deletion controls_fhemtabletui.txt
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ UPD 2018-01-13_21:05:02 6777 www/tablet/js/widget_departure.js
UPD 2018-03-20_14:38:04 6100 www/tablet/js/widget_dimmer.js
UPD 2017-02-11_14:27:26 3298 www/tablet/js/widget_eventmonitor.js
UPD 2018-01-21_14:51:58 2931 www/tablet/js/widget_example.js
UPD 2018-03-28_23:38:44 24824 www/tablet/js/widget_famultibutton.js
UPD 2018-08-14_01:44:16 25181 www/tablet/js/widget_famultibutton.js
UPD 2017-11-16_18:41:57 5018 www/tablet/js/widget_filelog.js
UPD 2018-01-21_14:53:01 8691 www/tablet/js/widget_fullcalview.js
UPD 2018-01-21_14:52:43 5415 www/tablet/js/widget_gds.js
Expand Down
9 changes: 9 additions & 0 deletions www/tablet/js/widget_famultibutton.js
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,9 @@ var Modul_famultibutton = function () {
elem.find('#warn').remove();
if (ftui.isValid(value) && value !== "") {
var val = ($.isNumeric(value)) ? Number(value).toFixed(0) : '!';
if (elem.isValidData('warn-icon')) {
val = '<i class="fa ' + elem.data('warn-icon') + '"><i/>';
}
var digits = val.toString().length;
var faElem = elem.find('.famultibutton');
var warnElem = $('<i/>', {
Expand Down Expand Up @@ -314,6 +317,9 @@ var Modul_famultibutton = function () {
} else if (elem.attr('data-fhem-cmd')) {
target = elem.attr('data-fhem-cmd');
type = 'fhem-cmd';
} else if (elem.attr('data-js-cmd')) {
target = elem.attr('data-js-cmd');
type = 'js-cmd';
} else {
var sets = elem.data('set-states') || elem.data('set-' + onoff);
// no value given means don't send it and keep current state
Expand Down Expand Up @@ -372,6 +378,9 @@ var Modul_famultibutton = function () {
}
$.get(target);
break;
case 'js-cmd':
eval(target);
break;
case 'fhem-cmd':
if (device && typeof device != "undefined" && device !== " ") {
ftui.toast(target);
Expand Down

0 comments on commit 71095cb

Please sign in to comment.