moves project index to separate sub path

Sun, 17 May 2020 16:38:04 +0200

author
Mike Becker <universe@uap-core.de>
date
Sun, 17 May 2020 16:38:04 +0200
changeset 61
3e287f361c7a
parent 60
ed51c5b1f3e5
child 62
833e0385572a

moves project index to separate sub path

unfortunately the current menu highlighting strategy sucks and this is the easiest way so that everything looks correct

src/main/java/de/uapcore/lightpit/modules/ProjectsModule.java file | annotate | diff | comparison | revisions
src/main/webapp/WEB-INF/dynamic_fragments/project-form.jsp file | annotate | diff | comparison | revisions
src/main/webapp/WEB-INF/dynamic_fragments/projects.jsp file | annotate | diff | comparison | revisions
--- a/src/main/java/de/uapcore/lightpit/modules/ProjectsModule.java	Sun May 17 16:28:13 2020 +0200
+++ b/src/main/java/de/uapcore/lightpit/modules/ProjectsModule.java	Sun May 17 16:38:04 2020 +0200
@@ -63,7 +63,13 @@
 
     public static final String SESSION_ATTR_SELECTED_PROJECT = fqn(ProjectsModule.class, "selected-project");
 
-    @RequestMapping(method = HttpMethod.GET, menuKey = "menu.index")
+    @RequestMapping(method = HttpMethod.GET)
+    public ResponseType indexRedirect(HttpServletResponse resp) throws IOException {
+        resp.sendRedirect("index/");
+        return ResponseType.NONE;
+    }
+
+    @RequestMapping(requestPath = "index", method = HttpMethod.GET, menuKey = "menu.index")
     public ResponseType index(HttpServletRequest req, DataAccessObjects dao) throws SQLException {
         final var projectList = dao.getProjectDao().list();
         req.setAttribute("projects", projectList);
@@ -122,7 +128,7 @@
 
             dao.getProjectDao().saveOrUpdate(project);
 
-            setRedirectLocation(req, "./projects/");
+            setRedirectLocation(req, "./projects/index/");
             setDynamicFragment(req, Constants.DYN_FRAGMENT_COMMIT_SUCCESSFUL);
             LOG.debug("Successfully updated project {}", project.getName());
         } catch (NoSuchElementException | NumberFormatException | SQLException ex) {
--- a/src/main/webapp/WEB-INF/dynamic_fragments/project-form.jsp	Sun May 17 16:28:13 2020 +0200
+++ b/src/main/webapp/WEB-INF/dynamic_fragments/project-form.jsp	Sun May 17 16:38:04 2020 +0200
@@ -69,7 +69,7 @@
         <tr>
             <td colspan="2">
                 <input type="hidden" name="id" value="${project.id}" />
-                <a href="./${moduleInfo.modulePath}/" class="button"><fmt:message bundle="${lightpit_bundle}" key="button.cancel"/></a>
+                <a href="./${moduleInfo.modulePath}/index/" class="button"><fmt:message bundle="${lightpit_bundle}" key="button.cancel"/></a>
                 <button type="submit"><fmt:message bundle="${lightpit_bundle}" key="button.okay" /></button>
             </td>
         </tr>
--- a/src/main/webapp/WEB-INF/dynamic_fragments/projects.jsp	Sun May 17 16:28:13 2020 +0200
+++ b/src/main/webapp/WEB-INF/dynamic_fragments/projects.jsp	Sun May 17 16:38:04 2020 +0200
@@ -67,7 +67,7 @@
     <c:forEach var="project" items="${projects}">
         <tr class="nowrap" <c:if test="${project eq selectedProject}">data-selected</c:if> >
             <td style="width: 2em;"><a href="./${moduleInfo.modulePath}/edit?id=${project.id}">&#x270e;</a></td>
-            <td><a href="./${moduleInfo.modulePath}/?select=${project.id}"><c:out value="${project.name}"/></a></td>
+            <td><a href="./${moduleInfo.modulePath}/index/?select=${project.id}"><c:out value="${project.name}"/></a></td>
             <td><c:out value="${project.description}"/></td>
             <td>
                 <c:if test="${not empty project.repoUrl}">

mercurial