Navigation Menu

Skip to content

Commit

Permalink
When creating new binary resources in the HTML UI, redirect to the da…
Browse files Browse the repository at this point in the history
…tastream description after creating.
  • Loading branch information
cbeer committed Oct 16, 2014
1 parent c515a0c commit 44dbb13
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions fcrepo-http-api/src/main/resources/views/common.js
Expand Up @@ -10,10 +10,10 @@ function addChild()

var newURI = $('#main').attr('resource') + "/" + id;

var postURI = newURI;

if ( mixin != '' ) {
var postURI = newURI + "?mixin=" + mixin;
} else {
var postURI = newURI;
postURI = postURI + "?mixin=" + mixin;
}

if (mixin == "fedora:datastream") {
Expand All @@ -24,8 +24,11 @@ function addChild()
if (xhr.readyState == 4) {
if (xhr.status == 201) {
var loc = xhr.getResponseHeader('Location');

if (loc != null) {
var link = xhr.getResponseHeader('Link');
if(link.match('rel="describedby"') && link.match('anchor="' + loc + '"') ) {
var str = link.match(/<[^>]+>/)[0];
window.location = str.slice(1, str.length - 1);
} else if (loc != null) {
window.location = loc;
} else {
window.location.reload();
Expand All @@ -34,7 +37,7 @@ function addChild()
ajaxErrorHandler(xhr, "", "Error creating datastream");
}
}
}
};

if (id == "") {
xhr.open( "POST", newURI );
Expand Down

0 comments on commit 44dbb13

Please sign in to comment.