code.gitea.io/gitea@v1.22.3/templates/base/head_navbar.tmpl (about) 1 {{$notificationUnreadCount := 0}} 2 {{if and .IsSigned .NotificationUnreadCount}} 3 {{$notificationUnreadCount = call .NotificationUnreadCount}} 4 {{end}} 5 6 <nav id="navbar" aria-label="{{ctx.Locale.Tr "aria.navbar"}}"> 7 <div class="navbar-left"> 8 <!-- the logo --> 9 <a class="item" id="navbar-logo" href="{{AppSubUrl}}/" aria-label="{{if .IsSigned}}{{ctx.Locale.Tr "dashboard"}}{{else}}{{ctx.Locale.Tr "home"}}{{end}}"> 10 <img width="30" height="30" src="{{AssetUrlPrefix}}/img/logo.svg" alt="{{ctx.Locale.Tr "logo"}}" aria-hidden="true"> 11 </a> 12 13 <!-- mobile right menu, it must be here because in mobile view, each item is a flex column, the first item is a full row column --> 14 <div class="ui secondary menu item navbar-mobile-right only-mobile"> 15 {{if and .IsSigned EnableTimetracking .ActiveStopwatch}} 16 <a id="mobile-stopwatch-icon" class="active-stopwatch item tw-mx-0" href="{{.ActiveStopwatch.IssueLink}}" title="{{ctx.Locale.Tr "active_stopwatch"}}" data-seconds="{{.ActiveStopwatch.Seconds}}"> 17 <div class="tw-relative"> 18 {{svg "octicon-stopwatch"}} 19 <span class="header-stopwatch-dot"></span> 20 </div> 21 </a> 22 {{end}} 23 {{if .IsSigned}} 24 <a id="mobile-notifications-icon" class="item tw-w-auto tw-p-2" href="{{AppSubUrl}}/notifications" data-tooltip-content="{{ctx.Locale.Tr "notifications"}}" aria-label="{{ctx.Locale.Tr "notifications"}}"> 25 <div class="tw-relative"> 26 {{svg "octicon-bell"}} 27 <span class="notification_count{{if not $notificationUnreadCount}} tw-hidden{{end}}">{{$notificationUnreadCount}}</span> 28 </div> 29 </a> 30 {{end}} 31 <button class="item tw-w-auto ui icon mini button tw-p-2 tw-m-0" id="navbar-expand-toggle" aria-label="{{ctx.Locale.Tr "home.nav_menu"}}">{{svg "octicon-three-bars"}}</button> 32 </div> 33 34 <!-- navbar links non-mobile --> 35 {{if and .IsSigned .MustChangePassword}} 36 {{/* No links */}} 37 {{else if .IsSigned}} 38 {{if not .UnitIssuesGlobalDisabled}} 39 <a class="item{{if .PageIsIssues}} active{{end}}" href="{{AppSubUrl}}/issues">{{ctx.Locale.Tr "issues"}}</a> 40 {{end}} 41 {{if not .UnitPullsGlobalDisabled}} 42 <a class="item{{if .PageIsPulls}} active{{end}}" href="{{AppSubUrl}}/pulls">{{ctx.Locale.Tr "pull_requests"}}</a> 43 {{end}} 44 {{if not (and .UnitIssuesGlobalDisabled .UnitPullsGlobalDisabled)}} 45 {{if .ShowMilestonesDashboardPage}} 46 <a class="item{{if .PageIsMilestonesDashboard}} active{{end}}" href="{{AppSubUrl}}/milestones">{{ctx.Locale.Tr "milestones"}}</a> 47 {{end}} 48 {{end}} 49 <a class="item{{if .PageIsExplore}} active{{end}}" href="{{AppSubUrl}}/explore/repos">{{ctx.Locale.Tr "explore"}}</a> 50 {{else if .IsLandingPageOrganizations}} 51 <a class="item{{if .PageIsExplore}} active{{end}}" href="{{AppSubUrl}}/explore/organizations">{{ctx.Locale.Tr "explore"}}</a> 52 {{else}} 53 <a class="item{{if .PageIsExplore}} active{{end}}" href="{{AppSubUrl}}/explore/repos">{{ctx.Locale.Tr "explore"}}</a> 54 {{end}} 55 56 {{template "custom/extra_links" .}} 57 58 {{if not .IsSigned}} 59 <a class="item" target="_blank" rel="noopener noreferrer" href="https://docs.gitea.com">{{ctx.Locale.Tr "help"}}</a> 60 {{end}} 61 </div> 62 63 <!-- the full dropdown menus --> 64 <div class="navbar-right"> 65 {{if and .IsSigned .MustChangePassword}} 66 <div class="ui dropdown jump item" data-tooltip-content="{{ctx.Locale.Tr "user_profile_and_more"}}"> 67 <span class="text tw-flex tw-items-center"> 68 {{ctx.AvatarUtils.Avatar .SignedUser 24 "tw-mr-1"}} 69 <span class="only-mobile tw-ml-2">{{.SignedUser.Name}}</span> 70 <span class="not-mobile">{{svg "octicon-triangle-down"}}</span> 71 </span> 72 <div class="menu user-menu"> 73 <div class="ui header"> 74 {{ctx.Locale.Tr "signed_in_as"}} <strong>{{.SignedUser.Name}}</strong> 75 </div> 76 77 <div class="divider"></div> 78 <a class="item link-action" href data-url="{{AppSubUrl}}/user/logout"> 79 {{svg "octicon-sign-out"}} 80 {{ctx.Locale.Tr "sign_out"}} 81 </a> 82 </div><!-- end content avatar menu --> 83 </div><!-- end dropdown avatar menu --> 84 {{else if .IsSigned}} 85 {{if and EnableTimetracking .ActiveStopwatch}} 86 <a class="item not-mobile active-stopwatch tw-mx-0" href="{{.ActiveStopwatch.IssueLink}}" title="{{ctx.Locale.Tr "active_stopwatch"}}" data-seconds="{{.ActiveStopwatch.Seconds}}"> 87 <div class="tw-relative"> 88 {{svg "octicon-stopwatch"}} 89 <span class="header-stopwatch-dot"></span> 90 </div> 91 </a> 92 {{end}} 93 94 <a class="item not-mobile tw-mx-0" href="{{AppSubUrl}}/notifications" data-tooltip-content="{{ctx.Locale.Tr "notifications"}}" aria-label="{{ctx.Locale.Tr "notifications"}}"> 95 <div class="tw-relative"> 96 {{svg "octicon-bell"}} 97 <span class="notification_count{{if not $notificationUnreadCount}} tw-hidden{{end}}">{{$notificationUnreadCount}}</span> 98 </div> 99 </a> 100 101 <div class="ui dropdown jump item tw-mx-0 tw-pr-2" data-tooltip-content="{{ctx.Locale.Tr "create_new"}}"> 102 <span class="text"> 103 {{svg "octicon-plus"}} 104 <span class="not-mobile">{{svg "octicon-triangle-down"}}</span> 105 <span class="only-mobile">{{ctx.Locale.Tr "create_new"}}</span> 106 </span> 107 <div class="menu"> 108 <a class="item" href="{{AppSubUrl}}/repo/create"> 109 {{svg "octicon-plus"}} {{ctx.Locale.Tr "new_repo"}} 110 </a> 111 {{if not .DisableMigrations}} 112 <a class="item" href="{{AppSubUrl}}/repo/migrate"> 113 {{svg "octicon-repo-push"}} {{ctx.Locale.Tr "new_migrate"}} 114 </a> 115 {{end}} 116 {{if .SignedUser.CanCreateOrganization}} 117 <a class="item" href="{{AppSubUrl}}/org/create"> 118 {{svg "octicon-organization"}} {{ctx.Locale.Tr "new_org"}} 119 </a> 120 {{end}} 121 </div><!-- end content create new menu --> 122 </div><!-- end dropdown menu create new --> 123 124 <div class="ui dropdown jump item tw-mx-0 tw-pr-2" data-tooltip-content="{{ctx.Locale.Tr "user_profile_and_more"}}"> 125 <span class="text tw-flex tw-items-center"> 126 {{ctx.AvatarUtils.Avatar .SignedUser 24 "tw-mr-1"}} 127 <span class="only-mobile tw-ml-2">{{.SignedUser.Name}}</span> 128 <span class="not-mobile">{{svg "octicon-triangle-down"}}</span> 129 </span> 130 <div class="menu user-menu"> 131 <div class="ui header"> 132 {{ctx.Locale.Tr "signed_in_as"}} <strong>{{.SignedUser.Name}}</strong> 133 </div> 134 135 <div class="divider"></div> 136 <a class="item" href="{{.SignedUser.HomeLink}}"> 137 {{svg "octicon-person"}} 138 {{ctx.Locale.Tr "your_profile"}} 139 </a> 140 {{if not .DisableStars}} 141 <a class="item" href="{{.SignedUser.HomeLink}}?tab=stars"> 142 {{svg "octicon-star"}} 143 {{ctx.Locale.Tr "your_starred"}} 144 </a> 145 {{end}} 146 <a class="item" href="{{AppSubUrl}}/notifications/subscriptions"> 147 {{svg "octicon-bell"}} 148 {{ctx.Locale.Tr "notification.subscriptions"}} 149 </a> 150 <a class="{{if .PageIsUserSettings}}active {{end}}item" href="{{AppSubUrl}}/user/settings"> 151 {{svg "octicon-tools"}} 152 {{ctx.Locale.Tr "your_settings"}} 153 </a> 154 <a class="item" target="_blank" rel="noopener noreferrer" href="https://docs.gitea.com"> 155 {{svg "octicon-question"}} 156 {{ctx.Locale.Tr "help"}} 157 </a> 158 {{if .IsAdmin}} 159 <div class="divider"></div> 160 161 <a class="{{if .PageIsAdmin}}active {{end}}item" href="{{AppSubUrl}}/admin"> 162 {{svg "octicon-server"}} 163 {{ctx.Locale.Tr "admin_panel"}} 164 </a> 165 {{end}} 166 167 <div class="divider"></div> 168 <a class="item link-action" href data-url="{{AppSubUrl}}/user/logout"> 169 {{svg "octicon-sign-out"}} 170 {{ctx.Locale.Tr "sign_out"}} 171 </a> 172 </div><!-- end content avatar menu --> 173 </div><!-- end dropdown avatar menu --> 174 {{else}} 175 {{if .ShowRegistrationButton}} 176 <a class="item{{if .PageIsSignUp}} active{{end}}" href="{{AppSubUrl}}/user/sign_up"> 177 {{svg "octicon-person"}} {{ctx.Locale.Tr "register"}} 178 </a> 179 {{end}} 180 <a class="item{{if .PageIsSignIn}} active{{end}}" rel="nofollow" href="{{AppSubUrl}}/user/login{{if not .PageIsSignIn}}?redirect_to={{.CurrentURL}}{{end}}"> 181 {{svg "octicon-sign-in"}} {{ctx.Locale.Tr "sign_in"}} 182 </a> 183 {{end}} 184 </div><!-- end full right menu --> 185 186 {{if and .IsSigned EnableTimetracking .ActiveStopwatch}} 187 <div class="active-stopwatch-popup tippy-target"> 188 <div class="tw-flex tw-items-center tw-gap-2 tw-p-3"> 189 <a class="stopwatch-link tw-flex tw-items-center tw-gap-2 muted" href="{{.ActiveStopwatch.IssueLink}}"> 190 {{svg "octicon-issue-opened" 16}} 191 <span class="stopwatch-issue">{{.ActiveStopwatch.RepoSlug}}#{{.ActiveStopwatch.IssueIndex}}</span> 192 </a> 193 <div class="tw-flex tw-gap-1"> 194 <form class="stopwatch-commit" method="post" action="{{.ActiveStopwatch.IssueLink}}/times/stopwatch/toggle"> 195 {{.CsrfTokenHtml}} 196 <button 197 type="submit" 198 class="ui button mini compact basic icon tw-mr-0" 199 data-tooltip-content="{{ctx.Locale.Tr "repo.issues.stop_tracking"}}" 200 >{{svg "octicon-square-fill"}}</button> 201 </form> 202 <form class="stopwatch-cancel" method="post" action="{{.ActiveStopwatch.IssueLink}}/times/stopwatch/cancel"> 203 {{.CsrfTokenHtml}} 204 <button 205 type="submit" 206 class="ui button mini compact basic icon tw-mr-0" 207 data-tooltip-content="{{ctx.Locale.Tr "repo.issues.cancel_tracking"}}" 208 >{{svg "octicon-trash"}}</button> 209 </form> 210 </div> 211 </div> 212 </div> 213 {{end}} 214 </nav>