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