UX: '.visited' wasn't applied in categories view and suggested topics

This commit is contained in:
Régis Hanol 2017-09-11 16:42:51 +02:00
parent 81e576ae37
commit 5a51953c8e
6 changed files with 19 additions and 20 deletions

View File

@ -4,10 +4,5 @@ import computed from 'ember-addons/ember-computed-decorators';
export default Ember.Component.extend({ export default Ember.Component.extend({
click: showEntrance, click: showEntrance,
attributeBindings: ['topic.id:data-topic-id'], attributeBindings: ['topic.id:data-topic-id'],
classNameBindings: [':latest-topic-list-item', 'topic.archived', 'visited'], classNameBindings: [':latest-topic-list-item', 'topic.archived', 'topic.visited']
@computed('topic.last_read_post_number', 'topic.highest_post_number')
visited(lastReadPost, highestPostNumber) {
return lastReadPost === highestPostNumber;
},
}); });

View File

@ -2,6 +2,6 @@ import { showEntrance } from 'discourse/components/topic-list-item';
export default Ember.Component.extend({ export default Ember.Component.extend({
tagName: 'tr', tagName: 'tr',
classNameBindings: [':category-topic-link', 'topic.archived'], classNameBindings: [':category-topic-link', 'topic.archived', 'topic.visited'],
click: showEntrance click: showEntrance
}); });

View File

@ -23,7 +23,7 @@ export function showEntrance(e) {
export default Ember.Component.extend(bufferedRender({ export default Ember.Component.extend(bufferedRender({
rerenderTriggers: ['bulkSelectEnabled', 'topic.pinned'], rerenderTriggers: ['bulkSelectEnabled', 'topic.pinned'],
tagName: 'tr', tagName: 'tr',
classNameBindings: [':topic-list-item', 'unboundClassNames', 'visited'], classNameBindings: [':topic-list-item', 'unboundClassNames', 'topic.visited'],
attributeBindings: ['data-topic-id'], attributeBindings: ['data-topic-id'],
'data-topic-id': Em.computed.alias('topic.id'), 'data-topic-id': Em.computed.alias('topic.id'),
@ -40,11 +40,6 @@ export default Ember.Component.extend(bufferedRender({
} }
}, },
@computed('topic.last_read_post_number', 'topic.highest_post_number')
visited(lastReadPost, highestPostNumber) {
return lastReadPost === highestPostNumber;
},
@computed('topic', 'lastVisitedTopic') @computed('topic', 'lastVisitedTopic')
unboundClassNames(topic, lastVisitedTopic) { unboundClassNames(topic, lastVisitedTopic) {
let classes = []; let classes = [];

View File

@ -33,6 +33,11 @@ const Topic = RestModel.extend({
message: null, message: null,
errorLoading: false, errorLoading: false,
@computed('last_read_post_number', 'highest_post_number')
visited(lastReadPostNumber, highestPostNumber) {
return lastReadPostNumber === highestPostNumber;
},
@computed('posters.firstObject') @computed('posters.firstObject')
creator(poster){ creator(poster){
return poster && poster.user; return poster && poster.user;

View File

@ -3,7 +3,7 @@
<table class="topic-list"> <table class="topic-list">
<tbody> <tbody>
{{#each topics as |t|}} {{#each topics as |t|}}
<tr class="{{if t.archived 'archived'}}" data-topic-id={{t.id}}> <tr class="{{if t.archived 'archived'}} {{if t.visited 'visited'}}" data-topic-id={{t.id}}>
<td> <td>
<div class='main-link'> <div class='main-link'>
{{topic-status topic=t}} {{topic-status topic=t}}

View File

@ -25,9 +25,13 @@
} }
} }
html.anon .topic-list a.title:visited:not(.badge-notification) {color: $primary-medium; } html.anon .topic-list,
.topic-list-item.visited a.title:not(.badge-notification) {color: $primary-medium; } .topic-list-item.visited,
.latest-topic-list-item.visited a.title:not(.badge-notification) {color: $primary-medium; } .latest-topic-list-item.visited,
.category-topic-link.visited,
#suggested-topics .topic-list tr.visited {
a.title:not(.badge-notification) { color: $primary-medium; }
}
.topic-list-main-link { .topic-list-main-link {
font-size: 1.143em; font-size: 1.143em;