Created
November 5, 2011 13:00
-
-
Save AdamG/1341479 to your computer and use it in GitHub Desktop.
NewsBlur reverse cron ordering
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/apps/reader/views.py b/apps/reader/views.py | |
index 1d7a89d..13c0a77 100644 | |
--- a/apps/reader/views.py | |
+++ b/apps/reader/views.py | |
@@ -421,6 +421,10 @@ def load_single_feed(request, feed_id): | |
diff1, diff2, userstories_db and userstories_db.count() or '~SN0~SB', diff3)) | |
FeedLoadtime.objects.create(feed=feed, loadtime=timediff) | |
+ prefs = json.decode(user.profile.preferences) | |
+ if prefs.get("chronological_ordering", "descending") == "ascending": | |
+ stories = reversed(stories) | |
+ | |
data = dict(stories=stories, | |
feed_tags=feed_tags, | |
feed_authors=feed_authors, | |
@@ -613,6 +617,10 @@ def load_river_stories(request): | |
"stories ~SN(%s/%s/%s feeds) ~FB(%s seconds)" % | |
(page, len(stories), len(mstories), len(found_feed_ids), | |
len(feed_ids), len(original_feed_ids), timediff)) | |
+ | |
+ prefs = json.decode(user.profile.preferences) | |
+ if prefs.get("chronological_ordering", "descending") == "ascending": | |
+ stories = reversed(stories) | |
if new_flag: | |
return dict(stories=stories, classifiers=classifiers) | |
diff --git a/media/js/newsblur/reader_preferences.js b/media/js/newsblur/reader_preferences.js | |
index 14bdf68..2dc52a5 100644 | |
--- a/media/js/newsblur/reader_preferences.js | |
+++ b/media/js/newsblur/reader_preferences.js | |
@@ -321,6 +321,25 @@ _.extend(NEWSBLUR.ReaderPreferences.prototype, { | |
'Animations' | |
]) | |
]), | |
+ $.make('div', { className: 'NB-preference NB-preference-chronological-ordering' }, [ | |
+ $.make('div', { className: 'NB-preference-options' }, [ | |
+ $.make('div', [ | |
+ $.make('input', { id: 'NB-preference-chronological-ordering-1', type: 'radio', name: 'chronological_ordering', value: 'descending' }), | |
+ $.make('label', { 'for': 'NB-preference-chronological-ordering-1' }, [ | |
+ 'Most recent first' | |
+ ]) | |
+ ]), | |
+ $.make('div', [ | |
+ $.make('input', { id: 'NB-preference-chronological-ordering-2', type: 'radio', name: 'chronological_ordering', value: 'ascending' }), | |
+ $.make('label', { 'for': 'NB-preference-chronological-ordering-2' }, [ | |
+ 'Oldest first' | |
+ ]) | |
+ ]) | |
+ ]), | |
+ $.make('div', { className: 'NB-preference-label'}, [ | |
+ 'Chronological Ordering' | |
+ ]) | |
+ ]), | |
$.make('div', { className: 'NB-preference NB-preference-folder-counts' }, [ | |
$.make('div', { className: 'NB-preference-options' }, [ | |
$.make('div', [ | |
@@ -502,6 +521,12 @@ _.extend(NEWSBLUR.ReaderPreferences.prototype, { | |
return false; | |
} | |
}); | |
+ $('input[name=chronological_ordering]', this.$modal).each(function() { | |
+ if ($(this).val() == ""+NEWSBLUR.Preferences.chronological_ordering) { | |
+ $(this).attr('checked', true); | |
+ return false; | |
+ } | |
+ }); | |
$('input[name=folder_counts]', this.$modal).each(function() { | |
if ($(this).val() == ""+NEWSBLUR.Preferences.folder_counts) { | |
$(this).attr('checked', true); | |
@@ -628,4 +653,4 @@ _.extend(NEWSBLUR.ReaderPreferences.prototype, { | |
$('input[type=submit]', this.$modal).attr('disabled', true).addClass('NB-disabled').val('Change what you like above...'); | |
} | |
-}); | |
\ No newline at end of file | |
+}); | |
diff --git a/templates/base.html b/templates/base.html | |
index adc3396..84b18ef 100644 | |
--- a/templates/base.html | |
+++ b/templates/base.html | |
@@ -37,6 +37,7 @@ | |
'hide_story_changes' : 1, | |
'feed_view_single_story' : 0, | |
'animations' : true, | |
+ 'chronological_ordering' : 'descending', | |
'folder_counts' : false, | |
'send_emails' : {{ user_profile.send_emails|yesno:"true,false" }}, | |
'view_settings' : {}, |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment