Skip to content

Commit 0fe5ecb

Browse files
committed
When there are 2000 or more posts, only show the post number on the progress bar
1 parent 13da653 commit 0fe5ecb

4 files changed

Lines changed: 12 additions & 3 deletions

File tree

app/assets/javascripts/discourse/controllers/topic_controller.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -293,6 +293,14 @@ Discourse.TopicController = Discourse.ObjectController.extend(Discourse.Selected
293293
return false;
294294
}.property('postStream.loaded', 'currentPost', 'postStream.filteredPostsCount'),
295295

296+
hugeNumberOfPosts: function() {
297+
return (this.get('postStream.filteredPostsCount') >= 1000);
298+
}.property('postStream.filteredPostsCount'),
299+
300+
progressPositionTitle: function() {
301+
return I18n.t("topic.progress.position", {current: this.get('progressPosition'), total: this.get('highest_post_number')});
302+
}.property('progressPosition', 'highest_post_number'),
303+
296304
deselectPost: function(post) {
297305
this.get('selectedPosts').removeObject(post);
298306

app/assets/javascripts/discourse/templates/topic.js.handlebars

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,8 @@
5151
<div id='topic-progress-wrapper' {{bindAttr class="dockedCounter:docked"}}>
5252
<nav id='topic-progress' title="{{i18n topic.progress.title}}" {{bindAttr class="hideProgress:hidden"}}>
5353
<button id='jump-top' title="{{i18n topic.progress.jump_top}}" {{bindAttr disabled="jumpTopDisabled"}} {{action jumpTop}}><i class="icon-circle-arrow-up"></i></button>
54-
<div class='nums'>
55-
<h4 title="{{i18n topic.progress.current}}">{{progressPosition}}</h4> <span>{{i18n of_value}}</span> <h4>{{highest_post_number}}</h4>
54+
<div class='nums' {{bindAttr title="progressPositionTitle"}}>
55+
<h4>{{progressPosition}}</h4><span {{bindAttr class="hugeNumberOfPosts:hidden"}}> <span>{{i18n of_value}}</span> <h4>{{highest_post_number}}</h4></span>
5656
</div>
5757
<button id='jump-bottom' title="{{i18n topic.progress.jump_bottom}}" {{bindAttr disabled="jumpBottomDisabled"}} {{action jumpBottom}}><i class="icon-circle-arrow-down"></i></button>
5858
<div class='bg'>&nbsp;</div>

app/assets/stylesheets/desktop/topic.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,8 +132,8 @@ a:hover.reply-new {
132132
border: 0;
133133
background: none;
134134
color: #666;
135-
width: 50%;
136135
text-align: left;
136+
width: 30px;
137137
height: 30px;
138138
margin: 0;
139139
i {

config/locales/client.en.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -674,6 +674,7 @@ en:
674674
jump_bottom: jump to last post
675675
total: total posts
676676
current: current post
677+
position: "post %{current} of %{total}"
677678

678679
notifications:
679680
title: ''

0 commit comments

Comments
 (0)