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

Fix select on widget page on first display #3044

Open
wants to merge 1 commit into
base: alpha
Choose a base branch
from
Open
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
4 changes: 3 additions & 1 deletion desktop/php/widgets.php
Original file line number Diff line number Diff line change
@@ -170,11 +170,13 @@ function jeedom_displayWidgetGroup($_type, $_widgets) {
<label class="col-lg-4 col-xs-4 control-label">{{Template}}</label>
<div class="col-lg-4 col-xs-5">
<?php
$selected = 'selected'; // Ajoute selected uniquement pour le premier élément
foreach ((widgets::listTemplate()) as $type => $values) {
foreach ($values as $subtype => $namelist) {
echo '<select class="form-control selectWidgetTemplate" data-l1key="template" data-type="' . $type . '" data-subtype="' . $subtype . '">';
foreach ($namelist as $name) {
echo '<option data-type="' . $type . '" data-subtype="' . $subtype . '" value="' . $name . '">' . ucfirst(str_replace('tmpl', '', $name)) . '</option>';
echo '<option data-type="' . $type . '" data-subtype="' . $subtype . '" value="' . $name . '" ' . $selected . '>' . ucfirst(str_replace('tmpl', '', $name)) . '</option>';
$selected = '';
}
echo '</select>';
}