privacy-policy.js 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. import MisagoRoute from 'misago/routes/misago';
  2. export default MisagoRoute.extend({
  3. page: 'privacy-policy',
  4. defaultTitle: gettext('Privacy policy'),
  5. setting: function() {
  6. return this.get('page').replace(/-/g, '_');
  7. }.property('page'),
  8. title: function() {
  9. return this.get('settings.' + this.get('setting') + '_title') || this.get('defaultTitle');
  10. }.property('defaultTitle', 'settings'),
  11. link: function() {
  12. return this.get('settings.' + this.get('setting') + '_link');
  13. }.property('settings'),
  14. beforeModel: function(transition) {
  15. if (this.get('link')) {
  16. transition.abort();
  17. window.location.replace(this.get('link'));
  18. }
  19. },
  20. model: function() {
  21. return this.store.find('legal-page', this.get('page'));
  22. },
  23. afterModel: function(model, transition) {
  24. if (model.get('link')) {
  25. transition.abort();
  26. window.location.replace(model.get('link'));
  27. }
  28. },
  29. actions: {
  30. didTransition: function() {
  31. this.set('title', this.get('title'));
  32. }
  33. }
  34. });