Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

bootstrap-modal

Package Overview
Dependencies
Maintainers
1
Versions
20
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

bootstrap-modal

Bootstrap Modal (w/ animation) addon for Ember CLI

  • 2.0.2
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
84
decreased by-62.83%
Maintainers
1
Weekly downloads
 
Created
Source

bootstrap-modal

Bootstrap Modal (w/ animation) addon for Ember CLI

Build Status npm version
Ember Version Ember Observer Score

Usage

Installation

ember install bootstrap-modal

:warning: This addon is only tested with Ember v1.13 and 2+. Use at your own risk otherwise.

Using

Usually you will want to create custom components based on this component, since every ones needs are different. The following is a simple example of what you can do.

{{#if showModal}}
  {{#with (action 'toggleShowModal') as |toggle|}}
    {{#bootstrap-modal close=(action toggle) closeOnOverlayClick=true}}
      <div class="modal-header">
        <button type="button" class="close" aria-label="Close" {{action toggle}}>
          <span aria-hidden="true">&times;</span>
        </button>
        <h4 class="modal-title">Test</h4>
      </div>

      <div class="modal-body">
        Content Here
      </div>

      <div class="modal-footer">
        <button type="button" class="btn btn-primary" {{action toggle}}>
          Close
        </button>
      </div>
    {{/bootstrap-modal}}
  {{/with}}
{{/if}}

The toggleShowModal is an action that toggles the showModal boolean.

If you have your own app/transitions.js, then you will need to add the modal transition like the example below, otherwise, the transition should just work.

// app/transitions.js

import defaultTransition from 'bootstrap-modal/utils/default-transition';

export default function () {
  // bootstrap-modal transition
  defaultTransition(this);

  // other transitions here..
}

Install Bootstrap

The above instructions will make the modal functional, but it will not look like the bootstrap modal. The following instructions will help you get the styles setup.

First install the bootstrap dependency:

bower install bootstrap --save-dev

Edit your ember-cli-build.js to look similar to the following:

var EmberAddon = require('ember-cli/lib/broccoli/ember-addon');

module.exports = function(defaults) {
  var app = new EmberAddon(defaults, {
    // Add options here
  });

  // The actual styles, which make the modal look good!
  app.import(app.bowerDirectory + '/bootstrap/dist/css/bootstrap.css');

  // The scripts are not necessary for the modal, but you might want them for other
  // bootstrap features.
  app.import(app.bowerDirectory + '/bootstrap/dist/js/bootstrap.js');

  // Any other imports you might have..

  return app.toTree();
};

Note: If you're using LESS or SASS, then you can import those files in your styles. This would also help if you only want the modal styles and want to pick and choose your files.

API

  • close - Action. The action attribute for closing the modal, e.g. close=(action 'closeModal'). The action will have it's first argument set to true if the modal was closed by clicking the overlay.
  • closeOnOverlayClick - Boolean. Flag enabling triggering the close via clicking the overlay/backdrop.

Developing

Follow the steps below to start the dummy app, and work on contributing to this addon.

Installation

  • git clone this repository
  • npm install
  • bower install

Running

Running Tests

  • npm test (Runs ember try:testall to test your addon against multiple Ember versions)
  • ember test
  • ember test --server

Building

  • ember build

For more information on using ember-cli, visit http://www.ember-cli.com/.

Keywords

FAQs

Package last updated on 14 Nov 2016

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc