Skip to content

Commit 4a7e9a5

Browse files
authored
Refactoring: command template. Fix: Start command (#78)
1 parent 70c3521 commit 4a7e9a5

File tree

2 files changed

+6
-8
lines changed

2 files changed

+6
-8
lines changed

extensions/star/star.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,10 @@ func (l action) Attrs() map[template.HTMLAttr]any {
106106
}
107107

108108
func starAction(p Page) []Command {
109+
if !p.Exists() {
110+
return nil
111+
}
112+
109113
starred := isStarred(p)
110114
return []Command{action{starred: starred, page: p}}
111115
}

templates/commands.html

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,4 @@
1-
{{- $commands := "" }}
2-
3-
{{- if .page }}
4-
{{- $commands = commands .page }}
5-
{{- end }}
6-
7-
{{- if $commands }}
1+
{{- with commands .page }}
82
<div class="modal" id="commands-modal">
93
<div class="modal-background"></div>
104

@@ -16,7 +10,7 @@
1610
</div>
1711
<aside class="menu p-1" style="max-height: 30em; overflow-y: auto;">
1812
<ul class="menu-list">
19-
{{- range $commands -}}
13+
{{- range . -}}
2014
<li>
2115
<a {{ range $k, $v := .Attrs }}{{$k}}="{{$v}}" {{end}} class="icon-text">
2216
<span class="icon"><i class="{{.Icon}}"></i></span>

0 commit comments

Comments
 (0)