From 82c734ec84447d15a859892a8a2555baae824fe4 Mon Sep 17 00:00:00 2001 From: Robin Ward Date: Tue, 16 Jul 2013 12:11:30 -0400 Subject: [PATCH] FIX: FAQ wasn't loading sometimes --- app/assets/javascripts/discourse.js | 4 +--- .../javascripts/discourse/controllers/static_controller.js | 2 +- app/assets/javascripts/discourse/routes/static_route.js | 3 +++ 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/app/assets/javascripts/discourse.js b/app/assets/javascripts/discourse.js index 7b3148392..4dbe46d57 100644 --- a/app/assets/javascripts/discourse.js +++ b/app/assets/javascripts/discourse.js @@ -250,9 +250,7 @@ Discourse = Ember.Application.createWithMixins({ // If we have URL_FIXTURES, load from there instead (testing) var fixture = Discourse.URL_FIXTURES && Discourse.URL_FIXTURES[url]; if (fixture) { - return Ember.Deferred.promise(function(promise) { - promise.resolve(fixture); - }); + return Ember.RSVP.resolve(fixture); } return Ember.Deferred.promise(function (promise) { diff --git a/app/assets/javascripts/discourse/controllers/static_controller.js b/app/assets/javascripts/discourse/controllers/static_controller.js index 79789c92a..9cf97a139 100644 --- a/app/assets/javascripts/discourse/controllers/static_controller.js +++ b/app/assets/javascripts/discourse/controllers/static_controller.js @@ -20,7 +20,7 @@ Discourse.StaticController = Discourse.Controller.extend({ text = text[1]; this.set('content', text); } else { - return Discourse.ajax(path).then(function (result) { + return Discourse.ajax(path, {dataType: 'html'}).then(function (result) { staticController.set('content', result); }); } diff --git a/app/assets/javascripts/discourse/routes/static_route.js b/app/assets/javascripts/discourse/routes/static_route.js index 5b1e8073a..dca850d22 100644 --- a/app/assets/javascripts/discourse/routes/static_route.js +++ b/app/assets/javascripts/discourse/routes/static_route.js @@ -9,9 +9,11 @@ Discourse.StaticController.pages.forEach(function(page) { Discourse[(page.capitalize()) + "Route"] = Discourse.Route.extend({ + renderTemplate: function() { this.render('static'); }, + setupController: function() { var config_key = Discourse.StaticController.configs[page]; if (config_key && Discourse.SiteSettings[config_key].length > 0) { @@ -20,6 +22,7 @@ Discourse.StaticController.pages.forEach(function(page) { this.controllerFor('static').loadPath("/" + page); } } + }); });