#13 -- Add rule edit form
All checks were successful
CI fuzzy controller / container-test-job (push) Successful in 1m31s
All checks were successful
CI fuzzy controller / container-test-job (push) Successful in 1m31s
This commit is contained in:
parent
495b04e51d
commit
c2019def08
@ -7,9 +7,6 @@ import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
|
||||
import ru.ulstu.fc.project.model.Project;
|
||||
import ru.ulstu.fc.project.model.ProjectForm;
|
||||
import ru.ulstu.fc.project.service.ProjectService;
|
||||
import ru.ulstu.fc.rule.model.Rule;
|
||||
import ru.ulstu.fc.rule.model.RuleForm;
|
||||
|
||||
@ -17,7 +14,7 @@ import ru.ulstu.fc.rule.model.RuleForm;
|
||||
@RequestMapping("rule")
|
||||
public class RuleController {
|
||||
private final RuleService ruleService;
|
||||
|
||||
|
||||
public RuleController(RuleService ruleService) {
|
||||
this.ruleService = ruleService;
|
||||
}
|
||||
@ -35,7 +32,7 @@ public class RuleController {
|
||||
@PostMapping(value = "save", params = "save")
|
||||
public String save(RuleForm ruleForm, Model model) {
|
||||
model.addAttribute("rule", ruleService.save(ruleForm));
|
||||
return "redirect:/project/edit/"+ruleForm.getProjectId();
|
||||
return "redirect:/project/edit/" + ruleForm.getProjectId();
|
||||
}
|
||||
|
||||
@PostMapping(value = "save", params = "delete")
|
||||
@ -43,6 +40,6 @@ public class RuleController {
|
||||
if (ruleForm != null && ruleForm.getId() != null) {
|
||||
ruleService.delete(ruleForm);
|
||||
}
|
||||
return "redirect:/project/edit/"+ruleForm.getProjectId();
|
||||
return "redirect:/project/edit/" + ruleForm.getProjectId();
|
||||
}
|
||||
}
|
||||
|
@ -7,6 +7,8 @@ logging.level.ru.ulstu=DEBUG
|
||||
logging.level.sun.rmi.transport=off
|
||||
logging.level.javax.management.remote.rmi=off
|
||||
logging.level.java.rmi.server=off
|
||||
logging.level.org.apache.tomcat=INFO
|
||||
logging.level.org.apache.tomcat.util.net=WARN
|
||||
extractor.custom-projects-dir=
|
||||
server.error.include-stacktrace=always
|
||||
server.error.include-exception=true
|
||||
|
28
src/main/resources/templates/rule/edit.html
Normal file
28
src/main/resources/templates/rule/edit.html
Normal file
@ -0,0 +1,28 @@
|
||||
<!DOCTYPE html SYSTEM "http://www.thymeleaf.org/dtd/xhtml1-strict-thymeleaf-spring4-4.dtd">
|
||||
<html
|
||||
xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout" xmlns:th="http://www.w3.org/1999/xhtml"
|
||||
layout:decorate="~{default}">
|
||||
<head>
|
||||
<title>Редактирование правила</title>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
|
||||
</head>
|
||||
<div class="container" layout:fragment="content">
|
||||
<h3>Редактирование правила:</h3>
|
||||
<form th:action="@{/rule/save}" th:object="${rule}" method="post">
|
||||
<input type="hidden" th:field="*{id}">
|
||||
<div class="form-group">
|
||||
<label for="name">Название</label>
|
||||
|
||||
</div>
|
||||
|
||||
<button name="save" type="submit" class="btn btn-outline-dark">Сохранить</button>
|
||||
<button name="delete"
|
||||
type="submit"
|
||||
class="btn btn-outline-dark"
|
||||
onclick="return confirm('Удалить запись?')">
|
||||
Удалить
|
||||
</button>
|
||||
<a th:href="@{'/project/edit/' + ${rule.projectId}}" class="btn btn-outline-dark">Отмена</a>
|
||||
</form>
|
||||
</div>
|
||||
</html>
|
Loading…
x
Reference in New Issue
Block a user