Convert all CoffeeScript to Javascript. See:
http://meta.discourse.org/t/is-it-better-for-discourse-to-use-javascript-or-coffeescript/3153
This commit is contained in:
@@ -0,0 +1,32 @@
|
||||
(function() {
|
||||
|
||||
Discourse.StaticController = Ember.Controller.extend({
|
||||
content: null,
|
||||
loadPath: function(path) {
|
||||
var $preloaded, text,
|
||||
_this = this;
|
||||
this.set('content', null);
|
||||
/* Load from <noscript> if we have it.
|
||||
*/
|
||||
|
||||
$preloaded = jQuery("noscript[data-path=\"" + path + "\"]");
|
||||
if ($preloaded.length) {
|
||||
text = $preloaded.text();
|
||||
text = text.replace(/<header[\s\S]*<\/header\>/, '');
|
||||
return this.set('content', text);
|
||||
} else {
|
||||
return jQuery.ajax({
|
||||
url: "" + path + ".json",
|
||||
success: function(result) {
|
||||
return _this.set('content', result);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
Discourse.StaticController.reopenClass({
|
||||
pages: ['faq', 'tos', 'privacy']
|
||||
});
|
||||
|
||||
}).call(this);
|
||||
Reference in New Issue
Block a user