diff --git a/src/main/java/ru/ulstu/extractor/mvc/GitExtractorController.java b/src/main/java/ru/ulstu/extractor/mvc/GitExtractorController.java index 487479c..4d9b72b 100644 --- a/src/main/java/ru/ulstu/extractor/mvc/GitExtractorController.java +++ b/src/main/java/ru/ulstu/extractor/mvc/GitExtractorController.java @@ -5,22 +5,23 @@ import org.springframework.ui.Model; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.ModelAttribute; import org.springframework.web.bind.annotation.PostMapping; -import ru.ulstu.extractor.mvc.model.EmailForm; +import ru.ulstu.extractor.mvc.model.RepoForm; @Controller public class GitExtractorController { - @GetMapping("/") - public String indexForm(Model model) { - model.addAttribute("emailForm", new EmailForm()); - return "index"; + + @GetMapping("/newRepo") + public String indexNewRepo(Model model) { + model.addAttribute("repoForm", new RepoForm()); + return "newRepo"; } - @PostMapping("/sendEmail") - public String sendEmail(@ModelAttribute EmailForm emailForm, Model model) { - if (emailForm.getTo().isEmpty()) { - model.addAttribute("error", "'Кому' не должно быть пустым"); - return "index"; + @PostMapping("/sendRepo") + public String sendRepo(@ModelAttribute RepoForm repoForm, Model model) { + if (repoForm.getRepo() == null || repoForm.getRepo().isEmpty()) { + model.addAttribute("error", "'Git' не должно быть пустым"); + return "newRepo"; } - return "result"; + return "filtering"; } } diff --git a/src/main/java/ru/ulstu/extractor/mvc/model/EmailForm.java b/src/main/java/ru/ulstu/extractor/mvc/model/EmailForm.java deleted file mode 100644 index 59765ee..0000000 --- a/src/main/java/ru/ulstu/extractor/mvc/model/EmailForm.java +++ /dev/null @@ -1,40 +0,0 @@ -package ru.ulstu.extractor.mvc.model; - -public class EmailForm { - private String subject; - private String to; - private String message; - - public String getSubject() { - return subject; - } - - public void setSubject(String subject) { - this.subject = subject; - } - - public String getTo() { - return to; - } - - public void setTo(String to) { - this.to = to; - } - - public String getMessage() { - return message; - } - - public void setMessage(String message) { - this.message = message; - } - - @Override - public String toString() { - return "EmailForm{" + - "subject='" + subject + '\'' + - ", to='" + to + '\'' + - ", message='" + message + '\'' + - '}'; - } -} diff --git a/src/main/java/ru/ulstu/extractor/mvc/model/RepoForm.java b/src/main/java/ru/ulstu/extractor/mvc/model/RepoForm.java new file mode 100644 index 0000000..0a86e6e --- /dev/null +++ b/src/main/java/ru/ulstu/extractor/mvc/model/RepoForm.java @@ -0,0 +1,20 @@ +package ru.ulstu.extractor.mvc.model; + +public class RepoForm { + private String repo; + + public String getRepo() { + return repo; + } + + public void setRepo(String repo) { + this.repo = repo; + } + + @Override + public String toString() { + return "EmailForm{" + + "subject='" + repo + + '}'; + } +} diff --git a/src/main/resources/templates/filtering.html b/src/main/resources/templates/filtering.html new file mode 100644 index 0000000..316f877 --- /dev/null +++ b/src/main/resources/templates/filtering.html @@ -0,0 +1,25 @@ + + +
+Тема: | -- |
Кому: | -- |
Сообщение: | -- |