This repository has been archived on 2023-03-18. You can view files and clone it, but cannot push or open issues or pull requests.
osr-discourse-src/app/assets/javascripts/discourse/routes/static_route.js
2014-01-14 01:09:12 +01:00

29 lines
687 B
JavaScript

/**
The routes used for rendering static content
@class StaticRoute
@extends Discourse.Route
@namespace Discourse
@module Discourse
**/
_.each(Discourse.StaticController.PAGES, 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) {
Discourse.URL.redirectTo(Discourse.SiteSettings[config_key]);
} else {
this.controllerFor('static').loadPath("/" + page);
}
}
});
});