Make the branches dropdown work on new repos page

7db57c4a30497bdb48914a95353fbdb361fb52fe

Tucker McKnight <tucker@pangolin.lan> | Tue Dec 09 2025

Make the branches dropdown work on new repos page
js_templates/helpers/nav.ts:1
Before
0
1
2
3
import { type ReposConfiguration } from "../../src/configTypes.ts"
import path from 'path'

export const NavHelper = (reposConfig: ReposConfiguration, slugify: Function, repoName: string, branchName: string) => {
  const reposPath = reposConfig.path || ""
After
0
1

2
import { type ReposConfiguration } from "../../src/configTypes.ts"

⁣
export const NavHelper = (reposConfig: ReposConfiguration, slugify: Function, repoName: string, branchName: string) => {
  const reposPath = reposConfig.path || ""
js_templates/helpers/nav.ts:28
Before
27
28
29



30
31
    repoCurrentBranchHome: () => {
      return currentBranchPath
    },
⁣
⁣
⁣
    repoCurrentBranchFiles: () => {
      return `${currentBranchPath}/files`
    },
After
27
28
29
30
31
32
33
34
    repoCurrentBranchHome: () => {
      return currentBranchPath
    },
    repoBranchHome: (branchName: string) => {
      return `${rootBasePathBranches}/${slugify(branchName)}`
    },
    repoCurrentBranchFiles: () => {
      return `${currentBranchPath}/files`
    },
js_templates/repo.ts:25
Before
24
25
26



27
28
          <title>${repo.name}</title>
          <link rel="stylesheet" href="/css/design-board.css">
          <link href="https://unpkg.com/prismjs@1.20.0/themes/prism.css" rel="stylesheet" />
⁣
⁣
⁣
        </head>
        <body>
          <div class="container">
After
24
25
26
27
28
29
30
31
          <title>${repo.name}</title>
          <link rel="stylesheet" href="/css/design-board.css">
          <link href="https://unpkg.com/prismjs@1.20.0/themes/prism.css" rel="stylesheet" />
          <script>
            window.branches = ${JSON.stringify(repo.branches)};
          </script>
        </head>
        <body>
          <div class="container">
js_templates/repo.ts:42
Before
41
42
43
44
45
46



47

48
49
50

51
52
                      <span class="nav-link d-inline-block">Branch:</span>
                      <div class="dropdown-center d-inline-block">
                        <button class="branches nav-link d-inline-block btn dropdown-toggle" data-bs-toggle="dropdown" aria-expanded="false">
                          main
                        </button>
                        <ul class="dropdown-menu">
⁣
⁣
⁣
                          <li><a class="dropdown-item" href="#">Action</a></li>
⁣
                          <li><a class="dropdown-item" href="#">Another action</a></li>
                          <li><a class="dropdown-item" href="#">Something else here</a></li>
                        </ul>
⁣
                      </div>
                    </li>
                  </ul>
After
41
42
43
44
45
46
47
48
49
50
51

52
53
54
55
56
                      <span class="nav-link d-inline-block">Branch:</span>
                      <div class="dropdown-center d-inline-block">
                        <button class="branches nav-link d-inline-block btn dropdown-toggle" data-bs-toggle="dropdown" aria-expanded="false">
                          ${branch.name}
                        </button>
                        <div class="dropdown-menu">
                          <form class="mx-3 my-1">
                            <input type="text" class="form-control" id="dropdownBranchSearch" placeholder="Search branches...">
                          </form>
                          <div class="dropdown-divider"></div>
                          <ul class="dropdown-branches">
⁣
                            ${repo.branches.map((branch) => { return `<li><a class='dropdown-item' href='${nav.repoBranchHome(branch.name)}'>${branch.name}</a></li>`}).join('')}
                          </ul>
                        </div>
                      </div>
                    </li>
                  </ul>