FEATURE: show bookmarked topics in topic list
This commit is contained in:
parent
7124456ae4
commit
1358ed2aad
|
@ -12,7 +12,6 @@
|
||||||
{{#if expandPinned}}
|
{{#if expandPinned}}
|
||||||
{{raw "list/topic-excerpt" topic=topic}}
|
{{raw "list/topic-excerpt" topic=topic}}
|
||||||
{{/if}}
|
{{/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"}}
|
{{raw "list/action-list" topic=topic postNumbers=topic.liked_post_numbers className="likes" icon="heart"}}
|
||||||
</td>
|
</td>
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,11 @@
|
||||||
<div class='topic-statuses'>
|
<div class='topic-statuses'>
|
||||||
{{/if ~}}
|
{{/if ~}}
|
||||||
{{~#each status in view.statuses ~}}
|
{{~#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}}>
|
<{{status.openTag}} title='{{status.title}}' class='topic-status'><i class='fa fa-{{status.icon}}'></i></{{status.closeTag}}>
|
||||||
|
{{~/if ~}}
|
||||||
{{~/each}}
|
{{~/each}}
|
||||||
{{~#if view.renderDiv ~}}
|
{{~#if view.renderDiv ~}}
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -13,6 +13,15 @@ export default Ember.Object.extend({
|
||||||
results.push({icon: 'envelope', key: 'warning'});
|
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')){
|
if(topic.get('closed')){
|
||||||
results.push({icon: 'lock', key: 'locked'});
|
results.push({icon: 'lock', key: 'locked'});
|
||||||
}
|
}
|
||||||
|
|
|
@ -45,7 +45,7 @@
|
||||||
.fa-thumb-tack {color: $primary;}
|
.fa-thumb-tack {color: $primary;}
|
||||||
.fa-thumb-tack.unpinned {color: $primary;}
|
.fa-thumb-tack.unpinned {color: $primary;}
|
||||||
a.title {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,
|
th,
|
||||||
td {
|
td {
|
||||||
padding: 12px 5px;
|
padding: 12px 5px;
|
||||||
|
|
|
@ -44,10 +44,10 @@ class TopicList
|
||||||
@topics = @topics_input.to_a
|
@topics = @topics_input.to_a
|
||||||
|
|
||||||
# Attach some data for serialization to each topic
|
# 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 =
|
post_action_type =
|
||||||
if @current_user.present?
|
if @current_user
|
||||||
if @opts[:filter].present?
|
if @opts[:filter].present?
|
||||||
if @opts[:filter] == "bookmarked"
|
if @opts[:filter] == "bookmarked"
|
||||||
PostActionType.types[:bookmark]
|
PostActionType.types[:bookmark]
|
||||||
|
@ -57,6 +57,11 @@ class TopicList
|
||||||
end
|
end
|
||||||
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
|
# Data for bookmarks or likes
|
||||||
post_action_lookup = PostAction.lookup_for(@current_user, @topics, post_action_type) if post_action_type
|
post_action_lookup = PostAction.lookup_for(@current_user, @topics, post_action_type) if post_action_type
|
||||||
|
|
||||||
|
|
|
@ -1367,6 +1367,8 @@ en:
|
||||||
topic_statuses:
|
topic_statuses:
|
||||||
warning:
|
warning:
|
||||||
help: "This is an official warning."
|
help: "This is an official warning."
|
||||||
|
bookmarked:
|
||||||
|
help: "You bookmarked this topic"
|
||||||
locked:
|
locked:
|
||||||
help: "This topic is closed; it no longer accepts new replies"
|
help: "This topic is closed; it no longer accepts new replies"
|
||||||
archived:
|
archived:
|
||||||
|
|
Loading…
Reference in New Issue