Sha256: b83ccc66933bb06f8fe990e689e0603cfdcc3fa20051e882561f374978d9e785

Contents?: true

Size: 916 Bytes

Versions: 8

Compression:

Stored size: 916 Bytes

Contents

// 
// More
// 
Rad.More = new Class({
  initialize: function(element){    
    this.element = element;
    var id = this.element.getData('id');
    this.core = $(id + '_core');    
    this.more = $(id + '_more');
    
    if(!this.more) console.log("Rad.More: no content for '" + id + "'!"); 
    
    // add event to button
    element.addEvent('click', function(event){
      event.stop();
      Rad.More.opened_containers[id] = true;      
      this._show();
    }.bind(this));
    
    // if opened once, keep it open in all next ajax updates
    if(Rad.More.opened_containers[id]) this._show();
  },
  _show: function(){    
    this.more.getChildren().reverse().each(function(e){
      e.inject(this.element, 'after');
    }.bind(this));
    if(this.core) this.core.destroy();
    this.more.destroy();
    this.element.destroy();
    window.fireEvent('updateStyle');
  }
});
Rad.More.opened_containers = {};

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
rad_common_interface-0.0.14 app/static/face/more.js
rad_common_interface-0.0.13 app/static/face/more.js
rad_common_interface-0.0.12 app/static/face/more.js
rad_common_interface-0.0.11 app/static/face/more.js
rad_common_interface-0.0.10 app/static/face/more.js
rad_common_interface-0.0.9 app/static/face/more.js
rad_common_interface-0.0.8 app/static/face/more.js
rad_common_interface-0.0.7 app/static/face/more.js