ember-foute

0.1.0 • Public • Published

Ember-foute

Ember Observer Score Build Status Code Climate Test Coverage

faux + route = foute

This addon was mostly copied from ember-hellgate, so many thanks to them for their efforts! There were just slight changes we needed to make, and we needed them made quickly, so we made ember-foute.

This addon helps you migrate an old application to Ember. It lets you define routes that load plain html pages inside an Ember app.

Pages loaded in a foute are loaded inside an iframe, so, they're totally isolated from the Ember app.

The objective of this addon is to let you create an Ember app that links to pages of the old system and, as you migrate each page to Ember, you replace the "foute" with normal routes.

Install

ember install ember-foute

Defining foutes

In the router you call this.foute(route, url) to define the name of the route and the url that should be loaded.

// app/router.js
Router.map(function() {
  this.foute('some-page', '/somepage.html');
  this.foute('my-search', 'http://apple.com');
});

Escaping the foute

The page loaded inside a "foute" can call actions of the route. For that, you should use the function escapeFoute.

// app/router.js
Router.map(function() {
  this.foute('test', '/test.html');
});
<!-- test.html (Page loaded inside a foute) -->
<html>
  <body>
    <span>Escape foute</span>
    <script type="text/javascript">
      window.parent.escapeFoute('showMessage', 'Hello');
    </script>
  </body>
</html>
// app/routes/test.js
export default Ember.Route.extend({
  actions: {
    showMessage(message) {
      alert(`Message from foute: ${message}`);
    }
  }
});

Styling the foute

The foute generates the following HTML:

<div class="foute-container">
  <iframe class="foute-iframe" src="..."></iframe>
</div>

So you can define styles for the container and for the iframe:

.foute-container {
  width: 100px;
  height: 400px;
  border: 1px solid red;
}

Readme

Keywords

Package Sidebar

Install

npm i ember-foute

Weekly Downloads

3

Version

0.1.0

License

MIT

Last publish

Collaborators

  • rwwagner90