Permalink
Browse files

Splitting up dashboard into unauthed and authed templates, needed to …

…redesign to unauthed view.
  • Loading branch information...
1 parent 027b28e commit 625e00b91f37f6c56c297348e8790888ef496d41 @samuelclay committed Sep 11, 2012
View
@@ -50,7 +50,7 @@
@never_cache
-@render_to('reader/feeds.xhtml')
+@render_to('reader/dashboard.xhtml')
def index(request, **kwargs):
if request.method == "GET" and request.subdomain and request.subdomain not in ['dev', 'app02', 'app01', 'www']:
username = request.subdomain
@@ -64,27 +64,17 @@ def index(request, **kwargs):
reverse('index')))
return load_social_page(request, user_id=user.pk, username=request.subdomain, **kwargs)
- # XXX TODO: Remove me on launch.
- # if request.method == "GET" and request.user.is_anonymous() and not request.REQUEST.get('letmein'):
- # return {}, 'reader/social_signup.xhtml'
-
- if request.method == "POST":
- if request.POST.get('submit') == 'login':
- login_form = LoginForm(request.POST, prefix='login')
- signup_form = SignupForm(prefix='signup')
- else:
- login_form = LoginForm(prefix='login')
- signup_form = SignupForm(request.POST, prefix='signup')
+ if request.user.is_anonymous():
+ return welcome(request, **kwargs)
else:
- login_form = LoginForm(prefix='login')
- signup_form = SignupForm(prefix='signup')
-
- user = get_user(request)
- authed = request.user.is_authenticated()
- feed_count = UserSubscription.objects.filter(user=request.user).count() if authed else 0
- active_count = UserSubscription.objects.filter(user=request.user, active=True).count() if authed else 0
+ return dashboard(request, **kwargs)
+
+def dashboard(request, **kwargs):
+ user = request.user
+ feed_count = UserSubscription.objects.filter(user=request.user).count()
+ active_count = UserSubscription.objects.filter(user=request.user, active=True).count()
train_count = UserSubscription.objects.filter(user=request.user, active=True, is_trained=False,
- feed__stories_last_month__gte=1).count() if authed else 0
+ feed__stories_last_month__gte=1).count()
recommended_feeds = RecommendedFeed.objects.filter(is_public=True,
approved_date__lte=datetime.datetime.now())\
.select_related('feed')[:2]
@@ -98,9 +88,7 @@ def index(request, **kwargs):
del request.session['import_from_google_reader']
return {
- 'user_profile' : hasattr(user, 'profile') and user.profile,
- 'login_form' : login_form,
- 'signup_form' : signup_form,
+ 'user_profile' : user.profile,
'feed_count' : feed_count,
'active_count' : active_count,
'train_count' : active_count - train_count,
@@ -110,7 +98,32 @@ def index(request, **kwargs):
'statistics' : statistics,
'social_profile' : social_profile,
'start_import_from_google_reader': start_import_from_google_reader,
- }
+ }, "reader/dashboard.xhtml"
+
+def welcome(request, **kwargs):
+ user = get_user(request)
+ statistics = MStatistics.all()
+ social_profile = MSocialProfile.get_user(user.pk)
+
+ if request.method == "POST":
+ if request.POST.get('submit') == 'login':
+ login_form = LoginForm(request.POST, prefix='login')
+ signup_form = SignupForm(prefix='signup')
+ else:
+ login_form = LoginForm(prefix='login')
+ signup_form = SignupForm(request.POST, prefix='signup')
+ else:
+ login_form = LoginForm(prefix='login')
+ signup_form = SignupForm(prefix='signup')
+
+
+ return {
+ 'user_profile' : hasattr(user, 'profile') and user.profile,
+ 'login_form' : login_form,
+ 'signup_form' : signup_form,
+ 'statistics' : statistics,
+ 'social_profile' : social_profile,
+ }, "reader/welcome.xhtml"
@never_cache
def login(request):
View
@@ -49,6 +49,8 @@ javascripts:
- media/js/vendor/jquery.flot.js
- media/js/vendor/jquery.tipsy.js
- media/js/vendor/jquery.chosen.js
+ - media/js/vendor/jquery.effects.core.js
+ - media/js/vendor/jquery.effects.slide.js
# - media/js/vendor/jquery.linkify.js
- media/js/vendor/bootstrap.*.js
- media/js/vendor/audio.js
@@ -0,0 +1,234 @@
+{% extends 'base.html' %}
+
+{% load recommendations_tags utils_tags statistics_tags %}
+
+{% block extra_head_js %}
+ <script>
+ $(document).ready(function() {
+
+ NEWSBLUR.reader = new NEWSBLUR.Reader();
+ NEWSBLUR.reader.init();
+
+ });
+ </script>
+
+ {% if user.is_staff %}
+ <script>
+ $(document).ready(function() {
+ $('#add-feature-button').click(function(e) {
+ e.preventDefault();
+ $('#add-feature-form').fadeIn(500);
+ });
+ });
+ </script>
+ {% endif %}
+{% endblock %}
+
+{% block bodyclass %}NB-body-main{% endblock %}
+{% block content %}
+
+
+<h1 class="NB-splash-heading">NewsBlur</h1>
+<h2 class="NB-splash-heading">- The best stories from your friends and favorite blogs, all in one place.</h2>
+
+<div id="NB-splash" style="left: {% firstof user_profile.feed_pane_size 240 %}px">
+
+ <div class="NB-modules-center">
+
+ {% render_interactions_module %}
+ {% render_activities_module %}
+
+ {% if recommended_feeds %}
+ {% render_recommended_feed recommended_feeds %}
+ {% endif %}
+
+ {% if user.is_staff and unmoderated_feeds %}
+ {% render_recommended_feed unmoderated_feeds 1 %}
+ {% endif %}
+
+ </div>
+
+ <div class="NB-account">
+ <div class="NB-module NB-module-account">
+ <h5 class="NB-module-header">
+ <div class="NB-module-header-right">
+ <a href="{% url logout %}?next=/" class="NB-splash-link">Logout</a>
+ </div>
+ Welcome, <span class="NB-module-account-username">{{ user.username }}</span>
+ </h5>
+ <div class="NB-module-item {% if train_count == active_count %}NB-last{% endif %}">
+ <div class="NB-module-item-image NB-load-user-profile">
+ {% if social_profile.large_photo_url %}
+ <img src="{{ social_profile.large_photo_url }}">
+ {% else %}
+ {% if user.profile.is_premium %}
+ <img src="{{ MEDIA_URL }}/img/reader/account_premium_{{ account_images|random }}.jpg" />
+ {% else %}
+ <img src="{{ MEDIA_URL }}/img/reader/account_standard_{{ account_images|random }}.jpg" />
+ {% endif %}
+ {% endif %}
+ </div>
+ <h3 class="NB-module-content-header">
+ <div class="NB-module-content-subtitle NB-module-content-account-realtime-subtitle"></div>
+ <div class="NB-module-content-account-realtime" title=""></div>
+ {% if user.profile.is_premium %}
+ Premium Account
+ {% else %}
+ Free Standard Account
+ {% endif %}
+ </h3>
+ <div class="NB-module-item-title">
+ <div class="NB-module-item NB-module-stats NB-module-account-stats {% if not social_profile.shared_stories_count %}NB-hidden{% endif %}">
+ <div class="NB-module-stats-count NB-module-stats-count-shared-stories">
+ <div class="NB-module-stats-count-number">{{ social_profile.shared_stories_count|commify }}</div>
+ <div class="NB-module-stats-count-description">Shared stor{{ social_profile.shared_stories_count|pluralize:"y,ies" }}</div>
+ </div>
+ <div class="NB-module-stats-count NB-module-stats-count-following">
+ <div class="NB-module-stats-count-number">{{ social_profile.following_count|commify }}</div>
+ <div class="NB-module-stats-count-description">Following</div>
+ </div>
+ <div class="NB-module-stats-count NB-module-stats-count-followers">
+ <div class="NB-module-stats-count-number">{{ social_profile.follower_count|commify }}</div>
+ <div class="NB-module-stats-count-description">Follower{{ social_profile.follower_count|pluralize }}</div>
+ </div>
+ </div>
+ </div>
+
+ </div>
+
+ </div>
+
+ {% if not user_profile.hide_getting_started %}
+ <div class="NB-module NB-module-gettingstarted">
+ <h5 class="NB-module-header">
+ <div class="NB-module-header-right">
+ <a href="#" class="NB-splash-link NB-module-gettingstarted-hide">Hide</a>
+ </div>
+ Getting Started
+ </h5>
+
+ <div class="NB-module-item NB-module-item-intro {% if user_profile.has_setup_feeds %}NB-done{% endif %}">
+ <div class="NB-module-item-image">
+ <img src="{{ MEDIA_URL }}/img/reader/module_tutorial.jpg" />
+ </div>
+ <h3 class="NB-module-content-header">
+ Start by setting up NewsBlur
+ </h3>
+ <div class="NB-module-item-title">
+ <div class="NB-modal-submit">
+ <div class="NB-modal-submit-green NB-modal-submit-button NB-module-launch-intro NB-javascript">Setup NewsBlur</div>
+ </div>
+ <div class="NB-done-label">Done</div>
+ </div>
+ </div>
+
+ <div class="NB-module-item NB-module-find-friends
+ {% if not user_profile.has_setup_feeds %}NB-hidden{% endif %}
+ {% if user_profile.has_found_friends %}NB-done{% endif %}">
+ <div class="NB-module-item-image">
+ <img src="{{ MEDIA_URL }}/img/reader/account_friends.jpg" />
+ </div>
+ <h3 class="NB-module-content-header">
+ Get Social and share stories
+ </h3>
+ <div class="NB-module-item-title">
+ <div class="NB-modal-submit">
+ <div class="NB-modal-submit-green NB-modal-submit-button NB-module-friends-button NB-javascript">Find and Follow Friends</div>
+ </div>
+ <div class="NB-done-label">Done</div>
+ </div>
+ </div>
+
+ <div class="NB-module-item NB-module-account-trainer NB-last
+ {% if not user_profile.has_setup_feeds %}NB-hidden{% endif %}
+ {% if user_profile.has_trained_intelligence %}NB-done{% endif %}">
+ <div class="NB-module-item-image">
+ <img src="{{ MEDIA_URL }}/img/reader/account_trainer.jpg" />
+ </div>
+ <h3 class="NB-module-content-header">
+ <span class="NB-module-content-subtitle">
+ <span class="NB-module-account-trainer-count">{{ train_count }}</span> of <span class="NB-module-account-trainer-site-count">{{ active_count }} site{{ active_count|pluralize }}</span>
+ </span>
+ Intelligence Trainer
+ </h3>
+ <div class="NB-module-item-title">
+ <div class="NB-modal-submit">
+ <div class="NB-modal-submit-green NB-modal-submit-button NB-module-account-train NB-javascript">Launch Intelligence Trainer</div>
+ </div>
+ <div class="NB-done-label">Done</div>
+ </div>
+ </div>
+ </div>
+ {% endif %}
+
+ {% if not user_profile.hide_mobile %}
+ <div class="NB-module NB-module-mobile">
+ <h5 class="NB-module-header">
+ <div class="NB-module-header-right">
+ <a href="#" class="NB-splash-link NB-module-mobile-hide">Hide</a>
+ </div>
+ Mobile Apps
+ </h5>
+ <div class="NB-module-item {% if user_profile.hide_mobile %}NB-hidden{% endif %}">
+ <div class="NB-module-mobile-image">
+ <img src="{{ MEDIA_URL }}/img/mobile/iphone-icon-newsblur.png" />
+ </div>
+ <h3 class="NB-module-content-header">
+ <span class="NB-module-content-subtitle">
+ Official Client
+ </span>
+ <div class="NB-module-mobile-title">NewsBlur</div>
+ <div class="NB-module-mobile-device">iPhone</div>
+ </h3>
+ <div class="NB-module-item-title">
+ <span class="NB-raquo">&raquo;</span>
+ <a href="/iphone/" class="NB-splash-link">See the free NewsBlur iPhone App</a>
+ </div>
+ </div>
+ <div class="NB-module-item {% if user_profile.hide_mobile %}NB-hidden{% endif %}">
+ <div class="NB-module-mobile-image">
+ <img src="{{ MEDIA_URL }}/img/mobile/android-icon-blar.png" />
+ </div>
+ <h3 class="NB-module-content-header">
+ <span class="NB-module-content-subtitle">
+ User-Built Client
+ </span>
+ <div class="NB-module-mobile-title">Blar</div>
+ <div class="NB-module-mobile-device">Android</div>
+ </h3>
+ <div class="NB-module-item-title">
+ <span class="NB-raquo">&raquo;</span>
+ <a href="https://market.android.com/details?id=bitwrit.Blar" class="NB-splash-link">Download Blar on the Android Market</a>
+ </div>
+ </div>
+ <div class="NB-module-item NB-last {% if user_profile.hide_mobile %}NB-hidden{% endif %}">
+ <div class="NB-module-mobile-image">
+ <img src="{{ MEDIA_URL }}/img/mobile/meego-icon-webfeeds.png" />
+ </div>
+ <h3 class="NB-module-content-header">
+ <span class="NB-module-content-subtitle">
+ User-Built Client
+ </span>
+ <div class="NB-module-mobile-title">Web Feeds</div>
+ <div class="NB-module-mobile-device">Nokia MeeGo</div>
+ </h3>
+ <div class="NB-module-item-title">
+ <span class="NB-raquo">&raquo;</span>
+ <a href="http://projects.developer.nokia.com/feed_reader" class="NB-splash-link">Download Web Feeds on the Nokia Store</a>
+ </div>
+ </div>
+ </div>
+ {% endif %}
+
+ {% if user_profile.hide_getting_started %}
+ {% render_features_module %}
+ {% render_statistics_graphs statistics %}
+ {% endif %}
+
+ </div>
+
+</div>
+
+{% render_feeds_skeleton %}
+
+{% endblock %}
Oops, something went wrong.

0 comments on commit 625e00b

Please sign in to comment.