Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add new widget PR 2864 #2865

Open
wants to merge 2 commits into
base: alpha
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 40 additions & 0 deletions core/template/dashboard/cmd.info.string.badge.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
<div class="cmd cmd-widget #history#" data-type="info" data-subtype="string" data-template="badge" data-cmd_id="#id#" data-cmd_uid="#uid#" data-version="#version#" data-eqLogic_id="#eqLogic_id#">
<div class="title #hide_name#">
<div class="cmdName">#name_display#</div>
</div>
<div class="content">
<div class="label label-info state"><span class="value"></span></div>
</div>
<div class="timeCmd label label-default #history#" data-type="info"></div>
<template>
<div>color : rgb(20,20,20) ({{Couleur de fond}})</div>
<div>fontcolor : rgb(20,20,20) ({{Couleur du texte}})</div>
<div>time : duration|date ({{Affiche durée ou date de la valeur}})</div>
</template>
<script>
jeedom.cmd.addUpdateFunction('#id#', function(_options) {
if (is_object(cmd = document.querySelector('.cmd[data-cmd_uid="#uid#"]'))) {
cmd.querySelector('.content').setAttribute('title', '{{Date de valeur}}: ' + _options.valueDate + '<br>{{Date de collecte}}: ' + _options.collectDate)
if ('#time#' == 'duration' || '#time#' == 'date') {
jeedom.cmd.displayDuration(_options.valueDate, cmd.querySelector('.timeCmd'), '#time#')
}
cmd.querySelector('.value').innerHTML = _options.display_value
if (_options.alertLevel == 'warning') {
cmd.querySelector('.value').innerHTML = '<span class="label label-warning"><i class="fas fa-bell"></i> ' + _options.value + '</span>'
} else if (_options.alertLevel == 'danger') {
cmd.querySelector('.value').innerHTML = '<span class="label label-danger"><i class="fas fa-exclamation"></i> ' + _options.value + '</span>'
}
}
})

jeedom.cmd.refreshValue([{ cmd_id: '#id#', value: '#value#', display_value: '#state#', valueDate: '#valueDate#', collectDate: '#collectDate#', alertLevel: '#alertLevel#', unit: '#unite#' }])

if (domUtils.issetWidgetOptParam('#color#', 'color')) {
document.querySelector('.cmd[data-cmd_uid="#uid#"] .label').style.setProperty('background-color', '#color#', 'important')
}
if (domUtils.issetWidgetOptParam('#fontcolor#', 'fontcolor')) {
document.querySelector('.cmd[data-cmd_uid="#uid#"] .label').style.setProperty('color', '#fontcolor#', 'important')
}
</script>
</div>

8 changes: 8 additions & 0 deletions core/template/mobile/cmd.info.string.badge.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<span class="cmd cmd-widget" data-type="info" data-subtype="string" data-template="badge" data-version="#version#" data-eqLogic_id="#eqLogic_id#" data-cmd_id="#id#" data-cmd_uid="#uid#">
<span class='ui-bar ui-bar-a state label-info'>#state#</span>
<script>
jeedom.cmd.addUpdateFunction('#id#',function(_options) {
$('.cmd[data-cmd_id=#id#] .state').empty().append(_options.display_value)
});
</script>
</span>
1 change: 1 addition & 0 deletions docs/fr_FR/changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@
- Suppression du dossier vendor (utilisation de composer de maniere normal), permet de reduire la taille du core [LIEN](https://github.com/jeedom/core/commit/3aa99c503b6b1903e6a07b346ceb4d03ca3c0c42)
- Les parametres spécifique des widgets peuvent maintent etre traduit [LIEN](https://github.com/jeedom/core/pull/2862)
- Correction d'un bug sous mac sur les designs lors d'un clic droit [LIEN](https://github.com/jeedom/core/issues/2863)
- Ajout de widget badge pour les commandes de type texte [LIEN](https://github.com/jeedom/core/issues/2864)

>**IMPORTANT**
>
Expand Down
Loading