Merge branch '10-savePaper' into 'master'
Resolve "Сохранение статьи" Closes #10 See merge request romanov73/ng-tracker!16
This commit is contained in:
commit
d2d2a7ae71
BIN
gradle/wrapper/gradle-wrapper.jar
vendored
BIN
gradle/wrapper/gradle-wrapper.jar
vendored
Binary file not shown.
1
gradle/wrapper/gradle-wrapper.properties
vendored
1
gradle/wrapper/gradle-wrapper.properties
vendored
@ -1,4 +1,3 @@
|
|||||||
#Tue Feb 06 11:48:53 SAMT 2018
|
|
||||||
distributionBase=GRADLE_USER_HOME
|
distributionBase=GRADLE_USER_HOME
|
||||||
distributionPath=wrapper/dists
|
distributionPath=wrapper/dists
|
||||||
zipStoreBase=GRADLE_USER_HOME
|
zipStoreBase=GRADLE_USER_HOME
|
||||||
|
23
gradlew
vendored
23
gradlew
vendored
@ -1,4 +1,4 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env sh
|
||||||
|
|
||||||
##############################################################################
|
##############################################################################
|
||||||
##
|
##
|
||||||
@ -33,11 +33,11 @@ DEFAULT_JVM_OPTS=""
|
|||||||
# Use the maximum available, or set MAX_FD != -1 to use that value.
|
# Use the maximum available, or set MAX_FD != -1 to use that value.
|
||||||
MAX_FD="maximum"
|
MAX_FD="maximum"
|
||||||
|
|
||||||
warn ( ) {
|
warn () {
|
||||||
echo "$*"
|
echo "$*"
|
||||||
}
|
}
|
||||||
|
|
||||||
die ( ) {
|
die () {
|
||||||
echo
|
echo
|
||||||
echo "$*"
|
echo "$*"
|
||||||
echo
|
echo
|
||||||
@ -154,16 +154,19 @@ if $cygwin ; then
|
|||||||
esac
|
esac
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules
|
# Escape application args
|
||||||
function splitJvmOpts() {
|
save () {
|
||||||
JVM_OPTS=("$@")
|
for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
|
||||||
|
echo " "
|
||||||
}
|
}
|
||||||
eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS
|
APP_ARGS=$(save "$@")
|
||||||
JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME"
|
|
||||||
|
# Collect all arguments for the java command, following the shell quoting and substitution rules
|
||||||
|
eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
|
||||||
|
|
||||||
# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong
|
# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong
|
||||||
if [[ "$(uname)" == "Darwin" ]] && [[ "$HOME" == "$PWD" ]]; then
|
if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then
|
||||||
cd "$(dirname "$0")"
|
cd "$(dirname "$0")"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@"
|
exec "$JAVACMD" "$@"
|
||||||
|
@ -37,6 +37,11 @@ public class PaperController {
|
|||||||
return new Response<>(paperService.findAllDto());
|
return new Response<>(paperService.findAllDto());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@GetMapping("/{paper-id}")
|
||||||
|
public Response<PaperDto> getPaper(@PathVariable("paper-id") Integer paperId){
|
||||||
|
return new Response(paperService.findPaper(paperId));
|
||||||
|
}
|
||||||
|
|
||||||
@PostMapping
|
@PostMapping
|
||||||
public Response<Integer> createPaper(@RequestBody @Valid PaperDto paperDto) throws IOException {
|
public Response<Integer> createPaper(@RequestBody @Valid PaperDto paperDto) throws IOException {
|
||||||
return new Response<>(paperService.create(paperDto));
|
return new Response<>(paperService.create(paperDto));
|
||||||
|
@ -130,6 +130,10 @@ public class PaperService {
|
|||||||
return convert(paperRepository.filter(userService.findById(filterDto.getAuthorId()), filterDto.getYear()), PaperDto::new);
|
return convert(paperRepository.filter(userService.findById(filterDto.getAuthorId()), filterDto.getYear()), PaperDto::new);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public PaperDto findPaper(int id){
|
||||||
|
return new PaperDto(paperRepository.getOne(id));
|
||||||
|
}
|
||||||
|
|
||||||
public void closeFailedPapers() {
|
public void closeFailedPapers() {
|
||||||
List<Paper> papers = paperRepository.findAll()
|
List<Paper> papers = paperRepository.findAll()
|
||||||
.stream()
|
.stream()
|
||||||
|
@ -49,16 +49,16 @@ function deletePaper(id, papersElement, paperRowClass) {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function addPaper(title, status, comment, locked) {
|
function addPaper(title, status, datePublish, dateUpdate, deadline, comment, locked, tmpFileName, authors) {
|
||||||
var paperData = JSON.stringify({
|
var paperData = JSON.stringify({
|
||||||
"title": title,
|
"title": title,
|
||||||
"status": status,
|
"status": status,
|
||||||
"comment": comment,
|
"deadlineDate":deadline,
|
||||||
"locked": locked
|
"comment": comment
|
||||||
});
|
});
|
||||||
postToRest(urlPapers, paperData, function (data) {
|
postToRest(urlPapers, paperData, function (data) {
|
||||||
alert(data);
|
alert(data);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function getPaperStatusClass(status) {
|
function getPaperStatusClass(status) {
|
||||||
|
@ -49,7 +49,7 @@
|
|||||||
|
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label>Дедлайн:</label>
|
<label>Дедлайн:</label>
|
||||||
<input type="date" class="form-control" name="deadline"/>
|
<input type="date" class="form-control" name="deadline" id="deadline"/>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="form-check">
|
<div class="form-check">
|
||||||
@ -57,18 +57,18 @@
|
|||||||
<label class="form-check-label" for="locked">Заблокирована</label>
|
<label class="form-check-label" for="locked">Заблокирована</label>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label for="loader">Загрузить статью:</label>
|
<label for="loader" id="loader">Загрузить статью:</label>
|
||||||
<div id="loader">
|
<!--<div id="loader">
|
||||||
|
|
||||||
</div>
|
</div>-->
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label>Дата публикации:</label>
|
<label>Дата публикации:</label>
|
||||||
<input type="date" class="form-control" name="date-publish"/>
|
<input type="date" class="form-control" name="date-publish" id="date-publish"/>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label>Последнее изменение:</label>
|
<label>Последнее изменение:</label>
|
||||||
<input type="date" class="form-control" name="date-update"/>
|
<input type="date" class="form-control" name="date-update" id="date-update"/>
|
||||||
</div>
|
</div>
|
||||||
<p><a href="#myModal1" class="btn btn-primary" data-toggle="modal">Редактировать авторов
|
<p><a href="#myModal1" class="btn btn-primary" data-toggle="modal">Редактировать авторов
|
||||||
статьи</a></p>
|
статьи</a></p>
|
||||||
@ -149,7 +149,7 @@
|
|||||||
<div class="col-lg-12">
|
<div class="col-lg-12">
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<button id="sendMessageButton" class="btn btn-success text-uppercase"
|
<button id="sendMessageButton" class="btn btn-success text-uppercase"
|
||||||
type="submit">
|
type="button" onclick="savePaper();" >
|
||||||
Сохранить
|
Сохранить
|
||||||
</button>
|
</button>
|
||||||
<button id="cancelButton" class="btn btn-default text-uppercase" type="button">
|
<button id="cancelButton" class="btn btn-default text-uppercase" type="button">
|
||||||
@ -182,7 +182,21 @@
|
|||||||
getFromRest(urlPaperStatuses, function (response) {
|
getFromRest(urlPaperStatuses, function (response) {
|
||||||
fillSelect($("#status"), response);
|
fillSelect($("#status"), response);
|
||||||
});
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
|
function savePaper(){
|
||||||
|
var title = document.getElementById("name").value;
|
||||||
|
var status = document.getElementById("status").value;
|
||||||
|
var datePublish = document.getElementById("date-publish").value;
|
||||||
|
var dateUpdate = document.getElementById("date-update").value;
|
||||||
|
var deadline = document.getElementById("deadline").value;
|
||||||
|
var comment = document.getElementById("comment").value;
|
||||||
|
var locked = document.getElementById("locked").value;
|
||||||
|
var tmpFileName = document.getElementById("loader").value;
|
||||||
|
var authors = document.getElementById("myInput").value;
|
||||||
|
|
||||||
|
addPaper(title,status,datePublish,dateUpdate,deadline,comment,locked,tmpFileName,authors);
|
||||||
|
}
|
||||||
/*]]>*/
|
/*]]>*/
|
||||||
</script>
|
</script>
|
||||||
</div>
|
</div>
|
||||||
|
Loading…
Reference in New Issue
Block a user