From 33e9e5203f4c8f91bcd3f5cea332d699168b1328 Mon Sep 17 00:00:00 2001 From: RandaNP Date: Tue, 10 Feb 2015 01:51:38 +0100 Subject: [PATCH 1/2] Solves scheduler time selector issue --- js/helpers/setting_helpers.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/js/helpers/setting_helpers.js b/js/helpers/setting_helpers.js index 52df3c8..c9cb9ee 100644 --- a/js/helpers/setting_helpers.js +++ b/js/helpers/setting_helpers.js @@ -79,7 +79,7 @@ kettu.SettingHelpers = { $.each($('#info select[name="' + key + '"]').find('option'), function() { var $option = $(this); - if($option.val() === scheduled_times[key]) { + if($option.val() === scheduled_times[key].toString()) { $option.attr('selected', 'selected'); } }); From a8e94cd9e97670b915a273833096874703385c0f Mon Sep 17 00:00:00 2001 From: RandaNP Date: Wed, 11 Feb 2015 23:35:20 +0100 Subject: [PATCH 2/2] Solves scheduler select issue finally --- js/helpers/setting_helpers.js | 16 ++-------------- templates/settings/hours.mustache | 2 +- templates/settings/minutes.mustache | 2 +- 3 files changed, 4 insertions(+), 16 deletions(-) diff --git a/js/helpers/setting_helpers.js b/js/helpers/setting_helpers.js index c9cb9ee..2e62ed3 100644 --- a/js/helpers/setting_helpers.js +++ b/js/helpers/setting_helpers.js @@ -59,13 +59,7 @@ kettu.SettingHelpers = { var $select = $(this), value = settings[$select.attr('name')]; - $.each($select.find('option'), function() { - var $option = $(this); - - if($option.val() === value) { - $option.attr('selected', 'selected'); - } - }); + $select.val(value); }); var scheduled_times = { @@ -76,13 +70,7 @@ kettu.SettingHelpers = { }; _.each(scheduled_times, function(value, key) { - $.each($('#info select[name="' + key + '"]').find('option'), function() { - var $option = $(this); - - if($option.val() === scheduled_times[key].toString()) { - $option.attr('selected', 'selected'); - } - }); + $('#info select[name="' + key + '"]').val(scheduled_times[key]); }); }, diff --git a/templates/settings/hours.mustache b/templates/settings/hours.mustache index 87955a1..b8183e8 100644 --- a/templates/settings/hours.mustache +++ b/templates/settings/hours.mustache @@ -7,7 +7,7 @@ - + diff --git a/templates/settings/minutes.mustache b/templates/settings/minutes.mustache index c149476..4d2d738 100644 --- a/templates/settings/minutes.mustache +++ b/templates/settings/minutes.mustache @@ -33,7 +33,7 @@ - +