Sha256: 3daae3f86695503c39e6c751c087f03a4aceab62daae65f1ed3025735d56126e

Contents?: true

Size: 1.57 KB

Versions: 9

Compression:

Stored size: 1.57 KB

Contents

var WhowishWordCreator = Class.extend({
	
  init: function(elem){
  	
    this.element = elem;
	
	if (this.element.id == "" || this.element.id == undefined) {
		this.element.id = "whowishWordId" + (whowishWordVariables.idRunner++);
	}
	
	if (this.element.tagName.toLowerCase() == "option") {
		this.editIconPanel = (new WhowishWordSelectCreator($w(this.element).parent()[0])).editIconPanel;
	} else {
		this.editIconPanel = this.createAndGetEditIconPanel();
	}
	
	
	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.makeEditIconPanelId()).length > 0)
		return $('#' + this.makeEditIconPanelId())[0];
  	
	var editIconPanel = document.createElement('span');
	
	$w(editIconPanel).attr('id', this.makeEditIconPanelId())
					.addClass('whowishWordEditIconPanel');
	
	customData = {};
	customData.editIconPanelId = editIconPanel.id;
	customData.elementId = this.element.id;
	customData.reposition = whowishWordHelper.editIconPanelRepositioning;
	
	whowishWordStorage[editIconPanel.id] = customData;
	
	
					
	whowishWordStorage[editIconPanel.id].reposition();
					
					
	$w(this.element).after(editIconPanel);
	
	return editIconPanel;
  },
  
  
  makeEditIconPanelId: function() {
  	return this.element.id + "EditPanel";
  }
  
  
});

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
whowish_word-0.3.1 lib/whowish_word/rails/public/javascripts/4_whowish_word_creator.js
whowish_word-0.3.0 lib/whowish_word/rails/public/javascripts/4_whowish_word_creator.js
whowish_word-0.2.7 lib/whowish_word/rails/public/javascripts/4_whowish_word_creator.js
whowish_word-0.2.6 lib/whowish_word/rails/public/javascripts/4_whowish_word_creator.js
whowish_word-0.2.5 lib/whowish_word/rails/public/javascripts/4_whowish_word_creator.js
whowish_word-0.2.3 lib/whowish_word/rails/public/javascripts/4_whowish_word_creator.js
whowish_word-0.2.2 lib/whowish_word/rails/public/javascripts/4_whowish_word_creator.js
whowish_word-0.2.1 lib/whowish_word/rails/public/javascripts/4_whowish_word_creator.js
whowish_word-0.2.0 lib/whowish_word/rails/public/javascripts/4_whowish_word_creator.js