mirror of
https://github.com/samuelclay/NewsBlur.git
synced 2025-09-18 21:50:56 +00:00
Cleaning up sharing from blurblog. Handling error case gracefully. Also cleaning up when unsharing and no shared comments are left to display.
This commit is contained in:
parent
b2f94dc52c
commit
c817d52193
3 changed files with 51 additions and 47 deletions
|
@ -83,7 +83,9 @@ NEWSBLUR.Views.StoryShareView = Backbone.View.extend({
|
|||
}
|
||||
} else {
|
||||
// Open/resize
|
||||
this.$('.NB-error').remove();
|
||||
if (!options.resize_open) {
|
||||
this.$('.NB-error').remove();
|
||||
}
|
||||
$sideoption.addClass('NB-active');
|
||||
$unshare_button.toggleClass('NB-hidden', !this.model.get("shared"));
|
||||
$twitter_button.toggleClass('NB-active', !!NEWSBLUR.assets.preference('post_to_twitter'));
|
||||
|
@ -143,7 +145,7 @@ NEWSBLUR.Views.StoryShareView = Backbone.View.extend({
|
|||
mark_story_as_shared: function(options) {
|
||||
options = options || {};
|
||||
var $share_button = this.$('.NB-sideoption-share-save');
|
||||
var $share_button_menu = $('.NB-menu-manage-story-share-save');
|
||||
var $share_button_menu = $('.NB-menu-manage .NB-menu-manage-story-share-save');
|
||||
var $share_menu = $share_button_menu.closest('.NB-sideoption-share');
|
||||
var $comments_sideoptions = this.$('.NB-sideoption-share-comments');
|
||||
var $comments_menu = $('.NB-sideoption-share-comments', $share_menu);
|
||||
|
@ -202,7 +204,7 @@ NEWSBLUR.Views.StoryShareView = Backbone.View.extend({
|
|||
$share_sideoption.text(shared_text).closest('.NB-sideoption');
|
||||
|
||||
if (this.options.on_social_page) {
|
||||
this.$('.NB-story-comments').replaceWith(data);
|
||||
this.$('.NB-story-comments-container').html(data);
|
||||
} else {
|
||||
this.model.story_view.$el.toggleClass('NB-story-shared', this.model.get('shared'));
|
||||
this.model.story_view.render_comments();
|
||||
|
@ -237,9 +239,8 @@ NEWSBLUR.Views.StoryShareView = Backbone.View.extend({
|
|||
post_share_error: function(data, shared) {
|
||||
var $share_button = this.$('.NB-sideoption-share-save');
|
||||
var $unshare_button = this.$('.NB-sideoption-share-unshare');
|
||||
var $share_button_menu = $('.NB-menu-manage-story-share-save');
|
||||
var $share_button_menu = $('.NB-menu-manage .NB-menu-manage-story-share-save');
|
||||
var message = data && data.message || ("Sorry, this story could not be " + (shared ? "" : "un") + "shared. Probably a bug.");
|
||||
console.log(["post_share_error", data, shared, message]);
|
||||
|
||||
if (!NEWSBLUR.Globals.is_authenticated) {
|
||||
message = "You need to be logged in to share a story.";
|
||||
|
@ -257,6 +258,7 @@ NEWSBLUR.Views.StoryShareView = Backbone.View.extend({
|
|||
$share_button_menu.after($error.clone());
|
||||
}
|
||||
this.toggle_feed_story_share_dialog({'resize_open': true});
|
||||
console.log(["post_share_error", data, shared, message, $share_button, $unshare_button, $share_button_menu, $error]);
|
||||
},
|
||||
|
||||
update_share_button_label: function() {
|
||||
|
|
|
@ -149,9 +149,11 @@
|
|||
</div>
|
||||
</div>
|
||||
|
||||
<div class="NB-story-comments-container">
|
||||
{% if story.share_count %}
|
||||
{% render_story_share story %}
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% endfor %}
|
||||
|
|
|
@ -1,51 +1,51 @@
|
|||
{% load social_tags %}
|
||||
|
||||
|
||||
{% if story.share_count %}
|
||||
<div class="NB-story-comments">
|
||||
{% if story.share_count %}
|
||||
<div class="NB-story-comments-shares-teaser-wrapper">
|
||||
<div class="NB-story-comments-shares-teaser">
|
||||
{% if story.share_count %}
|
||||
<div class="NB-right">
|
||||
Shared by
|
||||
<b>{{ story.share_count }}</b>
|
||||
{{ story.share_count|pluralize:"person, people" }}
|
||||
<div class="NB-story-comments-shares-teaser-wrapper">
|
||||
<div class="NB-story-comments-shares-teaser">
|
||||
{% if story.share_count %}
|
||||
<div class="NB-right">
|
||||
Shared by
|
||||
<b>{{ story.share_count }}</b>
|
||||
{{ story.share_count|pluralize:"person, people" }}
|
||||
</div>
|
||||
{% if story.share_count_public %}
|
||||
<div class="NB-story-share-profiles NB-story-share-profiles-public">
|
||||
{% for share_user in story.shared_by_public %}
|
||||
<a href="{{ share_user.feed_link }}" class="NB-user-avatar" title="{{ share_user.username }}">
|
||||
<img src="{{ share_user.photo_url }}">
|
||||
</a>
|
||||
{% endfor %}
|
||||
</div>
|
||||
{% if story.share_count_public %}
|
||||
<div class="NB-story-share-profiles NB-story-share-profiles-public">
|
||||
{% for share_user in story.shared_by_public %}
|
||||
<a href="{{ share_user.feed_link }}" class="NB-user-avatar" title="{{ share_user.username }}">
|
||||
<img src="{{ share_user.photo_url }}">
|
||||
</a>
|
||||
{% endfor %}
|
||||
</div>
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
{% if story.share_count %}
|
||||
{% if story.share_count_friends %}
|
||||
<div class="NB-story-share-label">Shared by: </div>
|
||||
<div class="NB-story-share-profiles NB-story-share-profiles-friends">
|
||||
{% for share_user in story.shared_by_friends %}
|
||||
<a href="{{ share_user.feed_link }}" class="NB-user-avatar" title="{{ share_user.username }}">
|
||||
<img src="{{ share_user.photo_url }}">
|
||||
</a>
|
||||
{% endfor %}
|
||||
</div>
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
{% if story.share_count %}
|
||||
{% if story.share_count_friends %}
|
||||
<div class="NB-story-share-label">Shared by: </div>
|
||||
<div class="NB-story-share-profiles NB-story-share-profiles-friends">
|
||||
{% for share_user in story.shared_by_friends %}
|
||||
<a href="{{ share_user.feed_link }}" class="NB-user-avatar" title="{{ share_user.username }}">
|
||||
<img src="{{ share_user.photo_url }}">
|
||||
</a>
|
||||
{% endfor %}
|
||||
</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
|
||||
{% render_story_comments story %}
|
||||
|
||||
{% if story.comment_count_public %}
|
||||
<div class="NB-story-comments-public-teaser-wrapper">
|
||||
<div class="NB-story-comments-public-teaser">
|
||||
There {{ story.comment_count_public|pluralize:"is,are" }} {{ story.comment_count_public}} public comment{{ story.comment_count_public|pluralize }}
|
||||
</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{% render_story_comments story %}
|
||||
|
||||
{% if story.comment_count_public %}
|
||||
<div class="NB-story-comments-public-teaser-wrapper">
|
||||
<div class="NB-story-comments-public-teaser">
|
||||
There {{ story.comment_count_public|pluralize:"is,are" }} {{ story.comment_count_public}} public comment{{ story.comment_count_public|pluralize }}
|
||||
</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue