-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
31 changed files
with
1,799 additions
and
49 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 change: 1 addition & 0 deletions
1
lvl-project/lvl-bundle/src/main/ui/js/apps/curation/layout/tpls/curation-layout.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
92 changes: 92 additions & 0 deletions
92
...l-bundle/src/main/ui/js/apps/curation/submission_resolver/curation_submission_resolver.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,92 @@ | ||
/** | ||
* RequireJS module that defines the view: curation->submission_resolver. | ||
*/ | ||
|
||
define([ 'app', 'tpl!apps/curation/submission_resolver/tpls/curation_submission_resolver', 'pace', 'backbone.oauth2', 'bootstrapvalidator', 'backbone.syphon' ], | ||
function(Lvl, ResolverTpl, pace) { | ||
Lvl.module('CurationApp.SubmissionResolver.View', function(View, Lvl, Backbone, Marionette, $, _) { | ||
'use strict'; | ||
View.Content = Marionette.ItemView.extend({ | ||
template : ResolverTpl, | ||
initialize : function(options) { | ||
this.section = options.section; | ||
this.collectionId = options.collectionId; | ||
this.item = options.item; | ||
}, | ||
events : { | ||
'focus #lvlSubmissionResolutionForm select.form-control' : function(e) { | ||
var form = $('#lvlSubmissionResolutionForm'); | ||
if (Boolean(form.attr('data-pristine') === 'true')) { | ||
form.attr('data-pristine', 'false'); | ||
form.on('init.form.bv', function(e, data) { | ||
data.bv.disableSubmitButtons(true); | ||
}).bootstrapValidator({ | ||
submitButtons : 'button[type="submit"]', | ||
fields : { | ||
'selectResolution' : { | ||
verbose : false, | ||
validators : { | ||
notEmpty : { | ||
message : 'The resolution is required and cannot be empty' | ||
} | ||
} | ||
} | ||
} | ||
}).on('success.field.bv', function(e, data) { | ||
var isValid = data.bv.isValid(); | ||
data.bv.disableSubmitButtons(!isValid); | ||
}); | ||
} | ||
}, 'click #lvlSubmissionResolutionBtn' : function(e) { | ||
e.preventDefault(); | ||
pace.restart(); | ||
$('#lvlSubmissionResolutionForm button[type="submit"]').attr('disabled', 'disabled'); | ||
$('#lvlSubmissionResolutionBtn').tooltip('hide'); | ||
var self = this, formData = Backbone.Syphon.serialize(this); | ||
self.item.set({ | ||
status : 'CLOSED', | ||
resolution : formData.selectResolution, | ||
allocatedCollection : formData.inputCollection, | ||
allocatedId : formData.inputItemId | ||
}); | ||
var jqxhr = $.ajax({ | ||
url : Lvl.config.get('service.url') + '/pending/' + (self.collectionId ? self.collectionId : self.section) + '/~/' + self.item.get('id'), | ||
type: 'PUT', | ||
crossDomain : true, | ||
contentType : 'application/json', | ||
headers : Lvl.config.authorizationHeader(), | ||
data : JSON.stringify(self.item) | ||
}).always(function() { | ||
pace.stop(); | ||
var form = self.$('#lvlSubmissionResolutionForm'); | ||
form[0].reset(); | ||
form.bootstrapValidator('resetForm', true); | ||
form.bootstrapValidator('disableSubmitButtons', true); | ||
}).done(function(data, textStatus, request) { | ||
self.trigger('destroy'); | ||
if (200 === request.status || 204 === request.status) { | ||
// TODO self.collection.set([ item ]); | ||
} else { | ||
require([ 'common/alert' ], function(alertDialog) { | ||
alertDialog('Error', 'The server response was not OK.'); | ||
}); | ||
} | ||
}).fail(function(jqXHR, textStatus, errorThrown) { | ||
self.trigger('destroy'); | ||
require([ 'common/alert' ], function(alertDialog) { | ||
alertDialog('Error', 'The submission cannot be resolved.'); | ||
}); | ||
}); | ||
} | ||
}, | ||
onDestroy : function() { | ||
pace.stop(); | ||
this.stopListening(); | ||
}, | ||
onRender : function() { | ||
pace.start(); | ||
} | ||
}); | ||
}); | ||
return Lvl.CurationApp.SubmissionResolver.View; | ||
}); |
55 changes: 55 additions & 0 deletions
55
...e/src/main/ui/js/apps/curation/submission_resolver/tpls/curation_submission_resolver.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
<div class="modal-dialog modal-lg"> | ||
<div class="modal-content"> | ||
<div class="modal-header"> | ||
<button type="button" class="close" data-dismiss="modal"> | ||
<span aria-hidden="true">×</span><span class="sr-only">Close</span> | ||
</button> | ||
<h4 class="modal-title" id="myModalLabel">Resolve submission</h4> | ||
</div> | ||
<div class="modal-body"> | ||
<div class="row"> | ||
<div class="col-xs-12"> | ||
<h5>Submission resolution:</h5> | ||
<form class="form-horizontal" id="lvlSubmissionResolutionForm" novalidate="novalidate" data-pristine="true"> | ||
<fieldset> | ||
<div class="form-group"> | ||
<label for="selectResolution" class="col-lg-2 control-label">Select resolution:</label> | ||
<div class="col-lg-10"> | ||
<select class="form-control" name="selectResolution" id="selectResolution"> | ||
<option value="" selected>Choose a resolution</option> | ||
<option value="ACCEPTED">Accept the submission</option> | ||
<option value="INVALID">Reject invalid submission</option> | ||
<option value="DUPLICATE">Submission duplicates a previous record</option> | ||
</select> | ||
</div> | ||
</div> | ||
<div class="form-group"> | ||
<label for="inputCollection" class="col-lg-2 control-label">Assigned collection:</label> | ||
<div class="col-lg-10"> | ||
<input type="text" class="form-control" id="inputCollection" name="inputCollection" placeholder="Collection where the submission was assigned"> | ||
</div> | ||
</div> | ||
<div class="form-group"> | ||
<label for="inputItemId" class="col-lg-2 control-label">Assigned Item Id:</label> | ||
<div class="col-lg-10"> | ||
<input type="text" class="form-control" id="inputItemId" name="inputItemId" placeholder="Enter Id assigned to the item"> | ||
</div> | ||
</div> | ||
</fieldset> | ||
<fieldset> | ||
<div class="form-group"> | ||
<div class="col-lg-10 col-lg-offset-2"> | ||
<button type="submit" class="btn btn-primary" id="lvlSubmissionResolutionBtn" disabled="disabled">Resolve</button> | ||
<span id="helpBlock" class="help-block">Check that all required fields are completed before submitting the data.</span> | ||
</div> | ||
</div> | ||
</fieldset> | ||
</form> | ||
</div> | ||
</div> | ||
</div> | ||
<div class="modal-footer"> | ||
<button type="button" class="btn btn-default" data-dismiss="modal">Cancel</button> | ||
</div> | ||
</div> | ||
</div> |
Oops, something went wrong.