FIX: FAQ wasn't loading sometimes

This commit is contained in:
Robin Ward
2013-07-16 12:11:30 -04:00
parent 1927263d1d
commit 82c734ec84
3 changed files with 5 additions and 4 deletions

View File

@ -250,9 +250,7 @@ Discourse = Ember.Application.createWithMixins({
// If we have URL_FIXTURES, load from there instead (testing) // If we have URL_FIXTURES, load from there instead (testing)
var fixture = Discourse.URL_FIXTURES && Discourse.URL_FIXTURES[url]; var fixture = Discourse.URL_FIXTURES && Discourse.URL_FIXTURES[url];
if (fixture) { if (fixture) {
return Ember.Deferred.promise(function(promise) { return Ember.RSVP.resolve(fixture);
promise.resolve(fixture);
});
} }
return Ember.Deferred.promise(function (promise) { return Ember.Deferred.promise(function (promise) {

View File

@ -20,7 +20,7 @@ Discourse.StaticController = Discourse.Controller.extend({
text = text[1]; text = text[1];
this.set('content', text); this.set('content', text);
} else { } else {
return Discourse.ajax(path).then(function (result) { return Discourse.ajax(path, {dataType: 'html'}).then(function (result) {
staticController.set('content', result); staticController.set('content', result);
}); });
} }

View File

@ -9,9 +9,11 @@
Discourse.StaticController.pages.forEach(function(page) { Discourse.StaticController.pages.forEach(function(page) {
Discourse[(page.capitalize()) + "Route"] = Discourse.Route.extend({ Discourse[(page.capitalize()) + "Route"] = Discourse.Route.extend({
renderTemplate: function() { renderTemplate: function() {
this.render('static'); this.render('static');
}, },
setupController: function() { setupController: function() {
var config_key = Discourse.StaticController.configs[page]; var config_key = Discourse.StaticController.configs[page];
if (config_key && Discourse.SiteSettings[config_key].length > 0) { if (config_key && Discourse.SiteSettings[config_key].length > 0) {
@ -20,6 +22,7 @@ Discourse.StaticController.pages.forEach(function(page) {
this.controllerFor('static').loadPath("/" + page); this.controllerFor('static').loadPath("/" + page);
} }
} }
}); });
}); });