FEATURE: show bookmarked topics in topic list

This commit is contained in:
Sam 2015-01-09 11:41:10 +11:00
parent 7124456ae4
commit 1358ed2aad
6 changed files with 23 additions and 4 deletions

View file

@ -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>

View file

@ -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>

View file

@ -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'});
}

View file

@ -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;

View file

@ -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

View file

@ -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: