mirror of
https://github.com/codeninjasllc/discourse.git
synced 2024-11-23 23:58:31 -05:00
FEATURE: show bookmarked topics in topic list
This commit is contained in:
parent
7124456ae4
commit
1358ed2aad
6 changed files with 23 additions and 4 deletions
|
@ -12,7 +12,6 @@
|
|||
{{#if expandPinned}}
|
||||
{{raw "list/topic-excerpt" topic=topic}}
|
||||
{{/if}}
|
||||
{{raw "list/action-list" topic=topic postNumbers=topic.bookmarked_post_numbers className="bookmarks" icon="bookmark"}}
|
||||
{{raw "list/action-list" topic=topic postNumbers=topic.liked_post_numbers className="likes" icon="heart"}}
|
||||
</td>
|
||||
|
||||
|
|
|
@ -2,7 +2,11 @@
|
|||
<div class='topic-statuses'>
|
||||
{{/if ~}}
|
||||
{{~#each status in view.statuses ~}}
|
||||
{{~#if status.href ~}}
|
||||
<a href='{{status.href}}' title='{{status.title}}' class='topic-status'><i class='fa fa-{{status.icon}}'></i></a>
|
||||
{{~else ~}}
|
||||
<{{status.openTag}} title='{{status.title}}' class='topic-status'><i class='fa fa-{{status.icon}}'></i></{{status.closeTag}}>
|
||||
{{~/if ~}}
|
||||
{{~/each}}
|
||||
{{~#if view.renderDiv ~}}
|
||||
</div>
|
||||
|
|
|
@ -13,6 +13,15 @@ export default Ember.Object.extend({
|
|||
results.push({icon: 'envelope', key: 'warning'});
|
||||
}
|
||||
|
||||
if(topic.get('bookmarked')){
|
||||
var url = topic.get('url');
|
||||
var postNumbers = topic.get('bookmarked_post_numbers');
|
||||
if(postNumbers && postNumbers[0] > 1) {
|
||||
url += '/' + postNumbers[0];
|
||||
}
|
||||
results.push({icon: 'bookmark', key: 'bookmarked', href: url});
|
||||
}
|
||||
|
||||
if(topic.get('closed')){
|
||||
results.push({icon: 'lock', key: 'locked'});
|
||||
}
|
||||
|
|
|
@ -45,7 +45,7 @@
|
|||
.fa-thumb-tack {color: $primary;}
|
||||
.fa-thumb-tack.unpinned {color: $primary;}
|
||||
a.title {color: $primary;}
|
||||
a.title:visited:not(.badge-notification) {color: scale-color($primary, $lightness: 35%);}
|
||||
a.title:visited:not(.badge-notification), .fa-bookmark {color: scale-color($primary, $lightness: 35%);}
|
||||
th,
|
||||
td {
|
||||
padding: 12px 5px;
|
||||
|
|
|
@ -44,10 +44,10 @@ class TopicList
|
|||
@topics = @topics_input.to_a
|
||||
|
||||
# Attach some data for serialization to each topic
|
||||
@topic_lookup = TopicUser.lookup_for(@current_user, @topics) if @current_user.present?
|
||||
@topic_lookup = TopicUser.lookup_for(@current_user, @topics) if @current_user
|
||||
|
||||
post_action_type =
|
||||
if @current_user.present?
|
||||
if @current_user
|
||||
if @opts[:filter].present?
|
||||
if @opts[:filter] == "bookmarked"
|
||||
PostActionType.types[:bookmark]
|
||||
|
@ -57,6 +57,11 @@ class TopicList
|
|||
end
|
||||
end
|
||||
|
||||
# Include bookmarks if you have bookmarked topics
|
||||
if @current_user && !post_action_type
|
||||
post_action_type = PostActionType.types[:bookmark] if @topic_lookup.any?{|_,tu| tu && tu.bookmarked}
|
||||
end
|
||||
|
||||
# Data for bookmarks or likes
|
||||
post_action_lookup = PostAction.lookup_for(@current_user, @topics, post_action_type) if post_action_type
|
||||
|
||||
|
|
|
@ -1367,6 +1367,8 @@ en:
|
|||
topic_statuses:
|
||||
warning:
|
||||
help: "This is an official warning."
|
||||
bookmarked:
|
||||
help: "You bookmarked this topic"
|
||||
locked:
|
||||
help: "This topic is closed; it no longer accepts new replies"
|
||||
archived:
|
||||
|
|
Loading…
Reference in a new issue