From 9b697c6f3f7302a4693f71ad4fed76b688b10258 Mon Sep 17 00:00:00 2001 From: ASH Date: Tue, 9 Apr 2019 23:18:39 +0400 Subject: [PATCH 1/8] #74 adding models, controllers and services --- .../ulstu/students/controller/Navigation.java | 16 ++ .../students/controller/TaskController.java | 85 ++++++++++ .../java/ru/ulstu/students/model/Task.java | 113 ++++++++++++++ .../java/ru/ulstu/students/model/TaskDto.java | 147 ++++++++++++++++++ .../students/repository/TaskRepository.java | 7 + .../ulstu/students/service/TaskService.java | 98 ++++++++++++ src/main/java/ru/ulstu/tags/model/Tag.java | 23 +++ src/main/java/ru/ulstu/tags/model/TagDto.java | 43 +++++ .../ulstu/tags/repository/TagRepository.java | 8 + .../ru/ulstu/tags/service/TagService.java | 46 ++++++ .../fragments/taskDashboardFragment.html | 12 +- .../students/fragments/taskLineFragment.html | 14 +- .../fragments/taskStatusFragment.html | 22 +-- .../resources/templates/students/task.html | 45 ++++-- .../resources/templates/students/tasks.html | 14 +- 15 files changed, 636 insertions(+), 57 deletions(-) create mode 100644 src/main/java/ru/ulstu/students/controller/Navigation.java create mode 100644 src/main/java/ru/ulstu/students/controller/TaskController.java create mode 100644 src/main/java/ru/ulstu/students/model/Task.java create mode 100644 src/main/java/ru/ulstu/students/model/TaskDto.java create mode 100644 src/main/java/ru/ulstu/students/repository/TaskRepository.java create mode 100644 src/main/java/ru/ulstu/students/service/TaskService.java create mode 100644 src/main/java/ru/ulstu/tags/model/Tag.java create mode 100644 src/main/java/ru/ulstu/tags/model/TagDto.java create mode 100644 src/main/java/ru/ulstu/tags/repository/TagRepository.java create mode 100644 src/main/java/ru/ulstu/tags/service/TagService.java diff --git a/src/main/java/ru/ulstu/students/controller/Navigation.java b/src/main/java/ru/ulstu/students/controller/Navigation.java new file mode 100644 index 0000000..3804a8b --- /dev/null +++ b/src/main/java/ru/ulstu/students/controller/Navigation.java @@ -0,0 +1,16 @@ +package ru.ulstu.students.controller; + +import org.springframework.validation.Errors; + +public class Navigation { + public static final String REDIRECT_TO = "redirect:%s"; + public static final String TASKS_PAGE = "/students/tasks"; + public static final String TASK_PAGE = "/students/task"; + + public static String hasErrors(Errors errors, String page) { + if (errors.hasErrors()) { + return page; + } + return null; + } +} diff --git a/src/main/java/ru/ulstu/students/controller/TaskController.java b/src/main/java/ru/ulstu/students/controller/TaskController.java new file mode 100644 index 0000000..76b2f2b --- /dev/null +++ b/src/main/java/ru/ulstu/students/controller/TaskController.java @@ -0,0 +1,85 @@ +package ru.ulstu.students.controller; + +import org.springframework.stereotype.Controller; +import org.springframework.ui.ModelMap; +import org.springframework.validation.Errors; +import org.springframework.web.bind.annotation.*; +import ru.ulstu.deadline.model.Deadline; +import ru.ulstu.students.model.Task; +import ru.ulstu.students.model.TaskDto; +import ru.ulstu.tags.model.Tag; +import springfox.documentation.annotations.ApiIgnore; +import ru.ulstu.students.service.TaskService; +import javax.validation.Valid; +import java.io.IOException; +import java.util.List; +import java.util.stream.Collectors; + +import static org.springframework.util.StringUtils.isEmpty; +import static ru.ulstu.students.controller.Navigation.*; + +@Controller() +@RequestMapping(value = "/students") +@ApiIgnore +public class TaskController { + + private final TaskService taskService; + + public TaskController(TaskService grantService) { + this.taskService = grantService; + } + + @GetMapping("/tasks") + public void getTasks(ModelMap modelMap) { + modelMap.put("tasks", taskService.findAllDto()); + } + + @GetMapping("/dashboard") + public void getDashboard(ModelMap modelMap) { + modelMap.put("tasks", taskService.findAllDto()); + } + + @GetMapping("/task") + public void getTask(ModelMap modelMap, @RequestParam(value = "id") Integer id) { + if (id != null && id > 0) { + modelMap.put("taskDto", taskService.findOneDto(id)); + } else { + modelMap.put("taskDto", new TaskDto()); + } + } + + @PostMapping(value = "/task", params = "save") + public String save(@Valid TaskDto taskDto, Errors errors) throws IOException { + filterEmptyDeadlines(taskDto); + if (taskDto.getDeadlines().isEmpty()) { + errors.rejectValue("deadlines", "errorCode", "Не может быть пустым"); + } + hasErrors(errors, TASK_PAGE); + taskService.save(taskDto); + return String.format(REDIRECT_TO, TASK_PAGE); + } + + @PostMapping(value = "/task", params = "addDeadline") + public String addDeadline(@Valid TaskDto taskDto, Errors errors) { + filterEmptyDeadlines(taskDto); + hasErrors(errors, TASK_PAGE); + taskDto.getDeadlines().add(new Deadline()); + return TASK_PAGE; + } + + @ModelAttribute("allStatuses") + public List getTaskStatuses() { + return taskService.getTaskStatuses(); + } + + @ModelAttribute("allTags") + public List getAllTags() { + return taskService.getTaskTags(); + } + + private void filterEmptyDeadlines(TaskDto taskDto) { + taskDto.setDeadlines(taskDto.getDeadlines().stream() + .filter(dto -> dto.getDate() != null || !isEmpty(dto.getDescription())) + .collect(Collectors.toList())); + } +} diff --git a/src/main/java/ru/ulstu/students/model/Task.java b/src/main/java/ru/ulstu/students/model/Task.java new file mode 100644 index 0000000..296ddcb --- /dev/null +++ b/src/main/java/ru/ulstu/students/model/Task.java @@ -0,0 +1,113 @@ +package ru.ulstu.students.model; + +import org.hibernate.annotations.Fetch; +import org.hibernate.annotations.FetchMode; +import org.hibernate.validator.constraints.NotBlank; +import ru.ulstu.core.model.BaseEntity; +import ru.ulstu.deadline.model.Deadline; +import ru.ulstu.tags.model.Tag; + +import javax.persistence.*; +import java.util.*; + +@Entity +public class Task extends BaseEntity { + + public enum TaskStatus { + IN_WORK("В работе"), + COMPLETED("Завершен"), + FAILED("Провалены сроки"), + LOADED_FROM_KIAS("Загружен автоматически"); + + private String statusName; + + TaskStatus(String name) { + this.statusName = name; + } + + public String getStatusName() { + return statusName; + } + } + + @NotBlank + private String title; + + private String description; + + @Enumerated(value = EnumType.STRING) + private ru.ulstu.students.model.Task.TaskStatus status = TaskStatus.IN_WORK; + + @OneToMany(cascade = CascadeType.ALL, fetch = FetchType.EAGER) + @JoinColumn(name = "task_id", unique = true) + @Fetch(FetchMode.SUBSELECT) + @OrderBy("date") + private List deadlines = new ArrayList<>(); + + @Column(name = "create_date") + @Temporal(TemporalType.TIMESTAMP) + private Date createDate = new Date(); + + @Column(name = "update_date") + @Temporal(TemporalType.TIMESTAMP) + private Date updateDate = new Date(); + + @ManyToMany(fetch = FetchType.EAGER) + private Set tags = new HashSet<>(); + + public String getTitle() { + return title; + } + + public void setTitle(String title) { + this.title = title; + } + + public TaskStatus getStatus() { + return status; + } + + public void setStatus(TaskStatus status) { + this.status = status; + } + + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description; + } + + public List getDeadlines() { + return deadlines; + } + + public void setDeadlines(List deadlines) { + this.deadlines = deadlines; + } + + public Date getCreateDate() { + return createDate; + } + + public void setCreateDate(Date createDate) { + this.createDate = createDate; + } + + public Date getUpdateDate() { + return updateDate; + } + + public void setUpdateDate(Date updateDate) { + this.updateDate = updateDate; + } + + public Set getTags() { + return tags; + } + + public void setTags(Set tags) { + this.tags = tags; + } +} diff --git a/src/main/java/ru/ulstu/students/model/TaskDto.java b/src/main/java/ru/ulstu/students/model/TaskDto.java new file mode 100644 index 0000000..62e73b4 --- /dev/null +++ b/src/main/java/ru/ulstu/students/model/TaskDto.java @@ -0,0 +1,147 @@ +package ru.ulstu.students.model; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import org.apache.commons.lang3.StringUtils; +import org.hibernate.validator.constraints.NotEmpty; +import ru.ulstu.deadline.model.Deadline; +import ru.ulstu.tags.model.TagDto; + +import java.util.ArrayList; +import java.util.Date; +import java.util.List; +import java.util.Set; +import java.util.stream.Collectors; + +import static ru.ulstu.core.util.StreamApiUtils.convert; + +public class TaskDto { + + private final static int MAX_TAGS_LENGTH = 50; + + private Integer id; + @NotEmpty + private String title; + private String description; + private Task.TaskStatus status; + private List deadlines = new ArrayList<>(); + private Date createDate; + private Date updateDate; + private Set tagIds; + private Set tags; + + public TaskDto() { + deadlines.add(new Deadline()); + } + + @JsonCreator + public TaskDto(@JsonProperty("id") Integer id, + @JsonProperty("title") String title, + @JsonProperty("description") String description, + @JsonProperty("createDate") Date createDate, + @JsonProperty("updateDate") Date updateDate, + @JsonProperty("status") Task.TaskStatus status, + @JsonProperty("deadlines") List deadlines, + @JsonProperty("tagIds") Set tagIds, + @JsonProperty("tagIds") Set tags){ + this.id = id; + this.title = title; + this.status = status; + this.deadlines = deadlines; + this.createDate = createDate; + this.updateDate = updateDate; + this.description = description; + this.tags = tags; + } + + public TaskDto(Task task) { + this.id = task.getId(); + this.title = task.getTitle(); + this.status = task.getStatus(); + this.deadlines = task.getDeadlines(); + this.createDate = task.getCreateDate(); + this.updateDate = task.getUpdateDate(); + this.description = task.getDescription(); + this.tagIds = convert(task.getTags(), tag -> tag.getId()); + this.tags = convert(task.getTags(), TagDto::new); + } + + public Integer getId() { + return id; + } + + public void setId(Integer id) { + this.id = id; + } + + public String getTitle() { + return title; + } + + public void setTitle(String title) { + this.title = title; + } + + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description; + } + + public Task.TaskStatus getStatus() { + return status; + } + + public void setStatus(Task.TaskStatus status) { + this.status = status; + } + + public List getDeadlines() { + return deadlines; + } + + public void setDeadlines(List deadlines) { + this.deadlines = deadlines; + } + + public Date getCreateDate() { + return createDate; + } + + public void setCreateDate(Date createDate) { + this.createDate = createDate; + } + + public Date getUpdateDate() { + return updateDate; + } + + public void setUpdateDate(Date updateDate) { + this.updateDate = updateDate; + } + + public Set getTagIds() { + return tagIds; + } + + public void setTagIds(Set tagIds) { + this.tagIds = tagIds; + } + + public Set getTags() { + return tags; + } + + public void setTags(Set tags) { + this.tags = tags; + } + + public String getTagsString() { + return StringUtils.abbreviate(tags + .stream() + .map(tag -> tag.getTagName()) + .collect(Collectors.joining(", ")), MAX_TAGS_LENGTH ); + } +} diff --git a/src/main/java/ru/ulstu/students/repository/TaskRepository.java b/src/main/java/ru/ulstu/students/repository/TaskRepository.java new file mode 100644 index 0000000..6f48d1f --- /dev/null +++ b/src/main/java/ru/ulstu/students/repository/TaskRepository.java @@ -0,0 +1,7 @@ +package ru.ulstu.students.repository; + +import org.springframework.data.jpa.repository.JpaRepository; +import ru.ulstu.students.model.Task; + +public interface TaskRepository extends JpaRepository { +} diff --git a/src/main/java/ru/ulstu/students/service/TaskService.java b/src/main/java/ru/ulstu/students/service/TaskService.java new file mode 100644 index 0000000..c3ac558 --- /dev/null +++ b/src/main/java/ru/ulstu/students/service/TaskService.java @@ -0,0 +1,98 @@ +package ru.ulstu.students.service; + +import org.apache.commons.lang3.StringUtils; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; +import ru.ulstu.deadline.service.DeadlineService; +import ru.ulstu.students.model.Task; +import ru.ulstu.students.model.TaskDto; +import ru.ulstu.students.repository.TaskRepository; +import ru.ulstu.tags.model.Tag; +import ru.ulstu.tags.service.TagService; + +import java.io.IOException; +import java.util.*; + +import static org.springframework.util.ObjectUtils.isEmpty; +import static ru.ulstu.core.util.StreamApiUtils.convert; +import static ru.ulstu.students.model.Task.TaskStatus.IN_WORK; + +@Service +public class TaskService { + + private final static int MAX_DISPLAY_SIZE = 40; + + private final TaskRepository taskRepository; + private final DeadlineService deadlineService; + private final TagService tagService; + + public TaskService(TaskRepository grantRepository, + DeadlineService deadlineService, TagService tagService){ + this.taskRepository = grantRepository; + this.deadlineService = deadlineService; + this.tagService = tagService; + } + + public List findAll() { + return taskRepository.findAll(); + } + + public List findAllDto() { + List tasks = convert(findAll(), TaskDto::new); + tasks.forEach(taskDto -> taskDto.setTitle(StringUtils.abbreviate(taskDto.getTitle(), MAX_DISPLAY_SIZE))); + return tasks; + } + + public TaskDto findOneDto(Integer id) { + return new TaskDto(taskRepository.findOne(id)); + } + + @Transactional + public Integer create(TaskDto taskDto) throws IOException { + Task newTask = copyFromDto(new Task(), taskDto); + newTask = taskRepository.save(newTask); + return newTask.getId(); + } + + private Task copyFromDto(Task task, TaskDto taskDto) throws IOException { + task.setTitle(taskDto.getTitle()); + task.setDescription(taskDto.getDescription()); + task.setStatus(taskDto.getStatus() == null ? IN_WORK : taskDto.getStatus()); + task.setDeadlines(deadlineService.saveOrCreate(taskDto.getDeadlines())); + task.setCreateDate(task.getCreateDate() == null ? new Date() : task.getCreateDate()); + task.setUpdateDate(new Date()); + task.getTags().clear(); + if (taskDto.getTagIds() != null && !taskDto.getTagIds().isEmpty()) { + taskDto.getTagIds().forEach(tagIds -> task.getTags().add(tagService.findById(tagIds))); + } + return task; + } + + @Transactional + public Integer update(TaskDto taskDto) throws IOException { + Task task = taskRepository.findOne(taskDto.getId()); + taskRepository.save(copyFromDto(task, taskDto)); + return task.getId(); + } + + @Transactional + public void delete(Integer taskId) throws IOException { + Task task = taskRepository.findOne(taskId); + taskRepository.delete(task); + } + + public void save(TaskDto taskDto) throws IOException { + if (isEmpty(taskDto.getId())) { + create(taskDto); + } else { + update(taskDto); + } + } + + public List getTaskStatuses() { + return Arrays.asList(Task.TaskStatus.values()); + } + public List getTaskTags() { + return tagService.findAll(); + } +} diff --git a/src/main/java/ru/ulstu/tags/model/Tag.java b/src/main/java/ru/ulstu/tags/model/Tag.java new file mode 100644 index 0000000..78a6274 --- /dev/null +++ b/src/main/java/ru/ulstu/tags/model/Tag.java @@ -0,0 +1,23 @@ +package ru.ulstu.tags.model; + +import org.hibernate.validator.constraints.NotBlank; +import ru.ulstu.core.model.BaseEntity; + +import javax.persistence.Entity; +import javax.persistence.Table; + +@Entity +@Table(name = "tag") +public class Tag extends BaseEntity { + + @NotBlank + private String tagName; + + public String getTagName() { + return tagName; + } + + public void setTagName(String tagName) { + this.tagName = tagName; + } +} diff --git a/src/main/java/ru/ulstu/tags/model/TagDto.java b/src/main/java/ru/ulstu/tags/model/TagDto.java new file mode 100644 index 0000000..80ce085 --- /dev/null +++ b/src/main/java/ru/ulstu/tags/model/TagDto.java @@ -0,0 +1,43 @@ +package ru.ulstu.tags.model; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import org.hibernate.validator.constraints.NotEmpty; + +import javax.validation.constraints.Size; + +public class TagDto { + + private Integer id; + @NotEmpty + @Size(max = 50) + private String tagName; + + @JsonCreator + public TagDto(@JsonProperty("id") Integer id, + @JsonProperty("tagName") String tagName) { + this.id = id; + this.tagName = tagName; + } + + public Integer getId() { + return id; + } + + public void setId(Integer id) { + this.id = id; + } + + public String getTagName() { + return tagName; + } + + public void setTagName(String tagName) { + this.tagName = tagName; + } + + public TagDto(Tag tag) { + this.id = tag.getId(); + this.tagName = tag.getTagName(); + } +} diff --git a/src/main/java/ru/ulstu/tags/repository/TagRepository.java b/src/main/java/ru/ulstu/tags/repository/TagRepository.java new file mode 100644 index 0000000..c0a014e --- /dev/null +++ b/src/main/java/ru/ulstu/tags/repository/TagRepository.java @@ -0,0 +1,8 @@ +package ru.ulstu.tags.repository; + +import org.springframework.data.jpa.repository.JpaRepository; +import ru.ulstu.tags.model.Tag; + +public interface TagRepository extends JpaRepository { + +} diff --git a/src/main/java/ru/ulstu/tags/service/TagService.java b/src/main/java/ru/ulstu/tags/service/TagService.java new file mode 100644 index 0000000..45c10f2 --- /dev/null +++ b/src/main/java/ru/ulstu/tags/service/TagService.java @@ -0,0 +1,46 @@ +package ru.ulstu.tags.service; + +import org.apache.commons.lang3.StringUtils; +import org.springframework.stereotype.Service; +import ru.ulstu.tags.model.Tag; +import ru.ulstu.tags.model.TagDto; +import ru.ulstu.tags.repository.TagRepository; + +import java.util.List; + +import static ru.ulstu.core.util.StreamApiUtils.convert; + +@Service +public class TagService { + + private final TagRepository tagRepository; + + + public TagService(TagRepository tagRepository) { + + this.tagRepository = tagRepository; + } + + public List findAll() { + return tagRepository.findAll(); + } + +// public List findAllDto() { +// List tag = convert(findAll(), TagDto::new); +// tags.forEach(tagDto -> tagDto.setTitle(StringUtils.abbreviate(tagDto.getTitle(), MAX_DISPLAY_SIZE))); +// return tags; +// } +// +// public TagDto findOneDto(Integer id) { +// return new TagDto(tagRepository.findOne(id)); +// } + + + public List findByIds(List ids) { + return tagRepository.findAll(ids); + } + public Tag findById(Integer id) { + return tagRepository.findOne(id); + } + +} diff --git a/src/main/resources/templates/students/fragments/taskDashboardFragment.html b/src/main/resources/templates/students/fragments/taskDashboardFragment.html index 0daea58..3779ef8 100644 --- a/src/main/resources/templates/students/fragments/taskDashboardFragment.html +++ b/src/main/resources/templates/students/fragments/taskDashboardFragment.html @@ -7,14 +7,14 @@
- - + +
- - - title -

type

+ title +

status

+ +
diff --git a/src/main/resources/templates/students/fragments/taskLineFragment.html b/src/main/resources/templates/students/fragments/taskLineFragment.html index 79ad5d7..44c2d03 100644 --- a/src/main/resources/templates/students/fragments/taskLineFragment.html +++ b/src/main/resources/templates/students/fragments/taskLineFragment.html @@ -4,15 +4,15 @@ -
+
- - - Первая хадач - Курсовая работа + + + + - - + diff --git a/src/main/resources/templates/students/fragments/taskStatusFragment.html b/src/main/resources/templates/students/fragments/taskStatusFragment.html index 8f3d800..ea9a3e9 100644 --- a/src/main/resources/templates/students/fragments/taskStatusFragment.html +++ b/src/main/resources/templates/students/fragments/taskStatusFragment.html @@ -5,18 +5,14 @@ - - -
- -
-
- -
-
+ + + + +
-
+
@@ -25,12 +21,6 @@
-
- -
-
- -
diff --git a/src/main/resources/templates/students/task.html b/src/main/resources/templates/students/task.html index 533c8f6..98c4147 100644 --- a/src/main/resources/templates/students/task.html +++ b/src/main/resources/templates/students/task.html @@ -21,47 +21,60 @@
-
+
- +
- + +

Incorrect title

- +
- +
-
+
-
- +
+
- +
- +
-
+

Incorrect title

Дата создания:
- - + text
@@ -98,8 +111,8 @@
Дата изменения:
- - + text
diff --git a/src/main/resources/templates/students/tasks.html b/src/main/resources/templates/students/tasks.html index 076f7ba..37ade14 100644 --- a/src/main/resources/templates/students/tasks.html +++ b/src/main/resources/templates/students/tasks.html @@ -20,8 +20,8 @@
- -
+ +
@@ -37,16 +37,6 @@
- Добавить задачу diff --git a/src/main/resources/templates/students/task.html b/src/main/resources/templates/students/task.html index 98c4147..ceda3bc 100644 --- a/src/main/resources/templates/students/task.html +++ b/src/main/resources/templates/students/task.html @@ -11,6 +11,7 @@
+
@@ -21,7 +22,7 @@
-
@@ -45,17 +46,19 @@
- +
- +
-
+
- +
@@ -77,18 +80,19 @@ class="alert alert-danger">Incorrect title

-
-
+
- +
@@ -99,7 +103,7 @@
+ th:text="${taskDto.createDate == null ? '' : #dates.format(taskDto.createDate, 'dd.MM.yyyy HH:mm')}"> text
@@ -112,7 +116,7 @@
+ th:text="${taskDto.updateDate == null ? '' : #dates.format(taskDto.updateDate, 'dd.MM.yyyy HH:mm')}"> text
@@ -124,6 +128,7 @@
+
diff --git a/src/main/resources/templates/students/tasks.html b/src/main/resources/templates/students/tasks.html index 37ade14..b1177d8 100644 --- a/src/main/resources/templates/students/tasks.html +++ b/src/main/resources/templates/students/tasks.html @@ -20,7 +20,7 @@
- +
@@ -41,7 +41,6 @@ -
From 5eae7305c4523f2c656b5b660352540cee4a7143 Mon Sep 17 00:00:00 2001 From: ASH Date: Thu, 11 Apr 2019 00:14:03 +0400 Subject: [PATCH 3/8] #74 codestyle --- .../students/controller/TaskController.java | 5 +++-- .../java/ru/ulstu/students/model/TaskDto.java | 18 +++++++++--------- .../ru/ulstu/students/service/TaskService.java | 2 +- .../ulstu/tags/repository/TagRepository.java | 2 +- .../java/ru/ulstu/tags/service/TagService.java | 1 + .../students/fragments/taskLineFragment.html | 8 ++++---- .../fragments/taskNavigationFragment.html | 2 +- .../students/fragments/taskStatusFragment.html | 2 +- .../resources/templates/students/task.html | 5 +++-- 9 files changed, 24 insertions(+), 21 deletions(-) diff --git a/src/main/java/ru/ulstu/students/controller/TaskController.java b/src/main/java/ru/ulstu/students/controller/TaskController.java index 52c9fc7..4b4d12d 100644 --- a/src/main/java/ru/ulstu/students/controller/TaskController.java +++ b/src/main/java/ru/ulstu/students/controller/TaskController.java @@ -11,6 +11,7 @@ import ru.ulstu.tags.model.Tag; import ru.ulstu.tags.model.TagDto; import springfox.documentation.annotations.ApiIgnore; import ru.ulstu.students.service.TaskService; + import javax.validation.Valid; import java.io.IOException; import java.util.List; @@ -55,7 +56,7 @@ public class TaskController { if (taskDto.getDeadlines().isEmpty()) { errors.rejectValue("deadlines", "errorCode", "Не может быть пустым"); } - if(errors.hasErrors()) + if (errors.hasErrors()) return TASK_PAGE; taskService.save(taskDto); return String.format(REDIRECT_TO, TASKS_PAGE); @@ -64,7 +65,7 @@ public class TaskController { @PostMapping(value = "/task", params = "addDeadline") public String addDeadline(@Valid TaskDto taskDto, Errors errors) { filterEmptyDeadlines(taskDto); - if(errors.hasErrors()) + if (errors.hasErrors()) return TASK_PAGE; taskDto.getDeadlines().add(new Deadline()); return TASK_PAGE; diff --git a/src/main/java/ru/ulstu/students/model/TaskDto.java b/src/main/java/ru/ulstu/students/model/TaskDto.java index 896d9ea..dc41be8 100644 --- a/src/main/java/ru/ulstu/students/model/TaskDto.java +++ b/src/main/java/ru/ulstu/students/model/TaskDto.java @@ -36,14 +36,14 @@ public class TaskDto { @JsonCreator public TaskDto(@JsonProperty("id") Integer id, - @JsonProperty("title") String title, - @JsonProperty("description") String description, - @JsonProperty("createDate") Date createDate, - @JsonProperty("updateDate") Date updateDate, - @JsonProperty("status") Task.TaskStatus status, - @JsonProperty("deadlines") List deadlines, - @JsonProperty("tagIds") Set tagIds, - @JsonProperty("tags") Set tags){ + @JsonProperty("title") String title, + @JsonProperty("description") String description, + @JsonProperty("createDate") Date createDate, + @JsonProperty("updateDate") Date updateDate, + @JsonProperty("status") Task.TaskStatus status, + @JsonProperty("deadlines") List deadlines, + @JsonProperty("tagIds") Set tagIds, + @JsonProperty("tags") Set tags) { this.id = id; this.title = title; this.status = status; @@ -142,6 +142,6 @@ public class TaskDto { return StringUtils.abbreviate(tags .stream() .map(tag -> tag.getTagName()) - .collect(Collectors.joining(", ")), MAX_TAGS_LENGTH ); + .collect(Collectors.joining(", ")), MAX_TAGS_LENGTH); } } diff --git a/src/main/java/ru/ulstu/students/service/TaskService.java b/src/main/java/ru/ulstu/students/service/TaskService.java index 22190ee..5e969ac 100644 --- a/src/main/java/ru/ulstu/students/service/TaskService.java +++ b/src/main/java/ru/ulstu/students/service/TaskService.java @@ -28,7 +28,7 @@ public class TaskService { private final TagService tagService; public TaskService(TaskRepository grantRepository, - DeadlineService deadlineService, TagService tagService){ + DeadlineService deadlineService, TagService tagService) { this.taskRepository = grantRepository; this.deadlineService = deadlineService; this.tagService = tagService; diff --git a/src/main/java/ru/ulstu/tags/repository/TagRepository.java b/src/main/java/ru/ulstu/tags/repository/TagRepository.java index 038a740..d4a9c76 100644 --- a/src/main/java/ru/ulstu/tags/repository/TagRepository.java +++ b/src/main/java/ru/ulstu/tags/repository/TagRepository.java @@ -3,6 +3,6 @@ package ru.ulstu.tags.repository; import org.springframework.data.jpa.repository.JpaRepository; import ru.ulstu.tags.model.TagDto; -public interface TagRepository extends JpaRepository{ +public interface TagRepository extends JpaRepository { } diff --git a/src/main/java/ru/ulstu/tags/service/TagService.java b/src/main/java/ru/ulstu/tags/service/TagService.java index 4d8232f..adf2a82 100644 --- a/src/main/java/ru/ulstu/tags/service/TagService.java +++ b/src/main/java/ru/ulstu/tags/service/TagService.java @@ -5,6 +5,7 @@ import org.springframework.stereotype.Service; import ru.ulstu.tags.model.TagDto; import ru.ulstu.tags.repository.TagRepository; + import javax.transaction.Transactional; import java.util.Set; import java.util.stream.Collectors; diff --git a/src/main/resources/templates/students/fragments/taskLineFragment.html b/src/main/resources/templates/students/fragments/taskLineFragment.html index 122de6d..baad17e 100644 --- a/src/main/resources/templates/students/fragments/taskLineFragment.html +++ b/src/main/resources/templates/students/fragments/taskLineFragment.html @@ -6,12 +6,12 @@
- - + + - + - + diff --git a/src/main/resources/templates/students/fragments/taskNavigationFragment.html b/src/main/resources/templates/students/fragments/taskNavigationFragment.html index 33f5cdb..cf32140 100644 --- a/src/main/resources/templates/students/fragments/taskNavigationFragment.html +++ b/src/main/resources/templates/students/fragments/taskNavigationFragment.html @@ -16,7 +16,7 @@ diff --git a/src/main/resources/templates/students/fragments/taskStatusFragment.html b/src/main/resources/templates/students/fragments/taskStatusFragment.html index ea9a3e9..77fd529 100644 --- a/src/main/resources/templates/students/fragments/taskStatusFragment.html +++ b/src/main/resources/templates/students/fragments/taskStatusFragment.html @@ -7,7 +7,7 @@ - +
diff --git a/src/main/resources/templates/students/task.html b/src/main/resources/templates/students/task.html index ceda3bc..74ec8f6 100644 --- a/src/main/resources/templates/students/task.html +++ b/src/main/resources/templates/students/task.html @@ -1,9 +1,10 @@ + layout:decorator="default" xmlns:th="http://www.w3.org/1999/xhtml" xmlns="http://www.w3.org/1999/html"> - + From d6a11a5902f469bad0df2312e8b51778239240c5 Mon Sep 17 00:00:00 2001 From: ASH Date: Sun, 14 Apr 2019 17:50:23 +0400 Subject: [PATCH 4/8] #74 fixing codestyle and tags --- .../students/controller/TaskController.java | 24 +++------- .../java/ru/ulstu/students/model/Task.java | 11 ++--- .../java/ru/ulstu/students/model/TaskDto.java | 13 +++--- .../ulstu/students/service/TaskService.java | 12 ++--- src/main/java/ru/ulstu/tags/model/Tag.java | 23 +++++++++- src/main/java/ru/ulstu/tags/model/TagDto.java | 44 ------------------- .../ulstu/tags/repository/TagRepository.java | 8 +++- .../ru/ulstu/tags/service/TagService.java | 34 +++++++------- 8 files changed, 64 insertions(+), 105 deletions(-) delete mode 100644 src/main/java/ru/ulstu/tags/model/TagDto.java diff --git a/src/main/java/ru/ulstu/students/controller/TaskController.java b/src/main/java/ru/ulstu/students/controller/TaskController.java index 4b4d12d..8fd9575 100644 --- a/src/main/java/ru/ulstu/students/controller/TaskController.java +++ b/src/main/java/ru/ulstu/students/controller/TaskController.java @@ -7,10 +7,8 @@ import org.springframework.web.bind.annotation.*; import ru.ulstu.deadline.model.Deadline; import ru.ulstu.students.model.Task; import ru.ulstu.students.model.TaskDto; -import ru.ulstu.tags.model.Tag; -import ru.ulstu.tags.model.TagDto; -import springfox.documentation.annotations.ApiIgnore; import ru.ulstu.students.service.TaskService; +import springfox.documentation.annotations.ApiIgnore; import javax.validation.Valid; import java.io.IOException; @@ -56,8 +54,9 @@ public class TaskController { if (taskDto.getDeadlines().isEmpty()) { errors.rejectValue("deadlines", "errorCode", "Не может быть пустым"); } - if (errors.hasErrors()) + if (errors.hasErrors()) { return TASK_PAGE; + } taskService.save(taskDto); return String.format(REDIRECT_TO, TASKS_PAGE); } @@ -65,8 +64,9 @@ public class TaskController { @PostMapping(value = "/task", params = "addDeadline") public String addDeadline(@Valid TaskDto taskDto, Errors errors) { filterEmptyDeadlines(taskDto); - if (errors.hasErrors()) + if (errors.hasErrors()) { return TASK_PAGE; + } taskDto.getDeadlines().add(new Deadline()); return TASK_PAGE; } @@ -76,20 +76,6 @@ public class TaskController { return taskService.getTaskStatuses(); } -// @ModelAttribute("allTags") -// public List getAllTags() { -// return taskService.getTaskTags(); -// } - -// @PostMapping(value = "/task", params = "addTag") -// public String addTag(@Valid TaskDto taskDto, Errors errors) { -// filterEmptyDeadlines(taskDto); -// if(errors.hasErrors()) -// return TASK_PAGE; -// taskDto.getTags().add(new TagDto()); -// return TASK_PAGE; -// } - private void filterEmptyDeadlines(TaskDto taskDto) { taskDto.setDeadlines(taskDto.getDeadlines().stream() .filter(dto -> dto.getDate() != null || !isEmpty(dto.getDescription())) diff --git a/src/main/java/ru/ulstu/students/model/Task.java b/src/main/java/ru/ulstu/students/model/Task.java index 1ffa95c..be1b1c6 100644 --- a/src/main/java/ru/ulstu/students/model/Task.java +++ b/src/main/java/ru/ulstu/students/model/Task.java @@ -6,10 +6,11 @@ import org.hibernate.validator.constraints.NotBlank; import ru.ulstu.core.model.BaseEntity; import ru.ulstu.deadline.model.Deadline; import ru.ulstu.tags.model.Tag; -import ru.ulstu.tags.model.TagDto; import javax.persistence.*; -import java.util.*; +import java.util.ArrayList; +import java.util.Date; +import java.util.List; @Entity public class Task extends BaseEntity { @@ -57,7 +58,7 @@ public class Task extends BaseEntity { @JoinTable(name = "task_tags", joinColumns = {@JoinColumn(name = "task_id")}, inverseJoinColumns = {@JoinColumn(name = "tag_id")}) - private Set tags = new HashSet<>(); + private List tags = new ArrayList<>(); public String getTitle() { return title; @@ -107,11 +108,11 @@ public class Task extends BaseEntity { this.updateDate = updateDate; } - public Set getTags() { + public List getTags() { return tags; } - public void setTags(Set tags) { + public void setTags(List tags) { this.tags = tags; } } diff --git a/src/main/java/ru/ulstu/students/model/TaskDto.java b/src/main/java/ru/ulstu/students/model/TaskDto.java index dc41be8..941a6df 100644 --- a/src/main/java/ru/ulstu/students/model/TaskDto.java +++ b/src/main/java/ru/ulstu/students/model/TaskDto.java @@ -5,7 +5,7 @@ import com.fasterxml.jackson.annotation.JsonProperty; import org.apache.commons.lang3.StringUtils; import org.hibernate.validator.constraints.NotEmpty; import ru.ulstu.deadline.model.Deadline; -import ru.ulstu.tags.model.TagDto; +import ru.ulstu.tags.model.Tag; import java.util.ArrayList; import java.util.Date; @@ -13,8 +13,6 @@ import java.util.List; import java.util.Set; import java.util.stream.Collectors; -import static ru.ulstu.core.util.StreamApiUtils.convert; - public class TaskDto { private final static int MAX_TAGS_LENGTH = 50; @@ -28,7 +26,7 @@ public class TaskDto { private Date createDate; private Date updateDate; private Set tagIds; - private Set tags; + private List tags; public TaskDto() { deadlines.add(new Deadline()); @@ -43,7 +41,7 @@ public class TaskDto { @JsonProperty("status") Task.TaskStatus status, @JsonProperty("deadlines") List deadlines, @JsonProperty("tagIds") Set tagIds, - @JsonProperty("tags") Set tags) { + @JsonProperty("tags") List tags) { this.id = id; this.title = title; this.status = status; @@ -62,7 +60,6 @@ public class TaskDto { this.createDate = task.getCreateDate(); this.updateDate = task.getUpdateDate(); this.description = task.getDescription(); -// this.tagIds = convert(task.getTags(), tag -> tag.getId()); this.tags = task.getTags(); } @@ -130,11 +127,11 @@ public class TaskDto { this.tagIds = tagIds; } - public Set getTags() { + public List getTags() { return tags; } - public void setTags(Set tags) { + public void setTags(List tags) { this.tags = tags; } diff --git a/src/main/java/ru/ulstu/students/service/TaskService.java b/src/main/java/ru/ulstu/students/service/TaskService.java index 5e969ac..7b67a44 100644 --- a/src/main/java/ru/ulstu/students/service/TaskService.java +++ b/src/main/java/ru/ulstu/students/service/TaskService.java @@ -7,12 +7,12 @@ import ru.ulstu.deadline.service.DeadlineService; import ru.ulstu.students.model.Task; import ru.ulstu.students.model.TaskDto; import ru.ulstu.students.repository.TaskRepository; -import ru.ulstu.tags.model.Tag; -import ru.ulstu.tags.model.TagDto; import ru.ulstu.tags.service.TagService; import java.io.IOException; -import java.util.*; +import java.util.Arrays; +import java.util.Date; +import java.util.List; import static org.springframework.util.ObjectUtils.isEmpty; import static ru.ulstu.core.util.StreamApiUtils.convert; @@ -64,9 +64,6 @@ public class TaskService { task.setUpdateDate(new Date()); task.getTags().clear(); task.setTags(tagService.saveOrCreate(taskDto.getTags())); -// if (taskDto.getTagIds() != null && !taskDto.getTagIds().isEmpty()) { -// taskDto.getTagIds().forEach(tagIds -> task.getTags().add(tagService.findById(tagIds))); -// } return task; } @@ -95,7 +92,4 @@ public class TaskService { return Arrays.asList(Task.TaskStatus.values()); } -// public List getTaskTags() { -// return tagService.; -// } } diff --git a/src/main/java/ru/ulstu/tags/model/Tag.java b/src/main/java/ru/ulstu/tags/model/Tag.java index d299b22..aed000f 100644 --- a/src/main/java/ru/ulstu/tags/model/Tag.java +++ b/src/main/java/ru/ulstu/tags/model/Tag.java @@ -1,20 +1,39 @@ package ru.ulstu.tags.model; -import org.hibernate.validator.constraints.NotBlank; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import org.hibernate.validator.constraints.NotEmpty; import ru.ulstu.core.model.BaseEntity; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.Table; +import javax.validation.constraints.Size; @Entity @Table(name = "tag") public class Tag extends BaseEntity { - @NotBlank + @NotEmpty + @Size(max = 50) @Column(name = "tag_name") private String tagName; + public Tag() { + + } + + @JsonCreator + public Tag(@JsonProperty("id") Integer id, + @JsonProperty("tag_name") String tagName) { + this.setId(id); + this.tagName = tagName; + } + + public Tag(String name) { + this.tagName = name; + } + public String getTagName() { return tagName; } diff --git a/src/main/java/ru/ulstu/tags/model/TagDto.java b/src/main/java/ru/ulstu/tags/model/TagDto.java deleted file mode 100644 index 582ea5d..0000000 --- a/src/main/java/ru/ulstu/tags/model/TagDto.java +++ /dev/null @@ -1,44 +0,0 @@ -package ru.ulstu.tags.model; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonProperty; -import org.hibernate.validator.constraints.NotEmpty; -import ru.ulstu.core.model.BaseEntity; - -import javax.persistence.Column; -import javax.persistence.Entity; -import javax.persistence.Table; -import javax.validation.constraints.Size; - -@Entity -@Table(name = "tag") -public class TagDto extends BaseEntity { - - @NotEmpty - @Size(max = 50) - @Column(name = "tag_name") - private String tagName; - - public TagDto() { - - } - - @JsonCreator - public TagDto(@JsonProperty("id") Integer id, - @JsonProperty("tag_name") String tagName) { - this.setId(id); - this.tagName = tagName; - } - - public TagDto(String name) { - this.tagName = name; - } - - public String getTagName() { - return tagName; - } - - public void setTagName(String tagName) { - this.tagName = tagName; - } -} diff --git a/src/main/java/ru/ulstu/tags/repository/TagRepository.java b/src/main/java/ru/ulstu/tags/repository/TagRepository.java index d4a9c76..213abae 100644 --- a/src/main/java/ru/ulstu/tags/repository/TagRepository.java +++ b/src/main/java/ru/ulstu/tags/repository/TagRepository.java @@ -1,8 +1,12 @@ package ru.ulstu.tags.repository; import org.springframework.data.jpa.repository.JpaRepository; -import ru.ulstu.tags.model.TagDto; +import org.springframework.data.jpa.repository.Query; +import org.springframework.data.repository.query.Param; +import ru.ulstu.tags.model.Tag; -public interface TagRepository extends JpaRepository { +public interface TagRepository extends JpaRepository { + @Query("SELECT t FROM Tag t WHERE (t.tagName = :tagName)") + Tag findByName(@Param("tagName") String tagName); } diff --git a/src/main/java/ru/ulstu/tags/service/TagService.java b/src/main/java/ru/ulstu/tags/service/TagService.java index adf2a82..681a506 100644 --- a/src/main/java/ru/ulstu/tags/service/TagService.java +++ b/src/main/java/ru/ulstu/tags/service/TagService.java @@ -1,17 +1,13 @@ package ru.ulstu.tags.service; -import org.apache.commons.lang3.StringUtils; import org.springframework.stereotype.Service; - -import ru.ulstu.tags.model.TagDto; +import ru.ulstu.tags.model.Tag; import ru.ulstu.tags.repository.TagRepository; import javax.transaction.Transactional; -import java.util.Set; +import java.util.List; import java.util.stream.Collectors; -import static ru.ulstu.core.util.StreamApiUtils.convert; - @Service public class TagService { @@ -23,23 +19,29 @@ public class TagService { this.tagRepository = tagRepository; } - public Set saveOrCreate(Set tagDtos) { - return tagDtos + public List saveOrCreate(List tags) { + return tags .stream() - .map(tagDto -> { - return tagRepository.exists(tagDto.getId()) ? takeExist(tagDto) : create(tagDto); - }).collect(Collectors.toSet()); + .map(tag -> { + return tag.getId() != null ? getExistById(tag) : + isExistByName(tag.getTagName()) != null ? isExistByName(tag.getTagName()) : create(tag); + }).collect(Collectors.toList()); } @Transactional - public TagDto takeExist(TagDto tagDto) { - return tagRepository.findOne(tagDto.getId()); + public Tag getExistById(Tag tag) { + return tagRepository.findOne(tag.getId()); } @Transactional - public TagDto create(TagDto tagDto) { - TagDto newTag = new TagDto(); - newTag.setTagName(tagDto.getTagName()); + public Tag isExistByName(String tagName) { + return tagRepository.findByName(tagName); + } + + @Transactional + public Tag create(Tag tag) { + Tag newTag = new Tag(); + newTag.setTagName(tag.getTagName()); newTag = tagRepository.save(newTag); return newTag; } From 1f36e04cd3eec6900f82af4dac8d8505ba9571d5 Mon Sep 17 00:00:00 2001 From: ASH Date: Sun, 14 Apr 2019 21:24:22 +0400 Subject: [PATCH 5/8] #74 fully adding tags --- src/main/resources/public/css/tasks.css | 73 +++++++++++++++---- src/main/resources/public/js/tasks.js | 70 ++++++++++++++++++ .../resources/templates/students/task.html | 15 +++- 3 files changed, 139 insertions(+), 19 deletions(-) diff --git a/src/main/resources/public/css/tasks.css b/src/main/resources/public/css/tasks.css index 2f42db5..6d18c99 100644 --- a/src/main/resources/public/css/tasks.css +++ b/src/main/resources/public/css/tasks.css @@ -1,24 +1,65 @@ -.bootstrap-tagsinput{ - +.tags-container { width: 100%; padding: .375rem .75rem; + background-color: #fff; + border: 1px solid #ccc; + box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075); + display: inline-block; + color: #555; + vertical-align: middle; + border-radius: 4px; + max-width: 100%; + line-height: 22px; + cursor: text; } -.bootstrap-tagsinput .label{ - - display: inline; - padding: .2em .6em .3em; - font-size: 75%; - font-weight: 700; - line-height: 2.5; - color: #fff; - text-align: center; - white-space: nowrap; - vertical-align: baseline; - border-radius: .25em; +.input-tag-name { + border: none; + box-shadow: none; + outline: none; + background-color: transparent; + padding: 0 6px; + margin: 0; + width: auto; + max-width: inherit; } -.bootstrap-tagsinput .label-info{ +.tag { + display: inline-block; + padding: .2em .6em .3em; + background-color: orange; + border-radius: .25em; + margin-right: 4px; + margin-bottom: 4px; + + font-size: 75%; + font-weight: 700; + line-height: 1.5; + color: #fff; +} + +.tag-name span[data-role="remove"] { + margin-left: 8px; + cursor: pointer; +} + +.tag-name span[data-role="remove"]:after { + content: "x"; + padding: 0px 2px; +} + +.tag-name input[type="text"] { + background: transparent; + border: none; + display: inline-flex; + font-size: 100%; + font-weight: 700; + line-height: 1.5; + color: #fff; + text-align: center; + white-space: nowrap; + vertical-align: baseline; + outline: none; + cursor: default; - background-color: orange; } diff --git a/src/main/resources/public/js/tasks.js b/src/main/resources/public/js/tasks.js index 6bf160c..b333c31 100644 --- a/src/main/resources/public/js/tasks.js +++ b/src/main/resources/public/js/tasks.js @@ -1,5 +1,75 @@ /*") + .attr("id", 'tags' + tagNumber) + .addClass("tag"); + // контейнер id + var idInput = $("") + .attr("type", "hidden") + .attr("id", "tags" + tagNumber + ".id") + .attr("name", "tags[" + tagNumber + "].id") + .attr("value", ''); + // контейнер текста + var conDiv = $("
") + .addClass("tag-name"); + // текст тега + var nameInput = $("") + .attr("type", "text") + .attr("id", "tags" + tagNumber + ".tagName") + .attr("name", "tags[" + tagNumber + "].tagName") + .attr("value", tagName) + .attr("readonly", "true") + .attr("size", tagName.length); + // кнопка удалить тег + var removeSpan = $("") + .attr("data-role", "remove") + .bind("click", removeTag); + + conDiv.append(nameInput); + conDiv.append(removeSpan); + newTagRow.append(idInput); + newTagRow.append(conDiv); + $(this).before(newTagRow); + } + + $(this).val(''); + } + }); + + $("span[data-role=remove]").click(removeTag); $(".task-row").mouseenter(function (event) { var taskRow = $(event.target).closest(".task-row"); $(taskRow).css("background-color", "#f8f9fa"); diff --git a/src/main/resources/templates/students/task.html b/src/main/resources/templates/students/task.html index 74ec8f6..968c7a0 100644 --- a/src/main/resources/templates/students/task.html +++ b/src/main/resources/templates/students/task.html @@ -53,8 +53,18 @@
- +
+
+ +
+ + +
+
+ +
@@ -131,7 +141,6 @@
-
\ No newline at end of file From dbd61ce80c9bd8459b19feebca8c176b404ec398 Mon Sep 17 00:00:00 2001 From: anastasia shulga Date: Tue, 16 Apr 2019 07:55:37 +0000 Subject: [PATCH 6/8] Update TagService.java --- src/main/java/ru/ulstu/tags/service/TagService.java | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/main/java/ru/ulstu/tags/service/TagService.java b/src/main/java/ru/ulstu/tags/service/TagService.java index 681a506..e68c683 100644 --- a/src/main/java/ru/ulstu/tags/service/TagService.java +++ b/src/main/java/ru/ulstu/tags/service/TagService.java @@ -23,8 +23,16 @@ public class TagService { return tags .stream() .map(tag -> { - return tag.getId() != null ? getExistById(tag) : - isExistByName(tag.getTagName()) != null ? isExistByName(tag.getTagName()) : create(tag); + if(tag.getId() != null){ + return getExistById(tag); + }else { + Tag existTag = isExistByName(tag.getTagName()); + if(existTag != null){ + return existTag; + }else{ + return create(tag); + } + } }).collect(Collectors.toList()); } From 95f70f425a6e379db63b9a824b97e94a3c08824d Mon Sep 17 00:00:00 2001 From: anastasia shulga Date: Tue, 16 Apr 2019 08:21:36 +0000 Subject: [PATCH 7/8] Update2 TagService.java --- .../ru/ulstu/tags/service/TagService.java | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/src/main/java/ru/ulstu/tags/service/TagService.java b/src/main/java/ru/ulstu/tags/service/TagService.java index e68c683..8541aad 100644 --- a/src/main/java/ru/ulstu/tags/service/TagService.java +++ b/src/main/java/ru/ulstu/tags/service/TagService.java @@ -23,16 +23,16 @@ public class TagService { return tags .stream() .map(tag -> { - if(tag.getId() != null){ - return getExistById(tag); - }else { - Tag existTag = isExistByName(tag.getTagName()); - if(existTag != null){ - return existTag; - }else{ - return create(tag); - } - } + if (tag.getId() != null) { + return getExistById(tag); + } else { + Tag existTag = isExistByName(tag.getTagName()); + if (existTag != null) { + return existTag; + } else { + return create(tag); + } + } }).collect(Collectors.toList()); } From d81d1cf72c875fe619abea9fd6c8b21d6452abff Mon Sep 17 00:00:00 2001 From: Anton Romanov Date: Tue, 16 Apr 2019 13:41:10 +0400 Subject: [PATCH 8/8] #74 some code fixes --- .../ru/ulstu/tags/service/TagService.java | 8 +- src/main/resources/public/css/agency.css | 1690 ++++++++--------- src/main/resources/templates/index.html | 6 - 3 files changed, 840 insertions(+), 864 deletions(-) diff --git a/src/main/java/ru/ulstu/tags/service/TagService.java b/src/main/java/ru/ulstu/tags/service/TagService.java index 8541aad..4e88304 100644 --- a/src/main/java/ru/ulstu/tags/service/TagService.java +++ b/src/main/java/ru/ulstu/tags/service/TagService.java @@ -23,15 +23,11 @@ public class TagService { return tags .stream() .map(tag -> { - if (tag.getId() != null) { + if (tag.getId() != null) { return getExistById(tag); } else { Tag existTag = isExistByName(tag.getTagName()); - if (existTag != null) { - return existTag; - } else { - return create(tag); - } + return existTag != null ? existTag : create(tag); } }).collect(Collectors.toList()); } diff --git a/src/main/resources/public/css/agency.css b/src/main/resources/public/css/agency.css index e1cc226..fb3ec24 100644 --- a/src/main/resources/public/css/agency.css +++ b/src/main/resources/public/css/agency.css @@ -1,853 +1,839 @@ -body { - overflow-x: hidden; - font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; -} - -p { - line-height: 1.75; -} - -a { - color: #000000; -} - -a:hover { - color: #fec503; -} - -.text-draft { - color: rgba(0, 0, 0, 0.48) !important; -} - -.text-primary { - color: #228bba !important; -} - -.text-warning { - color: #940000 !important; -} - -.text-review { - color: #94028d !important; -} - -.text-success { - color: #007741 !important; -} - -.text-accepted { - color: #fec503 !important; -} - -.text-not-accepted { - color: #A38831 !important; -} - -.text-failed { - color: #A38831 !important; -} - -h1, -h2, -h3, -h4, -h5, -h6 { - font-weight: 700; - font-family: 'Montserrat', 'Helvetica Neue', Helvetica, Arial, sans-serif; -} - -section { - padding: 100px 0; -} - -section h2.section-heading { - font-size: 2.5vw; - margin-top: 0; - margin-bottom: 15px; -} - -section h3.section-subheading { - font-size: 16px; - font-weight: 400; - font-style: italic; - margin-bottom: 75px; - text-transform: none; - font-family: 'Droid Serif', 'Helvetica Neue', Helvetica, Arial, sans-serif; -} - -@media (min-width: 768px) { - section { - padding: 100px 0; - } -} - -.btn { - font-family: 'Montserrat', 'Helvetica Neue', Helvetica, Arial, sans-serif; - font-weight: 700; -} - -.btn-xl { - font-size: 18px; - padding: 20px 40px; -} - -.btn-success { - background-color: #28a745; - border-color: #28a745; -} - -.btn-primary { - background-color: #fed136; - border-color: #fed136; -} - -.btn-default { - background-color: #ffffff; - border-color: #ced4da;; -} - -.btn-info { - background-color: #5bc0de; - border-color: #5bc0de; -} - -.progress-bar { - display: flex; - -ms-flex-direction: column; - flex-direction: column; - -ms-flex-pack: center; - justify-content: center; - color: #fff; - text-align: center; - white-space: nowrap; - background-color: #fed136; - transition: width .6s ease; -} - -.btn-primary:active, .btn-primary:focus, .btn-primary:hover { - background-color: #fec810 !important; - border-color: #fec810 !important; - color: white; -} - -.btn-primary:active, .btn-primary:focus { - box-shadow: 0 0 0 0.2rem rgba(254, 209, 55, 0.5) !important; -} - -::-moz-selection { - background: #fed136; - text-shadow: none; -} - -::selection { - background: #fed136; - text-shadow: none; -} - -img::selection { - background: transparent; -} - -img::-moz-selection { - background: transparent; -} - -#mainNav { - background-color: #212529; -} - -#mainNav .navbar-toggler { - font-size: 12px; - right: 0; - padding: 13px; - text-transform: uppercase; - color: white; - border: 0; - background-color: #fed136; - font-family: 'Montserrat', 'Helvetica Neue', Helvetica, Arial, sans-serif; -} - -#mainNav .navbar-brand { - color: #fed136; - font-family: 'Kaushan Script', 'Helvetica Neue', Helvetica, Arial, cursive; -} - -#mainNav .navbar-brand.active, #mainNav .navbar-brand:active, #mainNav .navbar-brand:focus, #mainNav .navbar-brand:hover { - color: #fec503; -} - -#mainNav .navbar-nav .nav-item .nav-link { - font-size: 90%; - font-weight: 400; - padding: 0.75em 0; - letter-spacing: 1px; - color: white; - font-family: 'Montserrat', 'Helvetica Neue', Helvetica, Arial, sans-serif; -} - -#mainNav .navbar-nav .nav-item .nav-link.active, #mainNav .navbar-nav .nav-item .nav-link:hover { - color: #fed136; -} - -@media (min-width: 992px) { - #mainNav { - padding-top: 25px; - padding-bottom: 25px; - -webkit-transition: padding-top 0.3s, padding-bottom 0.3s; - -moz-transition: padding-top 0.3s, padding-bottom 0.3s; - transition: padding-top 0.3s, padding-bottom 0.3s; - border: none; - background-color: transparent; - } - - #mainNav .navbar-brand { - font-size: 1.75em; - -webkit-transition: all 0.3s; - -moz-transition: all 0.3s; - transition: all 0.3s; - } - - #mainNav .navbar-nav .nav-item .nav-link { - padding: 1.1em 1em !important; - } - - #mainNav.navbar-shrink { - padding-top: 0; - padding-bottom: 0; - background-color: #212529; - } - - #mainNav.navbar-shrink .navbar-brand { - font-size: 1.25em; - padding: 12px 0; - } -} - -header.masthead { - text-align: center; - color: white; - background-image: url("../img/header-bg.jpg"); - background-repeat: no-repeat; - background-attachment: scroll; - background-position: center center; - -webkit-background-size: cover; - -moz-background-size: cover; - -o-background-size: cover; - background-size: cover; -} - -header.masthead .intro-text { - padding-top: 150px; - padding-bottom: 100px; -} - -header.masthead .intro-text .intro-lead-in { - font-size: 22px; - font-style: italic; - line-height: 22px; - margin-bottom: 25px; - font-family: 'Droid Serif', 'Helvetica Neue', Helvetica, Arial, sans-serif; -} - -header.masthead .intro-text .intro-heading { - font-size: 50px; - font-weight: 700; - line-height: 50px; - margin-bottom: 25px; - font-family: 'Montserrat', 'Helvetica Neue', Helvetica, Arial, sans-serif; -} - -@media (min-width: 768px) { - header.masthead .intro-text { - padding-top: 300px; - padding-bottom: 200px; - } - - header.masthead .intro-text .intro-lead-in { - font-size: 40px; - font-style: italic; - line-height: 40px; - margin-bottom: 25px; - font-family: 'Droid Serif', 'Helvetica Neue', Helvetica, Arial, sans-serif; - } - - header.masthead .intro-text .intro-heading { - font-size: 75px; - font-weight: 700; - line-height: 75px; - margin-bottom: 50px; - font-family: 'Montserrat', 'Helvetica Neue', Helvetica, Arial, sans-serif; - } -} - -.service-heading { - margin: 15px 0; - text-transform: none; -} - -#portfolio .portfolio-item { - right: 0; - margin: 0 0 15px; -} - -#portfolio .portfolio-item .portfolio-link { - position: relative; - display: block; - max-width: 400px; - margin: 0 auto; - cursor: pointer; -} - -#portfolio .portfolio-item .portfolio-link .portfolio-hover { - position: absolute; - width: 100%; - height: 100%; - -webkit-transition: all ease 0.5s; - -moz-transition: all ease 0.5s; - transition: all ease 0.5s; - opacity: 0; - background: rgba(254, 209, 54, 0.9); -} - -#portfolio .portfolio-item .portfolio-link .portfolio-hover:hover { - opacity: 1; -} - -#portfolio .portfolio-item .portfolio-link .portfolio-hover .portfolio-hover-content { - font-size: 20px; - position: absolute; - top: 50%; - width: 100%; - height: 20px; - margin-top: -12px; - text-align: center; - color: white; -} - -#portfolio .portfolio-item .portfolio-link .portfolio-hover .portfolio-hover-content i { - margin-top: -12px; -} - -#portfolio .portfolio-item .portfolio-link .portfolio-hover .portfolio-hover-content h3, -#portfolio .portfolio-item .portfolio-link .portfolio-hover .portfolio-hover-content h4 { - margin: 0; -} - -#portfolio .portfolio-item .portfolio-caption { - max-width: 400px; - margin: 0 auto; - padding: 25px; - text-align: center; - background-color: #fff; -} - -#portfolio .portfolio-item .portfolio-caption h4 { - margin: 0; - text-transform: none; -} - -#portfolio .portfolio-item .portfolio-caption p { - font-size: 16px; - font-style: italic; - margin: 0; - font-family: 'Droid Serif', 'Helvetica Neue', Helvetica, Arial, sans-serif; -} - -#portfolio * { - z-index: 2; -} - -@media (min-width: 767px) { - #portfolio .portfolio-item { - margin: 0 0 30px; - } -} - -.portfolio-modal { - padding-right: 0px !important; -} - -.portfolio-modal .modal-dialog { - margin: 1rem; - max-width: 100vw; -} - -.portfolio-modal .modal-content { - padding: 100px 0; - text-align: center; -} - -.portfolio-modal .modal-content h2 { - font-size: 3em; - margin-bottom: 15px; -} - -.portfolio-modal .modal-content p { - margin-bottom: 30px; -} - -.portfolio-modal .modal-content p.item-intro { - font-size: 16px; - font-style: italic; - margin: 20px 0 30px; - font-family: 'Droid Serif', 'Helvetica Neue', Helvetica, Arial, sans-serif; -} - -.portfolio-modal .modal-content ul.list-inline { - margin-top: 0; - margin-bottom: 30px; -} - -.portfolio-modal .modal-content img { - margin-bottom: 30px; -} - -.portfolio-modal .modal-content button { - cursor: pointer; -} - -.portfolio-modal .close-modal { - position: absolute; - top: 25px; - right: 25px; - width: 75px; - height: 75px; - cursor: pointer; - background-color: transparent; -} - -.portfolio-modal .close-modal:hover { - opacity: 0.3; -} - -.portfolio-modal .close-modal .lr { - /* Safari and Chrome */ - z-index: 1051; - width: 1px; - height: 75px; - margin-left: 35px; - /* IE 9 */ - -webkit-transform: rotate(45deg); - -ms-transform: rotate(45deg); - transform: rotate(45deg); - background-color: #212529; -} - -.portfolio-modal .close-modal .lr .rl { - /* Safari and Chrome */ - z-index: 1052; - width: 1px; - height: 75px; - /* IE 9 */ - -webkit-transform: rotate(90deg); - -ms-transform: rotate(90deg); - transform: rotate(90deg); - background-color: #212529; -} - -.timeline { - position: relative; - padding: 0; - list-style: none; -} - -.timeline:before { - position: absolute; - top: 0; - bottom: 0; - left: 40px; - width: 2px; - margin-left: -1.5px; - content: ''; - background-color: #e9ecef; -} - -.timeline > li { - position: relative; - min-height: 50px; - margin-bottom: 50px; -} - -.timeline > li:after, .timeline > li:before { - display: table; - content: ' '; -} - -.timeline > li:after { - clear: both; -} - -.timeline > li .timeline-panel { - position: relative; - float: right; - width: 100%; - padding: 0 20px 0 100px; - text-align: left; -} - -.timeline > li .timeline-panel:before { - right: auto; - left: -15px; - border-right-width: 15px; - border-left-width: 0; -} - -.timeline > li .timeline-panel:after { - right: auto; - left: -14px; - border-right-width: 14px; - border-left-width: 0; -} - -.timeline > li .timeline-image { - position: absolute; - z-index: 100; - left: 0; - width: 80px; - height: 80px; - margin-left: 0; - text-align: center; - color: white; - border: 7px solid #e9ecef; - border-radius: 100%; - background-color: #fed136; -} - -.timeline > li .timeline-image h4 { - font-size: 10px; - line-height: 14px; - margin-top: 12px; -} - -.timeline > li.timeline-inverted > .timeline-panel { - float: right; - padding: 0 20px 0 100px; - text-align: left; -} - -.timeline > li.timeline-inverted > .timeline-panel:before { - right: auto; - left: -15px; - border-right-width: 15px; - border-left-width: 0; -} - -.timeline > li.timeline-inverted > .timeline-panel:after { - right: auto; - left: -14px; - border-right-width: 14px; - border-left-width: 0; -} - -.timeline > li:last-child { - margin-bottom: 0; -} - -.timeline .timeline-heading h4 { - margin-top: 0; - color: inherit; -} - -.timeline .timeline-heading h4.subheading { - text-transform: none; -} - -.timeline .timeline-body > ul, -.timeline .timeline-body > p { - margin-bottom: 0; -} - -@media (min-width: 768px) { - .timeline:before { - left: 50%; - } - - .timeline > li { - min-height: 100px; - margin-bottom: 100px; - } - - .timeline > li .timeline-panel { - float: left; - width: 41%; - padding: 0 20px 20px 30px; - text-align: right; - } - - .timeline > li .timeline-image { - left: 50%; - width: 100px; - height: 100px; - margin-left: -50px; - } - - .timeline > li .timeline-image h4 { - font-size: 13px; - line-height: 18px; - margin-top: 16px; - } - - .timeline > li.timeline-inverted > .timeline-panel { - float: right; - padding: 0 30px 20px 20px; - text-align: left; - } -} - -@media (min-width: 992px) { - .timeline > li { - min-height: 150px; - } - - .timeline > li .timeline-panel { - padding: 0 20px 20px; - } - - .timeline > li .timeline-image { - width: 150px; - height: 150px; - margin-left: -75px; - } - - .timeline > li .timeline-image h4 { - font-size: 18px; - line-height: 26px; - margin-top: 30px; - } - - .timeline > li.timeline-inverted > .timeline-panel { - padding: 0 20px 20px; - } -} - -@media (min-width: 1200px) { - .timeline > li { - min-height: 170px; - } - - .timeline > li .timeline-panel { - padding: 0 20px 20px 100px; - } - - .timeline > li .timeline-image { - width: 170px; - height: 170px; - margin-left: -85px; - } - - .timeline > li .timeline-image h4 { - margin-top: 40px; - } - - .timeline > li.timeline-inverted > .timeline-panel { - padding: 0 100px 20px 20px; - } -} - -.team-member { - margin-bottom: 50px; - text-align: center; -} - -.team-member img { - width: 225px; - height: 225px; - border: 7px solid #fff; -} - -.team-member h4 { - margin-top: 25px; - margin-bottom: 0; - text-transform: none; -} - -.team-member p { - margin-top: 0; -} - -section#contact { - background-color: #212529; - background-image: url("../img/map-image.png"); - background-repeat: no-repeat; - background-position: center; -} - -section#contact .section-heading { - color: #fff; -} - -section#contact .form-group { - margin-bottom: 25px; -} - -section#contact .form-group input, -section#contact .form-group textarea { - padding: 20px; -} - -section#contact .form-group input.form-control { - height: auto; -} - -section#contact .form-group textarea.form-control { - height: 248px; -} - -section#contact .form-control:focus { - border-color: #fed136; - box-shadow: none; -} - -section#contact ::-webkit-input-placeholder { - font-weight: 700; - color: #ced4da; - font-family: 'Montserrat', 'Helvetica Neue', Helvetica, Arial, sans-serif; -} - -section#contact :-moz-placeholder { - font-weight: 700; - color: #ced4da; - /* Firefox 18- */ - font-family: 'Montserrat', 'Helvetica Neue', Helvetica, Arial, sans-serif; -} - -section#contact ::-moz-placeholder { - font-weight: 700; - color: #ced4da; - /* Firefox 19+ */ - font-family: 'Montserrat', 'Helvetica Neue', Helvetica, Arial, sans-serif; -} - -section#contact :-ms-input-placeholder { - font-weight: 700; - color: #ced4da; - font-family: 'Montserrat', 'Helvetica Neue', Helvetica, Arial, sans-serif; -} - -footer { - padding: 25px 0; - text-align: center; -} - -footer span.copyright { - font-size: 90%; - line-height: 40px; - text-transform: none; - font-family: 'Montserrat', 'Helvetica Neue', Helvetica, Arial, sans-serif; -} - -footer ul.quicklinks { - font-size: 90%; - line-height: 40px; - margin-bottom: 0; - text-transform: none; - font-family: 'Montserrat', 'Helvetica Neue', Helvetica, Arial, sans-serif; -} - -ul.social-buttons { - margin-bottom: 0; -} - -ul.social-buttons li a { - font-size: 20px; - line-height: 40px; - display: block; - width: 40px; - height: 40px; - -webkit-transition: all 0.3s; - -moz-transition: all 0.3s; - transition: all 0.3s; - color: white; - border-radius: 100%; - outline: none; - background-color: #212529; -} - -ul.social-buttons li a:active, ul.social-buttons li a:focus, ul.social-buttons li a:hover { - background-color: #fed136; -} - -.dashboard-card { - background: #ffffff none repeat scroll 0 0; - margin: 15px; - padding: 20px; - border: 0 solid #e7e7e7; - border-radius: 5px; - box-shadow: 0 5px 20px rgba(0, 0, 0, 0.05); -} - -@media (min-width: 1500px) { - .col-xl-3 { - max-width: 20%; - } - - .container { - max-width: 1340px; - } -} - -.toolbar-button { - width: 100%; - margin: 5px; -} - -.img-fluid { - width: 100% !important; -} - -/* --------------------------------------------------- - FEEDBACK STYLE ------------------------------------------------------ */ -.feedback-panel { - list-style-type: none; - padding: 5px; -} - -.feedback-panel .alert { - padding: 5px; - margin-bottom: 5px; - cursor: pointer; -} - -/* --------------------------------------------------- - MEDIAQUERIES ------------------------------------------------------ */ -@media (min-width: 768px) { - section h2.section-heading { - font-size: 3.5vw; - margin-top: 0; - margin-bottom: 15px; - } -} - -@media (min-width: 1500px) { - section h2.section-heading { - font-size: 1.5vw; - margin-top: 0; - margin-bottom: 15px; - } -} - -@media (min-width: 768px) { - .feedback-panel { - position: fixed; - overflow-y: hidden; - max-height: calc(100vh - 60px); - width: 250px; - top: 50px; - right: 15px; - opacity: .8; - z-index: 10000; - } - - .feedback-panel .alert { - padding: 10px; - margin-bottom: 10px; - overflow: hidden; - } - - .feedback-panel .alert:hover { - border-color: #888; - } +body { + overflow-x: hidden; + font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; +} + +p { + line-height: 1.75; +} + +a { + color: #000000; +} + +a:hover { + color: #fec503; +} + +.text-draft { + color: rgba(0, 0, 0, 0.48) !important; +} + +.text-primary { + color: #228bba !important; +} + +.text-warning { + color: #940000 !important; +} + +.text-review { + color: #94028d !important; +} + +.text-success { + color: #007741 !important; +} + +.text-accepted { + color: #fec503 !important; +} + +.text-not-accepted { + color: #A38831 !important; +} + +.text-failed { + color: #A38831 !important; +} + +h1, +h2, +h3, +h4, +h5, +h6 { + font-weight: 700; + font-family: 'Montserrat', 'Helvetica Neue', Helvetica, Arial, sans-serif; +} + +section { + padding: 100px 0; +} + +section h2.section-heading { + font-size: 2.5vw; + margin-top: 0; + margin-bottom: 15px; +} + +section h3.section-subheading { + font-size: 16px; + font-weight: 400; + font-style: italic; + margin-bottom: 75px; + text-transform: none; + font-family: 'Droid Serif', 'Helvetica Neue', Helvetica, Arial, sans-serif; +} + +@media (min-width: 768px) { + section { + padding: 100px 0; + } +} + +.btn { + font-family: 'Montserrat', 'Helvetica Neue', Helvetica, Arial, sans-serif; + font-weight: 700; +} + +.btn-xl { + font-size: 18px; + padding: 20px 40px; +} + +.btn-success { + background-color: #28a745; + border-color: #28a745; +} + +.btn-primary { + background-color: #fed136; + border-color: #fed136; +} + +.btn-default { + background-color: #ffffff; + border-color: #ced4da;; +} + +.btn-info { + background-color: #5bc0de; + border-color: #5bc0de; +} + +.progress-bar { + display: flex; + -ms-flex-direction: column; + flex-direction: column; + -ms-flex-pack: center; + justify-content: center; + color: #fff; + text-align: center; + white-space: nowrap; + background-color: #fed136; + transition: width .6s ease; +} + +.btn-primary:active, .btn-primary:focus, .btn-primary:hover { + background-color: #fec810 !important; + border-color: #fec810 !important; + color: white; +} + +.btn-primary:active, .btn-primary:focus { + box-shadow: 0 0 0 0.2rem rgba(254, 209, 55, 0.5) !important; +} + +::-moz-selection { + background: #fed136; + text-shadow: none; +} + +::selection { + background: #fed136; + text-shadow: none; +} + +img::selection { + background: transparent; +} + +img::-moz-selection { + background: transparent; +} + +#mainNav { + background-color: #212529; +} + +#mainNav .navbar-toggler { + font-size: 12px; + right: 0; + padding: 13px; + text-transform: uppercase; + color: white; + border: 0; + background-color: #fed136; + font-family: 'Montserrat', 'Helvetica Neue', Helvetica, Arial, sans-serif; +} + +#mainNav .navbar-brand { + color: #fed136; + font-family: 'Kaushan Script', 'Helvetica Neue', Helvetica, Arial, cursive; +} + +#mainNav .navbar-brand.active, #mainNav .navbar-brand:active, #mainNav .navbar-brand:focus, #mainNav .navbar-brand:hover { + color: #fec503; +} + +#mainNav .navbar-nav .nav-item .nav-link { + font-size: 90%; + font-weight: 400; + padding: 0.75em 0; + letter-spacing: 1px; + color: white; + font-family: 'Montserrat', 'Helvetica Neue', Helvetica, Arial, sans-serif; +} + +#mainNav .navbar-nav .nav-item .nav-link.active, #mainNav .navbar-nav .nav-item .nav-link:hover { + color: #fed136; +} + +@media (min-width: 992px) { + #mainNav { + padding-top: 25px; + padding-bottom: 25px; + -webkit-transition: padding-top 0.3s, padding-bottom 0.3s; + -moz-transition: padding-top 0.3s, padding-bottom 0.3s; + transition: padding-top 0.3s, padding-bottom 0.3s; + border: none; + background-color: transparent; + } + + #mainNav .navbar-brand { + font-size: 1.75em; + -webkit-transition: all 0.3s; + -moz-transition: all 0.3s; + transition: all 0.3s; + } + + #mainNav .navbar-nav .nav-item .nav-link { + padding: 1.1em 1em !important; + } + + #mainNav.navbar-shrink { + padding-top: 0; + padding-bottom: 0; + background-color: #212529; + } + + #mainNav.navbar-shrink .navbar-brand { + font-size: 1.25em; + padding: 12px 0; + } +} + +header.masthead { + text-align: center; + color: white; + background-image: url("../img/header-bg.jpg"); + background-repeat: no-repeat; + background-attachment: scroll; + background-position: center center; + -webkit-background-size: cover; + -moz-background-size: cover; + -o-background-size: cover; + background-size: cover; +} + +header.masthead .intro-text { + padding-top: 150px; + padding-bottom: 100px; +} + +header.masthead .intro-text .intro-lead-in { + font-size: 22px; + font-style: italic; + line-height: 22px; + margin-bottom: 25px; + font-family: 'Droid Serif', 'Helvetica Neue', Helvetica, Arial, sans-serif; +} + +header.masthead .intro-text .intro-heading { + font-size: 50px; + font-weight: 700; + line-height: 50px; + margin-bottom: 25px; + font-family: 'Montserrat', 'Helvetica Neue', Helvetica, Arial, sans-serif; +} + +@media (min-width: 768px) { + header.masthead .intro-text { + padding-top: 300px; + padding-bottom: 200px; + } + + header.masthead .intro-text .intro-lead-in { + font-size: 40px; + font-style: italic; + line-height: 40px; + margin-bottom: 25px; + font-family: 'Droid Serif', 'Helvetica Neue', Helvetica, Arial, sans-serif; + } + + header.masthead .intro-text .intro-heading { + font-size: 75px; + font-weight: 700; + line-height: 75px; + margin-bottom: 50px; + font-family: 'Montserrat', 'Helvetica Neue', Helvetica, Arial, sans-serif; + } +} + +.service-heading { + margin: 15px 0; + text-transform: none; +} + +#portfolio .portfolio-item { + right: 0; + margin: 0 0 15px; +} + +#portfolio .portfolio-item .portfolio-link { + position: relative; + display: block; + max-width: 400px; + margin: 0 auto; + cursor: pointer; +} + +#portfolio .portfolio-item .portfolio-link .portfolio-hover { + position: absolute; + width: 100%; + height: 100%; + -webkit-transition: all ease 0.5s; + -moz-transition: all ease 0.5s; + transition: all ease 0.5s; + opacity: 0; + background: rgba(254, 209, 54, 0.9); +} + +#portfolio .portfolio-item .portfolio-link .portfolio-hover:hover { + opacity: 1; +} + +#portfolio .portfolio-item .portfolio-link .portfolio-hover .portfolio-hover-content { + font-size: 20px; + position: absolute; + top: 50%; + width: 100%; + height: 20px; + margin-top: -12px; + text-align: center; + color: white; +} + +#portfolio .portfolio-item .portfolio-link .portfolio-hover .portfolio-hover-content i { + margin-top: -12px; +} + +#portfolio .portfolio-item .portfolio-link .portfolio-hover .portfolio-hover-content h3, +#portfolio .portfolio-item .portfolio-link .portfolio-hover .portfolio-hover-content h4 { + margin: 0; +} + +#portfolio .portfolio-item .portfolio-caption { + max-width: 400px; + margin: 0 auto; + padding: 25px; + text-align: center; + background-color: #fff; +} + +#portfolio .portfolio-item .portfolio-caption h4 { + margin: 0; + text-transform: none; +} + +#portfolio .portfolio-item .portfolio-caption p { + font-size: 16px; + font-style: italic; + margin: 0; + font-family: 'Droid Serif', 'Helvetica Neue', Helvetica, Arial, sans-serif; +} + +#portfolio * { + z-index: 2; +} + +@media (min-width: 767px) { + #portfolio .portfolio-item { + margin: 0 0 30px; + } +} + +.portfolio-modal { + padding-right: 0px !important; +} + +.portfolio-modal .modal-dialog { + margin: 1rem; + max-width: 100vw; +} + +.portfolio-modal .modal-content { + padding: 100px 0; + text-align: center; +} + +.portfolio-modal .modal-content h2 { + font-size: 3em; + margin-bottom: 15px; +} + +.portfolio-modal .modal-content p { + margin-bottom: 30px; +} + +.portfolio-modal .modal-content p.item-intro { + font-size: 16px; + font-style: italic; + margin: 20px 0 30px; + font-family: 'Droid Serif', 'Helvetica Neue', Helvetica, Arial, sans-serif; +} + +.portfolio-modal .modal-content ul.list-inline { + margin-top: 0; + margin-bottom: 30px; +} + +.portfolio-modal .modal-content img { + margin-bottom: 30px; +} + +.portfolio-modal .modal-content button { + cursor: pointer; +} + +.portfolio-modal .close-modal { + position: absolute; + top: 25px; + right: 25px; + width: 75px; + height: 75px; + cursor: pointer; + background-color: transparent; +} + +.portfolio-modal .close-modal:hover { + opacity: 0.3; +} + +.portfolio-modal .close-modal .lr { + /* Safari and Chrome */ + z-index: 1051; + width: 1px; + height: 75px; + margin-left: 35px; + /* IE 9 */ + -webkit-transform: rotate(45deg); + -ms-transform: rotate(45deg); + transform: rotate(45deg); + background-color: #212529; +} + +.portfolio-modal .close-modal .lr .rl { + /* Safari and Chrome */ + z-index: 1052; + width: 1px; + height: 75px; + /* IE 9 */ + -webkit-transform: rotate(90deg); + -ms-transform: rotate(90deg); + transform: rotate(90deg); + background-color: #212529; +} + +.timeline { + position: relative; + padding: 0; + list-style: none; +} + +.timeline:before { + position: absolute; + top: 0; + bottom: 0; + left: 40px; + width: 2px; + margin-left: -1.5px; + content: ''; + background-color: #e9ecef; +} + +.timeline > li { + position: relative; + min-height: 50px; + margin-bottom: 50px; +} + +.timeline > li:after, .timeline > li:before { + display: table; + content: ' '; +} + +.timeline > li:after { + clear: both; +} + +.timeline > li .timeline-panel { + position: relative; + float: right; + width: 100%; + padding: 0 20px 0 100px; + text-align: left; +} + +.timeline > li .timeline-panel:before { + right: auto; + left: -15px; + border-right-width: 15px; + border-left-width: 0; +} + +.timeline > li .timeline-panel:after { + right: auto; + left: -14px; + border-right-width: 14px; + border-left-width: 0; +} + +.timeline > li .timeline-image { + position: absolute; + z-index: 100; + left: 0; + width: 80px; + height: 80px; + margin-left: 0; + text-align: center; + color: white; + border: 7px solid #e9ecef; + border-radius: 100%; + background-color: #fed136; +} + +.timeline > li .timeline-image h4 { + font-size: 10px; + line-height: 14px; + margin-top: 12px; +} + +.timeline > li.timeline-inverted > .timeline-panel { + float: right; + padding: 0 20px 0 100px; + text-align: left; +} + +.timeline > li.timeline-inverted > .timeline-panel:before { + right: auto; + left: -15px; + border-right-width: 15px; + border-left-width: 0; +} + +.timeline > li.timeline-inverted > .timeline-panel:after { + right: auto; + left: -14px; + border-right-width: 14px; + border-left-width: 0; +} + +.timeline > li:last-child { + margin-bottom: 0; +} + +.timeline .timeline-heading h4 { + margin-top: 0; + color: inherit; +} + +.timeline .timeline-heading h4.subheading { + text-transform: none; +} + +.timeline .timeline-body > ul, +.timeline .timeline-body > p { + margin-bottom: 0; +} + +@media (min-width: 768px) { + .timeline:before { + left: 50%; + } + + .timeline > li { + min-height: 100px; + margin-bottom: 100px; + } + + .timeline > li .timeline-panel { + float: left; + width: 41%; + padding: 0 20px 20px 30px; + text-align: right; + } + + .timeline > li .timeline-image { + left: 50%; + width: 100px; + height: 100px; + margin-left: -50px; + } + + .timeline > li .timeline-image h4 { + font-size: 13px; + line-height: 18px; + margin-top: 16px; + } + + .timeline > li.timeline-inverted > .timeline-panel { + float: right; + padding: 0 30px 20px 20px; + text-align: left; + } +} + +@media (min-width: 992px) { + .timeline > li { + min-height: 150px; + } + + .timeline > li .timeline-panel { + padding: 0 20px 20px; + } + + .timeline > li .timeline-image { + width: 150px; + height: 150px; + margin-left: -75px; + } + + .timeline > li .timeline-image h4 { + font-size: 18px; + line-height: 26px; + margin-top: 30px; + } + + .timeline > li.timeline-inverted > .timeline-panel { + padding: 0 20px 20px; + } +} + +@media (min-width: 1200px) { + .timeline > li { + min-height: 170px; + } + + .timeline > li .timeline-panel { + padding: 0 20px 20px 100px; + } + + .timeline > li .timeline-image { + width: 170px; + height: 170px; + margin-left: -85px; + } + + .timeline > li .timeline-image h4 { + margin-top: 40px; + } + + .timeline > li.timeline-inverted > .timeline-panel { + padding: 0 100px 20px 20px; + } +} + +.team-member { + margin-bottom: 50px; + text-align: center; +} + +.team-member img { + width: 225px; + height: 225px; + border: 7px solid #fff; +} + +.team-member h4 { + margin-top: 25px; + margin-bottom: 0; + text-transform: none; +} + +.team-member p { + margin-top: 0; +} + +section#contact { + background-color: #212529; + background-image: url("../img/map-image.png"); + background-repeat: no-repeat; + background-position: center; +} + +section#contact .section-heading { + color: #fff; +} + +section#contact .form-group { + margin-bottom: 25px; +} + +section#contact .form-group input, +section#contact .form-group textarea { + padding: 20px; +} + +section#contact .form-group input.form-control { + height: auto; +} + +section#contact .form-group textarea.form-control { + height: 248px; +} + +section#contact .form-control:focus { + border-color: #fed136; + box-shadow: none; +} + +section#contact ::-webkit-input-placeholder { + font-weight: 700; + color: #ced4da; + font-family: 'Montserrat', 'Helvetica Neue', Helvetica, Arial, sans-serif; +} + +section#contact :-moz-placeholder { + font-weight: 700; + color: #ced4da; + /* Firefox 18- */ + font-family: 'Montserrat', 'Helvetica Neue', Helvetica, Arial, sans-serif; +} + +section#contact ::-moz-placeholder { + font-weight: 700; + color: #ced4da; + /* Firefox 19+ */ + font-family: 'Montserrat', 'Helvetica Neue', Helvetica, Arial, sans-serif; +} + +section#contact :-ms-input-placeholder { + font-weight: 700; + color: #ced4da; + font-family: 'Montserrat', 'Helvetica Neue', Helvetica, Arial, sans-serif; +} + +footer { + padding: 25px 0; + text-align: center; +} + +footer span.copyright { + font-size: 90%; + line-height: 40px; + text-transform: none; + font-family: 'Montserrat', 'Helvetica Neue', Helvetica, Arial, sans-serif; +} + +footer ul.quicklinks { + font-size: 90%; + line-height: 40px; + margin-bottom: 0; + text-transform: none; + font-family: 'Montserrat', 'Helvetica Neue', Helvetica, Arial, sans-serif; +} + +ul.social-buttons { + margin-bottom: 0; +} + +ul.social-buttons li a { + font-size: 20px; + line-height: 40px; + display: block; + width: 40px; + height: 40px; + -webkit-transition: all 0.3s; + -moz-transition: all 0.3s; + transition: all 0.3s; + color: white; + border-radius: 100%; + outline: none; + background-color: #212529; +} + +ul.social-buttons li a:active, ul.social-buttons li a:focus, ul.social-buttons li a:hover { + background-color: #fed136; +} + +.dashboard-card { + background: #ffffff none repeat scroll 0 0; + margin: 15px; + padding: 20px; + border: 0 solid #e7e7e7; + border-radius: 5px; + box-shadow: 0 5px 20px rgba(0, 0, 0, 0.05); +} + +.toolbar-button { + width: 100%; + margin: 5px; +} + +/* --------------------------------------------------- + FEEDBACK STYLE +----------------------------------------------------- */ +.feedback-panel { + list-style-type: none; + padding: 5px; +} + +.feedback-panel .alert { + padding: 5px; + margin-bottom: 5px; + cursor: pointer; +} + +/* --------------------------------------------------- + MEDIAQUERIES +----------------------------------------------------- */ +@media (min-width: 768px) { + section h2.section-heading { + font-size: 3.5vw; + margin-top: 0; + margin-bottom: 15px; + } +} + +@media (min-width: 1500px) { + section h2.section-heading { + font-size: 1.5vw; + margin-top: 0; + margin-bottom: 15px; + } +} + +@media (min-width: 768px) { + .feedback-panel { + position: fixed; + overflow-y: hidden; + max-height: calc(100vh - 60px); + width: 250px; + top: 50px; + right: 15px; + opacity: .8; + z-index: 10000; + } + + .feedback-panel .alert { + padding: 10px; + margin-bottom: 10px; + overflow: hidden; + } + + .feedback-panel .alert:hover { + border-color: #888; + } } \ No newline at end of file diff --git a/src/main/resources/templates/index.html b/src/main/resources/templates/index.html index 2d86945..3bf7f4e 100644 --- a/src/main/resources/templates/index.html +++ b/src/main/resources/templates/index.html @@ -10,12 +10,6 @@
-
-
-

Work hard

-

sometimes

-
-