From 2e387b1ce8b79faebd3e8e9da421882b8b561db3 Mon Sep 17 00:00:00 2001 From: JackDandy Date: Tue, 3 Jun 2014 18:43:37 +0100 Subject: [PATCH] Expose "Date Style"... "Use System Default" only when FuzzyMoment is off. If the Date Style "Use System Default" is selected and FuzzyMoments is clicked on, then an appropriate Date Style is chosen from explicit defaults. This change prevents issues where moments() cannot interpret or guess locale date formats. --- .../interfaces/default/config_general.tmpl | 39 ++++++++++++------- gui/slick/js/config.js | 33 +++++++++++++++- gui/slick/js/fuzzyMoment.js | 4 +- sickbeard/webserve.py | 3 +- 4 files changed, 61 insertions(+), 18 deletions(-) diff --git a/gui/slick/interfaces/default/config_general.tmpl b/gui/slick/interfaces/default/config_general.tmpl index a96c2367..59c3359c 100644 --- a/gui/slick/interfaces/default/config_general.tmpl +++ b/gui/slick/interfaces/default/config_general.tmpl @@ -370,31 +370,42 @@
- +
- -
- - +
+
+ + +
diff --git a/gui/slick/js/config.js b/gui/slick/js/config.js index 709d3ac7..e9fafc52 100644 --- a/gui/slick/js/config.js +++ b/gui/slick/js/config.js @@ -9,7 +9,38 @@ $(document).ready(function(){ $('#content_'+$(this).attr('id')).fadeIn("fast", "linear"); else $('#content_'+$(this).attr('id')).fadeOut("fast", "linear"); - }); + }); + + $(".viewIf").click(function() { + if ($(this).prop('checked')) { + $('.hide_if_'+$(this).attr('id')).css('display','none'); + $('.show_if_'+$(this).attr('id')).fadeIn("fast", "linear"); + } else { + $('.show_if_'+$(this).attr('id')).css('display','none'); + $('.hide_if_'+$(this).attr('id')).fadeIn("fast", "linear"); + } + }); + + $(".datePresets").click(function() { + var def = $('#date_presets').val() + if ($(this).prop('checked') && '%x' == def) { + def = '%a, %b %d, %Y' + $('#date_use_system_default').html('1') + } else if (!$(this).prop('checked') && '1' == $('#date_use_system_default').html()) + def = '%x' + + $('#date_presets').attr('name', 'date_preset_old') + $('#date_presets').attr('id', 'date_presets_old') + + $('#date_presets_na').attr('name', 'date_preset') + $('#date_presets_na').attr('id', 'date_presets') + + $('#date_presets_old').attr('name', 'date_preset_na') + $('#date_presets_old').attr('id', 'date_presets_na') + + if (def) + $('#date_presets').val(def) + }); // bind 'myForm' and provide a simple callback function $('#configForm').ajaxForm({ diff --git a/gui/slick/js/fuzzyMoment.js b/gui/slick/js/fuzzyMoment.js index f1812dc6..0b24597b 100644 --- a/gui/slick/js/fuzzyMoment.js +++ b/gui/slick/js/fuzzyMoment.js @@ -108,8 +108,8 @@ airdate = airdatetime.clone().hour(0).minute(0).second(0).millisecond(0), today = moment({}), day = Math.abs(airdate.diff(today, 'days')), - week = airdate.diff(today, 'week'), isPast = week < 0, week = Math.abs(week), - titleThis = false, qTipTime = false + week = Math.abs(weekdiff = airdate.diff(today, 'week')), isPast = weekdiff < 0, + titleThis = false, qTipTime = false, result = (0 == week ? airdatetime.calendar() : ''); if (/\bOn\b/i.test(result)) { diff --git a/sickbeard/webserve.py b/sickbeard/webserve.py index 66315646..fe356eff 100644 --- a/sickbeard/webserve.py +++ b/sickbeard/webserve.py @@ -1047,7 +1047,7 @@ class ConfigGeneral: web_password=None, version_notify=None, enable_https=None, https_cert=None, https_key=None, handle_reverse_proxy=None, sort_article=None, auto_update=None, proxy_setting=None, anon_redirect=None, git_path=None, calendar_unprotected=None, - fuzzy_dating=None, trim_zero=None, date_preset=None, time_preset=None, + fuzzy_dating=None, trim_zero=None, date_preset=None, date_preset_na=None, time_preset=None, indexer_timeout=None): results = [] @@ -1081,6 +1081,7 @@ class ConfigGeneral: if date_preset: sickbeard.DATE_PRESET = date_preset + discarded_na_data = date_preset_na if indexer_default: sickbeard.INDEXER_DEFAULT = config.to_int(indexer_default)