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
|
||||
distributionPath=wrapper/dists
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
|
19
gradlew
vendored
19
gradlew
vendored
@ -1,4 +1,4 @@
|
||||
#!/usr/bin/env bash
|
||||
#!/usr/bin/env sh
|
||||
|
||||
##############################################################################
|
||||
##
|
||||
@ -154,16 +154,19 @@ if $cygwin ; then
|
||||
esac
|
||||
fi
|
||||
|
||||
# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules
|
||||
function splitJvmOpts() {
|
||||
JVM_OPTS=("$@")
|
||||
# Escape application args
|
||||
save () {
|
||||
for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
|
||||
echo " "
|
||||
}
|
||||
eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS
|
||||
JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME"
|
||||
APP_ARGS=$(save "$@")
|
||||
|
||||
# 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
|
||||
if [[ "$(uname)" == "Darwin" ]] && [[ "$HOME" == "$PWD" ]]; then
|
||||
if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then
|
||||
cd "$(dirname "$0")"
|
||||
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());
|
||||
}
|
||||
|
||||
@GetMapping("/{paper-id}")
|
||||
public Response<PaperDto> getPaper(@PathVariable("paper-id") Integer paperId){
|
||||
return new Response(paperService.findPaper(paperId));
|
||||
}
|
||||
|
||||
@PostMapping
|
||||
public Response<Integer> createPaper(@RequestBody @Valid PaperDto paperDto) throws IOException {
|
||||
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);
|
||||
}
|
||||
|
||||
public PaperDto findPaper(int id){
|
||||
return new PaperDto(paperRepository.getOne(id));
|
||||
}
|
||||
|
||||
public void closeFailedPapers() {
|
||||
List<Paper> papers = paperRepository.findAll()
|
||||
.stream()
|
||||
|
@ -49,12 +49,12 @@ 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({
|
||||
"title": title,
|
||||
"status": status,
|
||||
"comment": comment,
|
||||
"locked": locked
|
||||
"deadlineDate":deadline,
|
||||
"comment": comment
|
||||
});
|
||||
postToRest(urlPapers, paperData, function (data) {
|
||||
alert(data);
|
||||
|
@ -49,7 +49,7 @@
|
||||
|
||||
<div class="form-group">
|
||||
<label>Дедлайн:</label>
|
||||
<input type="date" class="form-control" name="deadline"/>
|
||||
<input type="date" class="form-control" name="deadline" id="deadline"/>
|
||||
</div>
|
||||
|
||||
<div class="form-check">
|
||||
@ -57,18 +57,18 @@
|
||||
<label class="form-check-label" for="locked">Заблокирована</label>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="loader">Загрузить статью:</label>
|
||||
<div id="loader">
|
||||
<label for="loader" id="loader">Загрузить статью:</label>
|
||||
<!--<div id="loader">
|
||||
|
||||
</div>
|
||||
</div>-->
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<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 class="form-group">
|
||||
<label>Последнее изменение:</label>
|
||||
<input type="date" class="form-control" name="date-update"/>
|
||||
<input type="date" class="form-control" name="date-update" id="date-update"/>
|
||||
</div>
|
||||
<p><a href="#myModal1" class="btn btn-primary" data-toggle="modal">Редактировать авторов
|
||||
статьи</a></p>
|
||||
@ -149,7 +149,7 @@
|
||||
<div class="col-lg-12">
|
||||
<div class="form-group">
|
||||
<button id="sendMessageButton" class="btn btn-success text-uppercase"
|
||||
type="submit">
|
||||
type="button" onclick="savePaper();" >
|
||||
Сохранить
|
||||
</button>
|
||||
<button id="cancelButton" class="btn btn-default text-uppercase" type="button">
|
||||
@ -182,7 +182,21 @@
|
||||
getFromRest(urlPaperStatuses, function (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>
|
||||
</div>
|
||||
|
Loading…
Reference in New Issue
Block a user