Fix delete operation.

This commit is contained in:
Paulo Gustavo Veiga 2012-05-19 21:36:34 -03:00
parent 07056b95fe
commit b534fce00f
5 changed files with 51 additions and 97 deletions

View File

@ -16,7 +16,6 @@ import org.springframework.web.bind.annotation.*;
import org.springframework.web.servlet.ModelAndView;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import java.io.IOException;
import java.util.ArrayList;

View File

@ -121,7 +121,7 @@ public class MindmapController extends BaseController {
@RequestMapping(method = RequestMethod.DELETE, value = "/maps/batch")
@ResponseStatus(value = HttpStatus.NO_CONTENT)
public void batchDelete(@RequestParam(required = false) String ids) throws IOException, WiseMappingException {
public void batchDelete(@RequestParam(required = true) String ids) throws IOException, WiseMappingException {
final User user = Utils.getUser();
final String[] mapsIds = ids.split(",");
for (final String mapId : mapsIds) {

View File

@ -247,18 +247,6 @@ table.display {
background: @th-background-color url('../images/sort_desc_disabled.png') no-repeat center right;
}
/* ----------------------------- Rows ----------------------------------- */
tr.odd {
background-color: @odd-color;
}
tr.even {
background-color: @even-color;
}
/* ----------------------------- Misc ----------------------------------- */
.dataTables_scroll {
@ -331,62 +319,3 @@ td.details {
background-color: #ccc;
}
.paging_full_numbers span.paginate_active {
background-color: #99B3FF;
}
table.display tr.even.row_selected td {
background-color: #B0BED9;
}
table.display tr.odd.row_selected td {
background-color: #9FAFD1;
}
/* ------------------------ Sorting classes ----------------------------- */
tr.odd {
td.sorting_1 {
background-color: @sorting-odd-color;
}
td.sorting_2 {
background-color: #DADCFF;
}
td.sorting_3 {
background-color: #E0E2FF;
}
}
tr.even {
td.sorting_1 {
background-color: @sorting-even-color;
}
td.sorting_2 {
background-color: #F2F3FF;
}
td.sorting_3 {
background-color: #F9F9FF;
}
}
/* ------------------------------ Tags ---------------------------------- */
table.display span.tag {
color: white;
padding: 5px 10px;
background: desaturate(@red, 30%);
.rounded-corners(3px);
}
#mindmapListTable .columName {
cursor: pointer
}
#mindmapListTable tr:hover {
background: #e0ffff;
}

View File

@ -72,8 +72,11 @@ jQuery.fn.dialogForm = function(options) {
var containerId = this[0].id;
var url = options.url;
// Clean previous dialog content ...
$("#" + containerId + " div[id='errorMessage']").text("").removeClass("ui-state-highlight");
// Clear previous state ...
$("#" + containerId + " .errorMessage").text("").removeClass("alert alert-error");
$("#" + containerId + " .control-group").removeClass('error');
$("#" + containerId + " input").attr('value','');
var acceptBtn = $('#' + containerId + ' .btn-accept');
acceptBtn.click(function() {
@ -117,7 +120,9 @@ jQuery.fn.dialogForm = function(options) {
// Mark the field ...
var message = fieldErrors[fieldName];
var inputField = $("#" + containerId + " input[name='" + fieldName + "']");
$("#" + containerId + " div[id='errorMessage']").text(message).addClass("alert alert-error");
$("#" + containerId + " .errorMessage").text(message).addClass("alert alert-error");
inputField.parent().addClass('error');
}
}

View File

@ -202,21 +202,19 @@
});
$("#deleteBtn").click(function() {
var mapIds = $('#mindmapListTable').dataTableExt.getSelectedMapsIds();
var tableUI = $('#mindmapListTable');
var mapIds = tableUI.dataTableExt.getSelectedMapsIds();
if (mapIds.length > 0) {
var html2 = $('#delete-dialog-modal p span');
$("#delete-dialog-modal").dialog({
height: 140,
// Initialize dialog ...
$("#delete-dialog-modal").dialogForm({
modal: true,
buttons: {
"Delete": function() {
$('#mindmapListTable').dataTableExt.removeSelectedRows();
$(this).dialog("close");
},
Cancel: function() {
$(this).dialog("close");
}
}
type: 'DELETE',
postUpdate: function(reqBodyData) {
// Remove old entry ...
tableUI.dataTableExt.removeSelectedRows();
},
url : "../service/maps/batch?ids="+mapIds.join(',')
});
}
});
@ -245,6 +243,7 @@
});
// Register time update functions ....
setTimeout(function() {
jQuery("abbr.timeago").timeago()
@ -253,7 +252,6 @@
</script>
</head>
<body>
<div class="content">
<jsp:include page="header.jsp">
<jsp:param name="removeSignin" value="false"/>
@ -300,7 +298,7 @@
<h3>Create a new map</h3>
</div>
<div class="modal-body">
<div id="errorMessage"></div>
<div class="errorMessage"></div>
<form class="form-horizontal">
<fieldset>
<div class="control-group">
@ -329,12 +327,14 @@
<h3 id="dupDialogTitle"></h3>
</div>
<div class="modal-body">
<div id="errorMessage"></div>
<div class="errorMessage"></div>
<form class="form-horizontal">
<fieldset>
<div class="control-group">
<label for="title" class="control-label"><spring:message code="NAME" />: </label>
<input name="title" id="title" type="text" required="required" placeholder="Name of the new map to create" autofocus="autofocus" class="control"/>
<label for="title" class="control-label"><spring:message code="NAME"/>: </label>
<input name="title" id="title" type="text" required="required"
placeholder="Name of the new map to create" autofocus="autofocus"
class="control"/>
</div>
<div class="control-group">
<label for="description" class="control-label"><spring:message
@ -358,12 +358,13 @@
<h3 id="renameDialogTitle"></h3>
</div>
<div class="modal-body">
<div id="errorMessage"></div>
<div class="errorMessage"></div>
<form class="form-horizontal">
<fieldset>
<div class="control-group">
<label for="renTitle" class="control-label"><spring:message code="NAME"/>: </label>
<input name="title" id="renTitle" required="required" autofocus="autofocus" class="control"/>
<input name="title" id="renTitle" required="required" autofocus="autofocus"
class="control"/>
</div>
<div class="control-group">
<label for="renDescription" class="control-label"><spring:message
@ -380,14 +381,34 @@
</div>
</div>
<!-- Delete map dialog -->
<div id="delete-dialog-modal" class="modal fade" style="display: none">
<div class="modal-header">
<button class="close" data-dismiss="modal">x</button>
<h3>Delete MindMap</h3>
</div>
<div class="modal-body">
<div class="alert alert-block">
<h4 class="alert-heading">Warning!</h4>Deleted mindmap can not be recovered. Do you want to continue
?
</div>
</div>
<div class="modal-footer">
<button class="btn btn-primary btn-accept">Delete</button>
<button class="btn btn-cancel">Close</button>
</div>
</div>
<div>
<div id="map-table">
<table class="display" id="mindmapListTable">
<table class="table table-bordered" id="mindmapListTable">
</table>
</div>
</div>
</div>
</div>
</div>