Sha256: 6527b1d9ada04e0e373448585f881a08941177d006b5071a589a088146ca712e

Contents?: true

Size: 1.59 KB

Versions: 9

Compression:

Stored size: 1.59 KB

Contents

//create the modal container
var modal_container = tn.createEl('div');
$('body')[0].appendChild(modal_container);

//put the partial in the modal


<%-
    #Rails.logger.debug("Options: #{modal_options.to_json}")
    modal_container_content =
    escape_javascript(
        spurs_modal  modal_file_or_partial,
                     modal_object,
                     modal_options

    )
%>
modal_container.innerHTML = "<%= modal_container_content %>";

if ($(modal_container.children[0]).find('.javascript-hooks').size() > 0) {
    var js_hooks = $(modal_container.children[0]).find('.javascript-hooks');
    var modal = $(modal_container.children[0]);

    modal.on('hidden', function () {
        js_hooks.each(function (idx, item) {
            if ($(item).attr('onhidden')) {
                eval($(item).attr('onhidden'));
            }
        });
    });

    modal.on('hide', function () {
        js_hooks.each(function (idx, item) {
            if ($(item).attr('onhide')) {
                eval($(item).attr('onhide'));
            }
        });
    });

    modal.on('show', function () {
        js_hooks.each(function (idx, item) {
            if ($(item).attr('onShow')) {
                eval($(item).attr('onShow'));
            }
        });
    });

    modal.on('shown', function () {
        js_hooks.each(function (idx, item) {
            if ($(item).attr('onshown')) {
                console.log($(item));
                eval($(item).attr('onshown'));
            }
        });
    });
}

//activate the modal
$(modal_container.children[0]).modal();

if(window._asd != undefined) {
    window._asd();
}

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
spurs-0.0.6.rc1 app/views/spurs/modals/spawn.js.erb
spurs-0.0.5 app/views/spurs/modals/spawn.js.erb
spurs-0.0.5.alpha.7 app/views/spurs/modals/spawn.js.erb
spurs-0.0.5.alpha.6 app/views/spurs/modals/spawn.js.erb
spurs-0.0.5.alpha.5 app/views/spurs/modals/spawn.js.erb
spurs-0.0.5.alpha.4 app/views/spurs/modals/spawn.js.erb
spurs-0.0.5.alpha.3 app/views/spurs/modals/spawn.js.erb
spurs-0.0.5.alpha.2 app/views/spurs/modals/spawn.js.erb
spurs-0.0.5.alpha.1 app/views/spurs/modals/spawn.js.erb