diff options
| author | Omar Roth <omarroth@hotmail.com> | 2018-03-03 15:10:56 -0600 |
|---|---|---|
| committer | Omar Roth <omarroth@hotmail.com> | 2018-03-03 15:10:56 -0600 |
| commit | 84c8fb9b99e0f5690f4cd0de825f261d31347b34 (patch) | |
| tree | ffb477a6824301b74388039a11b96324dbc7d036 | |
| parent | 24cea8f3e7b3b8fc8207e2f07b0715204b8079d7 (diff) | |
| download | invidious-84c8fb9b99e0f5690f4cd0de825f261d31347b34.tar.gz invidious-84c8fb9b99e0f5690f4cd0de825f261d31347b34.tar.bz2 invidious-84c8fb9b99e0f5690f4cd0de825f261d31347b34.zip | |
Separate with comma views, likes, dislikes
| -rw-r--r-- | src/helpers.cr | 4 | ||||
| -rw-r--r-- | src/views/watch.ecr | 6 |
2 files changed, 7 insertions, 3 deletions
diff --git a/src/helpers.cr b/src/helpers.cr index b3625b67..d0b6feec 100644 --- a/src/helpers.cr +++ b/src/helpers.cr @@ -320,3 +320,7 @@ def template_comments(root) return html end + +def number_with_separator(number) + number.to_s.reverse.gsub(/(\d{3})(?=\d)/, "\\1,").reverse +end diff --git a/src/views/watch.ecr b/src/views/watch.ecr index 1e15c156..4e75cc7e 100644 --- a/src/views/watch.ecr +++ b/src/views/watch.ecr @@ -81,9 +81,9 @@ function dismiss(target) { <div class="pure-g"> <div class="pure-u-1 pure-u-md-1-5"> - <p><i class="fa fa-eye" aria-hidden="true"></i> <%= video.views %></p> - <p><i class="fa fa-thumbs-up" aria-hidden="true"></i> <%= video.likes %></p> - <p><i class="fa fa-thumbs-down" aria-hidden="true"></i> <%= video.dislikes %></p> + <p><i class="fa fa-eye" aria-hidden="true"></i> <%= number_with_separator(video.views) %></p> + <p><i class="fa fa-thumbs-up" aria-hidden="true"></i> <%= number_with_separator(video.likes) %></p> + <p><i class="fa fa-thumbs-down" aria-hidden="true"></i> <%= number_with_separator(video.dislikes) %></p> <p id="Wilson">Wilson Score : <%= video.wilson_score.round(4) %></p> <p id="Rating">Rating : <%= rating.round(4) %> / 5</p> <p id="Engagement">Engagement : <%= engagement.round(2) %>%</p> |
