From 034f7ae9c9e1ded4ec6cf330d4da43ed120e1b01 Mon Sep 17 00:00:00 2001 From: venkatesh2k3 Date: Fri, 26 Jul 2024 01:55:26 +0530 Subject: [PATCH] Added letter-sound correspondences List --- .../content/letter/LetterEditController.java | 39 ++++++++++++++----- .../WEB-INF/jsp/content/letter/edit.jsp | 35 +++++++++++++++++ src/main/webapp/static/css/content/styles.css | 21 ++++++++++ 3 files changed, 85 insertions(+), 10 deletions(-) diff --git a/src/main/java/ai/elimu/web/content/letter/LetterEditController.java b/src/main/java/ai/elimu/web/content/letter/LetterEditController.java index 68dba699c..399996ea1 100644 --- a/src/main/java/ai/elimu/web/content/letter/LetterEditController.java +++ b/src/main/java/ai/elimu/web/content/letter/LetterEditController.java @@ -1,20 +1,15 @@ package ai.elimu.web.content.letter; import java.util.Calendar; -import javax.validation.Valid; +import java.util.List; -import org.apache.logging.log4j.Logger; -import ai.elimu.dao.LetterContributionEventDao; -import ai.elimu.dao.LetterDao; -import ai.elimu.model.content.Letter; -import ai.elimu.model.contributor.Contributor; -import ai.elimu.model.contributor.LetterContributionEvent; -import ai.elimu.util.DiscordHelper; -import ai.elimu.web.context.EnvironmentContextLoaderListener; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpSession; +import javax.validation.Valid; + import org.apache.commons.lang.StringUtils; import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.ui.Model; @@ -23,6 +18,16 @@ import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; +import ai.elimu.dao.LetterContributionEventDao; +import ai.elimu.dao.LetterDao; +import ai.elimu.dao.LetterSoundDao; +import ai.elimu.model.content.Letter; +import ai.elimu.model.content.LetterSound; +import ai.elimu.model.contributor.Contributor; +import ai.elimu.model.contributor.LetterContributionEvent; +import ai.elimu.util.DiscordHelper; +import ai.elimu.web.context.EnvironmentContextLoaderListener; + @Controller @RequestMapping("/content/letter/edit") public class LetterEditController { @@ -31,6 +36,9 @@ public class LetterEditController { @Autowired private LetterDao letterDao; + + @Autowired + private LetterSoundDao letterSoundDao; @Autowired private LetterContributionEventDao letterContributionEventDao; @@ -46,7 +54,18 @@ public String handleRequest( model.addAttribute("timeStart", System.currentTimeMillis()); model.addAttribute("letterContributionEvents", letterContributionEventDao.readAll(letter)); - + + List letterSounds = letterSoundDao.readAllOrderedByUsage(); + model.addAttribute("letterSounds", letterSounds); + + int maxUsageCount = 0; + for (LetterSound letterSound : letterSounds) { + if (letterSound.getUsageCount() > maxUsageCount) { + maxUsageCount = letterSound.getUsageCount(); + } + } + model.addAttribute("maxUsageCount", maxUsageCount); + return "content/letter/edit"; } diff --git a/src/main/webapp/WEB-INF/jsp/content/letter/edit.jsp b/src/main/webapp/WEB-INF/jsp/content/letter/edit.jsp index 97588afa4..0d9292865 100644 --- a/src/main/webapp/WEB-INF/jsp/content/letter/edit.jsp +++ b/src/main/webapp/WEB-INF/jsp/content/letter/edit.jsp @@ -185,4 +185,39 @@ +
+ (${fn:length(letterSounds)}) +
+
+ +
+ + + + + + + + + + + + + + + + + + + +
${letterSound.usageCount} + " ${letter.text} " + + ➞ + + / ${sound.valueIpa} / +
+
+
+
diff --git a/src/main/webapp/static/css/content/styles.css b/src/main/webapp/static/css/content/styles.css index d75e2c446..3a62d723f 100644 --- a/src/main/webapp/static/css/content/styles.css +++ b/src/main/webapp/static/css/content/styles.css @@ -127,3 +127,24 @@ blockquote, border-radius: 4px; padding: 4px; } +.scrollable-table-container { + max-height: 250px; + overflow-y: auto; +} +.fixed-header thead { + position: sticky; + top: 0; + background-color: white; + z-index: 1; +} +.fixed-header th, + .fixed-header td { + text-align: center; + vertical-align: middle; +} +.letters-column { + min-width: 90px; +} +.sounds-column { + min-width: 90px; +} \ No newline at end of file