If there are pending posts in a topic, display a message at the bottom

This commit is contained in:
Robin Ward 2015-04-27 15:55:10 -04:00
parent ecafbb0a63
commit 8c930c97e0
5 changed files with 36 additions and 1 deletions

View file

@ -89,6 +89,17 @@
{{view 'topic-closing' topic=model}}
{{view 'topic-footer-buttons' topic=model}}
{{#if pending_posts_count}}
<div class='has-pending-posts'>
{{{i18n "queue.has_pending_posts" count=pending_posts_count}}}
{{#link-to 'queued-posts'}}
{{fa-icon 'check'}}
{{i18n 'queue.view_pending'}}
{{/link-to}}
</div>
{{/if}}
{{plugin-outlet "topic-above-suggested"}}
{{#if details.suggested_topics.length}}

View file

@ -41,3 +41,11 @@
}
}
.has-pending-posts {
padding: 0.5em;
background-color: dark-light-diff($highlight, $secondary, 50%, -70%);
a[href] {
float: right;
}
}

View file

@ -85,6 +85,7 @@ class Topic < ActiveRecord::Base
has_many :allowed_group_users, through: :allowed_groups, source: :users
has_many :allowed_groups, through: :topic_allowed_groups, source: :group
has_many :allowed_users, through: :topic_allowed_users, source: :user
has_many :queued_posts
has_one :top_topic
belongs_to :user
@ -271,6 +272,10 @@ class Topic < ActiveRecord::Base
Redcarpet::Render::SmartyPants.render(sanitized_title)
end
def pending_posts_count
queued_posts.new_count
end
# Returns hot topics since a date for display in email digest.
def self.for_digest(user, since, opts=nil)
opts = opts || {}

View file

@ -1,4 +1,5 @@
require_dependency 'pinned_check'
require_dependency 'new_post_manager'
class TopicViewSerializer < ApplicationSerializer
include PostStreamSerializerMixin
@ -30,7 +31,8 @@ class TopicViewSerializer < ApplicationSerializer
:slug,
:category_id,
:word_count,
:deleted_at
:deleted_at,
:pending_posts_count
attributes :draft,
:draft_key,
@ -206,4 +208,8 @@ class TopicViewSerializer < ApplicationSerializer
object.topic_user.try(:bookmarked)
end
def include_pending_posts_count
scope.user.staff? && NewPostManager.queue_enabled?
end
end

View file

@ -236,6 +236,11 @@ en:
none: "There are no posts to review."
edit: "Edit"
cancel: "Cancel"
view_pending: "view pending posts"
has_pending_posts:
one: "This topic has <b>1</b> post awaiting approval"
many: "This topic has <b>{{count}}</b> posts awaiting approval"
confirm: "Save Changes"
delete_prompt: "Are you sure you want to delete <b>%{username}</b>? This will remove all of their posts and block their email and ip address."