Navigation Menu

Skip to content

Commit

Permalink
Update HTML form for creating new content to use PUT/POST as appropri…
Browse files Browse the repository at this point in the history
…ate.
  • Loading branch information
cbeer committed May 1, 2014
1 parent 5b4d2e1 commit 84cfe19
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
Expand Up @@ -31,7 +31,7 @@
#end

#if ($readonly == false)
<form id="action_create" name="action_create" method="POST" enctype="multipart/form-data">
<form id="action_create" name="action_create" method="PUT" enctype="multipart/form-data">
<h3>Create New Node</h3>
<div class="form-group">
<label for="new_mixin" class="control-label">
Expand All @@ -47,7 +47,7 @@
<label for="new_id" class="control-label">
Identifier
</label>
<input type="text" id="new_id" name="slug" placeholder="(auto-generated identifier)" class="form-control"/>
<input type="text" id="new_id" name="slug" class="form-control"/>
</div>


Expand Down
11 changes: 8 additions & 3 deletions fcrepo-http-api/src/main/resources/views/common.js
@@ -1,3 +1,6 @@
$(document).ready(function() {
$("#new_id").attr("placeholder", "(auto-generated identifier)");
});

function addChild()
{
Expand Down Expand Up @@ -50,9 +53,11 @@ function addChild()
};
reader.readAsBinaryString(update_file);
} else {
$.post(postURI, function(data, textStatus, request) {
window.location = request.getResponseHeader('Location');
}).fail( ajaxErrorHandler);
$.ajax({
type: id == "" ? "POST" : "PUT",
url: postURI,
success: function(data, textStatus, request) { window.location = request.getResponseHeader('Location') || postURI }
}).fail( ajaxErrorHandler);
}

return false;
Expand Down

0 comments on commit 84cfe19

Please sign in to comment.