Skip to content

Commit

Permalink
Get download placeholder.
Browse files Browse the repository at this point in the history
  • Loading branch information
bengarrett committed Feb 2, 2024
1 parent afd4faf commit 66dfbef
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 0 deletions.
26 changes: 26 additions & 0 deletions handler/app/web.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,31 @@ import (
"go.uber.org/zap"
)

func EditDownloadGET(filename, filesize, demozoo any) template.HTML {
// TODO confirm signin
switch val := filename.(type) {
case null.String:
if val.Valid && val.String != "" {
return ""
}
}
switch val := filesize.(type) {
case null.Int64:
if val.Valid && val.Int64 > 0 {
return ""
}
}
switch val := demozoo.(type) {
case null.Int64:
if !val.Valid || val.Int64 == 0 {
return ""
}
}
// zoo := demozoo.(null.Int64).Int64
// fmt.Sprintf("%d", zoo)
return template.HTML(`<a class="card-link" href="">GET a remote download</a>`)
}

// Web is the configuration and status of the web app.
// Rename to app or template?
type Web struct {
Expand Down Expand Up @@ -294,6 +319,7 @@ func (web Web) TemplateClosures() template.FuncMap {
// TemplateFuncs are a collection of mapped functions that can be used in a template.
func (web Web) TemplateFuncs() template.FuncMap {
funcMap := template.FuncMap{
"editDownloadGET": EditDownloadGET,
"add": helper.Add1,
"attribute": Attribute,
"brief": Brief,
Expand Down
1 change: 1 addition & 0 deletions view/app/files.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@
<p class="card-text"><small class="text-body-secondary">{{$attr}}</small></p>
{{- end}}
{{- linkPage .ID}}
{{- editDownloadGET .Filename .Filesize .WebIDDemozoo }}
{{- linkDownload .ID .FileSecurityAlertURL.String }}{{ downloadB .Filesize}}
{{- linkPreview .ID .Filename.String .Platform.String}}
</div>
Expand Down

0 comments on commit 66dfbef

Please sign in to comment.