From 1e6b3cba3acc74c7777e27ef43f4cfe2e5509c12 Mon Sep 17 00:00:00 2001 From: T-Midnight Date: Wed, 17 Apr 2019 13:25:10 +0400 Subject: [PATCH] #42 delete blank lines, fix js, fix leaderId validation --- .../grant/controller/GrantController.java | 6 ++-- .../resources/templates/grants/grant.html | 28 ++++++++----------- 2 files changed, 14 insertions(+), 20 deletions(-) diff --git a/src/main/java/ru/ulstu/grant/controller/GrantController.java b/src/main/java/ru/ulstu/grant/controller/GrantController.java index 82fc80e..0731188 100644 --- a/src/main/java/ru/ulstu/grant/controller/GrantController.java +++ b/src/main/java/ru/ulstu/grant/controller/GrantController.java @@ -61,10 +61,10 @@ public class GrantController { throws IOException { filterEmptyDeadlines(grantDto); if (grantDto.getDeadlines().isEmpty()) { - errors.rejectValue("deadlines", "errorCode", "Не может быть пустым"); + errors.rejectValue("deadlines", "errorCode", "Не может быть пусто"); } - if (grantDto.getLeaderId().equals(null)) { - errors.rejectValue("leader", "errorCode", "Укажите руководителя"); + if (grantDto.getLeaderId().equals(-1)) { + errors.rejectValue("leaderId", "errorCode", "Укажите руководителя"); } if (errors.hasErrors()) { return GRANT_PAGE; diff --git a/src/main/resources/templates/grants/grant.html b/src/main/resources/templates/grants/grant.html index 4a45cad..91a9c6d 100644 --- a/src/main/resources/templates/grants/grant.html +++ b/src/main/resources/templates/grants/grant.html @@ -33,7 +33,6 @@ class="alert alert-danger">Incorrect title

-
-
-
@@ -77,7 +74,6 @@
-
@@ -91,7 +87,8 @@ aria-expanded="false" aria-controls="collapse-filter">Фильтр рабочей группы -
+

-
- +

Choose leader

+

-
-

Incorrect member

-

Добавить статью

-
-
@@ -212,10 +208,8 @@ $("#authors").val('default'); $("#authors").selectpicker("refresh"); $("#authors").children('option:disabled').prop('disabled', false); - - var lid = document.getElementById("leader"); - var aut = document.getElementById("authors"); - aut.options[lid.selectedIndex].disabled="disabled"; + var lid = $("#leaderId option:selected").val(); + $("#authors [value='" + lid + "']").attr("disabled", "disabled"); }