Sha256: c114d1f17456293e315f4e70b17ca72226144557f214ba3a719d693f55f45629

Contents?: true

Size: 1.48 KB

Versions: 7

Compression:

Stored size: 1.48 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');
	
	editIconPanel.whowishWord = {};
	editIconPanel.whowishWord.editIconPanel = editIconPanel;
	editIconPanel.whowishWord.element = this.element;
	editIconPanel.whowishWord.reposition = whowishWordHelper.editIconPanelRepositioning;
	
	$w(editIconPanel).attr('id', this.generateEditIconPanelId())
					.addClass('whowishWordEditIconPanel');
					
	editIconPanel.whowishWord.reposition();
					
					
	$w(this.element).after(editIconPanel);
	
	return editIconPanel;
  },
  
  
  generateEditIconPanelId: function() {
  	return this.element.id + "EditPanel" + (whowishWordVariables.idRunner++);
  }
  
  
});

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
whowish_word-0.1.6 lib/whowish_word/rails/public/javascripts/4_whowish_word_creator.js
whowish_word-0.1.5 lib/whowish_word/rails/public/javascripts/4_whowish_word_creator.js
whowish_word-0.1.4 lib/whowish_word/rails/public/javascripts/4_whowish_word_creator.js
whowish_word-0.1.3 lib/whowish_word/rails/public/javascripts/4_whowish_word_creator.js
whowish_word-0.1.2 lib/whowish_word/rails/public/javascripts/4_whowish_word_creator.js
whowish_word-0.1.1 lib/whowish_word/rails/public/javascripts/4_whowish_word_creator.js
whowish_word-0.1.0 lib/whowish_word/rails/public/javascripts/4_whowish_word_creator.js