dashboard.html.tmpl

  1{{- template "head" }}
  2{{- template "header" .IsDashboard }}
  3<main>
  4  <div class="wrapper">
  5    {{- $hasOutdated := false }}
  6    {{- range .Projects }}
  7      {{- if ne .Running (index .Releases 0).Tag }}
  8        {{ $hasOutdated = true }}
  9      {{ end }}
 10    {{ end }}
 11
 12    {{- if $hasOutdated }}
 13      <h2>Outdated projects</h2>
 14      <div class="projects-grid outdated">
 15        {{- range .Projects }}
 16          {{- if ne .Running (index .Releases 0).Tag }}
 17            <div id="{{ .ID }}" class="project card">
 18              <h3>
 19                <a href="{{ .URL }}">{{ .Name }}</a
 20                ><span class="delete"
 21                  ><a href="/new?action=delete&id={{ .ID }}">Delete?</a></span
 22                >
 23              </h3>
 24              <p>
 25                You've selected&nbsp;
 26                {{ $project := . }}
 27                {{ range .Releases }}
 28                  {{ if eq .Tag $project.Running }}
 29                    {{ if .URL }}
 30                      <a href="{{ .URL }}">{{ $project.Running }}</a>
 31                    {{ else }}
 32                      {{ $project.Running }}
 33                    {{ end }}
 34                    {{ break }}
 35                  {{ end }}
 36                {{ else }}
 37                  {{ $project.Running }}
 38                {{ end }}.
 39                <a
 40                  href="/new?action=update&url={{ .URL }}&forge={{ .Forge }}&name={{ .Name }}"
 41                  >Modify?</a
 42                >
 43              </p>
 44              <p>
 45                Latest:&nbsp;
 46                {{ if (index .Releases 0).URL }}
 47                  <a href="{{ (index .Releases 0).URL }}"
 48                    >{{ (index .Releases 0).Tag }}</a
 49                  >
 50                {{ else }}
 51                  {{ (index .Releases 0).Tag }}
 52                {{ end }}
 53              </p>
 54              <button popovertarget="popover-{{ (index .Releases 0).ID }}">
 55                View release notes
 56              </button>
 57              <div id="popover-{{ (index .Releases 0).ID }}" popover>
 58                <div class="popover-content">
 59                  <h3>
 60                    {{ .Name }}: release notes for
 61                    <a href="{{ (index .Releases 0).URL }}"
 62                      >{{ (index .Releases 0).Tag }}</a
 63                    >
 64                  </h3>
 65                  {{- if eq .Forge "github" "gitea" "forgejo" }}
 66                    {{ (index .Releases 0).Content }}
 67                  {{ else }}
 68                    <pre>{{ (index .Releases 0).Content }}</pre>
 69                  {{ end }}
 70                  <button
 71                    popovertarget="popover-{{ (index .Releases 0).ID }}"
 72                    popovertargetaction="hide"
 73                  >
 74                    Dismiss
 75                  </button>
 76                </div>
 77              </div>
 78            </div>
 79          {{ end }}
 80        {{ end }}
 81      </div>
 82    {{ end }}
 83
 84    {{- $hasUpToDate := false }}
 85    {{- range .Projects }}
 86      {{- if eq .Running (index .Releases 0).Tag }}
 87        {{ $hasUpToDate = true }}
 88      {{ end }}
 89    {{ end }}
 90
 91    {{- if $hasUpToDate }}
 92      <h2>Up-to-date projects</h2>
 93      <div class="projects-grid uptodate">
 94        {{- range .Projects }}
 95          {{- if eq .Running (index .Releases 0).Tag }}
 96            <div class="project card">
 97              <h3>
 98                <a href="{{ .URL }}">{{ .Name }}</a
 99                ><span class="delete"
100                  ><a href="/new?action=delete&id={{ .ID }}">Delete?</a></span
101                >
102              </h3>
103              <p>
104                You've selected&nbsp;
105                {{ $project := . }}
106                {{ range .Releases }}
107                  {{ if eq .Tag $project.Running }}
108                    {{ if .URL }}
109                      <a href="{{ .URL }}">{{ $project.Running }}</a>
110                    {{ else }}
111                      {{ $project.Running }}
112                    {{ end }}
113                    {{ break }}
114                  {{ end }}
115                {{ else }}
116                  {{ $project.Running }}
117                {{ end }}.
118                <a
119                  href="/new?action=update&url={{ .URL }}&forge={{ .Forge }}&name={{ .Name }}"
120                  >Modify?</a
121                >
122              </p>
123              <button popovertarget="popover-{{ (index .Releases 0).ID }}">
124                View release notes
125              </button>
126              <div id="popover-{{ (index .Releases 0).ID }}" popover>
127                <div class="popover-content">
128                  <h3>
129                    {{ .Name }}: release notes for
130                    <a href="{{ (index .Releases 0).URL }}"
131                      >{{ (index .Releases 0).Tag }}</a
132                    >
133                  </h3>
134                  {{- if eq .Forge "github" "gitea" "forgejo" }}
135                    {{ (index .Releases 0).Content }}
136                  {{ else }}
137                    <pre>{{ (index .Releases 0).Content }}</pre>
138                  {{ end }}
139                  <button
140                    popovertarget="popover-{{ (index .Releases 0).ID }}"
141                    popovertargetaction="hide"
142                  >
143                    Dismiss
144                  </button>
145                </div>
146              </div>
147            </div>
148          {{ end }}
149        {{ end }}
150      </div>
151    {{ end }}
152  </div>
153</main>
154{{- template "footer" .Version }}