diff --git a/app/assets/javascripts/discourse/components/preference-checkbox.js.es6 b/app/assets/javascripts/discourse/components/preference-checkbox.js.es6
new file mode 100644
index 000000000..98dc57079
--- /dev/null
+++ b/app/assets/javascripts/discourse/components/preference-checkbox.js.es6
@@ -0,0 +1,7 @@
+export default Em.Component.extend({
+ classNames: ['controls'],
+
+ label: function() {
+ return I18n.t(this.get('labelKey'));
+ }.property('labelKey')
+});
diff --git a/app/assets/javascripts/discourse/controllers/composer.js.es6 b/app/assets/javascripts/discourse/controllers/composer.js.es6
index 486b851eb..fc5027a2f 100644
--- a/app/assets/javascripts/discourse/controllers/composer.js.es6
+++ b/app/assets/javascripts/discourse/controllers/composer.js.es6
@@ -155,8 +155,10 @@ export default Discourse.Controller.extend({
} else {
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) {
composer.set('disableDrafts', false);
bootbox.alert(error);
diff --git a/app/assets/javascripts/discourse/models/user.js b/app/assets/javascripts/discourse/models/user.js
index 4f1d57c7f..96ad0dd66 100644
--- a/app/assets/javascripts/discourse/models/user.js
+++ b/app/assets/javascripts/discourse/models/user.js
@@ -202,7 +202,8 @@ Discourse.User = Discourse.Model.extend({
'new_topic_duration_minutes',
'external_links_in_new_tab',
'mailing_list_mode',
- 'enable_quoting');
+ 'enable_quoting',
+ 'disable_jump_reply');
_.each(['muted','watched','tracked'], function(s){
var cats = user.get(s + 'Categories').map(function(c){ return c.get('id')});
diff --git a/app/assets/javascripts/discourse/templates/components/preference-checkbox.js.handlebars b/app/assets/javascripts/discourse/templates/components/preference-checkbox.js.handlebars
new file mode 100644
index 000000000..b47200bf5
--- /dev/null
+++ b/app/assets/javascripts/discourse/templates/components/preference-checkbox.js.handlebars
@@ -0,0 +1,4 @@
+
diff --git a/app/assets/javascripts/discourse/templates/user/preferences.js.handlebars b/app/assets/javascripts/discourse/templates/user/preferences.js.handlebars
index ecf5383f1..87d6f901a 100644
--- a/app/assets/javascripts/discourse/templates/user/preferences.js.handlebars
+++ b/app/assets/javascripts/discourse/templates/user/preferences.js.handlebars
@@ -136,34 +136,23 @@
-
+ {{preference-checkbox labelKey="user.email_digests.title" checked=email_digests}}
+ {{#if email_digests}}
+
+ {{combobox valueAttribute="value" content=digestFrequencies value=digest_after_days}}
+
+ {{/if}}
+ {{preference-checkbox labelKey="user.email_private_messages" checked=email_private_messages}}
+ {{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}}
-
-
- {{#if email_digests}}
-
- {{combobox valueAttribute="value" content=digestFrequencies value=digest_after_days}}
-
- {{/if}}
-
-
-
-
-
-
{{i18n user.email.frequency}}
-
@@ -175,22 +164,10 @@
{{combobox valueAttribute="value" content=considerNewTopicOptions value=new_topic_duration_minutes}}
-
-
-
-
-
-
-
-
-
-
-
+ {{preference-checkbox labelKey="user.external_links_in_new_tab" checked=external_links_in_new_tab}}
+ {{preference-checkbox labelKey="user.enable_quoting" checked=enable_quoting}}
+ {{preference-checkbox labelKey="user.dynamic_favicon" checked=dynamic_favicon}}
+ {{preference-checkbox labelKey="user.disable_jump_reply" checked=disable_jump_reply}}
diff --git a/app/serializers/current_user_serializer.rb b/app/serializers/current_user_serializer.rb
index 903043204..e643ce7b1 100644
--- a/app/serializers/current_user_serializer.rb
+++ b/app/serializers/current_user_serializer.rb
@@ -19,7 +19,8 @@ class CurrentUserSerializer < BasicUserSerializer
:no_password,
:can_delete_account,
:should_be_redirected_to_top,
- :redirected_to_top_reason
+ :redirected_to_top_reason,
+ :disable_jump_reply
def include_site_flagged_posts_count?
object.staff?
diff --git a/app/serializers/user_serializer.rb b/app/serializers/user_serializer.rb
index 2d0681ed7..ceafb8fa8 100644
--- a/app/serializers/user_serializer.rb
+++ b/app/serializers/user_serializer.rb
@@ -70,7 +70,8 @@ class UserSerializer < BasicUserSerializer
:muted_category_ids,
:tracked_category_ids,
:watched_category_ids,
- :private_messages_stats
+ :private_messages_stats,
+ :disable_jump_reply
def auto_track_topics_after_msecs
diff --git a/app/services/user_updater.rb b/app/services/user_updater.rb
index 025f0b376..62580bf0e 100644
--- a/app/services/user_updater.rb
+++ b/app/services/user_updater.rb
@@ -14,7 +14,8 @@ class UserUpdater
:external_links_in_new_tab,
:enable_quoting,
:dynamic_favicon,
- :mailing_list_mode
+ :mailing_list_mode,
+ :disable_jump_reply
]
def initialize(actor, user)
diff --git a/config/locales/client.en.yml b/config/locales/client.en.yml
index 83b0cd0ea..f5521e147 100644
--- a/config/locales/client.en.yml
+++ b/config/locales/client.en.yml
@@ -253,6 +253,7 @@ en:
invited_by: "Invited By"
trust_level: "Trust Level"
notifications: "Notifications"
+ disable_jump_reply: "Don't jump to your new post after replying"
dynamic_favicon: "Show incoming message notifications on favicon (experimental)"
external_links_in_new_tab: "Open all external links in a new tab"
enable_quoting: "Enable quote reply for highlighted text"
diff --git a/db/migrate/20140526201939_add_disable_jump_reply_to_users.rb b/db/migrate/20140526201939_add_disable_jump_reply_to_users.rb
new file mode 100644
index 000000000..84c6c8c0d
--- /dev/null
+++ b/db/migrate/20140526201939_add_disable_jump_reply_to_users.rb
@@ -0,0 +1,5 @@
+class AddDisableJumpReplyToUsers < ActiveRecord::Migration
+ def change
+ add_column :users, :disable_jump_reply, :boolean, default: false, null: false
+ end
+end