- First impl of remove...

This commit is contained in:
Paulo Veiga
2011-08-24 00:03:52 -03:00
parent 1f5dbfb5d2
commit 74f69fd5e4
3 changed files with 114 additions and 56 deletions

View File

@@ -36,8 +36,6 @@ mindplot.ImageIcon = new Class({
//Remove
if (!this._readOnly) {
var deleteTip = new mindplot.ImageIcon.DeleteTip(this._topic.getId(), this);
//Icon
var image = this.getImage();
image.addEvent('click', function() {
@@ -50,10 +48,7 @@ mindplot.ImageIcon = new Class({
this._image.setHref(imgUrl);
}.bind(this));
image.addEvent('mouseover', function(event) {
deleteTip.show();
});
this._image.setCursor('pointer');
}
},
@@ -113,54 +108,6 @@ mindplot.ImageIcon = new Class({
});
mindplot.ImageIcon.DeleteTip = new Class({
initialize : function(topicId, icon) {
$assert(topicId, "topicId can not be null");
$assert(icon, "iconModel can not be null");
this._icon = icon;
this._topicId = topicId;
this._registerEvents();
},
_registerEvents : function() {
this._containerElem = this._buildHtml();
this._containerElem.inject($(document.body));
this._containerElem.addEvent('click', function() {
var actionDispatcher = mindplot.ActionDispatcher.getInstance();
actionDispatcher.removeIconFromTopic(this._topicId, this._icon._iconModel);
this.close();
}.bind(this));
},
show : function() {
this._icon._image.positionRelativeTo(this._containerElem, {
position: 'upperRight',
offset: {x:10,y:-10}
});
this._icon._image.setStroke(1,'dash','red');
},
close : function() {
this._containerElem.dispose();
},
_buildHtml : function() {
var result = new Element('div');
result.setStyles({
zIndex: "8",
width:"10px",
height:"10px",
'background-color':'red'}
);
return result;
}
});
mindplot.ImageIcon.prototype.ICON_FAMILIES = [
{"id": "face", "icons" : ["face_plain","face_sad","face_crying","face_smile","face_surprise","face_wink"]},