diff --git a/src/main/webapp/scripts/facets/list-facet.js b/src/main/webapp/scripts/facets/list-facet.js index 00f49fe45..374e6c193 100644 --- a/src/main/webapp/scripts/facets/list-facet.js +++ b/src/main/webapp/scripts/facets/list-facet.js @@ -133,6 +133,7 @@ ListFacet.prototype.render = function() { ); } + var renderEdit = this._config.expression == "value"; var renderChoice = function(choice, customLabel) { var label = customLabel || choice.v.l; var count = choice.c; @@ -170,11 +171,25 @@ ListFacet.prototype.render = function() { a.click(selectOnly); // include link - $('').addClass("facet-choice-link").text("include").click(select).appendTo(choiceDiv); + $('').addClass("facet-choice-link").text("include").click(select).prependTo(choiceDiv); } else { a.click(select); } + if (renderEdit && customLabel === undefined) { + // edit link + var editLink = $('').addClass("facet-choice-edit").text("edit").click(function() { + self._editChoice(choice, choiceDiv); + }).appendTo(choiceDiv); + + choiceDiv + .mouseenter(function() { + editLink.css("visibility", "visible"); + }) + .mouseleave(function() { + editLink.css("visibility", "hidden"); + }); + } }; var choices = this._data.choices; @@ -208,10 +223,12 @@ ListFacet.prototype.render = function() { }).appendTo(footerDiv); } - $('').html(" • ").appendTo(footerDiv); - $('').addClass("action").text("edit").click(function() { - self._doEdit(); - }).appendTo(footerDiv); + if (this._config.expression == "value") { + $('').html(" • ").appendTo(footerDiv); + $('').addClass("action").text("cluster").click(function() { + self._doEdit(); + }).appendTo(footerDiv); + } } }; @@ -219,6 +236,93 @@ ListFacet.prototype._doEdit = function() { new FacetBasedEditDialog(this._config.columnName, this._config.expression); }; +ListFacet.prototype._editChoice = function(choice, choiceDiv) { + var self = this; + + var menu = MenuSystem.createMenu().addClass("data-table-cell-editor").width("400px"); + menu.html( + '' + + '' + + '
' + + '