Skip to content

Commit

Permalink
ссылка на раздел статей в колонке на главной
Browse files Browse the repository at this point in the history
  • Loading branch information
maxcom committed Oct 5, 2023
1 parent 2f8a4f2 commit da51c10
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 5 deletions.
6 changes: 4 additions & 2 deletions src/main/scala/ru/org/linux/boxlets/ArticlesBoxlet.scala
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 1998-2022 Linux.org.ru
* Copyright 1998-2023 Linux.org.ru
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
Expand All @@ -17,14 +17,15 @@ package ru.org.linux.boxlets
import org.springframework.stereotype.Controller
import org.springframework.web.bind.annotation.RequestMapping
import org.springframework.web.servlet.ModelAndView
import ru.org.linux.section.{Section, SectionService}
import ru.org.linux.site.Template
import ru.org.linux.topic.BoxletTopicDao

import javax.servlet.http.HttpServletRequest
import scala.jdk.CollectionConverters.*

@Controller
class ArticlesBoxlet(topTenDao: BoxletTopicDao) extends AbstractBoxlet {
class ArticlesBoxlet(topTenDao: BoxletTopicDao, sectionService: SectionService) extends AbstractBoxlet {
@RequestMapping(Array("/articles.boxlet"))
override protected def getData(request: HttpServletRequest): ModelAndView = {
val profile = Template.getTemplate.getProf
Expand All @@ -35,6 +36,7 @@ class ArticlesBoxlet(topTenDao: BoxletTopicDao) extends AbstractBoxlet {
Map(
"messages" -> list.asJava,
"name" -> "Статьи",
"link" -> sectionService.getSection(Section.SECTION_ARTICLES).getSectionLink,
"title" -> "Новые статьи").asJava)
}
}
3 changes: 2 additions & 1 deletion src/main/scala/ru/org/linux/boxlets/TopTenBoxlet.scala
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 1998-2022 Linux.org.ru
* Copyright 1998-2023 Linux.org.ru
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
Expand Down Expand Up @@ -35,6 +35,7 @@ class TopTenBoxlet(topTenDao: BoxletTopicDao) extends AbstractBoxlet {
Map(
"messages" -> list.asJava,
"name" -> "Top 10",
"link" -> null,
"title" -> "Наиболее обсуждаемые темы этого месяца").asJava)
}
}
10 changes: 8 additions & 2 deletions src/main/webapp/WEB-INF/jsp/boxlets/topiclist.jsp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<%--
~ Copyright 1998-2015 Linux.org.ru
~ Copyright 1998-2023 Linux.org.ru
~ Licensed under the Apache License, Version 2.0 (the "License");
~ you may not use this file except in compliance with the License.
~ You may obtain a copy of the License at
Expand All @@ -18,7 +18,13 @@
<%@ taglib prefix="lor" uri="http://www.linux.org.ru" %>
<%@ taglib prefix="l" uri="http://www.linux.org.ru" %>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions"%>
<h2>${name}</h2>

<c:if test="${link!=null}">
<h2><a href="${link}">${name}</a></h2>
</c:if>
<c:if test="${link==null}">
<h2>${name}</h2>
</c:if>

<div class="boxlet_content">
${title}:
Expand Down

0 comments on commit da51c10

Please sign in to comment.