mirror of
https://github.com/codeninjasllc/discourse.git
synced 2024-11-23 23:58:31 -05:00
More Markdown refactoring - fixed bug with Pagedown not showing on user profile - replaced jQuery occurrences with $.
This commit is contained in:
parent
cf09e200a5
commit
86af49e663
43 changed files with 190 additions and 201 deletions
|
@ -25,7 +25,7 @@ Discourse.AdminEmailLogsController = Ember.ArrayController.extend(Discourse.Pres
|
|||
sendTestEmail: function() {
|
||||
var _this = this;
|
||||
_this.set('sentTestEmail', false);
|
||||
jQuery.ajax({
|
||||
$.ajax({
|
||||
url: '/admin/email_logs/test',
|
||||
type: 'POST',
|
||||
data: { email_address: this.get('testEmailAddress') },
|
||||
|
|
|
@ -10,7 +10,7 @@ Discourse.AdminUser = Discourse.Model.extend({
|
|||
|
||||
deleteAllPosts: function() {
|
||||
this.set('can_delete_all_posts', false);
|
||||
jQuery.ajax("/admin/users/" + (this.get('id')) + "/delete_all_posts", {type: 'PUT'});
|
||||
$.ajax("/admin/users/" + (this.get('id')) + "/delete_all_posts", {type: 'PUT'});
|
||||
},
|
||||
|
||||
// Revoke the user's admin access
|
||||
|
@ -18,14 +18,14 @@ Discourse.AdminUser = Discourse.Model.extend({
|
|||
this.set('admin', false);
|
||||
this.set('can_grant_admin', true);
|
||||
this.set('can_revoke_admin', false);
|
||||
return jQuery.ajax("/admin/users/" + (this.get('id')) + "/revoke_admin", {type: 'PUT'});
|
||||
return $.ajax("/admin/users/" + (this.get('id')) + "/revoke_admin", {type: 'PUT'});
|
||||
},
|
||||
|
||||
grantAdmin: function() {
|
||||
this.set('admin', true);
|
||||
this.set('can_grant_admin', false);
|
||||
this.set('can_revoke_admin', true);
|
||||
jQuery.ajax("/admin/users/" + (this.get('id')) + "/grant_admin", {type: 'PUT'});
|
||||
$.ajax("/admin/users/" + (this.get('id')) + "/grant_admin", {type: 'PUT'});
|
||||
},
|
||||
|
||||
// Revoke the user's moderation access
|
||||
|
@ -33,18 +33,18 @@ Discourse.AdminUser = Discourse.Model.extend({
|
|||
this.set('moderator', false);
|
||||
this.set('can_grant_moderation', true);
|
||||
this.set('can_revoke_moderation', false);
|
||||
return jQuery.ajax("/admin/users/" + (this.get('id')) + "/revoke_moderation", {type: 'PUT'});
|
||||
return $.ajax("/admin/users/" + (this.get('id')) + "/revoke_moderation", {type: 'PUT'});
|
||||
},
|
||||
|
||||
grantModeration: function() {
|
||||
this.set('moderator', true);
|
||||
this.set('can_grant_moderation', false);
|
||||
this.set('can_revoke_moderation', true);
|
||||
jQuery.ajax("/admin/users/" + (this.get('id')) + "/grant_moderation", {type: 'PUT'});
|
||||
$.ajax("/admin/users/" + (this.get('id')) + "/grant_moderation", {type: 'PUT'});
|
||||
},
|
||||
|
||||
refreshBrowsers: function() {
|
||||
jQuery.ajax("/admin/users/" + (this.get('id')) + "/refresh_browsers", {type: 'POST'});
|
||||
$.ajax("/admin/users/" + (this.get('id')) + "/refresh_browsers", {type: 'POST'});
|
||||
bootbox.alert("Message sent to all clients!");
|
||||
},
|
||||
|
||||
|
@ -52,7 +52,7 @@ Discourse.AdminUser = Discourse.Model.extend({
|
|||
this.set('can_approve', false);
|
||||
this.set('approved', true);
|
||||
this.set('approved_by', Discourse.get('currentUser'));
|
||||
jQuery.ajax("/admin/users/" + (this.get('id')) + "/approve", {type: 'PUT'});
|
||||
$.ajax("/admin/users/" + (this.get('id')) + "/approve", {type: 'PUT'});
|
||||
},
|
||||
|
||||
username_lower: (function() {
|
||||
|
@ -79,7 +79,7 @@ Discourse.AdminUser = Discourse.Model.extend({
|
|||
_this = this;
|
||||
if (duration = parseInt(window.prompt(Em.String.i18n('admin.user.ban_duration')), 10)) {
|
||||
if (duration > 0) {
|
||||
return jQuery.ajax("/admin/users/" + this.id + "/ban", {
|
||||
return $.ajax("/admin/users/" + this.id + "/ban", {
|
||||
type: 'PUT',
|
||||
data: {duration: duration},
|
||||
success: function() {
|
||||
|
@ -99,7 +99,7 @@ Discourse.AdminUser = Discourse.Model.extend({
|
|||
|
||||
unban: function() {
|
||||
var _this = this;
|
||||
return jQuery.ajax("/admin/users/" + this.id + "/unban", {
|
||||
return $.ajax("/admin/users/" + this.id + "/unban", {
|
||||
type: 'PUT',
|
||||
success: function() {
|
||||
window.location.reload();
|
||||
|
@ -116,7 +116,7 @@ Discourse.AdminUser = Discourse.Model.extend({
|
|||
|
||||
impersonate: function() {
|
||||
var _this = this;
|
||||
return jQuery.ajax("/admin/impersonate", {
|
||||
return $.ajax("/admin/impersonate", {
|
||||
type: 'POST',
|
||||
data: {
|
||||
username_or_email: this.get('username')
|
||||
|
@ -145,7 +145,7 @@ Discourse.AdminUser.reopenClass({
|
|||
user.set('can_approve', false);
|
||||
return user.set('selected', false);
|
||||
});
|
||||
return jQuery.ajax("/admin/users/approve-bulk", {
|
||||
return $.ajax("/admin/users/approve-bulk", {
|
||||
type: 'PUT',
|
||||
data: {
|
||||
users: users.map(function(u) {
|
||||
|
@ -158,7 +158,7 @@ Discourse.AdminUser.reopenClass({
|
|||
find: function(username) {
|
||||
var promise;
|
||||
promise = new RSVP.Promise();
|
||||
jQuery.ajax({
|
||||
$.ajax({
|
||||
url: "/admin/users/" + username,
|
||||
success: function(result) {
|
||||
return promise.resolve(Discourse.AdminUser.create(result));
|
||||
|
@ -170,7 +170,7 @@ Discourse.AdminUser.reopenClass({
|
|||
findAll: function(query, filter) {
|
||||
var result;
|
||||
result = Em.A();
|
||||
jQuery.ajax({
|
||||
$.ajax({
|
||||
url: "/admin/users/list/" + query + ".json",
|
||||
data: {
|
||||
filter: filter
|
||||
|
|
|
@ -19,7 +19,7 @@ Discourse.EmailLog.reopenClass({
|
|||
findAll: function(filter) {
|
||||
var result;
|
||||
result = Em.A();
|
||||
jQuery.ajax({
|
||||
$.ajax({
|
||||
url: "/admin/email_logs.json",
|
||||
data: { filter: filter },
|
||||
success: function(logs) {
|
||||
|
|
|
@ -49,7 +49,7 @@ Discourse.FlaggedPost = Discourse.Post.extend({
|
|||
var promise;
|
||||
promise = new RSVP.Promise();
|
||||
if (this.get('post_number') === "1") {
|
||||
return jQuery.ajax("/t/" + this.topic_id, {
|
||||
return $.ajax("/t/" + this.topic_id, {
|
||||
type: 'DELETE',
|
||||
cache: false,
|
||||
success: function() {
|
||||
|
@ -60,7 +60,7 @@ Discourse.FlaggedPost = Discourse.Post.extend({
|
|||
}
|
||||
});
|
||||
} else {
|
||||
return jQuery.ajax("/posts/" + this.id, {
|
||||
return $.ajax("/posts/" + this.id, {
|
||||
type: 'DELETE',
|
||||
cache: false,
|
||||
success: function() {
|
||||
|
@ -76,7 +76,7 @@ Discourse.FlaggedPost = Discourse.Post.extend({
|
|||
clearFlags: function() {
|
||||
var promise;
|
||||
promise = new RSVP.Promise();
|
||||
jQuery.ajax("/admin/flags/clear/" + this.id, {
|
||||
$.ajax("/admin/flags/clear/" + this.id, {
|
||||
type: 'POST',
|
||||
cache: false,
|
||||
success: function() {
|
||||
|
@ -99,7 +99,7 @@ Discourse.FlaggedPost.reopenClass({
|
|||
findAll: function(filter) {
|
||||
var result;
|
||||
result = Em.A();
|
||||
jQuery.ajax({
|
||||
$.ajax({
|
||||
url: "/admin/flags/" + filter + ".json",
|
||||
success: function(data) {
|
||||
var userLookup;
|
||||
|
|
|
@ -3,7 +3,7 @@ Discourse.Report = Discourse.Model.extend({});
|
|||
Discourse.Report.reopenClass({
|
||||
find: function(type) {
|
||||
var model = Discourse.Report.create();
|
||||
jQuery.ajax("/admin/reports/" + type, {
|
||||
$.ajax("/admin/reports/" + type, {
|
||||
type: 'GET',
|
||||
success: function(json) {
|
||||
model.mergeAttributes(json.report);
|
||||
|
|
|
@ -55,7 +55,7 @@ Discourse.SiteCustomization = Discourse.Model.extend({
|
|||
header: this.header,
|
||||
override_default_style: this.override_default_style
|
||||
};
|
||||
return jQuery.ajax({
|
||||
return $.ajax({
|
||||
url: "/admin/site_customizations" + (this.id ? '/' + this.id : ''),
|
||||
data: {
|
||||
site_customization: data
|
||||
|
@ -67,7 +67,7 @@ Discourse.SiteCustomization = Discourse.Model.extend({
|
|||
"delete": function() {
|
||||
if (!this.id) return;
|
||||
|
||||
return jQuery.ajax({
|
||||
return $.ajax({
|
||||
url: "/admin/site_customizations/" + this.id,
|
||||
type: 'DELETE'
|
||||
});
|
||||
|
@ -93,7 +93,7 @@ Discourse.SiteCustomization.reopenClass({
|
|||
content: [],
|
||||
loading: true
|
||||
});
|
||||
jQuery.ajax({
|
||||
$.ajax({
|
||||
url: "/admin/site_customizations",
|
||||
dataType: "json",
|
||||
success: function(data) {
|
||||
|
|
|
@ -72,7 +72,7 @@ Discourse.SiteSetting = Discourse.Model.extend({
|
|||
save: function() {
|
||||
// Update the setting
|
||||
var setting = this;
|
||||
return jQuery.ajax("/admin/site_settings/" + (this.get('setting')), {
|
||||
return $.ajax("/admin/site_settings/" + (this.get('setting')), {
|
||||
data: { value: this.get('value') },
|
||||
type: 'PUT',
|
||||
success: function() {
|
||||
|
@ -91,7 +91,7 @@ Discourse.SiteSetting.reopenClass({
|
|||
**/
|
||||
findAll: function() {
|
||||
var result = Em.A();
|
||||
jQuery.get("/admin/site_settings", function(settings) {
|
||||
$.get("/admin/site_settings", function(settings) {
|
||||
return settings.each(function(s) {
|
||||
s.originalValue = s.value;
|
||||
return result.pushObject(Discourse.SiteSetting.create(s));
|
||||
|
|
|
@ -23,7 +23,7 @@ Discourse.VersionCheck = Discourse.Model.extend({
|
|||
Discourse.VersionCheck.reopenClass({
|
||||
find: function() {
|
||||
var promise = new RSVP.Promise();
|
||||
jQuery.ajax({
|
||||
$.ajax({
|
||||
url: '/admin/version_check',
|
||||
dataType: 'json',
|
||||
success: function(json) {
|
||||
|
|
|
@ -142,7 +142,7 @@ Discourse = Ember.Application.createWithMixins({
|
|||
|
||||
// Add a CSRF token to all AJAX requests
|
||||
var csrfToken = $('meta[name=csrf-token]').attr('content');
|
||||
jQuery.ajaxPrefilter(function(options, originalOptions, xhr) {
|
||||
$.ajaxPrefilter(function(options, originalOptions, xhr) {
|
||||
if (!options.crossDomain) {
|
||||
xhr.setRequestHeader('X-CSRF-Token', csrfToken);
|
||||
}
|
||||
|
@ -156,7 +156,7 @@ Discourse = Ember.Application.createWithMixins({
|
|||
**/
|
||||
logout: function() {
|
||||
Discourse.KeyValueStore.abandonLocal();
|
||||
return jQuery.ajax("/session/" + this.get('currentUser.username'), {
|
||||
return $.ajax("/session/" + this.get('currentUser.username'), {
|
||||
type: 'DELETE',
|
||||
success: function(result) {
|
||||
// To keep lots of our variables unbound, we can handle a redirect on logging out.
|
||||
|
|
|
@ -47,7 +47,7 @@ $.fn.autocomplete = function(options) {
|
|||
}
|
||||
return d.find('a').click(function() {
|
||||
closeAutocomplete();
|
||||
inputSelectedItems.splice(jQuery.inArray(item), 1);
|
||||
inputSelectedItems.splice($.inArray(item), 1);
|
||||
$(this).parent().parent().remove();
|
||||
if (options.onChangeItems) {
|
||||
return options.onChangeItems(inputSelectedItems);
|
||||
|
|
|
@ -70,7 +70,7 @@ Discourse.ClickTrack = {
|
|||
|
||||
// if they want to open in a new tab, do an AJAX request
|
||||
if (e.metaKey || e.ctrlKey || e.which === 2) {
|
||||
jQuery.get("/clicks/track", {
|
||||
$.get("/clicks/track", {
|
||||
url: href,
|
||||
post_id: postId,
|
||||
topic_id: topicId,
|
||||
|
@ -82,7 +82,7 @@ Discourse.ClickTrack = {
|
|||
|
||||
// If we're on the same site, use the router and track via AJAX
|
||||
if (href.indexOf(window.location.origin) === 0) {
|
||||
jQuery.get("/clicks/track", {
|
||||
$.get("/clicks/track", {
|
||||
url: href,
|
||||
post_id: postId,
|
||||
topic_id: topicId,
|
||||
|
|
|
@ -129,7 +129,7 @@ Discourse.Development = {
|
|||
return $LAB.script(js + "?hash=" + me.hash).wait(function() {
|
||||
var templateName;
|
||||
templateName = js.replace(".js", "").replace("/assets/", "");
|
||||
return jQuery.each(Ember.View.views, function() {
|
||||
return $.each(Ember.View.views, function() {
|
||||
var _this = this;
|
||||
if (this.get('templateName') === templateName) {
|
||||
this.set('templateName', 'empty');
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/*global sanitizeHtml:true Markdown:true */
|
||||
/*global Markdown:true */
|
||||
|
||||
/**
|
||||
Contains methods to help us with markdown formatting.
|
||||
|
@ -15,6 +15,7 @@ Discourse.Markdown = {
|
|||
@method cook
|
||||
@param {String} raw the raw string we want to apply markdown to
|
||||
@param {Object} opts the options for the rendering
|
||||
@return {String} the cooked markdown string
|
||||
**/
|
||||
cook: function(raw, opts) {
|
||||
if (!opts) opts = {};
|
||||
|
@ -23,21 +24,27 @@ Discourse.Markdown = {
|
|||
if (!raw) return "";
|
||||
if (raw.length === 0) return "";
|
||||
|
||||
this.converter = this.markdownConverter(opts);
|
||||
return this.converter.makeHtml(raw);
|
||||
return this.markdownConverter(opts).makeHtml(raw);
|
||||
},
|
||||
|
||||
/**
|
||||
Creates a new markdown editor
|
||||
Creates a new pagedown markdown editor, supplying i18n translations.
|
||||
|
||||
@method createNewMarkdownEditor
|
||||
@param {Markdown.Converter} markdownConverter the converter object
|
||||
@param {String} idPostfix
|
||||
@param {Object} options the options for the markdown editor
|
||||
@method createEditor
|
||||
@param {Object} converterOptions custom options for our markdown converter
|
||||
@return {Markdown.Editor} the editor instance
|
||||
**/
|
||||
createNewMarkdownEditor: function(markdownConverter, idPostfix, options) {
|
||||
options = options || {};
|
||||
options.strings = {
|
||||
createEditor: function(converterOptions) {
|
||||
|
||||
if (!converterOptions) converterOptions = {};
|
||||
|
||||
// By default we always sanitize content in the editor
|
||||
converterOptions.sanitize = true;
|
||||
|
||||
var markdownConverter = Discourse.Markdown.markdownConverter(converterOptions);
|
||||
|
||||
var editorOptions = {
|
||||
strings: {
|
||||
bold: I18n.t("js.composer.bold_title") + " <strong> Ctrl+B",
|
||||
boldexample: I18n.t("js.composer.bold_text"),
|
||||
|
||||
|
@ -74,9 +81,10 @@ Discourse.Markdown = {
|
|||
redomac: I18n.t("js.composer.redo_title") + " - Ctrl+Shift+Z",
|
||||
|
||||
help: I18n.t("js.composer.help")
|
||||
}
|
||||
};
|
||||
|
||||
return new Markdown.Editor(markdownConverter, idPostfix, options);
|
||||
return new Markdown.Editor(markdownConverter, undefined, editorOptions);
|
||||
},
|
||||
|
||||
/**
|
||||
|
@ -86,21 +94,15 @@ Discourse.Markdown = {
|
|||
@param {Object} opts the converting options
|
||||
**/
|
||||
markdownConverter: function(opts) {
|
||||
var converter, mentionLookup,
|
||||
_this = this;
|
||||
converter = new Markdown.Converter();
|
||||
if (opts) {
|
||||
mentionLookup = opts.mentionLookup;
|
||||
}
|
||||
mentionLookup = mentionLookup || Discourse.Mention.lookupCache;
|
||||
if (!opts) opts = {};
|
||||
|
||||
var converter = new Markdown.Converter();
|
||||
var mentionLookup = opts.mentionLookup || Discourse.Mention.lookupCache;
|
||||
|
||||
// Before cooking callbacks
|
||||
converter.hooks.chain("preConversion", function(text) {
|
||||
_this.trigger('beforeCook', {
|
||||
detail: text,
|
||||
opts: opts
|
||||
});
|
||||
return _this.textResult || text;
|
||||
Discourse.Markdown.trigger('beforeCook', { detail: text, opts: opts });
|
||||
return Discourse.Markdown.textResult || text;
|
||||
});
|
||||
|
||||
// Support autolinking of www.something.com
|
||||
|
@ -114,9 +116,7 @@ Discourse.Markdown = {
|
|||
if (!Discourse.SiteSettings.traditional_markdown_linebreaks) {
|
||||
converter.hooks.chain("preConversion", function(text) {
|
||||
return text.replace(/(^[\w<][^\n]*\n+)/gim, function(t) {
|
||||
if (t.match(/\n{2}/gim)) {
|
||||
return t;
|
||||
}
|
||||
if (t.match(/\n{2}/gim)) return t;
|
||||
return t.replace("\n", " \n");
|
||||
});
|
||||
});
|
||||
|
@ -125,8 +125,7 @@ Discourse.Markdown = {
|
|||
// github style fenced code
|
||||
converter.hooks.chain("preConversion", function(text) {
|
||||
return text.replace(/^`{3}(?:(.*$)\n)?([\s\S]*?)^`{3}/gm, function(wholeMatch, m1, m2) {
|
||||
var escaped;
|
||||
escaped = Handlebars.Utils.escapeExpression(m2);
|
||||
var escaped = Handlebars.Utils.escapeExpression(m2);
|
||||
return "<pre><code class='" + (m1 || 'lang-auto') + "'>" + escaped + "</code></pre>";
|
||||
});
|
||||
});
|
||||
|
@ -142,20 +141,19 @@ Discourse.Markdown = {
|
|||
// Add @mentions of names
|
||||
text = text.replace(/([\s\t>,:'|";\]])(@[A-Za-z0-9_-|\.]*[A-Za-z0-9_-|]+)(?=[\s\t<\!:|;',"\?\.])/g, function(x, pre, name) {
|
||||
if (mentionLookup(name.substr(1))) {
|
||||
return "" + pre + "<a href='/users/" + (name.substr(1).toLowerCase()) + "' class='mention'>" + name + "</a>";
|
||||
return pre + "<a href='/users/" + (name.substr(1).toLowerCase()) + "' class='mention'>" + name + "</a>";
|
||||
} else {
|
||||
return "" + pre + "<span class='mention'>" + name + "</span>";
|
||||
return pre + "<span class='mention'>" + name + "</span>";
|
||||
}
|
||||
});
|
||||
|
||||
// a primitive attempt at oneboxing, this regex gives me much eye sores
|
||||
text = text.replace(/(<li>)?((<p>|<br>)[\s\n\r]*)(<a href=["]([^"]+)[^>]*)>([^<]+<\/a>[\s\n\r]*(?=<\/p>|<br>))/gi, function() {
|
||||
// We don't onebox items in a list
|
||||
var onebox, url;
|
||||
if (arguments[1]) {
|
||||
return arguments[0];
|
||||
}
|
||||
url = arguments[5];
|
||||
if (arguments[1]) return arguments[0];
|
||||
var url = arguments[5];
|
||||
var onebox;
|
||||
|
||||
if (Discourse && Discourse.Onebox) {
|
||||
onebox = Discourse.Onebox.lookupCache(url);
|
||||
}
|
||||
|
@ -175,10 +173,8 @@ Discourse.Markdown = {
|
|||
|
||||
if (opts.sanitize) {
|
||||
converter.hooks.chain("postConversion", function(text) {
|
||||
if (!window.sanitizeHtml) {
|
||||
return "";
|
||||
}
|
||||
return sanitizeHtml(text);
|
||||
if (!window.sanitizeHtml) return "";
|
||||
return window.sanitizeHtml(text);
|
||||
});
|
||||
}
|
||||
return converter;
|
||||
|
|
|
@ -21,7 +21,7 @@ Discourse.Mention = (function() {
|
|||
callback(cached);
|
||||
return false;
|
||||
} else {
|
||||
jQuery.get("/users/is_local_username", {
|
||||
$.get("/users/is_local_username", {
|
||||
username: name
|
||||
}, function(r) {
|
||||
cache(name, r.valid);
|
||||
|
|
|
@ -68,7 +68,7 @@ Discourse.MessageBus = (function() {
|
|||
data[c.channel] = c.last_id === void 0 ? -1 : c.last_id;
|
||||
});
|
||||
gotData = false;
|
||||
_this.longPoll = jQuery.ajax("/message-bus/" + clientId + "/poll?" + (isHidden() || !_this.enableLongPolling ? "dlp=t" : ""), {
|
||||
_this.longPoll = $.ajax("/message-bus/" + clientId + "/poll?" + (isHidden() || !_this.enableLongPolling ? "dlp=t" : ""), {
|
||||
data: data,
|
||||
cache: false,
|
||||
dataType: 'json',
|
||||
|
|
|
@ -98,7 +98,7 @@ Discourse.ScreenTrack = Ember.Object.extend({
|
|||
highestSeenByTopic[topicId] = this.highestSeen;
|
||||
}
|
||||
if (!Object.isEmpty(newTimings)) {
|
||||
jQuery.ajax('/topics/timings', {
|
||||
$.ajax('/topics/timings', {
|
||||
data: {
|
||||
timings: newTimings,
|
||||
topic_time: this.topicTime,
|
||||
|
|
|
@ -14,7 +14,7 @@ cacheTopicId = null;
|
|||
cacheTime = null;
|
||||
|
||||
doSearch = function(term, topicId, success) {
|
||||
return jQuery.ajax({
|
||||
return $.ajax({
|
||||
url: '/users/search/users',
|
||||
dataType: 'JSON',
|
||||
data: {
|
||||
|
|
|
@ -22,7 +22,7 @@ Discourse.StaticController = Discourse.Controller.extend({
|
|||
text = text[1];
|
||||
return this.set('content', text);
|
||||
} else {
|
||||
return jQuery.ajax({
|
||||
return $.ajax({
|
||||
url: "" + path + ".json",
|
||||
success: function(result) {
|
||||
return _this.set('content', result);
|
||||
|
|
|
@ -54,7 +54,7 @@ Discourse.ActionSummary = Discourse.Model.extend({
|
|||
|
||||
// Create our post action
|
||||
promise = new RSVP.Promise();
|
||||
jQuery.ajax({
|
||||
$.ajax({
|
||||
url: "/post_actions",
|
||||
type: 'POST',
|
||||
data: {
|
||||
|
@ -65,7 +65,7 @@ Discourse.ActionSummary = Discourse.Model.extend({
|
|||
error: function(error) {
|
||||
var errors;
|
||||
_this.removeAction();
|
||||
errors = jQuery.parseJSON(error.responseText).errors;
|
||||
errors = $.parseJSON(error.responseText).errors;
|
||||
return promise.reject(errors);
|
||||
},
|
||||
success: function() {
|
||||
|
@ -80,7 +80,7 @@ Discourse.ActionSummary = Discourse.Model.extend({
|
|||
this.removeAction();
|
||||
|
||||
// Remove our post action
|
||||
return jQuery.ajax({
|
||||
return $.ajax({
|
||||
url: "/post_actions/" + (this.get('post.id')),
|
||||
type: 'DELETE',
|
||||
data: {
|
||||
|
@ -91,7 +91,7 @@ Discourse.ActionSummary = Discourse.Model.extend({
|
|||
|
||||
clearFlags: function() {
|
||||
var _this = this;
|
||||
return jQuery.ajax({
|
||||
return $.ajax({
|
||||
url: "/post_actions/clear_flags",
|
||||
type: "POST",
|
||||
data: {
|
||||
|
@ -107,7 +107,7 @@ Discourse.ActionSummary = Discourse.Model.extend({
|
|||
|
||||
loadUsers: function() {
|
||||
var _this = this;
|
||||
return jQuery.getJSON("/post_actions/users", {
|
||||
return $.getJSON("/post_actions/users", {
|
||||
id: this.get('post.id'),
|
||||
post_action_type_id: this.get('id')
|
||||
}, function(result) {
|
||||
|
|
|
@ -42,7 +42,7 @@ Discourse.Category = Discourse.Model.extend({
|
|||
|
||||
"delete": function(callback) {
|
||||
var _this = this;
|
||||
return jQuery.ajax("/categories/" + (this.get('slug')), {
|
||||
return $.ajax("/categories/" + (this.get('slug')), {
|
||||
type: 'DELETE',
|
||||
success: function() {
|
||||
return callback();
|
||||
|
|
|
@ -34,7 +34,7 @@ Discourse.CategoryList.reopenClass({
|
|||
var promise,
|
||||
_this = this;
|
||||
promise = new RSVP.Promise();
|
||||
jQuery.getJSON("/" + filter + ".json").then(function(result) {
|
||||
$.getJSON("/" + filter + ".json").then(function(result) {
|
||||
var categoryList;
|
||||
categoryList = Discourse.TopicList.create();
|
||||
categoryList.set('can_create_category', result.category_list.can_create_category);
|
||||
|
|
|
@ -318,7 +318,7 @@ Discourse.Composer = Discourse.Model.extend({
|
|||
}
|
||||
}, function(error) {
|
||||
var errors;
|
||||
errors = jQuery.parseJSON(error.responseText).errors;
|
||||
errors = $.parseJSON(error.responseText).errors;
|
||||
promise.reject(errors[0]);
|
||||
post.set('cooked', oldCooked);
|
||||
return _this.set('composeState', OPEN);
|
||||
|
@ -419,7 +419,7 @@ Discourse.Composer = Discourse.Model.extend({
|
|||
if (topic) {
|
||||
topic.posts.removeObject(createdPost);
|
||||
}
|
||||
errors = jQuery.parseJSON(error.responseText).errors;
|
||||
errors = $.parseJSON(error.responseText).errors;
|
||||
promise.reject(errors[0]);
|
||||
return _this.set('composeState', OPEN);
|
||||
});
|
||||
|
|
|
@ -11,7 +11,7 @@ Discourse.Draft = Discourse.Model.extend({});
|
|||
Discourse.Draft.reopenClass({
|
||||
|
||||
clear: function(key, sequence) {
|
||||
return jQuery.ajax({
|
||||
return $.ajax({
|
||||
type: 'DELETE',
|
||||
url: "/draft",
|
||||
data: {
|
||||
|
@ -25,7 +25,7 @@ Discourse.Draft.reopenClass({
|
|||
var promise,
|
||||
_this = this;
|
||||
promise = new RSVP.Promise();
|
||||
jQuery.ajax({
|
||||
$.ajax({
|
||||
url: '/draft',
|
||||
data: {
|
||||
draft_key: key
|
||||
|
@ -47,7 +47,7 @@ Discourse.Draft.reopenClass({
|
|||
var promise;
|
||||
promise = new RSVP.Promise();
|
||||
data = typeof data === "string" ? data : JSON.stringify(data);
|
||||
jQuery.ajax({
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
url: "/draft",
|
||||
data: {
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
Discourse.Invite = Discourse.Model.extend({
|
||||
|
||||
rescind: function() {
|
||||
jQuery.ajax('/invites', {
|
||||
$.ajax('/invites', {
|
||||
type: 'DELETE',
|
||||
data: { email: this.get('email') }
|
||||
});
|
||||
|
|
|
@ -17,7 +17,7 @@ Discourse.InviteList.reopenClass({
|
|||
findInvitedBy: function(user) {
|
||||
var promise;
|
||||
promise = new RSVP.Promise();
|
||||
jQuery.ajax({
|
||||
$.ajax({
|
||||
url: "/users/" + (user.get('username_lower')) + "/invited.json",
|
||||
success: function(result) {
|
||||
var invitedList;
|
||||
|
|
|
@ -14,14 +14,14 @@ Discourse.Model = Ember.Object.extend(Discourse.Presence, {
|
|||
|
||||
@method ajax
|
||||
@param {String} url The url to contact
|
||||
@param {Object} args The arguments to pass to jQuery.ajax
|
||||
@param {Object} args The arguments to pass to $.ajax
|
||||
**/
|
||||
ajax: function(url, args) {
|
||||
var oldError = args.error;
|
||||
args.error = function(xhr) {
|
||||
return oldError(jQuery.parseJSON(xhr.responseText).errors);
|
||||
return oldError($.parseJSON(xhr.responseText).errors);
|
||||
};
|
||||
return jQuery.ajax(url, args);
|
||||
return $.ajax(url, args);
|
||||
},
|
||||
|
||||
/**
|
||||
|
|
|
@ -64,7 +64,7 @@ Discourse.Post = Discourse.Model.extend({
|
|||
|
||||
bookmarkedChanged: (function() {
|
||||
var _this = this;
|
||||
return jQuery.ajax({
|
||||
return $.ajax({
|
||||
url: "/posts/" + (this.get('id')) + "/bookmark",
|
||||
type: 'PUT',
|
||||
data: {
|
||||
|
@ -72,7 +72,7 @@ Discourse.Post = Discourse.Model.extend({
|
|||
},
|
||||
error: function(error) {
|
||||
var errors;
|
||||
errors = jQuery.parseJSON(error.responseText).errors;
|
||||
errors = $.parseJSON(error.responseText).errors;
|
||||
bootbox.alert(errors[0]);
|
||||
return _this.toggleProperty('bookmarked');
|
||||
}
|
||||
|
@ -123,7 +123,7 @@ Discourse.Post = Discourse.Model.extend({
|
|||
var data, metaData;
|
||||
if (!this.get('newPost')) {
|
||||
// We're updating a post
|
||||
return jQuery.ajax({
|
||||
return $.ajax({
|
||||
url: "/posts/" + (this.get('id')),
|
||||
type: 'PUT',
|
||||
data: {
|
||||
|
@ -153,7 +153,7 @@ Discourse.Post = Discourse.Model.extend({
|
|||
data.meta_data = {};
|
||||
Ember.keys(metaData).forEach(function(key) { data.meta_data[key] = metaData.get(key); });
|
||||
}
|
||||
return jQuery.ajax({
|
||||
return $.ajax({
|
||||
type: 'POST',
|
||||
url: "/posts",
|
||||
data: data,
|
||||
|
@ -168,11 +168,11 @@ Discourse.Post = Discourse.Model.extend({
|
|||
},
|
||||
|
||||
recover: function() {
|
||||
return jQuery.ajax("/posts/" + (this.get('id')) + "/recover", { type: 'PUT', cache: false });
|
||||
return $.ajax("/posts/" + (this.get('id')) + "/recover", { type: 'PUT', cache: false });
|
||||
},
|
||||
|
||||
"delete": function(complete) {
|
||||
return jQuery.ajax("/posts/" + (this.get('id')), {
|
||||
return $.ajax("/posts/" + (this.get('id')), {
|
||||
type: 'DELETE',
|
||||
success: function(result) {
|
||||
return typeof complete === "function" ? complete() : void 0;
|
||||
|
@ -220,7 +220,7 @@ Discourse.Post = Discourse.Model.extend({
|
|||
promise = new RSVP.Promise();
|
||||
this.set('loadingReplies', true);
|
||||
this.set('replies', []);
|
||||
jQuery.getJSON("/posts/" + (this.get('id')) + "/replies", function(loaded) {
|
||||
$.getJSON("/posts/" + (this.get('id')) + "/replies", function(loaded) {
|
||||
loaded.each(function(reply) {
|
||||
var post;
|
||||
post = Discourse.Post.create(reply);
|
||||
|
@ -234,7 +234,7 @@ Discourse.Post = Discourse.Model.extend({
|
|||
},
|
||||
|
||||
loadVersions: function(callback) {
|
||||
return jQuery.get("/posts/" + (this.get('id')) + "/versions.json", function(result) {
|
||||
return $.get("/posts/" + (this.get('id')) + "/versions.json", function(result) {
|
||||
return callback(result);
|
||||
});
|
||||
},
|
||||
|
@ -290,7 +290,7 @@ Discourse.Post.reopenClass({
|
|||
},
|
||||
|
||||
deleteMany: function(posts) {
|
||||
return jQuery.ajax("/posts/destroy_many", {
|
||||
return $.ajax("/posts/destroy_many", {
|
||||
type: 'DELETE',
|
||||
data: {
|
||||
post_ids: posts.map(function(p) {
|
||||
|
@ -302,14 +302,14 @@ Discourse.Post.reopenClass({
|
|||
|
||||
loadVersion: function(postId, version, callback) {
|
||||
var _this = this;
|
||||
return jQuery.getJSON("/posts/" + postId + ".json?version=" + version, function(result) {
|
||||
return $.getJSON("/posts/" + postId + ".json?version=" + version, function(result) {
|
||||
return callback(Discourse.Post.create(result));
|
||||
});
|
||||
},
|
||||
|
||||
loadByPostNumber: function(topicId, postId, callback) {
|
||||
var _this = this;
|
||||
return jQuery.getJSON("/posts/by_number/" + topicId + "/" + postId + ".json", function(result) {
|
||||
return $.getJSON("/posts/by_number/" + topicId + "/" + postId + ".json", function(result) {
|
||||
return callback(Discourse.Post.create(result));
|
||||
});
|
||||
},
|
||||
|
@ -318,7 +318,7 @@ Discourse.Post.reopenClass({
|
|||
var promise,
|
||||
_this = this;
|
||||
promise = new RSVP.Promise();
|
||||
jQuery.getJSON("/posts/" + postId + ".json", function(result) {
|
||||
$.getJSON("/posts/" + postId + ".json", function(result) {
|
||||
var post;
|
||||
post = Discourse.Post.create(result);
|
||||
return promise.resolve(Discourse.BBCode.buildQuoteBBCode(post, post.get('raw')));
|
||||
|
@ -328,7 +328,7 @@ Discourse.Post.reopenClass({
|
|||
|
||||
load: function(postId, callback) {
|
||||
var _this = this;
|
||||
return jQuery.getJSON("/posts/" + postId + ".json", function(result) {
|
||||
return $.getJSON("/posts/" + postId + ".json", function(result) {
|
||||
return callback(Discourse.Post.create(result));
|
||||
});
|
||||
}
|
||||
|
|
|
@ -24,7 +24,7 @@ Discourse.Topic = Discourse.Model.extend({
|
|||
a = this.get('archetype');
|
||||
if (a !== 'regular' && a !== 'private_message') {
|
||||
this.set('archetype', 'regular');
|
||||
return jQuery.post(this.get('url'), {
|
||||
return $.post(this.get('url'), {
|
||||
_method: 'put',
|
||||
archetype: 'regular'
|
||||
});
|
||||
|
@ -134,7 +134,7 @@ Discourse.Topic = Discourse.Model.extend({
|
|||
|
||||
toggleStatus: function(property) {
|
||||
this.toggleProperty(property);
|
||||
return jQuery.post("" + (this.get('url')) + "/status", {
|
||||
return $.post("" + (this.get('url')) + "/status", {
|
||||
_method: 'put',
|
||||
status: property,
|
||||
enabled: this.get(property) ? 'true' : 'false'
|
||||
|
@ -144,13 +144,13 @@ Discourse.Topic = Discourse.Model.extend({
|
|||
toggleStar: function() {
|
||||
var topic = this;
|
||||
topic.toggleProperty('starred');
|
||||
return jQuery.ajax({
|
||||
return $.ajax({
|
||||
url: "" + (this.get('url')) + "/star",
|
||||
type: 'PUT',
|
||||
data: { starred: topic.get('starred') ? true : false },
|
||||
error: function(error) {
|
||||
topic.toggleProperty('starred');
|
||||
var errors = jQuery.parseJSON(error.responseText).errors;
|
||||
var errors = $.parseJSON(error.responseText).errors;
|
||||
return bootbox.alert(errors[0]);
|
||||
}
|
||||
});
|
||||
|
@ -160,7 +160,7 @@ Discourse.Topic = Discourse.Model.extend({
|
|||
save: function() {
|
||||
// Don't save unless we can
|
||||
if (!this.get('can_edit')) return;
|
||||
return jQuery.post(this.get('url'), {
|
||||
return $.post(this.get('url'), {
|
||||
_method: 'put',
|
||||
title: this.get('title'),
|
||||
category: this.get('category.name')
|
||||
|
@ -169,7 +169,7 @@ Discourse.Topic = Discourse.Model.extend({
|
|||
|
||||
// Reset our read data for this topic
|
||||
resetRead: function(callback) {
|
||||
return jQuery.ajax("/t/" + (this.get('id')) + "/timings", {
|
||||
return $.ajax("/t/" + (this.get('id')) + "/timings", {
|
||||
type: 'DELETE',
|
||||
success: function() {
|
||||
return typeof callback === "function" ? callback() : void 0;
|
||||
|
@ -179,7 +179,7 @@ Discourse.Topic = Discourse.Model.extend({
|
|||
|
||||
// Invite a user to this topic
|
||||
inviteUser: function(user) {
|
||||
return jQuery.ajax({
|
||||
return $.ajax({
|
||||
type: 'POST',
|
||||
url: "/t/" + (this.get('id')) + "/invite",
|
||||
data: {
|
||||
|
@ -190,7 +190,7 @@ Discourse.Topic = Discourse.Model.extend({
|
|||
|
||||
// Delete this topic
|
||||
"delete": function(callback) {
|
||||
return jQuery.ajax("/t/" + (this.get('id')), {
|
||||
return $.ajax("/t/" + (this.get('id')), {
|
||||
type: 'DELETE',
|
||||
success: function() {
|
||||
return typeof callback === "function" ? callback() : void 0;
|
||||
|
@ -305,7 +305,7 @@ Discourse.Topic = Discourse.Model.extend({
|
|||
updateNotifications: function(v) {
|
||||
this.set('notification_level', v);
|
||||
this.set('notifications_reason_id', null);
|
||||
return jQuery.ajax({
|
||||
return $.ajax({
|
||||
url: "/t/" + (this.get('id')) + "/notifications",
|
||||
type: 'POST',
|
||||
data: {
|
||||
|
@ -389,7 +389,7 @@ Discourse.Topic.reopenClass({
|
|||
// Check the preload store. If not, load it via JSON
|
||||
promise = new RSVP.Promise();
|
||||
PreloadStore.get("topic_" + topicId, function() {
|
||||
return jQuery.getJSON(url + ".json", data);
|
||||
return $.getJSON(url + ".json", data);
|
||||
}).then(function(result) {
|
||||
var first;
|
||||
first = result.posts.first();
|
||||
|
@ -405,7 +405,7 @@ Discourse.Topic.reopenClass({
|
|||
|
||||
// Create a topic from posts
|
||||
movePosts: function(topicId, title, postIds) {
|
||||
return jQuery.ajax("/t/" + topicId + "/move-posts", {
|
||||
return $.ajax("/t/" + topicId + "/move-posts", {
|
||||
type: 'POST',
|
||||
data: { title: title, post_ids: postIds }
|
||||
});
|
||||
|
|
|
@ -15,7 +15,7 @@ Discourse.TopicList = Discourse.Model.extend({
|
|||
promise = new RSVP.Promise();
|
||||
if (moreUrl = this.get('more_topics_url')) {
|
||||
Discourse.URL.replaceState("/" + (this.get('filter')) + "/more");
|
||||
jQuery.ajax(moreUrl, {
|
||||
$.ajax(moreUrl, {
|
||||
success: function(result) {
|
||||
var newTopics, topicIds, topics;
|
||||
if (result) {
|
||||
|
@ -108,7 +108,7 @@ Discourse.TopicList.reopenClass({
|
|||
promise = new RSVP.Promise();
|
||||
found = PreloadStore.contains('topic_list');
|
||||
PreloadStore.get("topic_list", function() {
|
||||
return jQuery.getJSON(url);
|
||||
return $.getJSON(url);
|
||||
}).then(function(result) {
|
||||
topic_list.set('topics', Discourse.TopicList.topicsFrom(result));
|
||||
topic_list.set('can_create_topic', result.topic_list.can_create_topic);
|
||||
|
|
|
@ -33,7 +33,7 @@ Discourse.User = Discourse.Model.extend({
|
|||
}).property('trust_level'),
|
||||
|
||||
changeUsername: function(newUsername) {
|
||||
return jQuery.ajax({
|
||||
return $.ajax({
|
||||
url: "/users/" + (this.get('username_lower')) + "/preferences/username",
|
||||
type: 'PUT',
|
||||
data: {
|
||||
|
@ -43,7 +43,7 @@ Discourse.User = Discourse.Model.extend({
|
|||
},
|
||||
|
||||
changeEmail: function(email) {
|
||||
return jQuery.ajax({
|
||||
return $.ajax({
|
||||
url: "/users/" + (this.get('username_lower')) + "/preferences/email",
|
||||
type: 'PUT',
|
||||
data: {
|
||||
|
@ -58,7 +58,7 @@ Discourse.User = Discourse.Model.extend({
|
|||
|
||||
save: function(finished) {
|
||||
var _this = this;
|
||||
return jQuery.ajax("/users/" + this.get('username').toLowerCase(), {
|
||||
return $.ajax("/users/" + this.get('username').toLowerCase(), {
|
||||
data: this.getProperties('auto_track_topics_after_msecs',
|
||||
'bio_raw',
|
||||
'website',
|
||||
|
@ -77,7 +77,7 @@ Discourse.User = Discourse.Model.extend({
|
|||
changePassword: function(callback) {
|
||||
var good;
|
||||
good = false;
|
||||
return jQuery.ajax({
|
||||
return $.ajax({
|
||||
url: '/session/forgot_password',
|
||||
dataType: 'json',
|
||||
data: {
|
||||
|
@ -109,7 +109,7 @@ Discourse.User = Discourse.Model.extend({
|
|||
var stream,
|
||||
_this = this;
|
||||
stream = this.get('stream');
|
||||
return jQuery.ajax({
|
||||
return $.ajax({
|
||||
url: "/user_actions/" + id + ".json",
|
||||
dataType: 'json',
|
||||
cache: 'false',
|
||||
|
@ -142,7 +142,7 @@ Discourse.User = Discourse.Model.extend({
|
|||
url += "&filter=" + (this.get('streamFilter'));
|
||||
}
|
||||
|
||||
return jQuery.ajax({
|
||||
return $.ajax({
|
||||
url: url,
|
||||
dataType: 'json',
|
||||
cache: 'false',
|
||||
|
@ -226,7 +226,7 @@ Discourse.User = Discourse.Model.extend({
|
|||
Discourse.User.reopenClass({
|
||||
|
||||
checkUsername: function(username, email) {
|
||||
return jQuery.ajax({
|
||||
return $.ajax({
|
||||
url: '/users/check_username',
|
||||
type: 'GET',
|
||||
data: {
|
||||
|
@ -278,7 +278,7 @@ Discourse.User.reopenClass({
|
|||
var promise,
|
||||
_this = this;
|
||||
promise = new RSVP.Promise();
|
||||
jQuery.ajax({
|
||||
$.ajax({
|
||||
url: "/users/" + username + '.json',
|
||||
success: function(json) {
|
||||
// todo: decompose to object
|
||||
|
@ -305,7 +305,7 @@ Discourse.User.reopenClass({
|
|||
},
|
||||
|
||||
createAccount: function(name, email, password, username, passwordConfirm, challenge) {
|
||||
return jQuery.ajax({
|
||||
return $.ajax({
|
||||
url: '/users',
|
||||
dataType: 'json',
|
||||
data: {
|
||||
|
|
|
@ -18,7 +18,7 @@ var popstateReady = false;
|
|||
Ember.DiscourseLocation = Ember.Object.extend({
|
||||
init: function() {
|
||||
set(this, 'location', get(this, 'location') || window.location);
|
||||
if ( jQuery.inArray('state', jQuery.event.props) < 0 )
|
||||
if ( $.inArray('state', $.event.props) < 0 )
|
||||
jQuery.event.props.push('state')
|
||||
this.initState();
|
||||
},
|
||||
|
|
|
@ -89,7 +89,7 @@ Discourse.ComposerView = Discourse.View.extend({
|
|||
|
||||
// If visible update the text
|
||||
educationKey = this.get('content.creatingTopic') ? 'new-topic' : 'new-reply';
|
||||
return jQuery.get("/education/" + educationKey).then(function(result) {
|
||||
return $.get("/education/" + educationKey).then(function(result) {
|
||||
return _this.set('educationContents', result);
|
||||
});
|
||||
}).observes('controller.hasReply', 'content.creatingTopic', 'Discourse.currentUser.reply_count'),
|
||||
|
@ -251,15 +251,11 @@ Discourse.ComposerView = Discourse.View.extend({
|
|||
});
|
||||
|
||||
topic = this.get('topic');
|
||||
this.editor = editor = Discourse.Markdown.createNewMarkdownEditor(Discourse.Markdown.markdownConverter({
|
||||
this.editor = editor = Discourse.Markdown.createEditor({
|
||||
lookupAvatar: function(username) {
|
||||
return Discourse.Utilities.avatarImg({
|
||||
username: username,
|
||||
size: 'tiny'
|
||||
return Discourse.Utilities.avatarImg({ username: username, size: 'tiny' });
|
||||
}
|
||||
});
|
||||
},
|
||||
sanitize: true
|
||||
}));
|
||||
|
||||
$uploadTarget = $('#reply-control');
|
||||
this.editor.hooks.insertImageDialog = function(callback) {
|
||||
|
|
|
@ -53,7 +53,7 @@ Discourse.HeaderView = Discourse.View.extend({
|
|||
|
||||
showNotifications: function() {
|
||||
var _this = this;
|
||||
jQuery.get("/notifications").then(function(result) {
|
||||
$.get("/notifications").then(function(result) {
|
||||
_this.set('notifications', result.map(function(n) {
|
||||
return Discourse.Notification.create(n);
|
||||
}));
|
||||
|
|
|
@ -240,7 +240,7 @@ Discourse.CreateAccountView = Discourse.ModalBodyView.extend({
|
|||
|
||||
fetchConfirmationValue: function() {
|
||||
var _this = this;
|
||||
return jQuery.ajax({
|
||||
return $.ajax({
|
||||
url: '/users/hp.json',
|
||||
success: function(json) {
|
||||
_this.set('accountPasswordConfirm', json.value);
|
||||
|
|
|
@ -16,7 +16,7 @@ Discourse.ForgotPasswordView = Discourse.ModalBodyView.extend({
|
|||
}).property('accountEmailOrUsername'),
|
||||
|
||||
submit: function() {
|
||||
jQuery.post("/session/forgot_password", {
|
||||
$.post("/session/forgot_password", {
|
||||
username: this.get('accountEmailOrUsername')
|
||||
});
|
||||
// don't tell people what happened, this keeps it more secure (ensure same on server)
|
||||
|
|
|
@ -45,7 +45,7 @@ Discourse.LoginView = Discourse.ModalBodyView.extend({
|
|||
login: function() {
|
||||
var _this = this;
|
||||
this.set('loggingIn', true);
|
||||
jQuery.post("/session", {
|
||||
$.post("/session", {
|
||||
login: this.get('loginName'),
|
||||
password: this.get('loginPassword')
|
||||
}).success(function(result) {
|
||||
|
|
|
@ -12,7 +12,7 @@ Discourse.NotActivatedView = Discourse.ModalBodyView.extend({
|
|||
emailSent: false,
|
||||
|
||||
sendActivationEmail: function() {
|
||||
jQuery.get('/users/' + this.get('username') + '/send_activation_email');
|
||||
$.get('/users/' + this.get('username') + '/send_activation_email');
|
||||
this.set('emailSent', true);
|
||||
}
|
||||
});
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/*global Markdown:true*/
|
||||
/*global Markdown:true assetPath:true */
|
||||
|
||||
/**
|
||||
A control to support using PageDown as an Ember view.
|
||||
|
@ -14,14 +14,13 @@ Discourse.PagedownEditor = Ember.ContainerView.extend({
|
|||
init: function() {
|
||||
this._super();
|
||||
|
||||
$LAB.script(assetPath('defer/html-sanitizer-bundle'));
|
||||
|
||||
// Add a button bar
|
||||
this.pushObject(Em.View.create({ elementId: 'wmd-button-bar' }));
|
||||
this.pushObject(Em.TextArea.create({
|
||||
valueBinding: 'parentView.value',
|
||||
elementId: 'wmd-input'
|
||||
}));
|
||||
this.pushObject(Em.TextArea.create({ valueBinding: 'parentView.value', elementId: 'wmd-input' }));
|
||||
|
||||
this.pushObject(Em.View.createWithMixins(Discourse.Presence, {
|
||||
this.pushObject(Discourse.View.createWithMixins({
|
||||
elementId: 'wmd-preview',
|
||||
classNameBindings: [':preview', 'hidden'],
|
||||
hidden: (function() {
|
||||
|
@ -31,12 +30,9 @@ Discourse.PagedownEditor = Ember.ContainerView.extend({
|
|||
},
|
||||
|
||||
didInsertElement: function() {
|
||||
var $wmdInput;
|
||||
$wmdInput = $('#wmd-input');
|
||||
var $wmdInput = $('#wmd-input');
|
||||
$wmdInput.data('init', true);
|
||||
this.editor = Discourse.Markdown.createNewMarkdownEditor(Discourse.Markdown.markdownConverter({
|
||||
sanitize: true
|
||||
}));
|
||||
this.editor = Discourse.Markdown.createEditor();
|
||||
return this.editor.run();
|
||||
}
|
||||
|
||||
|
|
|
@ -190,7 +190,7 @@ Discourse.PostView = Discourse.View.extend({
|
|||
if ($aside.data('topic')) {
|
||||
topic_id = $aside.data('topic');
|
||||
}
|
||||
jQuery.getJSON("/posts/by_number/" + topic_id + "/" + ($aside.data('post')), function(result) {
|
||||
$.getJSON("/posts/by_number/" + topic_id + "/" + ($aside.data('post')), function(result) {
|
||||
var parsed;
|
||||
parsed = $(result.cooked);
|
||||
parsed.replaceText(originalText, "<span class='highlighted'>" + originalText + "</span>");
|
||||
|
|
|
@ -94,7 +94,7 @@ Discourse.SearchView = Discourse.View.extend({
|
|||
this.currentSearch = null;
|
||||
}
|
||||
this.searcher = this.searcher || Discourse.debounce(function(term, typeFilter) {
|
||||
_this.currentSearch = jQuery.ajax({
|
||||
_this.currentSearch = $.ajax({
|
||||
url: '/search',
|
||||
data: {
|
||||
term: term,
|
||||
|
|
|
@ -1023,6 +1023,7 @@
|
|||
var previewSetter;
|
||||
|
||||
var previewSet = function (text) {
|
||||
|
||||
if (previewSetter)
|
||||
return previewSetter(text);
|
||||
|
||||
|
|
|
@ -12,7 +12,7 @@ var console = window.console = {};
|
|||
console.log = console.info = console.warn = console.error = function(){};
|
||||
|
||||
// jQuery
|
||||
var jQuery = window.jQuery = function() { return jQuery; };
|
||||
var $ = jQuery = window.jQuery = function() { return jQuery; };
|
||||
jQuery.ready = function() { return jQuery; };
|
||||
jQuery.inArray = function() { return jQuery; };
|
||||
jQuery.event = {
|
||||
|
|
|
@ -12,13 +12,13 @@ describe("Discourse.Onebox", function() {
|
|||
it("Stops rapid calls with cache true", function() {
|
||||
Discourse.Onebox.load(anchor, true);
|
||||
Discourse.Onebox.load(anchor, true);
|
||||
expect(jQuery.ajax.calls.length).toBe(1);
|
||||
expect($.ajax.calls.length).toBe(1);
|
||||
});
|
||||
|
||||
it("Stops rapid calls with cache false", function() {
|
||||
Discourse.Onebox.load(anchor, false);
|
||||
Discourse.Onebox.load(anchor, false);
|
||||
expect(jQuery.ajax.calls.length).toBe(1);
|
||||
expect($.ajax.calls.length).toBe(1);
|
||||
});
|
||||
|
||||
});
|
||||
|
|
Loading…
Reference in a new issue