test_2 / head_navbar new.tmpl
zz001's picture
Update head_navbar new.tmpl
05489b7 verified
{{$notificationUnreadCount := 0}}
{{if and .IsSigned .NotificationUnreadCount}}
{{$notificationUnreadCount = call .NotificationUnreadCount}}
{{end}}
---
list:1-12345
grass:2.xxx
---
<nav id="navbar" aria-label="{{ctx.Locale.Tr " aria.navbar"}}">
<div class="navbar-left ui secondary menu">
<!-- the logo -->
<a class="item-non" id="navbar-logo" href="{{AppSubUrl}}/"
aria-label="{{if .IsSigned}}{{ctx.Locale.Tr " dashboard"}}{{else}}{{ctx.Locale.Tr "home" }}{{end}}">
<img width="183" height="31" src="{{AssetUrlPrefix}}/img/logo3.png" alt="{{ctx.Locale.Tr " logo"}}"
aria-hidden="true">
</a>
<div class="ui secondary menu item navbar-mobile-right" style="min-width:40px;width:40px;">
<button class="item gt-w-auto ui icon mini button gt-p-3 gt-m-0" id="navbar-expand-toggle"
style="min-width: 80px;color:white;">{{svg "octicon-three-bars"}}</button>
</div>
<div class="nav-countent">
<a class="item{{if .PageIsExplore}} active{{end}}" href="{{AppSubUrl}}/explore/repos">
{{ctx.Locale.Tr "explore"}}
<span class="img">
<img src="{{AssetUrlPrefix}}/img/icon/models.png" width="24" height="24">
</span>
</a>
{{template "custom/extra_links" .}}
<a class="item{{if .PageIsDataset}} active{{end}}" rel="noopener noreferrer"
href="{{AppSubUrl}}/explore/datasets">
{{ctx.Locale.Tr "datasets"}}
<span class="img">
<img src="{{AssetUrlPrefix}}/img/icon/database.png" width="24" height="24">
</span>
</a>
<a class="item{{if .PageIsSpace}} active{{end}}" rel="noopener noreferrer"
href="{{AppSubUrl}}/explore/spaces">
{{ctx.Locale.Tr "spaces"}}
<span class="img">
<img src="{{AssetUrlPrefix}}/img/icon/spaces.png" width="24" height="24">
</span>
</a>
<a class="item{{if .PageIsBlockchain}} active{{end}}" rel="noopener noreferrer" href="/">{{ctx.Locale.Tr
"blcokchain"}}
<span class="img">
<img src="{{AssetUrlPrefix}}/img/icon/blockchain.png" width="24" height="24" />
</span>
</a>
<a class="item{{if .PageIsDocs}} active{{end}}" rel="noopener noreferrer" href="/">{{ctx.Locale.Tr "docs"}}
<span class="img">
<img src="{{AssetUrlPrefix}}/img/icon/docs.png" width="24" height="24" />
</span>
</a>
<a class="item{{if .PageIsPricing}} active{{end}}" rel="noopener noreferrer" href="/">{{ctx.Locale.Tr
"pricing"}}
<span class="img">
<img src="{{AssetUrlPrefix}}/img/icon/pricing.png" width="24" height="24" />
</span>
</a>
<a class="item{{if .PageIsOther}} active{{end}}" rel="noopener noreferrer" href="/">{{ctx.Locale.Tr
"other"}}
<span class="img">
<img src="{{AssetUrlPrefix}}/img/icon/other.png" width="24" height="24" />
</span>
</a>
</div>
</div>
<!-- 20231207 update 添加了全球化 item和导航栏的冲突 所以提出来了-->
<!-- the full dropdown menus -->
<div class="navbar-right ui secondary menu">
<!-- 搜索图片-->
<span class="img-container"></span>
<a class="item search_img {{if .PageIsSignIn}} active{{end}}" rel="nofollow" href="/">
<img class="links" width="100%" height="100%" src="{{AssetUrlPrefix}}/img/suod.png" alt="{{ctx.Locale.Tr "
sousuo"}}" aria-hidden="true">
</a>
<!-- 全球化 begin-->
<div class="item right-links" role="group" aria-label="{{ctx.Locale.Tr " aria.footer.links"}}">
<div class="ui dropdown upward language">
<!--{{if eq ctx.Locale.Lang "en-US"}}
<span class="img" style="display:none;"><img src="{{AssetUrlPrefix}}/img/flags/ENG.png"></span>
{{else if eq ctx.Locale.Lang "zh-CN"}}
<span class="img" style="display:none;"><img src="{{AssetUrlPrefix}}/img/flags/CN.png"></span>
{{end}}-->
<span class="flex-text-inline">{{ctx.Locale.LangName}}</span>
<div class="menu language-menu">
{{range .AllLangs}}
<a lang="{{.Lang}}" data-url="{{AppSubUrl}}/?lang={{.Lang}}"
class="item {{if eq ctx.Locale.Lang .Lang}}active selected{{end}}"
style="width: auto; text-align: center;">
{{if eq .Lang "en-US"}}
<span><img src="{{AssetUrlPrefix}}/img/flags/ENG.png"></span>
{{else if eq .Lang "zh-CN"}}
<span><img src="{{AssetUrlPrefix}}/img/flags/CN.png"></span>
{{end}}
{{.Name}}
{{if eq ctx.Locale.Lang .Lang}}
<!--<span><img src="{{AssetUrlPrefix}}/img/flags/active.png"></span>-->
{{end}}
</a>
{{end}}
</div>
</div>
</div>
<!-- 全球化 end -->
{{if and .IsSigned .MustChangePassword}}
<div class="ui dropdown jump item" data-tooltip-content="{{ctx.Locale.Tr " user_profile_and_more"}}">
<span class="text gt-df gt-ac">
{{ctx.AvatarUtils.Avatar .SignedUser 24 "gt-mr-2"}}
<span class="mobile-only gt-ml-3">{{.SignedUser.Name}}</span>
<span class="not-mobile">{{svg "octicon-triangle-down"}}</span>
</span>
<div class="menu user-menu">
<div class="ui header">
{{ctx.Locale.Tr "signed_in_as"}} <strong>{{.SignedUser.Name}}</strong>
</div>
<!-- <div class="divider"></div> -->
<div class="pd">
<a class="item link-action" href data-url="{{AppSubUrl}}/user/logout">
{{svg "octicon-sign-out"}}
{{ctx.Locale.Tr "sign_out"}}
</a>
</div>
</div><!-- end content avatar menu -->
</div><!-- end dropdown avatar menu -->
{{else if .IsSigned}}
{{if EnableTimetracking}}
<div class="active-stopwatch-popup item tippy-target gt-p-3">
<div class="gt-df gt-ac">
<a class="stopwatch-link gt-df gt-ac" href="{{.ActiveStopwatch.IssueLink}}">
{{svg "octicon-issue-opened" 16 "gt-mr-3"}}
<span class="stopwatch-issue">{{.ActiveStopwatch.RepoSlug}}#{{.ActiveStopwatch.IssueIndex}}</span>
<span class="ui primary label stopwatch-time gt-my-0 gt-mx-4"
data-seconds="{{.ActiveStopwatch.Seconds}}">
{{if .ActiveStopwatch}}{{Sec2Time .ActiveStopwatch.Seconds}}{{end}}
</span>
</a>
<form class="stopwatch-commit" method="post"
action="{{.ActiveStopwatch.IssueLink}}/times/stopwatch/toggle">
{{.CsrfTokenHtml}}
<button type="submit" class="ui button mini compact basic icon"
data-tooltip-content="{{ctx.Locale.Tr " repo.issues.stop_tracking"}}">{{svg
"octicon-square-fill"}}</button>
</form>
<form class="stopwatch-cancel" method="post"
action="{{.ActiveStopwatch.IssueLink}}/times/stopwatch/cancel">
{{.CsrfTokenHtml}}
<button type="submit" class="ui button mini compact basic icon"
data-tooltip-content="{{ctx.Locale.Tr " repo.issues.cancel_tracking"}}">{{svg
"octicon-trash"}}</button>
</form>
</div>
</div>
{{end}}
<!-- <div class="ui dropdown jump item gt-mx-0 gt-pr-3" data-tooltip-content="{{ctx.Locale.Tr "create_new"}}">-->
<!-- <span class="text">-->
<!-- {{svg "octicon-plus"}}-->
<!-- <span class="not-mobile">{{svg "octicon-triangle-down"}}</span>-->
<!-- <span class="mobile-only">{{ctx.Locale.Tr "create_new"}}</span>-->
<!-- </span>-->
<!-- <div class="menu">-->
<!-- <a class="item" href="{{AppSubUrl}}/repo/create">-->
<!-- {{svg "octicon-plus"}} {{ctx.Locale.Tr "new_repo"}}-->
<!-- </a>-->
<!-- -->
<!-- <a class="item" href="{{AppSubUrl}}/create/dataset">-->
<!-- {{svg "octicon-plus"}} creat/dataset-->
<!-- &lt;!&ndash; {{svg "octicon-plus"}} {{ctx.Locale.Tr "new_repo"}} &ndash;&gt;-->
<!-- </a>-->
<!-- <a class="item" href="{{AppSubUrl}}/create/space">-->
<!-- {{svg "octicon-plus"}} creat/space-->
<!-- &lt;!&ndash; {{svg "octicon-plus"}} {{ctx.Locale.Tr "new_repo"}} &ndash;&gt;-->
<!-- </a>-->
<!-- <a class="item" href="{{AppSubUrl}}/create/collection">-->
<!-- {{svg "octicon-plus"}} create/collection-->
<!-- &lt;!&ndash; {{svg "octicon-plus"}} {{ctx.Locale.Tr "new_repo"}} &ndash;&gt;-->
<!-- </a>-->
<!-- -->
<!-- {{if .SignedUser.CanCreateOrganization}}-->
<!-- <a class="item" href="{{AppSubUrl}}/org/create">-->
<!-- {{svg "octicon-organization"}} {{ctx.Locale.Tr "new_org"}}-->
<!-- </a>-->
<!-- {{end}}-->
<!-- &lt;!&ndash; {{if not .DisableMigrations}}-->
<!-- <a class="item" href="{{AppSubUrl}}/repo/migrate">-->
<!-- {{svg "octicon-repo-push"}} {{ctx.Locale.Tr "new_migrate"}}-->
<!-- </a>-->
<!-- {{end}} &ndash;&gt;-->
<!-- </div>&lt;!&ndash; end content create new menu &ndash;&gt;-->
<!-- </div>&lt;!&ndash; end dropdown menu create new &ndash;&gt;-->
<div class="ui dropdown jump item gt-mx-0 gt-pr-3" data-tooltip-content="{{ctx.Locale.Tr "
user_profile_and_more"}}">
<span class="text gt-df gt-ac">
{{ctx.AvatarUtils.Avatar .SignedUser 24 "gt-mr-2"}}
<span class="mobile-only gt-ml-3">{{.SignedUser.Name}}</span>
<span class="not-mobile">{{svg "octicon-triangle-down"}}</span>
</span>
<div class="menu user-menu">
<div class="ui header">
{{ctx.Locale.Tr "signed_in_as"}} <strong>{{.SignedUser.Name}}</strong>
</div>
<!-- <div class="divider"></div> -->
<div class="pd">
<a class="item" href="{{.SignedUser.HomeLink}}">
{{svg "octicon-person"}}
{{ctx.Locale.Tr "your_profile"}}
</a>
{{if not .DisableStars}}
<a class="item" href="{{.SignedUser.HomeLink}}?tab=stars">
{{svg "octicon-star"}}
{{ctx.Locale.Tr "your_starred"}}
</a>
{{end}}
</div>
<!-- <div class="divider"></div> -->
<div class="pd">
<a class="item" href="{{AppSubUrl}}/repo/create">
{{svg "octicon-plus"}} {{ctx.Locale.Tr "new_repo"}}
</a>
<a class="item" href="{{AppSubUrl}}/repo/create/dataset">
{{svg "octicon-plus"}} {{ctx.Locale.Tr "new_dataset"}}
<!-- {{svg "octicon-plus"}} {{ctx.Locale.Tr "new_repo"}} -->
</a>
<a class="item" href="{{AppSubUrl}}/repo/create/space">
{{svg "octicon-plus"}} {{ctx.Locale.Tr "new_space"}}
<!-- {{svg "octicon-plus"}} {{ctx.Locale.Tr "new_repo"}} -->
</a>
<a class="item" href="{{AppSubUrl}}/repo/create/collection">
{{svg "octicon-plus"}} {{ctx.Locale.Tr "new_collection"}}
<!-- {{svg "octicon-plus"}} {{ctx.Locale.Tr "new_repo"}} -->
</a>
{{if .SignedUser.CanCreateOrganization}}
<a class="item" href="{{AppSubUrl}}/org/create">
{{svg "octicon-organization"}} {{ctx.Locale.Tr "new_org"}}
</a>
{{end}}
<a class="item" href="{{.SignedUser.HomeLink}}">
{{svg "octicon-person"}}
{{ctx.Locale.Tr "your_profile"}}
</a>
{{if not .DisableStars}}
<a class="item" href="{{.SignedUser.HomeLink}}?tab=stars">
{{svg "octicon-star"}}
{{ctx.Locale.Tr "your_starred"}}
</a>
{{end}}
<a class="item" href="{{AppSubUrl}}/notifications/subscriptions">
{{svg "octicon-bell"}}
{{ctx.Locale.Tr "notification.subscriptions"}}
</a>
<a class="{{if .PageIsUserSettings}}active {{end}}item" href="{{AppSubUrl}}/user/settings">
{{svg "octicon-tools"}}
{{ctx.Locale.Tr "your_settings"}}
</a>
<a class="item" target="_blank" rel="noopener noreferrer" href="https://docs.gitea.com">
{{svg "octicon-question"}}
{{ctx.Locale.Tr "help"}}
</a>
</div>
{{if .IsAdmin}}
<div class="pd">
<a class="{{if .PageIsAdmin}}active {{end}}item" href="{{AppSubUrl}}/admin">
{{svg "octicon-server"}}
{{ctx.Locale.Tr "admin_panel"}}
</a>
</div>
{{end}}
<!-- <div class="divider"></div> -->
<div class="pd">
<a class="item link-action" href data-url="{{AppSubUrl}}/user/logout">
{{svg "octicon-sign-out"}}
{{ctx.Locale.Tr "sign_out"}}
</a>
</div>
</div><!-- end content avatar menu -->
</div><!-- end dropdown avatar menu -->
{{else}}
{{if .ShowRegistrationButton}}
<a class="item{{if .PageIsSignUp}} active{{end}}" href="{{AppSubUrl}}/user/sign_up">
{{svg "octicon-person"}} {{ctx.Locale.Tr "register"}}
</a>
{{end}}
<a class="item{{if .PageIsSignIn}} active{{end}}" rel="nofollow"
href="{{AppSubUrl}}/user/login{{if not .PageIsSignIn}}?redirect_to={{.CurrentURL}}{{end}}">
{{svg "octicon-sign-in"}} {{ctx.Locale.Tr "sign_in"}}
</a>
{{end}}
</div><!-- end full right menu -->
</nav>