Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Adding premium requirement for Text view.

  • Loading branch information...
commit 9c1d0c42ddd1c9a9d135969c9e6cab7de231bb2a 1 parent e8b6435
@samuelclay authored
View
2  apps/rss_feeds/text_importer.py
@@ -32,7 +32,7 @@ def fetch(self):
self.story.save()
logging.user(self.request, "~SN~FYFetched ~FGoriginal text~FY: now ~SB%s bytes~SN vs. was ~SB%s bytes" % (
len(unicode(content)),
- len(zlib.decompress(self.story.story_content_z))
+ self.story.story_content_z and len(zlib.decompress(self.story.story_content_z))
))
else:
logging.user(self.request, "~SN~FRFailed~FY to fetch ~FGoriginal text~FY: was ~SB%s bytes" % (
View
2  apps/rss_feeds/views.py
@@ -417,7 +417,7 @@ def original_text(request):
return {'code': -1, 'message': 'Story not found.'}
original_text = story.fetch_original_text(force=force, request=request)
-
+
return {
'feed_id': feed_id,
'story_id': story_id,
View
41 media/css/reader.css
@@ -2174,6 +2174,47 @@ background: transparent;
#story_pane .NB-story-hide-changes .NB-feed-story-content del {
display: none;
}
+
+/* ============= */
+/* = Text View = */
+/* ============= */
+
+#story_pane .NB-text-view-detail .NB-feed-story-content {
+ min-height: 120px;
+}
+
+#story_pane .NB-premium-only .NB-text-view-detail .NB-feed-story-content {
+ max-height: 300px;
+ overflow: hidden;
+}
+
+.NB-text-view-premium-only {
+ border-top: 1px solid #C0C0C0;
+ font-size: 13px;
+ text-align: center;
+ padding: 12px 0;
+ font-weight: bold;
+ margin: -32px 200px 42px 28px;
+ cursor: default;
+ max-width: 700px;
+}
+
+.NB-text-view-premium-only img {
+ width: 16px;
+ height: 16px;
+ vertical-align: text-bottom;
+ margin: 0 -2px 0 2px;
+}
+
+.NB-premium-only .NB-feed-story-sideoptions-container {
+ bottom: 60px;
+}
+
+
+/* ============ */
+/* = Comments = */
+/* ============ */
+
#story_pane .NB-feed-story-comments {
margin: -24px 200px 32px 28px;
/* padding: 1px 0 0;*/
View
3  media/js/newsblur/views/story_titles_view.js
@@ -3,7 +3,8 @@ NEWSBLUR.Views.StoryTitlesView = Backbone.View.extend({
el: '.NB-story-titles',
events: {
- "click .NB-feed-story-premium-only a" : function() {
+ "click .NB-feed-story-premium-only a" : function(e) {
+ e.preventDefault();
NEWSBLUR.reader.open_feedchooser_modal();
}
},
View
34 media/js/newsblur/views/text_tab_view.js
@@ -1,5 +1,12 @@
NEWSBLUR.Views.TextTabView = Backbone.View.extend({
+ events: {
+ "click .NB-premium-only a" : function(e) {
+ e.preventDefault();
+ NEWSBLUR.reader.open_feedchooser_modal();
+ }
+ },
+
initialize: function() {
this.setElement(NEWSBLUR.reader.$s.$text_view);
this.collection.bind('change:selected', this.select_story, this);
@@ -59,6 +66,10 @@ NEWSBLUR.Views.TextTabView = Backbone.View.extend({
duration: 250,
queue: false
});
+
+ if (!NEWSBLUR.Globals.is_premium) {
+ this.append_premium_only_notification();
+ }
},
unload: function() {
@@ -83,6 +94,29 @@ NEWSBLUR.Views.TextTabView = Backbone.View.extend({
$content.html(this.story.get('story_content'));
},
+ append_premium_only_notification: function() {
+ var $content = this.$('.NB-feed-story-content');
+ var $notice = $.make('div', { className: 'NB-text-view-premium-only' }, [
+ $.make('div', { className: 'NB-feed-story-premium-only-divider'}),
+ $.make('div', { className: 'NB-feed-story-premium-only-text'}, [
+ 'The full ',
+ $.make('img', { src: NEWSBLUR.Globals['MEDIA_URL'] + 'img/icons/silk/application_view_columns.png' }),
+ ' Text view is a ',
+ $.make('a', { href: '#', className: 'NB-splash-link' }, 'premium feature'),
+ '.'
+ ])
+ ]);
+
+ $notice.hide();
+ this.$('.NB-feed-story-premium-only').remove();
+ $content.after($notice);
+ this.$el.addClass('NB-premium-only');
+
+ $notice.css('opacity', 0);
+ $notice.show();
+ $notice.animate({'opacity': 1}, {'duration': 250, 'queue': false});
+ },
+
// ==========
// = Events =
// ==========
View
3  utils/exception_middleware.py
@@ -1,5 +1,6 @@
import traceback
import sys
+import inspect
from pprint import pprint
class ConsoleExceptionMiddleware:
@@ -7,6 +8,8 @@ def process_exception(self, request, exception):
exc_info = sys.exc_info()
print "######################## Exception #############################"
print '\n'.join(traceback.format_exception(*(exc_info or sys.exc_info())))
+ print "----------------------------------------------------------------"
+ pprint(inspect.trace()[-1][0].f_locals)
print "################################################################"
#pprint(request)
Please sign in to comment.
Something went wrong with that request. Please try again.