#13 -- Add link to rule edit page
All checks were successful
CI fuzzy controller / container-test-job (push) Successful in 1m10s
All checks were successful
CI fuzzy controller / container-test-job (push) Successful in 1m10s
This commit is contained in:
parent
48e65bd53d
commit
63ec2cc289
@ -9,6 +9,7 @@ import org.springframework.web.bind.annotation.RequestMapping;
|
||||
|
||||
import ru.ulstu.fc.rule.model.Rule;
|
||||
import ru.ulstu.fc.rule.model.RuleForm;
|
||||
import ru.ulstu.fc.rule.service.RuleService;
|
||||
|
||||
@Controller
|
||||
@RequestMapping("rule")
|
||||
@ -19,8 +20,10 @@ public class RuleController {
|
||||
this.ruleService = ruleService;
|
||||
}
|
||||
|
||||
@GetMapping("/edit/{ruleId}")
|
||||
public String edit(@PathVariable(value = "ruleId") Integer id, Model model) {
|
||||
@GetMapping("/edit/{projectId}/{ruleId}")
|
||||
public String edit(@PathVariable(value = "projectId") Integer projectId,
|
||||
@PathVariable(value = "ruleId") Integer id, Model model) {
|
||||
model.addAttribute("projectId", projectId);
|
||||
model.addAttribute("rule",
|
||||
new RuleForm((id != null && id != 0)
|
||||
? ruleService.getById(id)
|
||||
|
@ -1,4 +1,4 @@
|
||||
package ru.ulstu.fc.rule.controller;
|
||||
package ru.ulstu.fc.rule.service;
|
||||
|
||||
import org.springframework.stereotype.Service;
|
||||
|
@ -68,5 +68,6 @@
|
||||
<span class="badge badge-danger">И / ИЛИ</span>
|
||||
</div>
|
||||
</div>
|
||||
<a th:href="@{'/rule/edit/' + ${projectId}+'/0'}" class="btn btn-outline-dark">Добавить правило</a>
|
||||
</div>
|
||||
</html>
|
||||
|
@ -9,6 +9,7 @@
|
||||
<div class="container" layout:fragment="content">
|
||||
<h3>Редактирование правила:</h3>
|
||||
<form th:action="@{/rule/save}" th:object="${rule}" method="post">
|
||||
<input type="hidden" th:field="${projectId}">
|
||||
<input type="hidden" th:field="*{id}">
|
||||
<div class="form-group">
|
||||
<label for="name">Название</label>
|
||||
@ -22,7 +23,7 @@
|
||||
onclick="return confirm('Удалить запись?')">
|
||||
Удалить
|
||||
</button>
|
||||
<a th:href="@{'/project/edit/' + ${rule.projectId}}" class="btn btn-outline-dark">Отмена</a>
|
||||
<a th:href="@{'/project/edit/' + ${projectId}}" class="btn btn-outline-dark">Отмена</a>
|
||||
</form>
|
||||
</div>
|
||||
</html>
|
||||
|
Loading…
x
Reference in New Issue
Block a user