mirror of
https://github.com/samuelclay/NewsBlur.git
synced 2025-09-18 21:50:56 +00:00
Stubbing in dashboard rivers model and loading. Needs attachment to JS models.
This commit is contained in:
parent
f39a0405cf
commit
ccdf7e260b
8 changed files with 92 additions and 54 deletions
|
@ -1517,7 +1517,44 @@ class MCustomStyling(mongo.Document):
|
||||||
styling.custom_css = css
|
styling.custom_css = css
|
||||||
styling.custom_js = js
|
styling.custom_js = js
|
||||||
styling.save()
|
styling.save()
|
||||||
|
|
||||||
|
|
||||||
|
class MDashboardRivers(mongo.Document):
|
||||||
|
user_id = mongo.IntField(unique=True)
|
||||||
|
left_rivers = mongo.ListField(mongo.StringField())
|
||||||
|
right_rivers = mongo.ListField(mongo.StringField())
|
||||||
|
|
||||||
|
def canonical(self):
|
||||||
|
return {
|
||||||
|
'left_rivers': self.left_rivers,
|
||||||
|
'right_rivers': self.right_rivers,
|
||||||
|
}
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def get_user(cls, user_id):
|
||||||
|
try:
|
||||||
|
rivers = cls.objects.get(user_id=user_id)
|
||||||
|
except cls.DoesNotExist:
|
||||||
|
return None
|
||||||
|
|
||||||
|
return rivers
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def save_user(cls, user_id, left_rivers, right_rivers):
|
||||||
|
rivers = cls.get_user(user_id)
|
||||||
|
if not left_rivers and not right_rivers:
|
||||||
|
if rivers:
|
||||||
|
rivers.delete()
|
||||||
|
return
|
||||||
|
|
||||||
|
if not rivers:
|
||||||
|
rivers = cls.objects.create(user_id=user_id)
|
||||||
|
|
||||||
|
rivers.left_rivers = left_rivers
|
||||||
|
rivers.right_rivers = right_rivers
|
||||||
|
rivers.save()
|
||||||
|
|
||||||
|
|
||||||
class RNewUserQueue:
|
class RNewUserQueue:
|
||||||
|
|
||||||
KEY = "new_user_queue"
|
KEY = "new_user_queue"
|
||||||
|
|
|
@ -32,7 +32,7 @@ from apps.analyzer.models import MClassifierTitle, MClassifierAuthor, MClassifie
|
||||||
from apps.analyzer.models import apply_classifier_titles, apply_classifier_feeds
|
from apps.analyzer.models import apply_classifier_titles, apply_classifier_feeds
|
||||||
from apps.analyzer.models import apply_classifier_authors, apply_classifier_tags
|
from apps.analyzer.models import apply_classifier_authors, apply_classifier_tags
|
||||||
from apps.analyzer.models import get_classifiers_for_user, sort_classifiers_by_feed
|
from apps.analyzer.models import get_classifiers_for_user, sort_classifiers_by_feed
|
||||||
from apps.profile.models import Profile, MCustomStyling
|
from apps.profile.models import Profile, MCustomStyling, MDashboardRivers
|
||||||
from apps.reader.models import UserSubscription, UserSubscriptionFolders, RUserStory, Feature
|
from apps.reader.models import UserSubscription, UserSubscriptionFolders, RUserStory, Feature
|
||||||
from apps.reader.forms import SignupForm, LoginForm, FeatureForm
|
from apps.reader.forms import SignupForm, LoginForm, FeatureForm
|
||||||
from apps.rss_feeds.models import MFeedIcon, MStarredStoryCounts, MSavedSearch
|
from apps.rss_feeds.models import MFeedIcon, MStarredStoryCounts, MSavedSearch
|
||||||
|
@ -119,6 +119,7 @@ def dashboard(request, **kwargs):
|
||||||
statistics = MStatistics.all()
|
statistics = MStatistics.all()
|
||||||
social_profile = MSocialProfile.get_user(user.pk)
|
social_profile = MSocialProfile.get_user(user.pk)
|
||||||
custom_styling = MCustomStyling.get_user(user.pk)
|
custom_styling = MCustomStyling.get_user(user.pk)
|
||||||
|
dashboard_rivers = MDashboardRivers.get_user(user.pk)
|
||||||
preferences = json.decode(user.profile.preferences)
|
preferences = json.decode(user.profile.preferences)
|
||||||
|
|
||||||
if not user.is_active:
|
if not user.is_active:
|
||||||
|
@ -133,6 +134,7 @@ def dashboard(request, **kwargs):
|
||||||
'preferences' : preferences,
|
'preferences' : preferences,
|
||||||
'feed_count' : feed_count,
|
'feed_count' : feed_count,
|
||||||
'custom_styling' : custom_styling,
|
'custom_styling' : custom_styling,
|
||||||
|
'dashboard_rivers' : dashboard_rivers,
|
||||||
'account_images' : list(range(1, 4)),
|
'account_images' : list(range(1, 4)),
|
||||||
'recommended_feeds' : recommended_feeds,
|
'recommended_feeds' : recommended_feeds,
|
||||||
'unmoderated_feeds' : unmoderated_feeds,
|
'unmoderated_feeds' : unmoderated_feeds,
|
||||||
|
@ -324,7 +326,8 @@ def load_feeds(request):
|
||||||
social_feeds = MSocialSubscription.feeds(**social_params)
|
social_feeds = MSocialSubscription.feeds(**social_params)
|
||||||
social_profile = MSocialProfile.profile(user.pk)
|
social_profile = MSocialProfile.profile(user.pk)
|
||||||
social_services = MSocialServices.profile(user.pk)
|
social_services = MSocialServices.profile(user.pk)
|
||||||
|
dashboard_rivers = MDashboardRivers.get_user(user.pk)
|
||||||
|
|
||||||
categories = None
|
categories = None
|
||||||
if not user_subs:
|
if not user_subs:
|
||||||
categories = MCategory.serialize()
|
categories = MCategory.serialize()
|
||||||
|
@ -344,6 +347,7 @@ def load_feeds(request):
|
||||||
'starred_count': starred_count,
|
'starred_count': starred_count,
|
||||||
'starred_counts': starred_counts,
|
'starred_counts': starred_counts,
|
||||||
'saved_searches': saved_searches,
|
'saved_searches': saved_searches,
|
||||||
|
'dashboard_rivers': dashboard_rivers,
|
||||||
'categories': categories
|
'categories': categories
|
||||||
}
|
}
|
||||||
return data
|
return data
|
||||||
|
|
|
@ -26,6 +26,12 @@ server {
|
||||||
server_name *.nb.local.com nb.local.com;
|
server_name *.nb.local.com nb.local.com;
|
||||||
add_header X-nginx-server nginx_none;
|
add_header X-nginx-server nginx_none;
|
||||||
|
|
||||||
|
# kill cache
|
||||||
|
add_header Last-Modified $date_gmt;
|
||||||
|
add_header Cache-Control 'no-store, no-cache, must-revalidate, proxy-revalidate, max-age=0';
|
||||||
|
if_modified_since off;
|
||||||
|
expires off;
|
||||||
|
|
||||||
# if ($host = 'newsblur.com') {
|
# if ($host = 'newsblur.com') {
|
||||||
# rewrite ^/(.*)$ https://www.newsblur.com/$1 permanent;
|
# rewrite ^/(.*)$ https://www.newsblur.com/$1 permanent;
|
||||||
# }
|
# }
|
||||||
|
|
|
@ -6505,7 +6505,7 @@ form.opml_import_form input {
|
||||||
/* =========================== */
|
/* =========================== */
|
||||||
|
|
||||||
.NB-module-features {
|
.NB-module-features {
|
||||||
margin-top: 36px;
|
margin-top: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
.NB-account .NB-module,
|
.NB-account .NB-module,
|
||||||
|
|
|
@ -33,6 +33,20 @@ NEWSBLUR.Views.DashboardRiver = Backbone.View.extend({
|
||||||
|
|
||||||
this.setup_dashboard_refresh();
|
this.setup_dashboard_refresh();
|
||||||
},
|
},
|
||||||
|
|
||||||
|
options_template: function () {
|
||||||
|
var $options = $(_.template('<div class="NB-feedbar-options-container">\
|
||||||
|
<span class="NB-feedbar-options">\
|
||||||
|
<div class="NB-icon"></div>\
|
||||||
|
<%= NEWSBLUR.assets.view_setting(feed_id, "read_filter") %>\
|
||||||
|
·\
|
||||||
|
<%= NEWSBLUR.assets.view_setting(feed_id, "order") %>\
|
||||||
|
</span>\
|
||||||
|
</div>'), {
|
||||||
|
feed_id: this.options.active_feed
|
||||||
|
});
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
feeds: function() {
|
feeds: function() {
|
||||||
var feeds;
|
var feeds;
|
||||||
|
@ -254,4 +268,4 @@ NEWSBLUR.Views.DashboardRiver = Backbone.View.extend({
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
|
@ -53,45 +53,10 @@
|
||||||
{% if not user_profile.hide_getting_started %}
|
{% if not user_profile.hide_getting_started %}
|
||||||
{% render_getting_started %}
|
{% render_getting_started %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
<div class="NB-module NB-module-river NB-module-river-1">
|
|
||||||
<h5 class="NB-module-header">
|
|
||||||
<div class="NB-module-river-settings NB-javascript"></div>
|
|
||||||
All Site Stories
|
|
||||||
</h5>
|
|
||||||
|
|
||||||
<div class="NB-view-river">
|
|
||||||
<div class="NB-module-item NB-story-pane-west">
|
|
||||||
<div class="NB-story-titles"></div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="NB-module NB-module-river NB-module-river-2">
|
{% for dashboard_river in dashboard_rivers.left_rivers %}
|
||||||
<h5 class="NB-module-header">
|
{% render_dashboard_river dashboard_river %}
|
||||||
<div class="NB-module-river-settings NB-javascript"></div>
|
{% endfor %}
|
||||||
Infrequent Site Stories
|
|
||||||
</h5>
|
|
||||||
|
|
||||||
<div class="NB-view-river">
|
|
||||||
<div class="NB-module-item NB-story-pane-west">
|
|
||||||
<div class="NB-story-titles"></div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="NB-module NB-module-river NB-module-river-3">
|
|
||||||
<h5 class="NB-module-header">
|
|
||||||
<div class="NB-module-river-settings NB-javascript"></div>
|
|
||||||
Global Shared Stories
|
|
||||||
</h5>
|
|
||||||
|
|
||||||
<div class="NB-view-river">
|
|
||||||
<div class="NB-module-item NB-story-pane-west">
|
|
||||||
<div class="NB-story-titles"></div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="NB-module-search NB-module">
|
<div class="NB-module-search NB-module">
|
||||||
<h5 class="NB-module-header">
|
<h5 class="NB-module-header">
|
||||||
|
@ -117,18 +82,9 @@
|
||||||
|
|
||||||
<div class="NB-account-wide">
|
<div class="NB-account-wide">
|
||||||
|
|
||||||
<div class="NB-module NB-module-river NB-module-river-4">
|
{% for dashboard_river in dashboard_rivers.right_rivers %}
|
||||||
<h5 class="NB-module-header">
|
{% render_dashboard_river dashboard_river %}
|
||||||
<div class="NB-module-river-settings NB-javascript"></div>
|
{% endfor %}
|
||||||
"pizza" in All Site Stories
|
|
||||||
</h5>
|
|
||||||
|
|
||||||
<div class="NB-view-river">
|
|
||||||
<div class="NB-module-item NB-story-pane-west">
|
|
||||||
<div class="NB-story-titles"></div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
{% render_features_module %}
|
{% render_features_module %}
|
||||||
|
|
||||||
|
|
12
templates/reader/dashboard_river.xhtml
Normal file
12
templates/reader/dashboard_river.xhtml
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
<div class="NB-module NB-module-river">
|
||||||
|
<h5 class="NB-module-header">
|
||||||
|
<div class="NB-module-river-settings NB-javascript"></div>
|
||||||
|
<div class="NB-module-river-title"></div>
|
||||||
|
</h5>
|
||||||
|
|
||||||
|
<div class="NB-view-river">
|
||||||
|
<div class="NB-module-item NB-story-pane-west">
|
||||||
|
<div class="NB-story-titles"></div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
|
@ -71,6 +71,15 @@ def render_getting_started(context):
|
||||||
'social_profile': profile,
|
'social_profile': profile,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@register.inclusion_tag('reader/dashboard_river.xhtml', takes_context=True)
|
||||||
|
def render_dashboard_river(context, dashboard_river):
|
||||||
|
user = get_user(context['user'])
|
||||||
|
|
||||||
|
return {
|
||||||
|
'user': user,
|
||||||
|
'dashboard_river': dashboard_river,
|
||||||
|
}
|
||||||
|
|
||||||
@register.inclusion_tag('reader/account_module.xhtml', takes_context=True)
|
@register.inclusion_tag('reader/account_module.xhtml', takes_context=True)
|
||||||
def render_account_module(context):
|
def render_account_module(context):
|
||||||
user = get_user(context['user'])
|
user = get_user(context['user'])
|
||||||
|
|
Loading…
Add table
Reference in a new issue