Giter VIP home page Giter VIP logo

ember-popout's Introduction

ember-popout

Build Status npm Version Ember Observer Score

Simple popout window management. One parent route can open several child popout routes. Actions from the child popout routes can be propagated to the parent route.

Installation

  • ember install ember-popout

Usage

app/router.js

import Ember from 'ember';
let Router = Ember.Router.extend();
Router.map(function() {
  this.route('parent');
  this.route('popout');
});
export default Router;

app/routes/parent.js

import PopoutParentRouteMixin  from 'ember-popout/mixins/popout-parent-route';
import Ember from 'ember';
export default Ember.Route.extend(PopoutParentRouteMixin, {
  actions: {
    openPopout() {
      // first argument is an id used later for popout manipulation
      // second argument is the path for the popout
      // option argument is stringified and passed on to `window.open`
      this.get('popoutParent').open(1, 'popout', {
        left: _globalId * 10,
        top: _globalId * 10,
        width: 300,
        height: 300,
        scrollbars: 0,
        resizable: 0,
      });
    },
    writeHello(name) {
      console.log('hello, ' + name);
    }
  }
});

app/templates/parent.hbs

<button {{action "openPopout"}}>Open Popout</button>

app/routes/popout.js

import PopoutChildRouteMixin  from 'ember-popout/mixins/popout-child-route';
let ParentRoute = Ember.Route.extend(PopoutChildRouteMixin, {
  parentActions: ['writeHello']
});

app/templates/popout.hbs

<button {{action "writeHello" "friend"}}>Print to console in parent window</button>

Clicking the button will print "hello, friend" to the parent window's console.

ember-popout's People

Contributors

akatov avatar eugeniodepalo avatar jeffjewiss avatar

Stargazers

 avatar

Watchers

James Cloos avatar  avatar

Forkers

jeffjewiss

ember-popout's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.