Move Clone New into repo dropdown, remove sidebar links

Remove the Repositories and Clone New links from the sidebar.
Add a 'Clone New...' option to the repo dropdown that shows the
clone form in the content frame when selected.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
2026-02-27 09:18:08 +01:00
parent 8b5bdc0043
commit 45f7c84b43
4 changed files with 20 additions and 8 deletions

View File

@@ -20,7 +20,11 @@ public class HomeController
@GetMapping("/")
public String frameset(@RequestParam(required = false) String repo, Model model) throws IOException
{
boolean showCloneForm = "__clone__".equals(repo);
if (showCloneForm)
repo = null;
model.addAttribute("selectedRepo", repo);
model.addAttribute("showCloneForm", showCloneForm);
return "frameset";
}

View File

@@ -4,7 +4,7 @@
</head>
<frameset cols="180,*">
<frame th:src="${selectedRepo != null} ? '/nav?repo=' + ${selectedRepo} : '/nav'" name="nav">
<frame th:src="${selectedRepo != null} ? '/repo/' + ${selectedRepo} + '/branches' : '/welcome'" name="content">
<frame th:src="${showCloneForm} ? '/clone-form' : (${selectedRepo != null} ? '/repo/' + ${selectedRepo} + '/branches' : '/welcome')" name="content">
<noframes>
<body>
<p>Your browser does not support frames. <a href="/repos">Click here</a> to continue.</p>

View File

@@ -10,16 +10,12 @@
<select name="repo">
<option value="">-- Select repo --</option>
<option th:each="r : ${repositories}" th:value="${r}" th:text="${r}" th:selected="${r == selectedRepo}"></option>
<option value="__clone__">Clone New...</option>
</select>
<br>
<input type="submit" value="Go">
</form>
<hr>
<a href="/repos" target="content">Repositories</a><br>
<a href="/clone-form" target="content">Clone New</a><br>
<th:block th:if="${selectedRepo != null}">
<hr>
<b th:text="${selectedRepo}"></b><br>

View File

@@ -30,7 +30,8 @@ class HomeControllerTest
mockMvc.perform(get("/"))
.andExpect(status().isOk())
.andExpect(view().name("frameset"))
.andExpect(model().attributeDoesNotExist("selectedRepo"));
.andExpect(model().attributeDoesNotExist("selectedRepo"))
.andExpect(model().attribute("showCloneForm", false));
}
@Test
@@ -39,7 +40,18 @@ class HomeControllerTest
mockMvc.perform(get("/").param("repo", "myrepo"))
.andExpect(status().isOk())
.andExpect(view().name("frameset"))
.andExpect(model().attribute("selectedRepo", "myrepo"));
.andExpect(model().attribute("selectedRepo", "myrepo"))
.andExpect(model().attribute("showCloneForm", false));
}
@Test
void rootWithCloneSentinelShowsCloneForm() throws Exception
{
mockMvc.perform(get("/").param("repo", "__clone__"))
.andExpect(status().isOk())
.andExpect(view().name("frameset"))
.andExpect(model().attributeDoesNotExist("selectedRepo"))
.andExpect(model().attribute("showCloneForm", true));
}
@Test