mirror of
https://github.com/davegallant/rfd-fyi.git
synced 2025-08-07 00:58:12 +00:00
Add colour to score
This commit is contained in:
@@ -100,7 +100,6 @@ func (a *App) refreshTopics() {
|
||||
func (a *App) updateScores(t []Topic) []Topic {
|
||||
for i := range t {
|
||||
t[i].Score = t[i].Votes.Up - t[i].Votes.Down
|
||||
log.Debug().Msgf("Added score: %d", t[i].Score)
|
||||
}
|
||||
return t
|
||||
}
|
||||
|
10
src/App.vue
10
src/App.vue
@@ -38,7 +38,15 @@
|
||||
v-html="highlightMatches(topic.title)"
|
||||
></a>
|
||||
</td>
|
||||
<td scope="col">{{ topic.score }}</td>
|
||||
<td v-if="topic.score > 0" scope="col" class="green-score">
|
||||
+{{ topic.score }}
|
||||
</td>
|
||||
<td v-if="topic.score < 0" scope="col" class="red-score">
|
||||
{{ topic.score }}
|
||||
</td>
|
||||
<td v-if="topic.score == 0" scope="col">
|
||||
{{ topic.score }}
|
||||
</td>
|
||||
<td scope="col">{{ topic.total_views }}</td>
|
||||
<td scope="col">{{ formatDate(topic.last_post_time) }}</td>
|
||||
</tr>
|
||||
|
@@ -199,3 +199,11 @@ footer {
|
||||
.footer-right {
|
||||
float: right;
|
||||
}
|
||||
|
||||
.green-score {
|
||||
color: rgb(22, 120, 63);
|
||||
}
|
||||
|
||||
.red-score {
|
||||
color: rgb(175, 21, 21);
|
||||
}
|
||||
|
Reference in New Issue
Block a user