Sha256: df399e1f00241e56ff78d1ca9ac8e5bb925b593fb10a91c0b0c197b6bd21e824

Contents?: true

Size: 1.66 KB

Versions: 24

Compression:

Stored size: 1.66 KB

Contents

(function(ko, $, Veil, Overlay, app) {
  "use strict";

  ko.bindingHandlers.childVmOverlay = {
    init: function(element, valueAccessor, allBindingsAccessor, viewModel, bindingContext) {
      var $element        = $(element),
          options         = ko.unwrap(valueAccessor()),
          overlayName     = ko.unwrap(options.name),
          vmName          = ko.unwrap(options.vm),
          parentVm        = options.parentVm || bindingContext.$parent,
          setup           = options.setup,
          overlayOptions  = options.overlayOptions || {},
          css             = options.css;
      
      overlayOptions.overlayClass = [overlayOptions.overlayClass, overlayName, css].join(' ');
          
      $element.on('click', function() {
        var childVm = parentVm.getVm(vmName),
            overlay;
        
        if (childVm.setup) {
          childVm.setup(setup);
        }
        
        overlay = Overlay.control.createOverlay(overlayName, bindingContext, childVm, overlayOptions);
        
        if (childVm.keyboardHandlerConfigs) {
          childVm.keyboardHandlerConfigs.forEach(function(config) {
            childVm.keyboardHandlers.push( app.page.MainVm.listener.register_combo(config) );
          });
          
          overlay.on('beforeClose', function() {
            app.page.MainVm.listener.unregister_many(childVm.keyboardHandlers);
            childVm.keyboardHandlers.length = 0;
          });
        }
        
        if (childVm.exit) {
          childVm.exit.subscribe(function() {
            overlay.hide();
          });
        }
        
        overlay.show();
      });
    }
  };

})(ko, $, window.Veil, window.Overlay, window.app);

Version data entries

24 entries across 24 versions & 1 rubygems

Version Path
kea-rails-1.0.9 app/assets/javascripts/kea/overlay/child_vm_overlay.js
kea-rails-2.0.0.pre.alpha14 app/assets/javascripts/kea/overlay/child_vm_overlay.js
kea-rails-2.0.0.pre.alpha13 app/assets/javascripts/kea/overlay/child_vm_overlay.js
kea-rails-2.0.0.pre.alpha12 app/assets/javascripts/kea/overlay/child_vm_overlay.js
kea-rails-2.0.0.pre.alpha11 app/assets/javascripts/kea/overlay/child_vm_overlay.js
kea-rails-2.0.0.pre.alpha10 app/assets/javascripts/kea/overlay/child_vm_overlay.js
kea-rails-2.0.0.pre.alpha9 app/assets/javascripts/kea/overlay/child_vm_overlay.js
kea-rails-2.0.0.pre.alpha8 app/assets/javascripts/kea/overlay/child_vm_overlay.js
kea-rails-2.0.0.pre.alpha7 app/assets/javascripts/kea/overlay/child_vm_overlay.js
kea-rails-2.0.0.pre.alpha6 app/assets/javascripts/kea/overlay/child_vm_overlay.js
kea-rails-2.0.0.pre.alpha5 app/assets/javascripts/kea/overlay/child_vm_overlay.js
kea-rails-2.0.0.pre.alpha4 app/assets/javascripts/kea/overlay/child_vm_overlay.js
kea-rails-2.0.0.pre.alpha3 app/assets/javascripts/kea/overlay/child_vm_overlay.js
kea-rails-2.0.0.pre.alpha2 app/assets/javascripts/kea/overlay/child_vm_overlay.js
kea-rails-1.0.8 app/assets/javascripts/kea/overlay/child_vm_overlay.js
kea-rails-2.0.0.pre.alpha1 app/assets/javascripts/kea/overlay/child_vm_overlay.js
kea-rails-1.0.7 app/assets/javascripts/kea/overlay/child_vm_overlay.js
kea-rails-1.0.6 app/assets/javascripts/kea/overlay/child_vm_overlay.js
kea-rails-1.0.5 app/assets/javascripts/kea/overlay/child_vm_overlay.js
kea-rails-1.0.4 app/assets/javascripts/kea/overlay/child_vm_overlay.js