Skip to content

Commit

Permalink
start annotation submitting process
Browse files Browse the repository at this point in the history
  • Loading branch information
sprklinginfo committed Jan 4, 2016
1 parent 4959896 commit 5bf20d7
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion includes/annotation.inc
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ function _create_web_annotation() {
// return drupal_json_output(array('message' => 'posted', 'results' => $_POST));
// return drupal_json_output($_POST);
// return 'A new annotation is added.';
return drupal_json_output("success");
return drupal_json_output(array('annotation' => $_POST, 'response' => 'success'));
}

/**
Expand Down
8 changes: 4 additions & 4 deletions js/annotationApp.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
var targetObjectId = Drupal.settings.islandoraOralhistories.objectId;
var enableAnnotation = Drupal.settings.islandoraOralhistories.enableAnnotationTabDisplay;
var videoElement = $(".islandora-oralhistories-object").find('video, audio')[0];
var apiUrl = '/islandora/object/' + targetObjectId + '/web_annotation/create';
var apiUrl = '/islandora/object/' + targetObjectId + '/web_annotation';
var user = Drupal.settings.islandoraOralhistories.user;
var permissions = Drupal.settings.islandoraOralhistories.permissions;
console.log(permissions);
Expand All @@ -36,17 +36,17 @@
handleAnnotationSubmit: function (annotation) {
var arr = this.state.annotations;
$.ajax({
url: this.props.url,
url: this.props.url + '/create',
dataType: 'json',
type: 'POST',
data: annotation,
success: (function (data) {
if (data == 'success') {
console.log(data);
if (data.response == 'success') {
arr.push(annotation);
this.setState({ annotations: arr });
this.setState({ adding: false }); // Hide the form after submission
}
console.dir(data);
}).bind(this),
error: (function (xhr, status, err) {
console.error(this.props.url, status, err.toString());
Expand Down
8 changes: 4 additions & 4 deletions js/source/annotationApp.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
var targetObjectId = Drupal.settings.islandoraOralhistories.objectId;
var enableAnnotation = Drupal.settings.islandoraOralhistories.enableAnnotationTabDisplay;
var videoElement = $(".islandora-oralhistories-object").find('video, audio')[0];
var apiUrl = '/islandora/object/' + targetObjectId + '/web_annotation/create';
var apiUrl = '/islandora/object/' + targetObjectId + '/web_annotation';
var user = Drupal.settings.islandoraOralhistories.user;
var permissions = Drupal.settings.islandoraOralhistories.permissions;
console.log(permissions);
Expand All @@ -35,17 +35,17 @@
handleAnnotationSubmit: function(annotation) {
var arr = this.state.annotations;
$.ajax({
url: this.props.url,
url: this.props.url + '/create',
dataType: 'json',
type: 'POST',
data: annotation,
success: function(data) {
if (data == 'success') {
console.log(data);
if (data.response == 'success') {
arr.push(annotation);
this.setState({annotations: arr});
this.setState({adding: false}); // Hide the form after submission
}
console.dir(data);

}.bind(this),
error: function(xhr, status, err) {
Expand Down

0 comments on commit 5bf20d7

Please sign in to comment.