Adding privacy handling to social_page (blurblog).

This commit is contained in:
Samuel Clay 2012-10-26 18:10:23 -07:00
parent e97878a354
commit 6a6c32df02
15 changed files with 105 additions and 32 deletions

View file

@ -42,10 +42,13 @@ def render_story_comments(context, story):
@register.inclusion_tag('social/story_comment.xhtml', takes_context=True)
def render_story_comment(context, story, comment):
user = context['user']
MEDIA_URL = settings.MEDIA_URL
return {
'user': user,
'story': story,
'comment': comment,
'MEDIA_URL': MEDIA_URL,
}
@register.inclusion_tag('mail/email_story_comment.xhtml')

View file

@ -6917,7 +6917,7 @@ form.opml_import_form input {
background: transparent url('/media/embed/icons/silk/images.png') no-repeat 0 0;
}
.NB-modal-feedchooser .NB-feedchooser-premium-bullets li.NB-4 .NB-feedchooser-premium-bullet-image {
background: transparent url('/media/embed/icons/silk/magnifier.png') no-repeat 0 0;
background: transparent url('/media/embed/icons/silk/lock.png') no-repeat 0 0;
}
.NB-modal-feedchooser .NB-feedchooser-premium-bullets li.NB-5 .NB-feedchooser-premium-bullet-image {
background: transparent url('/media/embed/icons/silk/lorry.png') no-repeat 0 0;

View file

@ -686,6 +686,52 @@ header {
.NB-story-comment .NB-story-comment-reply-button:active .NB-story-comment-reply-button-wrapper {
background-color: #9F3A00;
}
.NB-story-comment .NB-story-comment-reply-button img {
padding-right: 6px;
width: 9px;
height: 9px;
vertical-align: bottom;
float: left;
}
.NB-story-comment .NB-story-comment-likes {
overflow: hidden;
height: 14px;
margin: 3px 2px 0;
}
.NB-story-comment .NB-story-comment-like {
float: left;
width: 16px;
background: transparent url('/media/embed/reader/star_grey.png') no-repeat center 0;
text-transform: uppercase;
padding: 1px 6px 1px 2px;
height: 11px;
}
.NB-story-comment .NB-story-comment-like:hover,
.NB-story-comment .NB-story-comment-like.NB-active {
cursor: pointer;
background: transparent url('/media/embed/reader/star_green.png') no-repeat center 0;
}
.NB-story-comment .NB-story-comment-like:active {
cursor: pointer;
}
.NB-story-comment .NB-story-comment-likes-users {
display: inline-block;
}
.NB-story-comment .NB-story-comment-likes-users .NB-story-share-profile .NB-user-avatar {
width: auto;
height: auto;
}
.NB-story-comment .NB-story-comment-likes-users .NB-story-share-profile .NB-user-avatar img {
width: 12px;
height: 12px;
}
.NB-story-comment .NB-story-comment-error {
float: left;
font-size: 10px;
color: #6A1000;
font-weight: bold;
}
.NB-story-comment-reply {
border-top: 1px solid #E0E0E0;

View file

@ -30,7 +30,7 @@ NEWSBLUR.Router = Backbone.Router.extend({
},
site: function(site_id, slug) {
// NEWSBLUR.log(["site", site_id, slug]);
NEWSBLUR.log(["site", site_id, slug]);
site_id = parseInt(site_id, 10);
var feed = NEWSBLUR.assets.get_feed(site_id);
if (feed) {
@ -48,7 +48,7 @@ NEWSBLUR.Router = Backbone.Router.extend({
folder: function(folder_name) {
folder_name = folder_name.replace(/-/g, ' ');
// NEWSBLUR.log(["folder", folder_name]);
NEWSBLUR.log(["folder", folder_name]);
var options = {router: true};
if (folder_name == "everything") {
NEWSBLUR.reader.open_river_stories(null, null, options);
@ -63,7 +63,7 @@ NEWSBLUR.Router = Backbone.Router.extend({
},
social: function(user_id, slug) {
// NEWSBLUR.log(["router:social", user_id, slug]);
NEWSBLUR.log(["router:social", user_id, slug]);
var feed_id = "social:" + user_id;
if (NEWSBLUR.assets.get_feed(feed_id)) {
NEWSBLUR.reader.open_social_stories(feed_id, {router: true, force: true});

View file

@ -1121,7 +1121,7 @@
var slug = _.string.words(_.string.clean(feed_title.replace(/[^a-z0-9\. ]/ig, ''))).join('-').toLowerCase();
var url = "site/" + feed.id + "/" + slug;
if (!_.string.include(window.location.pathname, url)) {
// NEWSBLUR.log(["Navigating to url", url]);
NEWSBLUR.log(["Navigating to url", url]);
NEWSBLUR.router.navigate(url);
}
}
@ -1576,7 +1576,7 @@
if (_.string.include(window.location.pathname, "social/" + feed.get('user_id'))) {
params['replace'] = true;
}
// NEWSBLUR.log(["Navigating to social", url, window.location.pathname]);
NEWSBLUR.log(["Navigating to social", url, window.location.pathname]);
NEWSBLUR.router.navigate(url, params);
}
} else if (!feed.get('feed_title')) {

View file

@ -31,7 +31,7 @@ NEWSBLUR.ReaderFeedchooser.prototype = {
this.$modal = $.make('div', { className: 'NB-modal-feedchooser NB-modal' }, [
// $.make('h2', { className: 'NB-modal-title' }, 'Choose Your '+this.MAX_FEEDS),
$.make('div', { className: 'NB-feedchooser-type'}, [
$.make('div', { className: 'NB-feedchooser-type NB-feedchooser-left'}, [
$.make('div', { className: 'NB-feedchooser-info'}, [
$.make('div', { className: 'NB-feedchooser-info-type' }, [
$.make('span', { className: 'NB-feedchooser-subtitle-type-prefix' }, 'Free'),
@ -84,7 +84,7 @@ NEWSBLUR.ReaderFeedchooser.prototype = {
]),
$.make('li', { className: 'NB-4' }, [
$.make('div', { className: 'NB-feedchooser-premium-bullet-image' }),
'First access to future features'
'Privacy options for your blurblog'
]),
$.make('li', { className: 'NB-5' }, [
$.make('div', { className: 'NB-feedchooser-premium-bullet-image' }),
@ -203,13 +203,13 @@ NEWSBLUR.ReaderFeedchooser.prototype = {
},
resize_modal: function(previous_height) {
var height = this.$modal.height() + 16;
var parent_height = this.$modal.parent().height();
if (height > parent_height && previous_height != height) {
var content_height = $('.NB-feedchooser-left', this.$modal).height() + 32;
var container_height = this.$modal.parent().height();
if (content_height > container_height && previous_height != content_height) {
var chooser_height = $('#NB-feedchooser-feeds').height();
var diff = Math.max(4, height - parent_height);
var diff = Math.max(4, content_height - container_height);
$('#NB-feedchooser-feeds').css({'max-height': chooser_height - diff});
_.defer(_.bind(function() { this.resize_modal(height); }, this), 1);
_.defer(_.bind(function() { this.resize_modal(content_height); }, this), 1);
}
},

View file

@ -50,7 +50,13 @@ NEWSBLUR.Views.SocialPageComment = Backbone.View.extend({
open_reply: function(options) {
options = options || {};
var current_user = NEWSBLUR.assets.user_profile;
if (NEWSBLUR.Globals.blurblog_protected && !NEWSBLUR.Globals.blurblog_following) {
var $error = this.$('.NB-story-comment-error');
$error.text("You must be following " + NEWSBLUR.Globals.blurblog_username + " to reply");
return;
}
var $form = $.make('div', { className: 'NB-story-comment-reply NB-story-comment-reply-form' }, [
$.make('img', { className: 'NB-story-comment-reply-photo', src: current_user.get('photo_url') }),
$.make('div', { className: 'NB-story-comment-username NB-story-comment-reply-username' }, current_user.get('username')),

View file

@ -30,7 +30,8 @@ NEWSBLUR.Views.SocialPageComments = Backbone.View.extend({
story: self.model,
story_comments_view: self,
story_view: self.story_view,
model: comment
model: comment,
public_comment: $comment.closest(".NB-story-comments-public").length
});
self.comment_views.push(comment_view);
});

View file

@ -56,7 +56,8 @@ NEWSBLUR.Views.SocialPageStory = Backbone.View.extend({
});
$sideoptions.append($(this.share_view.template({
story: this.model,
social_services: NEWSBLUR.assets.social_services
social_services: NEWSBLUR.assets.social_services,
profile: NEWSBLUR.assets.user_profile
})));
}, this), 50);
} else {

View file

@ -1,6 +1,4 @@
{% load utils_tags %}
{% block body %}{% endblock body %}
{% load utils_tags %}{% block body %}{% endblock body %}
-----------------------------------------------------------------------------

View file

@ -1,9 +1,11 @@
{% extends "mail/email_base.txt" %}
{% load utils_tags %}
{% block body %}Somebody wants to follow your Blurblog: {{ follower_profile.username }}.
{% block body %}You have a follow request: {{ follower_profile.username }}.
{{ follower_profile.blurblog_url }} - {{ follower_profile.shared_stories_count }} shared {{ follower_profile.shared_stories_count|pluralize:"story,stories" }} - {{ follower_profile.follower_count }} follower{{ follower_profile.follower_count|pluralize }}
Approve or ignore this follow request on NewsBlur: http://{% current_domain %}{{ user.profile.autologin_url }}
{% if common_followers %}
You follow {{ common_followers|length }} {{ common_followers|pluralize:"person,people" }} who follow{{ common_followers|pluralize:"s," }} {{ follower_profile.username }}:

View file

@ -1,15 +1,20 @@
{% extends "mail/email_base.xhtml" %}
{% load utils_tags %}
{% block body %}
<p style="font-size: 37px; color:#555555; margin-top: 18px;margin-bottom: 10px;padding-top:6px;">
Somebody wants to follow your Blurblog:
You have a follow request:
</p>
<div style="margin: 24px 0;font-size: 24px;text-align: center;">
<a href="{{ follower_profile.blurblog_url }}"><img src="{{ follower_profile.large_photo_url }}" style="max-width: 200px; max-height: 200px;margin: 0 auto;border-radius: 3px;border: none;"></a>
<div style="margin: 8px 0 0 0;font-weight: bold;"><a href="{{ follower_profile.blurblog_url }}" style="color: #404040;text-decoration: none">{{ follower_profile.username }}</a></div>
<div style="color: #AE5D15;font-size: 11px;text-transform: uppercase;margin: 4px 0;"><b>{{ follower_profile.shared_stories_count }}</b> shared {{ follower_profile.shared_stories_count|pluralize:"story,stories" }} &middot; <b>{{ follower_profile.follower_count }}</b> follower{{ follower_profile.follower_count|pluralize }}</div>
</div>
<p style="padding-top: 12px;">
Approve or ignore this follow request <a href="http://{% current_domain %}{{ user.profile.autologin_url }}">on NewsBlur</a>.
</p>
{% if common_followers %}
<div style="clear: both; overflow: hidden">
<p style="margin: 12px 0 12px;line-height: 16px;clear: both;">You follow {{ common_followers|length }} {{ common_followers|pluralize:"person,people" }} who follow{{ common_followers|pluralize:"s," }} {{ follower_profile.username }}:</p>

View file

@ -31,6 +31,8 @@
'user_id' : "{{ user.pk|safe }}",
'blurblog_user_id' : "{{ social_profile.user_id|safe }}",
'blurblog_username' : "{{ social_profile.username|safe }}",
'blurblog_protected': {{ social_profile.protected|yesno:"true,false" }},
'blurblog_following': {{ user_following_social_profile|yesno:"true,false" }},
'email' : "{{ user.email|safe }}",
'MEDIA_URL' : "{{ MEDIA_URL }}",
};

View file

@ -18,13 +18,20 @@
{% endif %}
<div class="NB-story-comment-date">{{ comment.shared_date }} ago</div>
<div class="NB-story-comment-reply-button">
<div class="NB-story-comment-reply-button-wrapper">reply</div>
<div class="NB-story-comment-reply-button-wrapper">
{% if comment.user.protected %}
<img src="{{ MEDIA_URL }}img/icons/silk/lock.png">
{% endif %}
reply
</div>
</div>
{% if comment.user_id == user.pk %}
<div class="NB-story-comment-edit-button">
<div class="NB-story-comment-edit-button-wrapper">edit</div>
</div>
{% endif %}
{# <div class="NB-story-comment-likes"></div> #}
<div class="NB-story-comment-error"></div>
<div class="NB-spinner"></div>
</div>
<div class="NB-story-comment-content">

View file

@ -31,17 +31,19 @@
</div>
</div>
{% if story.comment_count_public %}
<div class="NB-story-comments-public-header-wrapper">
<div class="NB-story-comments-public-header">
{{ story.comment_count_public }} public comment{{ story.comment_count_public|pluralize }}
<div class="NB-story-comments-public">
{% if story.comment_count_public %}
<div class="NB-story-comments-public-header-wrapper">
<div class="NB-story-comments-public-header">
{{ story.comment_count_public }} public comment{{ story.comment_count_public|pluralize }}
</div>
</div>
</div>
{% endif %}
{% endif %}
{% for comment in story.public_comments %}
{% render_story_comment story comment %}
{% endfor %}
{% for comment in story.public_comments %}
{% render_story_comment story comment %}
{% endfor %}
</div>
</div>