add method for create paper
This commit is contained in:
parent
43e446e871
commit
5e4f137dba
@ -1,7 +1,7 @@
|
||||
var urlPaperList = "https://localhost:8443/api/1.0/papers";
|
||||
var urlPapers = "https://localhost:8443/api/1.0/papers";
|
||||
|
||||
function showPapers(papersElement) {
|
||||
getFromRest(urlPaperList, function (paperList) {
|
||||
getFromRest(urlPapers, function (paperList) {
|
||||
paperList.forEach(function (paper, index) {
|
||||
$(papersElement).parent().append("<div class='row text-left'>" +
|
||||
" <div class='col-md-12'>" +
|
||||
@ -15,3 +15,15 @@ function showPapers(papersElement) {
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
function addPaper(title, status, comment, locked) {
|
||||
var paperData = JSON.stringify({
|
||||
"title": title,
|
||||
"status": status,
|
||||
"comment": comment,
|
||||
"locked": locked
|
||||
});
|
||||
postToRest(urlPapers, paperData, function(data) {
|
||||
alert(data);
|
||||
});
|
||||
}
|
@ -34,6 +34,8 @@
|
||||
<script src="js/papers.js"></script>
|
||||
<script>
|
||||
showPapers($("#paper-list"));
|
||||
// only for demo
|
||||
//addPaper("название", "DRAFT", "comment", false);
|
||||
</script>
|
||||
</div>
|
||||
</body>
|
||||
|
Loading…
Reference in New Issue
Block a user