open-orchestra/open-orchestra-cms-bundle

View on GitHub
BackofficeBundle/Resources/public/ecmascript/OpenOrchestra/Service/Modal/View/ModalView.js

Summary

Maintainability
A
0 mins
Test Coverage
import OrchestraView from 'OpenOrchestra/Application/View/OrchestraView'

/**
 * @class ModalView
 */
class ModalView extends OrchestraView
{
    /**
     * @inheritdoc
     */
    preinitialize(options) {
        this.tagName = 'div';
        this.className = 'modal fade';
        this.events = {
            'hidden.bs.modal': 'hide'
        }
    }

    /**
     * Show modal
     */
    show() {
        this.$el.modal('show');
    }

    /**
     * Hide modal
     */
    hide() {
        $('body').removeClass('modal-open');
        $('.modal-backdrop').remove();
        this.remove();
    }
}

export default ModalView;