Sha256: 05a83a66b83101a020ef7302f7b343b788ee732a504f188fa88769f3a8c73630

Contents?: true

Size: 1.5 KB

Versions: 3

Compression:

Stored size: 1.5 KB

Contents

var WhowishWordCreator = Class.extend({
	
  init: function(elem){
  	
    this.element = elem;
	
	if (this.element.tagName.toLowerCase() == "option") {
		this.editIconPanel = (new WhowishWordSelectCreator($w(this.element).parent()[0])).editIconPanel;
	} else {
		this.editIconPanel = this.createAndGetEditIconPanel();
	}
	
	this.element.editIconPanel = this.editIconPanel;
	
	this.makeEditIcon();
	this.sanitize();
	
  },
  
  makeEditIcon: function() {
  	throw 'makeEditIcon() is not implemented'
  },
  
  sanitize: function() {
  	throw 'sanitize() is not implemented'
  },
  
  addEditIcon: function(editIcon){
    this.editIconPanel.appendChild(editIcon);
  },
  
  createAndGetEditIconPanel: function() {

	if (this.element.editIconPanel != undefined)
		return this.element.editIconPanel;
  	
	var editIconPanel = document.createElement('span');
	
	$w(editIconPanel).attr('id', this.generateEditIconPanelId())
					.addClass('whowishWordEditIconPanel');
	
	customData = {};
	customData.editIconPanel = editIconPanel;
	customData.element = this.element;
	customData.reposition = whowishWordHelper.editIconPanelRepositioning;
	
	whowishWordStorage[editIconPanel.id] = customData;
	
	
					
	whowishWordStorage[editIconPanel.id].reposition();
					
					
	$w(this.element).after(editIconPanel);
	
	return editIconPanel;
  },
  
  
  generateEditIconPanelId: function() {
  	return this.element.id + "EditPanel" + (whowishWordVariables.idRunner++);
  }
  
  
});

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
whowish_word-0.1.9 lib/whowish_word/rails/public/javascripts/4_whowish_word_creator.js
whowish_word-0.1.8 lib/whowish_word/rails/public/javascripts/4_whowish_word_creator.js
whowish_word-0.1.7 lib/whowish_word/rails/public/javascripts/4_whowish_word_creator.js