Sha256: 013dbe5a2091564140964eea01112ba9215bac1e3a454004f296912a48b7d5bd

Contents?: true

Size: 1.47 KB

Versions: 7

Compression:

Stored size: 1.47 KB

Contents

module Netzke
  module Basepack
    module ItemPersistence
      class EventsPlugin < Netzke::Plugin
        client_class do |c|
          c.init = l(<<-JS)
            function(cmp){
              cmp.on('afterlayout', function(){

                // scope of the parent panel
                this.items.each(function(item, index, length){
                  if (!item.oldSize) item.oldSize = item.getSize(); // remember initial size

                  item.on('resize', function(panel, w, h){
                    var params = {item: panel.itemId};

                    if ((panel.region == 'west' || panel.region == 'east') && panel.oldSize.width != w) {
                      params.width = w;
                      this.server.regionResized(params);
                    } else if (panel.region == 'north' || panel.region == 'south' && panel.oldSize.height != h){
                      params.height = h;
                      this.server.regionResized(params);
                    }

                    panel.oldSize = panel.getSize();
                  }, this);

                  item.on('collapse', function(panel){
                    this.server.regionCollapsed({item: panel.itemId});
                  }, this);

                  item.on('expand', function(panel){
                    this.server.regionExpanded({item: panel.itemId});
                  }, this);

                }, this);

              }, cmp, {single: true});
            }
          JS
        end
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
netzke-basepack-6.5.0.0 lib/netzke/basepack/item_persistence/events_plugin.rb
netzke-basepack-6.5.0.0.rc2 lib/netzke/basepack/item_persistence/events_plugin.rb
netzke-basepack-6.5.0.0.rc1 lib/netzke/basepack/item_persistence/events_plugin.rb
netzke-basepack-1.0.1.0 lib/netzke/basepack/item_persistence/events_plugin.rb
netzke-basepack-1.0.0.1 lib/netzke/basepack/item_persistence/events_plugin.rb
netzke-basepack-1.0.0.0 lib/netzke/basepack/item_persistence/events_plugin.rb
netzke-basepack-1.0.0.0.pre3 lib/netzke/basepack/item_persistence/events_plugin.rb