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