From 034f7ae9c9e1ded4ec6cf330d4da43ed120e1b01 Mon Sep 17 00:00:00 2001 From: venkatesh2k3 Date: Fri, 26 Jul 2024 01:55:26 +0530 Subject: [PATCH 1/3] 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 From 0a2d4abc47f130eb6e258b1dc31b215b458c35bd Mon Sep 17 00:00:00 2001 From: venkatesh2k3 Date: Fri, 26 Jul 2024 19:09:13 +0530 Subject: [PATCH 2/3] Changes done --- .../content/letter/LetterEditController.java | 13 +-- .../WEB-INF/jsp/content/letter/edit.jsp | 83 ++++++++++--------- 2 files changed, 47 insertions(+), 49 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 399996ea1..c64a2b538 100644 --- a/src/main/java/ai/elimu/web/content/letter/LetterEditController.java +++ b/src/main/java/ai/elimu/web/content/letter/LetterEditController.java @@ -1,7 +1,6 @@ package ai.elimu.web.content.letter; import java.util.Calendar; -import java.util.List; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpSession; @@ -22,7 +21,6 @@ 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; @@ -55,16 +53,7 @@ public String handleRequest( 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); + model.addAttribute("letterSounds", letterSoundDao.readAll()); 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 0d9292865..45bb7e8a6 100644 --- a/src/main/webapp/WEB-INF/jsp/content/letter/edit.jsp +++ b/src/main/webapp/WEB-INF/jsp/content/letter/edit.jsp @@ -160,7 +160,7 @@
Hindi resources: - +
@@ -185,39 +185,48 @@
-
- (${fn:length(letterSounds)}) -
-
- -
- - - - - - - - - - - - - - - - - - - -
${letterSound.usageCount} - " ${letter.text} " - - ➞ - - / ${sound.valueIpa} / -
-
-
-
+
+ + + + + + + + + + + <%-- Check if the current letter is used by the letter-sound. --%> + + + + + + + + + + + + + + + + +
+ ${letterSound.usageCount} + + " + ${letter.text} + " + + ➞ + + / + + + ${s.valueIpa} + + / +
From 59db35aaf24c33379e23b3733b2e65ec2e511afb Mon Sep 17 00:00:00 2001 From: Venkatesh Sangam <137500548+venkatesh2k3@users.noreply.github.com> Date: Fri, 26 Jul 2024 19:11:59 +0530 Subject: [PATCH 3/3] Update styles.css --- src/main/webapp/static/css/content/styles.css | 21 ------------------- 1 file changed, 21 deletions(-) diff --git a/src/main/webapp/static/css/content/styles.css b/src/main/webapp/static/css/content/styles.css index 3a62d723f..d75e2c446 100644 --- a/src/main/webapp/static/css/content/styles.css +++ b/src/main/webapp/static/css/content/styles.css @@ -127,24 +127,3 @@ 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