diff --git a/app/assets/javascripts/admin/controllers/admin_email_logs_controller.js b/app/assets/javascripts/admin/controllers/admin_email_logs_controller.js index 8fffd53d2fd..bb39a5868e2 100644 --- a/app/assets/javascripts/admin/controllers/admin_email_logs_controller.js +++ b/app/assets/javascripts/admin/controllers/admin_email_logs_controller.js @@ -26,7 +26,7 @@ Discourse.AdminEmailLogsController = Ember.ArrayController.extend(Discourse.Pres var _this = this; _this.set('sentTestEmail', false); $.ajax({ - url: '/admin/email_logs/test', + url: Discourse.getURL("/admin/email_logs/test"), type: 'POST', data: { email_address: this.get('testEmailAddress') }, success: function() { diff --git a/app/assets/javascripts/admin/models/admin_user.js b/app/assets/javascripts/admin/models/admin_user.js index 47a111969c9..1bc09ddb965 100644 --- a/app/assets/javascripts/admin/models/admin_user.js +++ b/app/assets/javascripts/admin/models/admin_user.js @@ -7,10 +7,18 @@ @module Discourse **/ Discourse.AdminUser = Discourse.Model.extend({ + path: (function() { + return Discourse.getURL("/users/") + (this.get('username_lower')); + }).property('username'), + + adminPath: (function() { + return Discourse.getURL("/admin/users/") + (this.get('username_lower')); + }).property('username'), + deleteAllPosts: function() { this.set('can_delete_all_posts', false); - $.ajax("/admin/users/" + (this.get('id')) + "/delete_all_posts", {type: 'PUT'}); + $.ajax(Discourse.getURL("/admin/users/") + (this.get('id')) + "/delete_all_posts", {type: 'PUT'}); }, // Revoke the user's admin access @@ -18,14 +26,14 @@ Discourse.AdminUser = Discourse.Model.extend({ this.set('admin', false); this.set('can_grant_admin', true); this.set('can_revoke_admin', false); - return $.ajax("/admin/users/" + (this.get('id')) + "/revoke_admin", {type: 'PUT'}); + return $.ajax(Discourse.getURL("/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); - $.ajax("/admin/users/" + (this.get('id')) + "/grant_admin", {type: 'PUT'}); + $.ajax(Discourse.getURL("/admin/users/") + (this.get('id')) + "/grant_admin", {type: 'PUT'}); }, // Revoke the user's moderation access @@ -33,18 +41,18 @@ Discourse.AdminUser = Discourse.Model.extend({ this.set('moderator', false); this.set('can_grant_moderation', true); this.set('can_revoke_moderation', false); - return $.ajax("/admin/users/" + (this.get('id')) + "/revoke_moderation", {type: 'PUT'}); + return $.ajax(Discourse.getURL("/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); - $.ajax("/admin/users/" + (this.get('id')) + "/grant_moderation", {type: 'PUT'}); + $.ajax(Discourse.getURL("/admin/users/") + (this.get('id')) + "/grant_moderation", {type: 'PUT'}); }, refreshBrowsers: function() { - $.ajax("/admin/users/" + (this.get('id')) + "/refresh_browsers", {type: 'POST'}); + $.ajax(Discourse.getURL("/admin/users/") + (this.get('id')) + "/refresh_browsers", {type: 'POST'}); bootbox.alert("Message sent to all clients!"); }, @@ -52,7 +60,7 @@ Discourse.AdminUser = Discourse.Model.extend({ this.set('can_approve', false); this.set('approved', true); this.set('approved_by', Discourse.get('currentUser')); - $.ajax("/admin/users/" + (this.get('id')) + "/approve", {type: 'PUT'}); + $.ajax(Discourse.getURL("/admin/users/") + (this.get('id')) + "/approve", {type: 'PUT'}); }, username_lower: (function() { @@ -79,7 +87,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 $.ajax("/admin/users/" + this.id + "/ban", { + return $.ajax(Discourse.getURL("/admin/users/") + this.id + "/ban", { type: 'PUT', data: {duration: duration}, success: function() { @@ -99,7 +107,7 @@ Discourse.AdminUser = Discourse.Model.extend({ unban: function() { var _this = this; - return $.ajax("/admin/users/" + this.id + "/unban", { + return $.ajax(Discourse.getURL("/admin/users/") + this.id + "/unban", { type: 'PUT', success: function() { window.location.reload(); @@ -116,7 +124,7 @@ Discourse.AdminUser = Discourse.Model.extend({ impersonate: function() { var _this = this; - return $.ajax("/admin/impersonate", { + return $.ajax(Discourse.getURL("/admin/impersonate"), { type: 'POST', data: { username_or_email: this.get('username') @@ -145,7 +153,7 @@ Discourse.AdminUser.reopenClass({ user.set('can_approve', false); return user.set('selected', false); }); - return $.ajax("/admin/users/approve-bulk", { + return $.ajax(Discourse.getURL("/admin/users/approve-bulk"), { type: 'PUT', data: { users: users.map(function(u) { @@ -156,7 +164,7 @@ Discourse.AdminUser.reopenClass({ }, find: function(username) { - return $.ajax({url: "/admin/users/" + username}).then(function (result) { + return $.ajax({url: Discourse.getURL("/admin/users/") + username}).then(function (result) { return Discourse.AdminUser.create(result); }) }, @@ -165,7 +173,7 @@ Discourse.AdminUser.reopenClass({ var result; result = Em.A(); $.ajax({ - url: "/admin/users/list/" + query + ".json", + url: Discourse.getURL("/admin/users/list/") + query + ".json", data: { filter: filter }, diff --git a/app/assets/javascripts/admin/models/email_log.js b/app/assets/javascripts/admin/models/email_log.js index ab5e4ff3b01..066767a7a8e 100644 --- a/app/assets/javascripts/admin/models/email_log.js +++ b/app/assets/javascripts/admin/models/email_log.js @@ -20,7 +20,7 @@ Discourse.EmailLog.reopenClass({ var result; result = Em.A(); $.ajax({ - url: "/admin/email_logs.json", + url: Discourse.getURL("/admin/email_logs.json"), data: { filter: filter }, success: function(logs) { logs.each(function(log) { diff --git a/app/assets/javascripts/admin/models/flagged_post.js b/app/assets/javascripts/admin/models/flagged_post.js index e22e751d278..5eafc07be52 100644 --- a/app/assets/javascripts/admin/models/flagged_post.js +++ b/app/assets/javascripts/admin/models/flagged_post.js @@ -47,14 +47,14 @@ Discourse.FlaggedPost = Discourse.Post.extend({ deletePost: function() { if (this.get('post_number') === "1") { - return $.ajax("/t/" + this.topic_id, { type: 'DELETE', cache: false }); + return $.ajax(Discourse.getURL("/t/") + this.topic_id, { type: 'DELETE', cache: false }); } else { - return $.ajax("/posts/" + this.id, { type: 'DELETE', cache: false }); + return $.ajax(Discourse.getURL("/posts/") + this.id, { type: 'DELETE', cache: false }); } }, clearFlags: function() { - return $.ajax("/admin/flags/clear/" + this.id, { type: 'POST', cache: false }); + return $.ajax(Discourse.getURL("/admin/flags/clear/") + this.id, { type: 'POST', cache: false }); }, hiddenClass: (function() { @@ -68,7 +68,7 @@ Discourse.FlaggedPost.reopenClass({ var result; result = Em.A(); $.ajax({ - url: "/admin/flags/" + filter + ".json", + url: Discourse.getURL("/admin/flags/") + filter + ".json", success: function(data) { var userLookup; userLookup = {}; diff --git a/app/assets/javascripts/admin/models/report.js b/app/assets/javascripts/admin/models/report.js index 1088edbbf21..5099065c2e2 100644 --- a/app/assets/javascripts/admin/models/report.js +++ b/app/assets/javascripts/admin/models/report.js @@ -3,7 +3,7 @@ Discourse.Report = Discourse.Model.extend({}); Discourse.Report.reopenClass({ find: function(type) { var model = Discourse.Report.create({type: type}); - $.ajax("/admin/reports/" + type, { + $.ajax(Discourse.getURL("/admin/reports/") + type, { type: 'GET', success: function(json) { @@ -24,4 +24,4 @@ Discourse.Report.reopenClass({ }); return(model); } -}); \ No newline at end of file +}); diff --git a/app/assets/javascripts/admin/models/site_customization.js b/app/assets/javascripts/admin/models/site_customization.js index dbc3f8618a9..2f7294c7082 100644 --- a/app/assets/javascripts/admin/models/site_customization.js +++ b/app/assets/javascripts/admin/models/site_customization.js @@ -56,7 +56,7 @@ Discourse.SiteCustomization = Discourse.Model.extend({ override_default_style: this.override_default_style }; return $.ajax({ - url: "/admin/site_customizations" + (this.id ? '/' + this.id : ''), + url: Discourse.getURL("/admin/site_customizations") + (this.id ? '/' + this.id : ''), data: { site_customization: data }, @@ -68,7 +68,7 @@ Discourse.SiteCustomization = Discourse.Model.extend({ if (!this.id) return; return $.ajax({ - url: "/admin/site_customizations/" + this.id, + url: Discourse.getURL("/admin/site_customizations/") + this.id, type: 'DELETE' }); } @@ -94,7 +94,7 @@ Discourse.SiteCustomization.reopenClass({ loading: true }); $.ajax({ - url: "/admin/site_customizations", + url: Discourse.getURL("/admin/site_customizations"), dataType: "json", success: function(data) { if (data) { diff --git a/app/assets/javascripts/admin/models/site_setting.js b/app/assets/javascripts/admin/models/site_setting.js index c8f8b4ae6e3..daeb2b5a5ed 100644 --- a/app/assets/javascripts/admin/models/site_setting.js +++ b/app/assets/javascripts/admin/models/site_setting.js @@ -72,7 +72,7 @@ Discourse.SiteSetting = Discourse.Model.extend({ save: function() { // Update the setting var setting = this; - return $.ajax("/admin/site_settings/" + (this.get('setting')), { + return $.ajax(Discourse.getURL("/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(); - $.get("/admin/site_settings", function(settings) { + $.get(Discourse.getURL("/admin/site_settings"), function(settings) { return settings.each(function(s) { s.originalValue = s.value; return result.pushObject(Discourse.SiteSetting.create(s)); diff --git a/app/assets/javascripts/admin/models/version_check.js b/app/assets/javascripts/admin/models/version_check.js index 91640b86d4c..1746d30f19d 100644 --- a/app/assets/javascripts/admin/models/version_check.js +++ b/app/assets/javascripts/admin/models/version_check.js @@ -26,8 +26,8 @@ Discourse.VersionCheck = Discourse.Model.extend({ Discourse.VersionCheck.reopenClass({ find: function() { - return $.ajax({ url: '/admin/version_check', dataType: 'json' }).then(function(json) { + return $.ajax({ url: Discourse.getURL('/admin/version_check'), dataType: 'json' }).then(function(json) { return Discourse.VersionCheck.create(json); }); } -}); \ No newline at end of file +}); diff --git a/app/assets/javascripts/admin/templates/email_logs.js.handlebars b/app/assets/javascripts/admin/templates/email_logs.js.handlebars index 371fd81b858..213f47e6466 100644 --- a/app/assets/javascripts/admin/templates/email_logs.js.handlebars +++ b/app/assets/javascripts/admin/templates/email_logs.js.handlebars @@ -22,8 +22,8 @@ {{date view.content.created_at}} {{#if view.content.user}} - {{avatar view.content.user imageSize="tiny"}} - {{view.content.user.username}} + {{avatar view.content.user imageSize="tiny"}} + {{view.content.user.username}} {{else}} — {{/if}} diff --git a/app/assets/javascripts/admin/templates/user.js.handlebars b/app/assets/javascripts/admin/templates/user.js.handlebars index 074e3fd7216..ca6832ca90d 100644 --- a/app/assets/javascripts/admin/templates/user.js.handlebars +++ b/app/assets/javascripts/admin/templates/user.js.handlebars @@ -5,7 +5,7 @@
{{i18n user.username.title}}
{{content.username}}
- + {{i18n admin.user.show_public_profile}} @@ -45,8 +45,8 @@
{{#if content.approved}} {{i18n admin.user.approved_by}} - {{avatar approved_by imageSize="small"}} - {{content.approved_by.username}} + {{avatar approved_by imageSize="small"}} + {{content.approved_by.username}} {{else}} {{i18n no_value}} {{/if}} diff --git a/app/assets/javascripts/admin/templates/users_list.js.handlebars b/app/assets/javascripts/admin/templates/users_list.js.handlebars index 32d347c8d4a..2314de35e95 100644 --- a/app/assets/javascripts/admin/templates/users_list.js.handlebars +++ b/app/assets/javascripts/admin/templates/users_list.js.handlebars @@ -51,9 +51,9 @@ {{/if}} - {{avatar this imageSize="small"}} + {{avatar this imageSize="small"}} - {{unbound username}} + {{unbound username}} {{shorten email}} {{{unbound last_emailed_age}}} {{{unbound last_seen_age}}} @@ -79,4 +79,4 @@ {{else}}
{{i18n loading}}
-{{/if}} \ No newline at end of file +{{/if}} diff --git a/app/assets/javascripts/discourse.js b/app/assets/javascripts/discourse.js index 81926437dd8..1b3b02e645b 100644 --- a/app/assets/javascripts/discourse.js +++ b/app/assets/javascripts/discourse.js @@ -22,6 +22,16 @@ Discourse = Ember.Application.createWithMixins({ // The highest seen post number by topic highestSeenByTopic: {}, + rootURL: '/', + + getURL: function(url) { + var u = this.get('rootURL'); + if (u[u.length-1] === '/') { + u = u.substring(0, u.length-1); + } + return u + url; + }, + titleChanged: function() { var title; title = ""; @@ -156,7 +166,7 @@ Discourse = Ember.Application.createWithMixins({ **/ logout: function() { Discourse.KeyValueStore.abandonLocal(); - return $.ajax("/session/" + this.get('currentUser.username'), { + return $.ajax(Discourse.getURL("/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. diff --git a/app/assets/javascripts/discourse/components/click_track.js b/app/assets/javascripts/discourse/components/click_track.js index cb22e91ff1d..a4ccbeb36dd 100644 --- a/app/assets/javascripts/discourse/components/click_track.js +++ b/app/assets/javascripts/discourse/components/click_track.js @@ -44,7 +44,7 @@ Discourse.ClickTrack = { ownLink = userId && (userId === Discourse.get('currentUser.id')); // Build a Redirect URL - trackingUrl = "/clicks/track?url=" + encodeURIComponent(href); + trackingUrl = Discourse.getURL("/clicks/track?url=" + encodeURIComponent(href)); if (postId && (!$a.data('ignore-post-id'))) { trackingUrl += "&post_id=" + encodeURI(postId); } @@ -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) { - $.get("/clicks/track", { + $.get(Discourse.getURL("/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) { - $.get("/clicks/track", { + $.get(Discourse.getURL("/clicks/track"), { url: href, post_id: postId, topic_id: topicId, diff --git a/app/assets/javascripts/discourse/components/markdown.js b/app/assets/javascripts/discourse/components/markdown.js index df3d627864d..ff87bfb3ce4 100644 --- a/app/assets/javascripts/discourse/components/markdown.js +++ b/app/assets/javascripts/discourse/components/markdown.js @@ -141,7 +141,7 @@ 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 + "" + name + ""; + return pre + "" + name + ""; } else { return pre + "" + name + ""; } diff --git a/app/assets/javascripts/discourse/components/mention.js b/app/assets/javascripts/discourse/components/mention.js index 2b22d7463fd..bccddd7bf03 100644 --- a/app/assets/javascripts/discourse/components/mention.js +++ b/app/assets/javascripts/discourse/components/mention.js @@ -21,7 +21,7 @@ Discourse.Mention = (function() { callback(cached); return false; } else { - $.get("/users/is_local_username", { + $.get(Discourse.getURL("/users/is_local_username"), { username: name }, function(r) { cache(name, r.valid); @@ -40,7 +40,7 @@ Discourse.Mention = (function() { username = username.substr(1); loading = lookup(username, function(valid) { if (valid) { - return $elem.replaceWith("@" + username + ""); + return $elem.replaceWith("@" + username + ""); } else { return $elem.removeClass('mention-loading').addClass('mention-tested'); } diff --git a/app/assets/javascripts/discourse/components/message_bus.js b/app/assets/javascripts/discourse/components/message_bus.js index 8086d83c008..c38cb9f4e27 100644 --- a/app/assets/javascripts/discourse/components/message_bus.js +++ b/app/assets/javascripts/discourse/components/message_bus.js @@ -68,7 +68,7 @@ Discourse.MessageBus = (function() { data[c.channel] = c.last_id === void 0 ? -1 : c.last_id; }); gotData = false; - _this.longPoll = $.ajax("/message-bus/" + clientId + "/poll?" + (isHidden() || !_this.enableLongPolling ? "dlp=t" : ""), { + _this.longPoll = $.ajax(Discourse.getURL("/message-bus/") + clientId + "/poll?" + (isHidden() || !_this.enableLongPolling ? "dlp=t" : ""), { data: data, cache: false, dataType: 'json', @@ -154,4 +154,4 @@ Discourse.MessageBus = (function() { } } }; -})(); \ No newline at end of file +})(); diff --git a/app/assets/javascripts/discourse/components/screen_track.js b/app/assets/javascripts/discourse/components/screen_track.js index ddfc8c47cb4..0eb9371f314 100644 --- a/app/assets/javascripts/discourse/components/screen_track.js +++ b/app/assets/javascripts/discourse/components/screen_track.js @@ -98,7 +98,7 @@ Discourse.ScreenTrack = Ember.Object.extend({ highestSeenByTopic[topicId] = this.highestSeen; } if (!Object.isEmpty(newTimings)) { - $.ajax('/topics/timings', { + $.ajax(Discourse.getURL('/topics/timings'), { data: { timings: newTimings, topic_time: this.topicTime, diff --git a/app/assets/javascripts/discourse/components/url.js b/app/assets/javascripts/discourse/components/url.js index 87d67327d52..99d7682e5d1 100644 --- a/app/assets/javascripts/discourse/components/url.js +++ b/app/assets/javascripts/discourse/components/url.js @@ -13,6 +13,14 @@ Discourse.URL = { // Used for matching a /more URL MORE_REGEXP: /\/more$/, + /** + Will be pre-pended to path upon state change + + @property rootURL + @default '/' + */ + rootURL: '/', + /** @private @@ -61,6 +69,13 @@ Discourse.URL = { routeTo: function(path) { var oldPath = window.location.pathname; path = path.replace(/https?\:\/\/[^\/]+/, ''); + /* + If the URL is absolute, remove rootURL + */ + if (path.match(/^\//)) { + var rootURL = this.rootURL.replace(/\/$/, ''); + path = path.replace(rootURL, ''); + } /* If the URL is in the topic form, /t/something/:topic_id/:post_number @@ -98,4 +113,4 @@ Discourse.URL = { return router.handleURL(path); } -}; \ No newline at end of file +}; diff --git a/app/assets/javascripts/discourse/components/user_search.js b/app/assets/javascripts/discourse/components/user_search.js index 4c113428816..3fb023a5933 100644 --- a/app/assets/javascripts/discourse/components/user_search.js +++ b/app/assets/javascripts/discourse/components/user_search.js @@ -15,7 +15,7 @@ cacheTime = null; doSearch = function(term, topicId, success) { return $.ajax({ - url: '/users/search/users', + url: Discourse.getURL('/users/search/users'), dataType: 'JSON', data: { term: term, diff --git a/app/assets/javascripts/discourse/components/utilities.js b/app/assets/javascripts/discourse/components/utilities.js index c96efb2cf76..4b608aa7b55 100644 --- a/app/assets/javascripts/discourse/components/utilities.js +++ b/app/assets/javascripts/discourse/components/utilities.js @@ -48,7 +48,7 @@ Discourse.Utilities = { description = Em.get(category, 'description'); // Build the HTML link - result = " 0) { url += "?exclude_category=" + menuItem.filters[0].substring(1); } diff --git a/app/assets/javascripts/discourse/models/user.js b/app/assets/javascripts/discourse/models/user.js index 509d54fe630..447572b5e1a 100644 --- a/app/assets/javascripts/discourse/models/user.js +++ b/app/assets/javascripts/discourse/models/user.js @@ -45,7 +45,17 @@ Discourse.User = Discourse.Model.extend({ @type {String} **/ path: (function() { - return "/users/" + (this.get('username_lower')); + return Discourse.getURL("/users/") + (this.get('username_lower')); + }).property('username'), + + /** + Path to this user's administration + + @property adminPath + @type {String} + **/ + adminPath: (function() { + return Discourse.getURL("/admin/users/") + (this.get('username_lower')); }).property('username'), /** @@ -77,7 +87,7 @@ Discourse.User = Discourse.Model.extend({ **/ changeUsername: function(newUsername) { return $.ajax({ - url: "/users/" + (this.get('username_lower')) + "/preferences/username", + url: Discourse.getURL("/users/") + (this.get('username_lower')) + "/preferences/username", type: 'PUT', data: { new_username: newUsername @@ -94,7 +104,7 @@ Discourse.User = Discourse.Model.extend({ **/ changeEmail: function(email) { return $.ajax({ - url: "/users/" + (this.get('username_lower')) + "/preferences/email", + url: Discourse.getURL("/users/") + (this.get('username_lower')) + "/preferences/email", type: 'PUT', data: { email: email @@ -121,7 +131,7 @@ Discourse.User = Discourse.Model.extend({ **/ save: function(finished) { var _this = this; - $.ajax("/users/" + this.get('username').toLowerCase(), { + $.ajax(Discourse.getURL("/users/") + this.get('username').toLowerCase(), { data: this.getProperties('auto_track_topics_after_msecs', 'bio_raw', 'website', @@ -154,7 +164,7 @@ Discourse.User = Discourse.Model.extend({ var good; good = false; $.ajax({ - url: '/session/forgot_password', + url: Discourse.getURL("/session/forgot_password"), dataType: 'json', data: { username: this.get('username') @@ -200,7 +210,7 @@ Discourse.User = Discourse.Model.extend({ _this = this; stream = this.get('stream'); $.ajax({ - url: "/user_actions/" + id + ".json", + url: Discourse.getURL("/user_actions/") + id + ".json", dataType: 'json', cache: 'false', success: function(result) { @@ -236,7 +246,7 @@ Discourse.User = Discourse.Model.extend({ stream = this.get('stream'); if (!stream) return; - url = "/user_actions?offset=" + this.get('totalItems') + "&user_id=" + (this.get("id")); + url = Discourse.getURL("/user_actions?offset=") + this.get('totalItems') + "&user_id=" + (this.get("id")); if (this.get('streamFilter')) { url += "&filter=" + (this.get('streamFilter')); } @@ -363,7 +373,7 @@ Discourse.User.reopenClass({ **/ checkUsername: function(username, email) { return $.ajax({ - url: '/users/check_username', + url: Discourse.getURL('/users/check_username'), type: 'GET', data: { username: username, @@ -428,7 +438,7 @@ Discourse.User.reopenClass({ // Check the preload store first return PreloadStore.get("user_" + username, function() { - return $.ajax({ url: "/users/" + username + '.json' }); + return $.ajax({ url: Discourse.getURL("/users/") + username + '.json' }); }).then(function (json) { // Create a user from the resulting JSON @@ -466,7 +476,7 @@ Discourse.User.reopenClass({ **/ createAccount: function(name, email, password, username, passwordConfirm, challenge) { return $.ajax({ - url: '/users', + url: Discourse.getURL("/users"), dataType: 'json', data: { name: name, diff --git a/app/assets/javascripts/discourse/templates/list/topic_list_item.js.handlebars b/app/assets/javascripts/discourse/templates/list/topic_list_item.js.handlebars index 6532e922ef0..d651cf94e5e 100644 --- a/app/assets/javascripts/discourse/templates/list/topic_list_item.js.handlebars +++ b/app/assets/javascripts/discourse/templates/list/topic_list_item.js.handlebars @@ -24,7 +24,7 @@ {{#each posters}} - {{avatar this usernamePath="user.username" imageSize="small"}} + {{avatar this usernamePath="user.username" imageSize="small"}} {{/each}} diff --git a/app/assets/javascripts/discourse/templates/post.js.handlebars b/app/assets/javascripts/discourse/templates/post.js.handlebars index 89790ae8da4..7d3b1722d3d 100644 --- a/app/assets/javascripts/discourse/templates/post.js.handlebars +++ b/app/assets/javascripts/discourse/templates/post.js.handlebars @@ -28,8 +28,8 @@ diff --git a/app/assets/javascripts/discourse/templates/user/stream.js.handlebars b/app/assets/javascripts/discourse/templates/user/stream.js.handlebars index b174b42cf5b..2a195fb5751 100644 --- a/app/assets/javascripts/discourse/templates/user/stream.js.handlebars +++ b/app/assets/javascripts/discourse/templates/user/stream.js.handlebars @@ -2,7 +2,7 @@ {{#collection contentBinding="stream" itemClass="item"}} {{#with view.content}}
-
{{avatar this imageSize="large" extraClasses="actor" ignoreTitle="true"}}
+
{{avatar this imageSize="large" extraClasses="actor" ignoreTitle="true"}}
{{date path="created_at" leaveAgo="true"}} {{unbound title}} @@ -17,7 +17,7 @@ {{/if}} {{/unless}} - {{personalizedName name usernamePath="username"}} + {{personalizedName name usernamePath="username"}} {{#if description}} {{unbound description}} {{#if isPostAction}} @@ -40,7 +40,7 @@ {{/each}} diff --git a/app/assets/javascripts/discourse/templates/user/user.js.handlebars b/app/assets/javascripts/discourse/templates/user/user.js.handlebars index f0c23433ecf..b3ab7e19973 100644 --- a/app/assets/javascripts/discourse/templates/user/user.js.handlebars +++ b/app/assets/javascripts/discourse/templates/user/user.js.handlebars @@ -7,7 +7,7 @@ {{/if}} {{#if Discourse.currentUser.admin}} -  {{i18n admin.user.show_admin_profile}} +  {{i18n admin.user.show_admin_profile}} {{/if}}