make sure the drop down appears only when criteria are met

This commit is contained in:
Ben Chang 2024-12-17 05:46:13 +00:00
parent 35b45fb3a6
commit 54593db38c
2 changed files with 11 additions and 3 deletions

View File

@ -5,10 +5,10 @@ package org
import ( import (
"fmt" "fmt"
html_template "html/template"
"net/http" "net/http"
"path" "path"
"strings" "strings"
html_template "html/template"
"code.gitea.io/gitea/models/db" "code.gitea.io/gitea/models/db"
"code.gitea.io/gitea/models/organization" "code.gitea.io/gitea/models/organization"
@ -131,6 +131,12 @@ func home(ctx *context.Context, viewRepositories bool) {
ctx.Data["PageIsViewRepositories"] = true ctx.Data["PageIsViewRepositories"] = true
} }
err = shared_user.RenderOrgHeader(ctx)
if err != nil {
ctx.ServerError("RenderOrgHeader", err)
return
}
var ( var (
repos []*repo_model.Repository repos []*repo_model.Repository
count int64 count int64

View File

@ -5,16 +5,18 @@
<div class="ui container"> <div class="ui container">
<div class="ui mobile reversed stackable grid"> <div class="ui mobile reversed stackable grid">
<div class="ui {{if .ShowMemberAndTeamTab}}eleven wide{{end}} column"> <div class="ui {{if .ShowMemberAndTeamTab}}eleven wide{{end}} column">
{{if and .ShowMemberAndTeamTab .HasPublicProfileReadme .HasPrivateProfileReadme}}
<div class="item ui small dropdown jump"> <div class="item ui small dropdown jump">
<span class="text">view as</span> <span class="text">view as: {{if not .IsViewerMember}}Public{{else}}Member{{end}}</span>
{{svg "octicon-triangle-down" 14 "dropdown icon"}} {{svg "octicon-triangle-down" 14 "dropdown icon"}}
<div class="menu"> <div class="menu">
<a href="{{$.Org.HomeLink}}?{{.QueryForPublic}}" class="{{if not .IsViewerMember}}active {{end}}item"><input hidden type="radio" {{if not .IsViewerMember}}checked{{end}}> Public</a> <a href="{{$.Org.HomeLink}}?{{.QueryForPublic}}" class="{{if not .IsViewerMember}}active {{end}}item"><input hidden type="radio" {{if not .IsViewerMember}}checked{{end}}> Public</a>
<a href="{{$.Org.HomeLink}}?{{.QueryForMember}}" class="{{if .IsViewerMember}}active {{end}}item"><input hidden type="radio" {{if .IsViewerMember}}checked{{end}}> Member</a> <a href="{{$.Org.HomeLink}}?{{.QueryForMember}}" class="{{if .IsViewerMember}}active {{end}}item"><input hidden type="radio" {{if .IsViewerMember}}checked{{end}}> Member</a>
</div> </div>
</div> </div>
{{end}}
{{if .IsViewerMember}} {{if .IsViewerMember}}
{{if .PrivateProfileReadme}} {{if and .ShowMemberAndTeamTab .PrivateProfileReadme}}
<div id="readme_profile" class="markup">{{.PrivateProfileReadme}}</div> <div id="readme_profile" class="markup">{{.PrivateProfileReadme}}</div>
{{end}} {{end}}
{{else}} {{else}}