Support for running discourse with a prefix (i.e. as http://servername/discourse)

This commit is contained in:
Wojciech Kocjan
2013-03-14 13:01:52 +01:00
parent 19860bd2c5
commit e6ccc300dc
61 changed files with 231 additions and 163 deletions

View File

@ -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.