Skip to content
This repository
Browse code

Adding premium requirement for Text view.

  • Loading branch information...
commit 9c1d0c42ddd1c9a9d135969c9e6cab7de231bb2a 1 parent e8b6435
Samuel Clay authored January 09, 2013
2  apps/rss_feeds/text_importer.py
@@ -32,7 +32,7 @@ def fetch(self):
32 32
             self.story.save()
33 33
             logging.user(self.request, "~SN~FYFetched ~FGoriginal text~FY: now ~SB%s bytes~SN vs. was ~SB%s bytes" % (
34 34
                 len(unicode(content)),
35  
-                len(zlib.decompress(self.story.story_content_z))
  35
+                self.story.story_content_z and len(zlib.decompress(self.story.story_content_z))
36 36
             ))
37 37
         else:
38 38
             logging.user(self.request, "~SN~FRFailed~FY to fetch ~FGoriginal text~FY: was ~SB%s bytes" % (
2  apps/rss_feeds/views.py
@@ -417,7 +417,7 @@ def original_text(request):
417 417
         return {'code': -1, 'message': 'Story not found.'}
418 418
     
419 419
     original_text = story.fetch_original_text(force=force, request=request)
420  
-    
  420
+
421 421
     return {
422 422
         'feed_id': feed_id,
423 423
         'story_id': story_id,
41  media/css/reader.css
@@ -2174,6 +2174,47 @@ background: transparent;
2174 2174
 #story_pane .NB-story-hide-changes .NB-feed-story-content del {
2175 2175
     display: none;
2176 2176
 }
  2177
+
  2178
+/* ============= */
  2179
+/* = Text View = */
  2180
+/* ============= */
  2181
+
  2182
+#story_pane .NB-text-view-detail .NB-feed-story-content {
  2183
+    min-height: 120px;
  2184
+}
  2185
+
  2186
+#story_pane .NB-premium-only .NB-text-view-detail .NB-feed-story-content {
  2187
+    max-height: 300px;
  2188
+    overflow: hidden;
  2189
+}
  2190
+
  2191
+.NB-text-view-premium-only {
  2192
+    border-top: 1px solid #C0C0C0;
  2193
+    font-size: 13px;
  2194
+    text-align: center;
  2195
+    padding: 12px 0;
  2196
+    font-weight: bold;
  2197
+    margin: -32px 200px 42px 28px;
  2198
+    cursor: default;
  2199
+    max-width: 700px;
  2200
+}
  2201
+
  2202
+.NB-text-view-premium-only img {
  2203
+    width: 16px;
  2204
+    height: 16px;
  2205
+    vertical-align: text-bottom;
  2206
+    margin: 0 -2px 0 2px;
  2207
+}
  2208
+
  2209
+.NB-premium-only .NB-feed-story-sideoptions-container {
  2210
+    bottom: 60px;
  2211
+}
  2212
+
  2213
+
  2214
+/* ============ */
  2215
+/* = Comments = */
  2216
+/* ============ */
  2217
+
2177 2218
 #story_pane .NB-feed-story-comments {
2178 2219
     margin: -24px 200px 32px 28px;
2179 2220
 /*    padding: 1px 0 0;*/
3  media/js/newsblur/views/story_titles_view.js
@@ -3,7 +3,8 @@ NEWSBLUR.Views.StoryTitlesView = Backbone.View.extend({
3 3
     el: '.NB-story-titles',
4 4
     
5 5
     events: {
6  
-        "click .NB-feed-story-premium-only a" : function() {
  6
+        "click .NB-feed-story-premium-only a" : function(e) {
  7
+            e.preventDefault();
7 8
             NEWSBLUR.reader.open_feedchooser_modal();
8 9
         }
9 10
     },
34  media/js/newsblur/views/text_tab_view.js
... ...
@@ -1,5 +1,12 @@
1 1
 NEWSBLUR.Views.TextTabView = Backbone.View.extend({
2 2
     
  3
+    events: {
  4
+        "click .NB-premium-only a" : function(e) {
  5
+            e.preventDefault();
  6
+            NEWSBLUR.reader.open_feedchooser_modal();
  7
+        }
  8
+    },
  9
+    
3 10
     initialize: function() {
4 11
         this.setElement(NEWSBLUR.reader.$s.$text_view);
5 12
         this.collection.bind('change:selected', this.select_story, this);
@@ -59,6 +66,10 @@ NEWSBLUR.Views.TextTabView = Backbone.View.extend({
59 66
             duration: 250,
60 67
             queue: false
61 68
         });
  69
+        
  70
+        if (!NEWSBLUR.Globals.is_premium) {
  71
+            this.append_premium_only_notification();
  72
+        }
62 73
     },
63 74
     
64 75
     unload: function() {
@@ -83,6 +94,29 @@ NEWSBLUR.Views.TextTabView = Backbone.View.extend({
83 94
         $content.html(this.story.get('story_content'));
84 95
     },
85 96
     
  97
+    append_premium_only_notification: function() {
  98
+        var $content = this.$('.NB-feed-story-content');
  99
+        var $notice = $.make('div', { className: 'NB-text-view-premium-only' }, [
  100
+            $.make('div', { className: 'NB-feed-story-premium-only-divider'}),
  101
+            $.make('div', { className: 'NB-feed-story-premium-only-text'}, [
  102
+                'The full ',
  103
+                $.make('img', { src: NEWSBLUR.Globals['MEDIA_URL'] + 'img/icons/silk/application_view_columns.png' }),
  104
+                ' Text view is a ',
  105
+                $.make('a', { href: '#', className: 'NB-splash-link' }, 'premium feature'),
  106
+                '.'
  107
+            ])
  108
+        ]);
  109
+        
  110
+        $notice.hide();
  111
+        this.$('.NB-feed-story-premium-only').remove();
  112
+        $content.after($notice);
  113
+        this.$el.addClass('NB-premium-only');
  114
+        
  115
+        $notice.css('opacity', 0);
  116
+        $notice.show();
  117
+        $notice.animate({'opacity': 1}, {'duration': 250, 'queue': false});
  118
+    },
  119
+    
86 120
     // ==========
87 121
     // = Events =
88 122
     // ==========
3  utils/exception_middleware.py
... ...
@@ -1,5 +1,6 @@
1 1
 import traceback
2 2
 import sys
  3
+import inspect
3 4
 from pprint import pprint
4 5
 
5 6
 class ConsoleExceptionMiddleware:
@@ -7,6 +8,8 @@ def process_exception(self, request, exception):
7 8
         exc_info = sys.exc_info()
8 9
         print "######################## Exception #############################"
9 10
         print '\n'.join(traceback.format_exception(*(exc_info or sys.exc_info())))
  11
+        print "----------------------------------------------------------------"
  12
+        pprint(inspect.trace()[-1][0].f_locals)
10 13
         print "################################################################"
11 14
         
12 15
         #pprint(request)

0 notes on commit 9c1d0c4

Please sign in to comment.
Something went wrong with that request. Please try again.