2
0

routes.js 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. Router.onBeforeAction('loading');
  2. Router.configure({
  3. loadingTemplate: 'loading'
  4. });
  5. Router.route("/", {
  6. template: "home"
  7. });
  8. Router.route("/login", {
  9. template: "login"
  10. });
  11. Router.route("/signup", {
  12. template: "register"
  13. });
  14. Router.route("/terms", {
  15. template: "terms"
  16. });
  17. Router.route("/api", {
  18. template: "api"
  19. });
  20. Router.route("/privacy", {
  21. template: "privacy"
  22. });
  23. Router.route("/about", {
  24. template: "about"
  25. });
  26. Router.route("/admin", {
  27. waitOn: function() {
  28. return Meteor.subscribe("isAdmin", Meteor.userId());
  29. },
  30. action: function() {
  31. var user = Meteor.users.findOne({});
  32. if (user !== undefined && user.profile !== undefined && user.profile.rank === "admin") {
  33. this.render("admin");
  34. } else {
  35. this.redirect("/");
  36. }
  37. }
  38. });
  39. Router.route("/stations", {
  40. action: function() {
  41. var user = Meteor.users.findOne({});
  42. if (user !== undefined && user.profile !== undefined && user.profile.rank === "admin") {
  43. this.render("stations");
  44. } else {
  45. this.redirect("/");
  46. }
  47. }
  48. })
  49. Router.route("/vis", {
  50. template: "visualizer"
  51. });
  52. Router.route("/:type", {
  53. template: "room"
  54. });
  55. Router.route("/u/:user", {
  56. template: "profile"
  57. });