Open-event-frontend: Events: events/list & events/view render the same view

Created on 21 Jun 2017  路  4Comments  路  Source: fossasia/open-event-frontend

I'm submitting a ... (check one with "x")

Current behaviour
Currently the events/view & events/list render the same view, i.e events/list. This is happening due to the using multiple dynamic routing.

this.route('events', function() {
  this.route('view', { path: '/:event_id' }, function() {
    ...
  }
  this.route('list', { path: '/:event_state' });
  }

Steps to reproduce

Both the routes load the same template.

@niranjan94 Please guide

bug

All 4 comments

Yes. This. I faced a similar problem in another project. lemme first see if that fix could work here too.

@geekyd works beautifully :)

  beforeModel(transition) {
    const eventState = transition.params[transition.targetName].event_state;
    if (!['live', 'draft', 'past'].includes(eventState)) {
      this.replaceWith('events.view', eventState);
    }
  },

In routes/events/list.js solves it.

But for this to work, this.route('list', { path: '/:event_state' }); should be after the events.view definition in router.js. That's how ember router resolves routes.

Okay I will test this locally & send a PR for this. Thanks :)

Was this page helpful?
0 / 5 - 0 ratings

Related issues

mariobehling picture mariobehling  路  4Comments

mariobehling picture mariobehling  路  3Comments

hpdang picture hpdang  路  5Comments

kushthedude picture kushthedude  路  4Comments

mariobehling picture mariobehling  路  5Comments