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