New Setting: Don't jump to new posts when replying

This commit is contained in:
Robin Ward 2014-05-26 16:39:03 -04:00
parent 7900c7bd2f
commit 5284fb7cbc
10 changed files with 42 additions and 42 deletions

View file

@ -0,0 +1,7 @@
export default Em.Component.extend({
classNames: ['controls'],
label: function() {
return I18n.t(this.get('labelKey'));
}.property('labelKey')
});

View file

@ -155,8 +155,10 @@ export default Discourse.Controller.extend({
} else { } else {
currentUser.set('reply_count', currentUser.get('reply_count') + 1); currentUser.set('reply_count', currentUser.get('reply_count') + 1);
} }
Discourse.URL.routeTo(opts.post.get('url'));
if ((!composer.get('replyingToTopic')) || (!Discourse.User.currentProp('disable_jump_reply'))) {
Discourse.URL.routeTo(opts.post.get('url'));
}
}, function(error) { }, function(error) {
composer.set('disableDrafts', false); composer.set('disableDrafts', false);
bootbox.alert(error); bootbox.alert(error);

View file

@ -202,7 +202,8 @@ Discourse.User = Discourse.Model.extend({
'new_topic_duration_minutes', 'new_topic_duration_minutes',
'external_links_in_new_tab', 'external_links_in_new_tab',
'mailing_list_mode', 'mailing_list_mode',
'enable_quoting'); 'enable_quoting',
'disable_jump_reply');
_.each(['muted','watched','tracked'], function(s){ _.each(['muted','watched','tracked'], function(s){
var cats = user.get(s + 'Categories').map(function(c){ return c.get('id')}); var cats = user.get(s + 'Categories').map(function(c){ return c.get('id')});

View file

@ -0,0 +1,4 @@
<label class='checkbox-label'>
{{input type="checkbox" checked=checked}}
{{label}}
</label>

View file

@ -136,34 +136,23 @@
<div class="control-group"> <div class="control-group">
<label class="control-label">{{i18n user.email_settings}}</label> <label class="control-label">{{i18n user.email_settings}}</label>
<div class="controls"> {{preference-checkbox labelKey="user.email_digests.title" checked=email_digests}}
<label class="checkbox-label">{{view Ember.Checkbox checkedBinding="email_digests"}}
{{i18n user.email_digests.title}}</label>
{{#if email_digests}} {{#if email_digests}}
<div class='control-indent'> <div class='controls control-dropdown'>
{{combobox valueAttribute="value" content=digestFrequencies value=digest_after_days}} {{combobox valueAttribute="value" content=digestFrequencies value=digest_after_days}}
</div> </div>
{{/if}} {{/if}}
<label class="checkbox-label">{{view Ember.Checkbox checkedBinding="email_private_messages"}} {{preference-checkbox labelKey="user.email_private_messages" checked=email_private_messages}}
{{i18n user.email_private_messages}}</label> {{preference-checkbox labelKey="user.email_direct" checked=email_direct}}
{{preference-checkbox labelKey="user.mailing_list_mode" checked=mailing_list_mode}}
{{preference-checkbox labelKey="user.email_always" checked=email_always}}
<label class="checkbox-label">{{view Ember.Checkbox checkedBinding="email_direct"}}
{{i18n user.email_direct}}</label>
<label class="checkbox-label">
{{view Ember.Checkbox checkedBinding="mailing_list_mode"}}
{{i18n user.mailing_list_mode}}</label>
<label class="checkbox-label">{{view Ember.Checkbox checkedBinding="email_always"}}
{{i18n user.email_always}}</label>
</div>
<div class='instructions'> <div class='instructions'>
{{i18n user.email.frequency}} {{i18n user.email.frequency}}
</div> </div>
</div> </div>
<div class="control-group other"> <div class="control-group other">
<label class="control-label">{{i18n user.other_settings}}</label> <label class="control-label">{{i18n user.other_settings}}</label>
<div class="controls controls-dropdown"> <div class="controls controls-dropdown">
<label>{{i18n user.auto_track_topics}}</label> <label>{{i18n user.auto_track_topics}}</label>
@ -175,22 +164,10 @@
{{combobox valueAttribute="value" content=considerNewTopicOptions value=new_topic_duration_minutes}} {{combobox valueAttribute="value" content=considerNewTopicOptions value=new_topic_duration_minutes}}
</div> </div>
<div class="controls"> {{preference-checkbox labelKey="user.external_links_in_new_tab" checked=external_links_in_new_tab}}
<label class="checkbox-label">{{view Ember.Checkbox checkedBinding="external_links_in_new_tab"}} {{preference-checkbox labelKey="user.enable_quoting" checked=enable_quoting}}
{{i18n user.external_links_in_new_tab}}</label> {{preference-checkbox labelKey="user.dynamic_favicon" checked=dynamic_favicon}}
</div> {{preference-checkbox labelKey="user.disable_jump_reply" checked=disable_jump_reply}}
<div class="controls">
<label class="checkbox-label">{{view Ember.Checkbox checkedBinding="enable_quoting"}}
{{i18n user.enable_quoting}}</label>
</div>
<div class="controls">
<label class='checkbox-label'>
{{view Ember.Checkbox checkedBinding="dynamic_favicon"}}
{{i18n user.dynamic_favicon}}
</label>
</div>
</div> </div>
<div class="control-group category"> <div class="control-group category">

View file

@ -19,7 +19,8 @@ class CurrentUserSerializer < BasicUserSerializer
:no_password, :no_password,
:can_delete_account, :can_delete_account,
:should_be_redirected_to_top, :should_be_redirected_to_top,
:redirected_to_top_reason :redirected_to_top_reason,
:disable_jump_reply
def include_site_flagged_posts_count? def include_site_flagged_posts_count?
object.staff? object.staff?

View file

@ -70,7 +70,8 @@ class UserSerializer < BasicUserSerializer
:muted_category_ids, :muted_category_ids,
:tracked_category_ids, :tracked_category_ids,
:watched_category_ids, :watched_category_ids,
:private_messages_stats :private_messages_stats,
:disable_jump_reply
def auto_track_topics_after_msecs def auto_track_topics_after_msecs

View file

@ -14,7 +14,8 @@ class UserUpdater
:external_links_in_new_tab, :external_links_in_new_tab,
:enable_quoting, :enable_quoting,
:dynamic_favicon, :dynamic_favicon,
:mailing_list_mode :mailing_list_mode,
:disable_jump_reply
] ]
def initialize(actor, user) def initialize(actor, user)

View file

@ -253,6 +253,7 @@ en:
invited_by: "Invited By" invited_by: "Invited By"
trust_level: "Trust Level" trust_level: "Trust Level"
notifications: "Notifications" notifications: "Notifications"
disable_jump_reply: "Don't jump to your new post after replying"
dynamic_favicon: "Show incoming message notifications on favicon (experimental)" dynamic_favicon: "Show incoming message notifications on favicon (experimental)"
external_links_in_new_tab: "Open all external links in a new tab" external_links_in_new_tab: "Open all external links in a new tab"
enable_quoting: "Enable quote reply for highlighted text" enable_quoting: "Enable quote reply for highlighted text"

View file

@ -0,0 +1,5 @@
class AddDisableJumpReplyToUsers < ActiveRecord::Migration
def change
add_column :users, :disable_jump_reply, :boolean, default: false, null: false
end
end