Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for routable engines #97

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

aaxelb
Copy link

@aaxelb aaxelb commented May 18, 2018

Make {{href-to}} act like {{link-to}} does within an engine, automatically prefixing routes with the engine's namespace.

Add {{href-to-external}} helper, for linking to routes in an engine's host app. Acts like {{link-to-external}}.

This is a breaking change for anyone using {{href-to}} within an engine to link to routes in the host app, but that seems like an uncommon case.

I was not sure how to write tests that pretend to be in an engine, suggestions are welcome.

let owner = getOwner(context);

// If used in an engine, namespace the route
if(owner.mountPoint && targetRouteName !== 'application') {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

perhaps create a well named variable in place of the comment? Something like linksToEngine or linksToOtherEngine perhaps?

@GavinJoyce
Copy link
Contributor

I was not sure how to write tests that pretend to be in an engine, suggestions are welcome.

I'm not familiar with engines so I don't have any good suggestions. Perhaps there are some tests in https://github.com/ember-engines/ember-engines that will serve as a guide?

@GavinJoyce GavinJoyce closed this May 20, 2018
@GavinJoyce GavinJoyce reopened this May 20, 2018
@willviles
Copy link

@aaxelb - You need to add export { default } from 'ember-href-to/helpers/href-to-external' to app/helpers/href-to-external.js.

Apart from that, this seems to work!

@jamescdavis
Copy link

Bump.

@GCheung55
Copy link
Contributor

@GavinJoyce @jamescdavis any updates on this?

@jamescdavis
Copy link

Needs rebased to resolve conflicts. @aaxelb?

@aaxelb
Copy link
Author

aaxelb commented Jul 16, 2020

rebas'd to resolve conflicts!

tho now the build is failing for node version reasons:

error [email protected]: The engine "node" is incompatible with this module. Expected version "8.* || 10.* || >= 12.*". Got "6.17.1"

@GCheung55
Copy link
Contributor

GCheung55 commented Jul 20, 2020

I've created PR #128 to just bump the Node.js version to 8 in .travis.yaml.

@GCheung55
Copy link
Contributor

@aaxelb can you rebase? #128 was merged and should fix the Node.js version issue.

@aaxelb aaxelb force-pushed the engine-support branch 2 times, most recently from 2797dfd to b761532 Compare July 21, 2020 20:23
Make {{href-to}} behave the same as {{link-to}} within an engine,
automatically prefixing routes with the engine's namespace

Add {{href-to-external}}, for routes external to the engine.
@villander
Copy link

Any chance to merge this?

@villander
Copy link

Any update on this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants