mirror of
https://github.com/codeninjasllc/discourse.git
synced 2024-11-27 09:36:19 -05:00
added options to disable quoting and open links in new tabs
fixed a some regressions removed some dead code fixed messages about constants being re-defined
This commit is contained in:
parent
5a2d8e344f
commit
38f185355d
16 changed files with 64 additions and 2072 deletions
|
@ -93,7 +93,14 @@ Discourse.ClickTrack = {
|
|||
}
|
||||
|
||||
// Otherwise, use a custom URL with a redirect
|
||||
if (Discourse.get('currentUser.external_links_in_new_tab')) {
|
||||
var win = window.open(trackingUrl, '_blank');
|
||||
win.focus();
|
||||
}
|
||||
else {
|
||||
window.location = trackingUrl;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
|
|
@ -65,7 +65,7 @@ Discourse.PreferencesController = Discourse.ObjectController.extend({
|
|||
Discourse.currentUser.set('name', model.get('name'));
|
||||
}
|
||||
|
||||
_this.set('content.bio_cooked', Discourse.Utilities.cook(_this.get('content.bio_raw')));
|
||||
_this.set('content.bio_cooked', Discourse.Markdown.cook(_this.get('content.bio_raw')));
|
||||
return _this.set('saved', true);
|
||||
} else {
|
||||
return alert('failed');
|
||||
|
|
|
@ -407,7 +407,7 @@ Discourse.TopicController = Discourse.ObjectController.extend({
|
|||
if (Discourse.get('currentUser.moderator')) {
|
||||
post.set('deleted_at', new Date());
|
||||
} else {
|
||||
post.set('cooked', Discourse.Utilities.cook(Em.String.i18n("post.deleted_by_author")));
|
||||
post.set('cooked', Discourse.Markdown.cook(Em.String.i18n("post.deleted_by_author")));
|
||||
post.set('can_delete', false);
|
||||
post.set('version', post.get('version') + 1);
|
||||
}
|
||||
|
|
|
@ -67,9 +67,15 @@ Discourse.User = Discourse.Model.extend({
|
|||
'email_direct',
|
||||
'email_private_messages',
|
||||
'digest_after_days',
|
||||
'new_topic_duration_minutes'),
|
||||
'new_topic_duration_minutes',
|
||||
'external_links_in_new_tab',
|
||||
'enable_quoting'),
|
||||
type: 'PUT',
|
||||
success: function() { return finished(true); },
|
||||
success: function() {
|
||||
Discourse.set('currentUser.enable_quoting', _this.get('enable_quoting'));
|
||||
Discourse.set('currentUser.external_links_in_new_tab', _this.get('external_links_in_new_tab'));
|
||||
return finished(true);
|
||||
},
|
||||
error: function() { return finished(false); }
|
||||
});
|
||||
},
|
||||
|
|
|
@ -101,6 +101,13 @@
|
|||
<label>{{i18n user.new_topic_duration.label}}</label>
|
||||
{{view Discourse.ComboboxView valueAttribute="value" contentBinding="controller.considerNewTopicOptions" valueBinding="content.new_topic_duration_minutes"}}
|
||||
</div>
|
||||
|
||||
<div class="controls">
|
||||
<label>{{view Ember.Checkbox checkedBinding="content.external_links_in_new_tab"}}
|
||||
{{i18n user.external_links_in_new_tab}}</label>
|
||||
<label>{{view Ember.Checkbox checkedBinding="content.enable_quoting"}}
|
||||
{{i18n user.enable_quoting}}</label>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="control-group">
|
||||
|
|
|
@ -64,25 +64,18 @@ Discourse.PostView = Discourse.View.extend({
|
|||
return this.set('context', this.get('content'));
|
||||
},
|
||||
|
||||
mouseDown: function(e) {
|
||||
var qbc;
|
||||
if (qbc = Discourse.get('router.quoteButtonController')) {
|
||||
return qbc.mouseDown(e);
|
||||
}
|
||||
},
|
||||
|
||||
mouseUp: function(e) {
|
||||
var $target, qbc;
|
||||
if (qbc = Discourse.get('router.quoteButtonController')) {
|
||||
qbc.mouseUp(e);
|
||||
}
|
||||
if (this.get('controller.multiSelect') && (e.metaKey || e.ctrlKey)) {
|
||||
this.toggleProperty('post.selected');
|
||||
}
|
||||
|
||||
$target = $(e.target);
|
||||
if ($target.closest('.cooked').length === 0) return;
|
||||
if (qbc = this.get('controller.controllers.quoteButton')) {
|
||||
qbc = this.get('controller.controllers.quoteButton');
|
||||
|
||||
|
||||
if (qbc && Discourse.get('currentUser.enable_quoting')) {
|
||||
e.context = this.get('post');
|
||||
return qbc.selectText(e);
|
||||
}
|
||||
|
|
|
@ -43,7 +43,8 @@ class UsersController < ApplicationController
|
|||
u.auto_track_topics_after_msecs = params[:auto_track_topics_after_msecs].to_i if params[:auto_track_topics_after_msecs]
|
||||
u.new_topic_duration_minutes = params[:new_topic_duration_minutes].to_i if params[:new_topic_duration_minutes]
|
||||
|
||||
[:email_digests, :email_direct, :email_private_messages].each do |i|
|
||||
[:email_digests, :email_direct, :email_private_messages,
|
||||
:external_links_in_new_tab, :enable_quoting].each do |i|
|
||||
if params[i].present?
|
||||
u.send("#{i.to_s}=", params[i] == 'true')
|
||||
end
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
require_dependency 'message_bus'
|
||||
require_dependency 'discourse_observer'
|
||||
|
||||
# This class is responsible for notifying the message bus of various
|
||||
|
|
|
@ -1,6 +1,3 @@
|
|||
require_dependency 'message_bus'
|
||||
require_dependency 'sql_builder'
|
||||
|
||||
class UserAction < ActiveRecord::Base
|
||||
belongs_to :user
|
||||
belongs_to :target_post, :class_name => "Post"
|
||||
|
|
|
@ -8,7 +8,9 @@ class CurrentUserSerializer < BasicUserSerializer
|
|||
:site_flagged_posts_count,
|
||||
:moderator?,
|
||||
:reply_count,
|
||||
:topic_count
|
||||
:topic_count,
|
||||
:enable_quoting,
|
||||
:external_links_in_new_tab
|
||||
|
||||
# we probably want to move this into site, but that json is cached so hanging it off current user seems okish
|
||||
|
||||
|
|
|
@ -44,7 +44,10 @@ class UserSerializer < BasicUserSerializer
|
|||
:email_direct,
|
||||
:digest_after_days,
|
||||
:auto_track_topics_after_msecs,
|
||||
:new_topic_duration_minutes
|
||||
:new_topic_duration_minutes,
|
||||
:external_links_in_new_tab,
|
||||
:enable_quoting
|
||||
|
||||
|
||||
def auto_track_topics_after_msecs
|
||||
object.auto_track_topics_after_msecs || SiteSetting.auto_track_topics_after
|
||||
|
|
|
@ -63,6 +63,8 @@ en:
|
|||
change_password: "change"
|
||||
invited_by: "Invited By"
|
||||
trust_level: "Trust Level"
|
||||
external_links_in_new_tab: "Open all external links in a new tab"
|
||||
enable_quoting: "Enable quote reply for highlighted text"
|
||||
|
||||
change_username:
|
||||
action: "change"
|
||||
|
|
|
@ -0,0 +1,6 @@
|
|||
class AddExternalLinksInNewTabAnDisableQuotingToUser < ActiveRecord::Migration
|
||||
def change
|
||||
add_column :users, :external_links_in_new_tab, :boolean, default: false, null: false
|
||||
add_column :users, :enable_quoting, :boolean, default: true, null: false
|
||||
end
|
||||
end
|
2046
db/structure.sql
2046
db/structure.sql
File diff suppressed because it is too large
Load diff
|
@ -1,4 +1,6 @@
|
|||
module Discourse
|
||||
# work around reloader
|
||||
unless defined? ::Discourse::VERSION
|
||||
module VERSION #:nodoc:
|
||||
MAJOR = 0
|
||||
MINOR = 8
|
||||
|
@ -8,3 +10,4 @@ module Discourse
|
|||
STRING = [MAJOR, MINOR, TINY, PRE].compact.join('.')
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue