Sha256: 08b38248304197b138524005b33f3072c0f8259d4835bdf6774a7bd84cb66b27

Contents?: true

Size: 1.52 KB

Versions: 22

Compression:

Stored size: 1.52 KB

Contents

var AjaxEditStack = new Class({
	version: 0.1,

	options: {
	},
	bricksArray: [],
	bricksIndex: 0,

	Implements: [Options, Events],

	initialize: function(_options) {
		this.setOptions(_options);
	},
	addEditBrick: function(editOptions, link, linkParent){
		var qi = this.bricksIndex;
		var qe = this.bricksArray[qi];
		if ( ! qe) {
			qe = new AjaxEdit(editOptions);
			this.bricksArray.push(qe);
		}
		
		this.bricksArray.each(function(b, i){
			if (i === qi) {
				b.show();
			}
			else if (i > qi) {
				b.close();
			}
		});
		
		var fadeTm;
		qe.addEvents({
			startRequest: function(){
				this.wrapElement.addClass('live_edit');
				setTimeout(function(){
					this.wrapElement.addClass('live_edit');
				}.bind(this), 10);
			},
			closed: function(){
				this.wrapElement.addClass('animate');
				setTimeout(function(){
					this.wrapElement.removeClass('live_edit');
				}.bind(this));
				setTimeout(function(){
					this.wrapElement.removeClass('animate');
				}.bind(this), 600);
			}
		});
		qe.startEdit(link, linkParent);
	},
	addStack: function(){
		this.bricksIndex = this.bricksIndex + 1;
		this.bricksArray.each(function(b){
			b.hide();
		});
	},
	removeStack: function(){
		this.bricksArray[this.bricksIndex] = undefined;
		this.bricksIndex = this.bricksIndex - 1;
		this.bricksArray = this.bricksArray.clean();
		(this.bricksArray.getLast() || {show: function(){}}).show();
	},
	removeAllStacks: function(){
		this.bricksArray.clean().each(function(b, i){
			b.close();
		});
		this.bricksArray = [];
		this.bricksIndex = 0;
	}
});

Version data entries

22 entries across 22 versions & 1 rubygems

Version Path
bhf-0.7.11 app/assets/javascripts/bhf/classes/AjaxEditStack.js
bhf-0.7.9 app/assets/javascripts/bhf/classes/AjaxEditStack.js
bhf-0.7.8 app/assets/javascripts/bhf/classes/AjaxEditStack.js
bhf-0.7.7 app/assets/javascripts/bhf/classes/AjaxEditStack.js
bhf-0.7.5 app/assets/javascripts/bhf/classes/AjaxEditStack.js
bhf-0.7.4 app/assets/javascripts/bhf/classes/AjaxEditStack.js
bhf-0.7.3 app/assets/javascripts/bhf/classes/AjaxEditStack.js
bhf-0.7.2 app/assets/javascripts/bhf/classes/AjaxEditStack.js
bhf-0.7.1 app/assets/javascripts/bhf/classes/AjaxEditStack.js
bhf-0.7.0.rc3 app/assets/javascripts/bhf/classes/AjaxEditStack.js
bhf-0.7.0.rc2 app/assets/javascripts/bhf/classes/AjaxEditStack.js
bhf-0.7.0.rc1 app/assets/javascripts/bhf/classes/AjaxEditStack.js
bhf-0.6.32 app/assets/javascripts/bhf/classes/AjaxEditStack.js
bhf-0.6.31 app/assets/javascripts/bhf/classes/AjaxEditStack.js
bhf-0.6.30 app/assets/javascripts/bhf/classes/AjaxEditStack.js
bhf-0.6.29 app/assets/javascripts/bhf/classes/AjaxEditStack.js
bhf-0.6.28 app/assets/javascripts/bhf/classes/AjaxEditStack.js
bhf-0.6.27 app/assets/javascripts/bhf/classes/AjaxEditStack.js
bhf-0.6.26 app/assets/javascripts/bhf/classes/AjaxEditStack.js
bhf-0.6.25 app/assets/javascripts/bhf/classes/AjaxEditStack.js