diff --git a/wise-webapp/src/main/webapp/js/buttonActions.js b/wise-webapp/src/main/webapp/js/buttonActions.js
index 1bbe0d20..5f487143 100644
--- a/wise-webapp/src/main/webapp/js/buttonActions.js
+++ b/wise-webapp/src/main/webapp/js/buttonActions.js
@@ -22,15 +22,32 @@ $(function () {
function () {
fetchLabels({
postUpdate: function(data) {
+ var labelList = $("#labelId");
+
+ //clear dropdown...
+ labelList.find("option").remove();
+
+ if (data.labels.length == 0) {
+ window.alert('no hay labels, como resolvemos esto?');
+ return;
+ }
+ //append items to dropdown
$.each(data.labels, function(index, value) {
- $("#labelList").append($('').val(index).html(value.title));
- })
+ labelList.append($('').val(value.id).html(value.title));
+ });
+
+ var mapIds = $('#mindmapListTable').dataTableExt.getSelectedMapsIds();
+
+ $("#add-label-dialog-modal").dialogForm({
+ type:'PUT',
+ url:"c/restful/labels/maps?ids=" + jQuery.makeArray(mapIds).join(','),
+ postUpdate: function(data) {
+
+ }
+ });
}
});
- $("#add-label-dialog-modal").dialogForm({
- //url:"c/restful/labels",
- //postUpdate: createLabelItem
- });
+
}
);
diff --git a/wise-webapp/src/main/webapp/js/mindmapList.js b/wise-webapp/src/main/webapp/js/mindmapList.js
index c191ab27..1467cbc2 100644
--- a/wise-webapp/src/main/webapp/js/mindmapList.js
+++ b/wise-webapp/src/main/webapp/js/mindmapList.js
@@ -98,6 +98,14 @@ jQuery.fn.dialogForm = function (options) {
$('#' + containerId + ' input').each(function (index, elem) {
formData[elem.name] = elem.value;
});
+
+ //No me gusta, revisar only support one select in the form
+ var dropdown = $('#' + containerId + ' option:selected');
+ if (dropdown.val()) {
+ formData['id'] = dropdown.val();
+ formData['title'] = dropdown.html();
+ }
+
$(acceptBtn).button('loading');
var dialogElem = this;
jQuery.ajax(url, {