Skip to content

Commit

Permalink
Adding premium requirement for Text view.
Browse files Browse the repository at this point in the history
  • Loading branch information
samuelclay committed Jan 9, 2013
1 parent e8b6435 commit 9c1d0c4
Show file tree
Hide file tree
Showing 6 changed files with 82 additions and 3 deletions.
2 changes: 1 addition & 1 deletion apps/rss_feeds/text_importer.py
Original file line number Diff line number Diff line change
Expand Up @@ -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" % (
Expand Down
2 changes: 1 addition & 1 deletion apps/rss_feeds/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
41 changes: 41 additions & 0 deletions media/css/reader.css
Original file line number Diff line number Diff line change
Expand Up @@ -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;*/
Expand Down
3 changes: 2 additions & 1 deletion media/js/newsblur/views/story_titles_view.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
},
Expand Down
34 changes: 34 additions & 0 deletions media/js/newsblur/views/text_tab_view.js
Original file line number Diff line number Diff line change
@@ -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);
Expand Down Expand Up @@ -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() {
Expand All @@ -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 =
// ==========
Expand Down
3 changes: 3 additions & 0 deletions utils/exception_middleware.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
import traceback
import sys
import inspect
from pprint import pprint

class ConsoleExceptionMiddleware:
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)
Expand Down

0 comments on commit 9c1d0c4

Please sign in to comment.