Give widget color dialog unique class in order to identify it later for binding click handler to picker span.

-Fix the bug, color picker opens other colorpickers dialog which are in the same template.
This commit is contained in:
Hadi Nategh 2014-10-10 15:06:04 +00:00
parent 6d57bfc580
commit e5115b430e

View File

@ -138,13 +138,21 @@ var et2_color = et2_inputWidget.extend(
resizable: false, resizable: false,
width: "auto" width: "auto"
}); });
jQuery('table.jPicker').each(function(){
if (!this.getAttribute('class').match(/jPickerColorIden/))
{
//Add an identifier to dialog for later on to bind a click handler to it
//as jquery dialog has already an unique id, we make a unique class identifier with help of the widget id
jQuery(this).addClass('jPickerColorIden-'+self.id);
return false;
}
});
// Hide original move bar // Hide original move bar
jQuery('table.jPicker .Move').hide(); jQuery('table.jPicker .Move').hide();
// Trigger dialog opening // Trigger dialog opening
jQuery('.Image',self.$node.next()).click(function() { jQuery('.Image',self.$node.next()).click(function() {
jQuery("table.jPicker").dialog("open"); jQuery("table.jPickerColorIden-"+self.id).dialog("open");
}); });
},500); },500);
return true; return true;