Add a site setting for when progress bar should only show post number. Default is 1000.

This commit is contained in:
Neil Lalonde 2013-12-05 17:03:31 -05:00
parent 79427732b2
commit 082f131b27
6 changed files with 18 additions and 9 deletions

View File

@ -294,12 +294,16 @@ Discourse.TopicController = Discourse.ObjectController.extend(Discourse.Selected
}.property('postStream.loaded', 'currentPost', 'postStream.filteredPostsCount'), }.property('postStream.loaded', 'currentPost', 'postStream.filteredPostsCount'),
hugeNumberOfPosts: function() { hugeNumberOfPosts: function() {
return (this.get('postStream.filteredPostsCount') >= 1000); return (this.get('postStream.filteredPostsCount') >= Discourse.SiteSettings.short_progress_text_threshold);
}.property('postStream.filteredPostsCount'), }.property('highest_post_number'),
progressPositionTitle: function() { jumpToBottomTitle: function() {
return I18n.t("topic.progress.position", {current: this.get('progressPosition'), total: this.get('highest_post_number')}); if (this.get('hugeNumberOfPosts')) {
}.property('progressPosition', 'highest_post_number'), return I18n.t('topic.progress.jump_bottom_with_number', {post_number: this.get('highest_post_number')});
} else {
return I18n.t('topic.progress.jump_bottom');
}
}.property('hugeNumberOfPosts', 'highest_post_number'),
deselectPost: function(post) { deselectPost: function(post) {
this.get('selectedPosts').removeObject(post); this.get('selectedPosts').removeObject(post);

View File

@ -52,9 +52,9 @@
<nav id='topic-progress' title="{{i18n topic.progress.title}}" {{bindAttr class="hideProgress:hidden"}}> <nav id='topic-progress' title="{{i18n topic.progress.title}}" {{bindAttr class="hideProgress:hidden"}}>
<button id='jump-top' title="{{i18n topic.progress.jump_top}}" {{bindAttr disabled="jumpTopDisabled"}} {{action jumpTop}}><i class="icon-circle-arrow-up"></i></button> <button id='jump-top' title="{{i18n topic.progress.jump_top}}" {{bindAttr disabled="jumpTopDisabled"}} {{action jumpTop}}><i class="icon-circle-arrow-up"></i></button>
<div class='nums' {{bindAttr title="progressPositionTitle"}}> <div class='nums' {{bindAttr title="progressPositionTitle"}}>
<h4>{{progressPosition}}</h4><span {{bindAttr class="hugeNumberOfPosts:hidden"}}> <span>{{i18n of_value}}</span> <h4>{{postStream.filteredPostsCount}}</h4></span> <h4>{{progressPosition}}</h4><span {{bindAttr class="hugeNumberOfPosts:hidden"}}> <span>{{i18n of_value}}</span> <h4>{{highest_post_number}}</h4></span>
</div> </div>
<button id='jump-bottom' title="{{i18n topic.progress.jump_bottom}}" {{bindAttr disabled="jumpBottomDisabled"}} {{action jumpBottom}}><i class="icon-circle-arrow-down"></i></button> <button id='jump-bottom' {{bindAttr title="jumpToBottomTitle"}} {{bindAttr disabled="jumpBottomDisabled"}} {{action jumpBottom}}><i class="icon-circle-arrow-down"></i></button>
<div class='bg'>&nbsp;</div> <div class='bg'>&nbsp;</div>
</nav> </nav>
</div> </div>

View File

@ -132,8 +132,8 @@ a:hover.reply-new {
border: 0; border: 0;
background: none; background: none;
color: #666; color: #666;
width: 50%;
text-align: left; text-align: left;
width: 30px;
height: 30px; height: 30px;
margin: 0; margin: 0;
i { i {

View File

@ -672,6 +672,7 @@ en:
title: topic progress title: topic progress
jump_top: jump to first post jump_top: jump to first post
jump_bottom: jump to last post jump_bottom: jump to last post
jump_bottom_with_number: "jump to post %{post_number}"
total: total posts total: total posts
current: current post current: current post
position: "post %{current} of %{total}" position: "post %{current} of %{total}"

View File

@ -734,6 +734,7 @@ en:
enable_names: "Allow users to show their full names" enable_names: "Allow users to show their full names"
display_name_on_posts: "Also show a user's full name on their posts" display_name_on_posts: "Also show a user's full name on their posts"
invites_shown: "Maximum invites shown on a user page" invites_shown: "Maximum invites shown on a user page"
short_progress_text_threshold: "After the number of posts in a topic goes above this number, the progress bar will only show the current post number. If you change the progress bar's width, you may need to change this value."
notification_types: notification_types:
mentioned: "%{display_username} mentioned you in %{link}" mentioned: "%{display_username} mentioned you in %{link}"

View File

@ -197,6 +197,9 @@ posting:
display_name_on_posts: display_name_on_posts:
client: true client: true
default: false default: false
short_progress_text_threshold:
client: true
default: 1000
email: email:
email_time_window_mins: 10 email_time_window_mins: 10