Browse Source

legal page routes

Rafał Pitoń 10 years ago
parent
commit
299310ffb1

+ 43 - 0
misago/emberapp/app/routes/privacy-policy.js

@@ -0,0 +1,43 @@
+import Ember from 'ember';
+
+export default Ember.Route.extend({
+  page: 'privacy-policy',
+  defaultTitle: gettext('Privacy policy'),
+
+  setting: function() {
+    return this.get('page').replace(/-/g, '_');
+  }.property('page'),
+
+  title: function() {
+    return this.get('settings.' + this.get('setting') + '_title') || this.get('defaultTitle');
+  }.property('defaultTitle', 'settings'),
+
+  link: function() {
+    return this.get('settings.' + this.get('setting') + '_link');
+  }.property('settings'),
+
+  beforeModel: function(transition) {
+    if (this.get('link')) {
+      transition.abort();
+      window.location.replace(this.get('link'));
+    }
+  },
+
+  model: function() {
+    return this.store.find('legal-page', this.get('page'));
+  },
+
+  afterModel: function(model, transition) {
+    if (model.get('link')) {
+      transition.abort();
+      window.location.replace(model.get('link'));
+    }
+  },
+
+  actions: {
+    didTransition: function() {
+      this.send('setTitle', this.get('title'));
+      return true;
+    }
+  }
+});

+ 6 - 0
misago/emberapp/app/routes/terms-of-service.js

@@ -0,0 +1,6 @@
+import PrivacyPolicyRoute from 'misago/routes/privacy-policy';
+
+export default PrivacyPolicyRoute.extend({
+  page: 'terms-of-service',
+  defaultTitle: gettext('Terms of service')
+});