Some import bug fixing stuff.

This commit is contained in:
Paulo Gustavo Veiga
2012-06-06 01:19:55 -03:00
parent 79b009e29e
commit 4d3e371d05
5 changed files with 34 additions and 19 deletions

View File

@@ -1,9 +1,13 @@
<%@ include file="/jsp/init.jsp" %>
<p>
<p class="alert alert-info">
<spring:message code="EXPORT_DETAILS"/>
</p>
<p id="exportInfo">
<span class="label label-important">Warning</span> <spring:message code="EXPORT_FORMAT_RESTRICTIONS"/>
</p>
<div>
<form method="GET" class="form-horizontal" action="service/maps/${mindmap.id}"
enctype="application/x-www-form-urlencoded" id="dialogMainForm">
@@ -45,10 +49,6 @@
</fieldset>
</form>
</div>
<p>
<span class="alert alert-info" id="exportInfo"><i class="icon-info-sign"></i> <spring:message
code="EXPORT_FORMAT_RESTRICTIONS"/></span>
</p>
<script type="text/javascript">

View File

@@ -1,14 +1,11 @@
<%@ include file="/jsp/init.jsp" %>
<div id="messagePanel" class="alert alert-error">
</div>
<div>
<p class="well"><spring:message code="IMPORT_MINDMAP_INFO"/></p>
<p class="alert alert-info"><spring:message code="IMPORT_MINDMAP_INFO"/></p>
<form method="POST" enctype="multipart/form-data" action="#" id="dialogMainForm" class="form-horizontal">
<div class="errorMessage"></div>
<fieldset>
<div class="control-group">
<label for="mapFile" class="control-label"><spring:message code="MIND_FILE"/>: </label>
@@ -16,7 +13,8 @@
</div>
<div class="control-group">
<label for="title" class="control-label"><spring:message code="NAME"/>: </label>
<input type="text" id="title" required="required" placeholder="Name of the new map to create"
<input type="text" id="title" name="title" required="required"
placeholder="Name of the new map to create"
class="control"/>
</div>
<div class="control-group">
@@ -66,7 +64,25 @@
window.location = "c/maps/" + resourceId + "/edit";
},
error: function(jqXHR, textStatus, errorThrown) {
$('#messagePanel').text(textStatus);
if (jqXHR.status == 400) {
var errors = JSON.parse(jqXHR.responseText);
// Mark fields with errors ...
var fieldErrors = errors.fieldErrors;
if (fieldErrors) {
for (var fieldName in fieldErrors) {
// Mark the field with errors ...
var message = fieldErrors[fieldName];
var inputField = $("#dialogMainForm input[name='" + fieldName + "']");
$("#dialogMainForm").find(".errorMessage").text(message).addClass("alert alert-error");
inputField.parent().addClass('error');
}
}
} else {
console.log(errorThrown);
console.log(jqXHR);
$('#messagesPanel div').text(errorThrown).parent().show();
}
}
});
event.preventDefault();

View File

@@ -126,7 +126,7 @@
<fieldset>
<div class="control-group">
<label class="control-label" for="newTitle"><spring:message code="NAME"/>:</label>
<input class="control" name="title" id="newTitle" type="text" required="true"
<input class="control" name="title" id="newTitle" type="text" required="required"
placeholder="Name of the new map to create" autofocus="autofocus"/>
</div>
<div class="control-group">
@@ -146,7 +146,7 @@
<!-- Duplicate map dialog -->
<div id="duplicate-dialog-modal" class="modal fade" style="display: none">
<div class="modal-header">
<button class="close" data-dismiss="modal">X</button>
<button class="close" data-dismiss="modal">x</button>
<h3 id="dupDialogTitle"></h3>
</div>
<div class="modal-body">
@@ -265,7 +265,7 @@
</div>
</div>
<!-- Export Dialog Config -->
<!-- Import Dialog Config -->
<div id="import-dialog-modal" class="modal fade" style="display: none">
<div class="modal-header">
<button class="close" data-dismiss="modal">x</button>