]> source.dussan.org Git - gitea.git/commitdiff
Fix disable download button (#20701)
authorLunny Xiao <xiaolunwen@gmail.com>
Mon, 8 Aug 2022 13:42:36 +0000 (21:42 +0800)
committerGitHub <noreply@github.com>
Mon, 8 Aug 2022 13:42:36 +0000 (15:42 +0200)
modules/context/context.go
templates/repo/branch/list.tmpl
templates/repo/home.tmpl

index 8824911619921c907b12c8107cd7abcb3bad8222..0b9898acef048a4ff26ce172474913c41b428236 100644 (file)
@@ -224,7 +224,7 @@ func (ctx *Context) HTML(status int, name base.TplName) {
        ctx.Data["TemplateLoadTimes"] = func() string {
                return strconv.FormatInt(time.Since(tmplStartTime).Nanoseconds()/1e6, 10) + "ms"
        }
-       if err := ctx.Render.HTML(ctx.Resp, status, string(name), ctx.Data); err != nil {
+       if err := ctx.Render.HTML(ctx.Resp, status, string(name), templates.BaseVars().Merge(ctx.Data)); err != nil {
                if status == http.StatusInternalServerError && name == base.TplName("status/500") {
                        ctx.PlainText(http.StatusInternalServerError, "Unable to find status/500 template")
                        return
index 4a85692a831517b837c2b1ae343aa3b5006d38a6..09799fbece577982339bfc3a3ca4a10fba9b9fa1 100644 (file)
                                                                                                {{svg "octicon-git-branch"}}
                                                                                        </div>
                                                                                {{end}}
-                                                                               {{if (not .IsDeleted)}}
+                                                                               {{if and (not .IsDeleted) (not $.DisableDownloadSourceArchives)}}
                                                                                        <div class="ui basic jump dropdown icon button tooltip" data-content="{{$.locale.Tr "repo.branch.download" (.Name)}}" data-position="top right">
                                                                                                {{svg "octicon-download"}}
                                                                                                <div class="menu">
index 74eaa6ab32232102902a91635f22f8c9ae03af87..1ff2ec5bc501a9d24da234123065852c771c5b51 100644 (file)
                                        <div class="ui action tiny input" id="clone-panel">
                                        {{template "repo/clone_buttons" .}}
                                        {{template "repo/clone_script" .}}
-                                       {{if not .DisableDownloadSourceArchives}}
+                                       {{if not $.DisableDownloadSourceArchives}}
                                                <button id="download-btn" class="ui basic small compact jump dropdown icon button tooltip" data-content="{{.locale.Tr "repo.download_archive"}}" data-position="top right">
                                                        {{svg "octicon-download"}}
                                                        <div class="menu">