mirror of
				https://github.com/go-gitea/gitea.git
				synced 2025-11-04 05:25:15 +01:00 
			
		
		
		
	Improve navbar: add "admin" tip, add "active" style (#32927)
By the way, remove all "tw-" patches and unused styles.
This commit is contained in:
		
							parent
							
								
									1c9b022c4d
								
							
						
					
					
						commit
						4774151e53
					
				@ -11,9 +11,9 @@
 | 
				
			|||||||
		</a>
 | 
							</a>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		<!-- 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 -->
 | 
							<!-- 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 -->
 | 
				
			||||||
		<div class="ui secondary menu item navbar-mobile-right only-mobile">
 | 
							<div class="ui secondary menu navbar-mobile-right only-mobile">
 | 
				
			||||||
			{{if and .IsSigned EnableTimetracking .ActiveStopwatch}}
 | 
								{{if and .IsSigned EnableTimetracking .ActiveStopwatch}}
 | 
				
			||||||
			<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}}">
 | 
								<a id="mobile-stopwatch-icon" class="active-stopwatch item" href="{{.ActiveStopwatch.IssueLink}}" title="{{ctx.Locale.Tr "active_stopwatch"}}" data-seconds="{{.ActiveStopwatch.Seconds}}">
 | 
				
			||||||
				<div class="tw-relative">
 | 
									<div class="tw-relative">
 | 
				
			||||||
					{{svg "octicon-stopwatch"}}
 | 
										{{svg "octicon-stopwatch"}}
 | 
				
			||||||
					<span class="header-stopwatch-dot"></span>
 | 
										<span class="header-stopwatch-dot"></span>
 | 
				
			||||||
@ -21,14 +21,14 @@
 | 
				
			|||||||
			</a>
 | 
								</a>
 | 
				
			||||||
			{{end}}
 | 
								{{end}}
 | 
				
			||||||
			{{if .IsSigned}}
 | 
								{{if .IsSigned}}
 | 
				
			||||||
			<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"}}">
 | 
								<a id="mobile-notifications-icon" class="item" href="{{AppSubUrl}}/notifications" data-tooltip-content="{{ctx.Locale.Tr "notifications"}}" aria-label="{{ctx.Locale.Tr "notifications"}}">
 | 
				
			||||||
				<div class="tw-relative">
 | 
									<div class="tw-relative">
 | 
				
			||||||
					{{svg "octicon-bell"}}
 | 
										{{svg "octicon-bell"}}
 | 
				
			||||||
					<span class="notification_count{{if not $notificationUnreadCount}} tw-hidden{{end}}">{{$notificationUnreadCount}}</span>
 | 
										<span class="notification_count{{if not $notificationUnreadCount}} tw-hidden{{end}}">{{$notificationUnreadCount}}</span>
 | 
				
			||||||
				</div>
 | 
									</div>
 | 
				
			||||||
			</a>
 | 
								</a>
 | 
				
			||||||
			{{end}}
 | 
								{{end}}
 | 
				
			||||||
			<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>
 | 
								<button class="item ui icon mini button tw-m-0" id="navbar-expand-toggle" aria-label="{{ctx.Locale.Tr "home.nav_menu"}}">{{svg "octicon-three-bars"}}</button>
 | 
				
			||||||
		</div>
 | 
							</div>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		<!-- navbar links non-mobile -->
 | 
							<!-- navbar links non-mobile -->
 | 
				
			||||||
@ -64,9 +64,9 @@
 | 
				
			|||||||
	<div class="navbar-right">
 | 
						<div class="navbar-right">
 | 
				
			||||||
		{{if and .IsSigned .MustChangePassword}}
 | 
							{{if and .IsSigned .MustChangePassword}}
 | 
				
			||||||
			<div class="ui dropdown jump item" data-tooltip-content="{{ctx.Locale.Tr "user_profile_and_more"}}">
 | 
								<div class="ui dropdown jump item" data-tooltip-content="{{ctx.Locale.Tr "user_profile_and_more"}}">
 | 
				
			||||||
				<span class="text tw-flex tw-items-center">
 | 
									<span class="text">
 | 
				
			||||||
					{{ctx.AvatarUtils.Avatar .SignedUser 24 "tw-mr-1"}}
 | 
										{{ctx.AvatarUtils.Avatar .SignedUser 24 "tw-mr-1"}}
 | 
				
			||||||
					<span class="only-mobile tw-ml-2">{{.SignedUser.Name}}</span>
 | 
										<span class="only-mobile">{{.SignedUser.Name}}</span>
 | 
				
			||||||
					<span class="not-mobile">{{svg "octicon-triangle-down"}}</span>
 | 
										<span class="not-mobile">{{svg "octicon-triangle-down"}}</span>
 | 
				
			||||||
				</span>
 | 
									</span>
 | 
				
			||||||
				<div class="menu user-menu">
 | 
									<div class="menu user-menu">
 | 
				
			||||||
@ -83,7 +83,7 @@
 | 
				
			|||||||
			</div><!-- end dropdown avatar menu -->
 | 
								</div><!-- end dropdown avatar menu -->
 | 
				
			||||||
		{{else if .IsSigned}}
 | 
							{{else if .IsSigned}}
 | 
				
			||||||
			{{if and EnableTimetracking .ActiveStopwatch}}
 | 
								{{if and EnableTimetracking .ActiveStopwatch}}
 | 
				
			||||||
			<a class="item not-mobile active-stopwatch tw-mx-0" href="{{.ActiveStopwatch.IssueLink}}" title="{{ctx.Locale.Tr "active_stopwatch"}}" data-seconds="{{.ActiveStopwatch.Seconds}}">
 | 
								<a class="item not-mobile active-stopwatch" href="{{.ActiveStopwatch.IssueLink}}" title="{{ctx.Locale.Tr "active_stopwatch"}}" data-seconds="{{.ActiveStopwatch.Seconds}}">
 | 
				
			||||||
				<div class="tw-relative">
 | 
									<div class="tw-relative">
 | 
				
			||||||
					{{svg "octicon-stopwatch"}}
 | 
										{{svg "octicon-stopwatch"}}
 | 
				
			||||||
					<span class="header-stopwatch-dot"></span>
 | 
										<span class="header-stopwatch-dot"></span>
 | 
				
			||||||
@ -91,14 +91,14 @@
 | 
				
			|||||||
			</a>
 | 
								</a>
 | 
				
			||||||
			{{end}}
 | 
								{{end}}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			<a class="item not-mobile tw-mx-0" href="{{AppSubUrl}}/notifications" data-tooltip-content="{{ctx.Locale.Tr "notifications"}}" aria-label="{{ctx.Locale.Tr "notifications"}}">
 | 
								<a class="item not-mobile" href="{{AppSubUrl}}/notifications" data-tooltip-content="{{ctx.Locale.Tr "notifications"}}" aria-label="{{ctx.Locale.Tr "notifications"}}">
 | 
				
			||||||
				<div class="tw-relative">
 | 
									<div class="tw-relative">
 | 
				
			||||||
					{{svg "octicon-bell"}}
 | 
										{{svg "octicon-bell"}}
 | 
				
			||||||
					<span class="notification_count{{if not $notificationUnreadCount}} tw-hidden{{end}}">{{$notificationUnreadCount}}</span>
 | 
										<span class="notification_count{{if not $notificationUnreadCount}} tw-hidden{{end}}">{{$notificationUnreadCount}}</span>
 | 
				
			||||||
				</div>
 | 
									</div>
 | 
				
			||||||
			</a>
 | 
								</a>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			<div class="ui dropdown jump item tw-mx-0 tw-pr-2" data-tooltip-content="{{ctx.Locale.Tr "create_new"}}">
 | 
								<div class="ui dropdown jump item" data-tooltip-content="{{ctx.Locale.Tr "create_new"}}">
 | 
				
			||||||
				<span class="text">
 | 
									<span class="text">
 | 
				
			||||||
					{{svg "octicon-plus"}}
 | 
										{{svg "octicon-plus"}}
 | 
				
			||||||
					<span class="not-mobile">{{svg "octicon-triangle-down"}}</span>
 | 
										<span class="not-mobile">{{svg "octicon-triangle-down"}}</span>
 | 
				
			||||||
@ -121,12 +121,14 @@
 | 
				
			|||||||
				</div><!-- end content create new menu -->
 | 
									</div><!-- end content create new menu -->
 | 
				
			||||||
			</div><!-- end dropdown menu create new -->
 | 
								</div><!-- end dropdown menu create new -->
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			<div class="ui dropdown jump item tw-mx-0 tw-pr-2" data-tooltip-content="{{ctx.Locale.Tr "user_profile_and_more"}}">
 | 
								<div class="ui dropdown jump item" data-tooltip-content="{{ctx.Locale.Tr "user_profile_and_more"}}">
 | 
				
			||||||
				<span class="text tw-flex tw-items-center">
 | 
									<span class="text">
 | 
				
			||||||
					{{ctx.AvatarUtils.Avatar .SignedUser 24 "tw-mr-1"}}
 | 
										{{ctx.AvatarUtils.Avatar .SignedUser 24 "tw-mr-1"}}
 | 
				
			||||||
					<span class="only-mobile tw-ml-2">{{.SignedUser.Name}}</span>
 | 
										<span class="only-mobile">{{.SignedUser.Name}}</span>
 | 
				
			||||||
					<span class="not-mobile">{{svg "octicon-triangle-down"}}</span>
 | 
										<span class="not-mobile">{{svg "octicon-triangle-down"}}</span>
 | 
				
			||||||
				</span>
 | 
									</span>
 | 
				
			||||||
 | 
									{{/* do not localize it, here it needs the fixed length (width) to make UI comfortable */}}
 | 
				
			||||||
 | 
									{{if .IsAdmin}}<span class="navbar-profile-admin">admin</span>{{end}}
 | 
				
			||||||
				<div class="menu user-menu">
 | 
									<div class="menu user-menu">
 | 
				
			||||||
					<div class="ui header">
 | 
										<div class="ui header">
 | 
				
			||||||
						{{ctx.Locale.Tr "signed_in_as"}} <strong>{{.SignedUser.Name}}</strong>
 | 
											{{ctx.Locale.Tr "signed_in_as"}} <strong>{{.SignedUser.Name}}</strong>
 | 
				
			||||||
@ -157,7 +159,6 @@
 | 
				
			|||||||
					</a>
 | 
										</a>
 | 
				
			||||||
					{{if .IsAdmin}}
 | 
										{{if .IsAdmin}}
 | 
				
			||||||
						<div class="divider"></div>
 | 
											<div class="divider"></div>
 | 
				
			||||||
 | 
					 | 
				
			||||||
						<a class="{{if .PageIsAdmin}}active {{end}}item" href="{{AppSubUrl}}/-/admin">
 | 
											<a class="{{if .PageIsAdmin}}active {{end}}item" href="{{AppSubUrl}}/-/admin">
 | 
				
			||||||
							{{svg "octicon-server"}}
 | 
												{{svg "octicon-server"}}
 | 
				
			||||||
							{{ctx.Locale.Tr "admin_panel"}}
 | 
												{{ctx.Locale.Tr "admin_panel"}}
 | 
				
			||||||
 | 
				
			|||||||
@ -4,51 +4,34 @@
 | 
				
			|||||||
  justify-content: space-between;
 | 
					  justify-content: space-between;
 | 
				
			||||||
  background: var(--color-nav-bg);
 | 
					  background: var(--color-nav-bg);
 | 
				
			||||||
  border-bottom: 1px solid var(--color-secondary);
 | 
					  border-bottom: 1px solid var(--color-secondary);
 | 
				
			||||||
  margin: 0 !important;
 | 
					 | 
				
			||||||
  padding: 0 10px;
 | 
					  padding: 0 10px;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#navbar,
 | 
					 | 
				
			||||||
#navbar .navbar-left,
 | 
					#navbar .navbar-left,
 | 
				
			||||||
#navbar .navbar-right {
 | 
					#navbar .navbar-right {
 | 
				
			||||||
  min-height: 49px; /* +1px border-bottom */
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
#navbar .navbar-left,
 | 
					 | 
				
			||||||
#navbar .navbar-right {
 | 
					 | 
				
			||||||
  margin: 0;
 | 
					 | 
				
			||||||
  display: flex;
 | 
					  display: flex;
 | 
				
			||||||
  align-items: center;
 | 
					  align-items: center;
 | 
				
			||||||
  gap: 5px;
 | 
					  gap: 5px;
 | 
				
			||||||
}
 | 
					  min-height: 49px; /* +1px border-bottom */
 | 
				
			||||||
 | 
					 | 
				
			||||||
#navbar-logo {
 | 
					 | 
				
			||||||
  margin: 0;
 | 
					 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
.navbar-left > .item,
 | 
					.navbar-left > .item,
 | 
				
			||||||
.navbar-right > .item {
 | 
					.navbar-right > .item,
 | 
				
			||||||
 | 
					.navbar-mobile-right > .item {
 | 
				
			||||||
 | 
					  flex: 0 0 auto;
 | 
				
			||||||
 | 
					  display: flex;
 | 
				
			||||||
 | 
					  align-items: center;
 | 
				
			||||||
  color: var(--color-nav-text);
 | 
					  color: var(--color-nav-text);
 | 
				
			||||||
  position: relative;
 | 
					  position: relative;
 | 
				
			||||||
  text-decoration: none;
 | 
					  text-decoration: none;
 | 
				
			||||||
  line-height: var(--line-height-default);
 | 
					 | 
				
			||||||
  flex: 0 0 auto;
 | 
					 | 
				
			||||||
  font-weight: var(--font-weight-normal);
 | 
					 | 
				
			||||||
  align-items: center;
 | 
					 | 
				
			||||||
  padding: .78571429em .92857143em;
 | 
					 | 
				
			||||||
  border-radius: .28571429rem;
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
#navbar .item {
 | 
					 | 
				
			||||||
  min-height: 36px;
 | 
					  min-height: 36px;
 | 
				
			||||||
  min-width: 36px;
 | 
					  min-width: 36px;
 | 
				
			||||||
  padding-top: 3px;
 | 
					  padding: 3px 13px;
 | 
				
			||||||
  padding-bottom: 3px;
 | 
					  border-radius: 4px;
 | 
				
			||||||
  display: flex;
 | 
					 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#navbar .dropdown .item {
 | 
					#navbar .item.active {
 | 
				
			||||||
  justify-content: stretch;
 | 
					  background: var(--color-active);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#navbar a.item:hover,
 | 
					#navbar a.item:hover,
 | 
				
			||||||
@ -56,9 +39,8 @@
 | 
				
			|||||||
  background: var(--color-nav-hover-bg);
 | 
					  background: var(--color-nav-hover-bg);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#navbar .secondary.menu > .item > .svg,
 | 
					#navbar .item.ui.dropdown {
 | 
				
			||||||
#navbar .right.menu > .item > .svg {
 | 
					  padding-right: 5px;
 | 
				
			||||||
  margin-right: 0;
 | 
					 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@media (max-width: 767.98px) {
 | 
					@media (max-width: 767.98px) {
 | 
				
			||||||
@ -80,12 +62,12 @@
 | 
				
			|||||||
  }
 | 
					  }
 | 
				
			||||||
  #navbar .navbar-mobile-right {
 | 
					  #navbar .navbar-mobile-right {
 | 
				
			||||||
    display: flex;
 | 
					    display: flex;
 | 
				
			||||||
    margin: 0 0 0 auto !important;
 | 
					    margin: 0 0 0 auto;
 | 
				
			||||||
    width: auto !important;
 | 
					    width: auto;
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
  #navbar .navbar-mobile-right > .item {
 | 
					  #navbar .navbar-mobile-right > .item {
 | 
				
			||||||
    display: flex;
 | 
					    display: flex;
 | 
				
			||||||
    width: auto !important;
 | 
					    width: auto;
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
  /* show items if the navbar is open */
 | 
					  /* show items if the navbar is open */
 | 
				
			||||||
  #navbar.navbar-menu-open {
 | 
					  #navbar.navbar-menu-open {
 | 
				
			||||||
@ -96,13 +78,12 @@
 | 
				
			|||||||
    flex-direction: column;
 | 
					    flex-direction: column;
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
  #navbar.navbar-menu-open .navbar-left {
 | 
					  #navbar.navbar-menu-open .navbar-left {
 | 
				
			||||||
    display: flex;
 | 
					 | 
				
			||||||
    flex-wrap: wrap;
 | 
					    flex-wrap: wrap;
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
  #navbar.navbar-menu-open .item {
 | 
					  #navbar.navbar-menu-open .navbar-left > .item,
 | 
				
			||||||
 | 
					  #navbar.navbar-menu-open .navbar-right > .item {
 | 
				
			||||||
    display: flex;
 | 
					    display: flex;
 | 
				
			||||||
    width: 100%;
 | 
					    width: 100%;
 | 
				
			||||||
    margin: 0;
 | 
					 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
  #navbar.navbar-menu-open .navbar-left #navbar-logo {
 | 
					  #navbar.navbar-menu-open .navbar-left #navbar-logo {
 | 
				
			||||||
    justify-content: flex-start;
 | 
					    justify-content: flex-start;
 | 
				
			||||||
@ -111,14 +92,27 @@
 | 
				
			|||||||
  #navbar.navbar-menu-open .navbar-left .navbar-mobile-right {
 | 
					  #navbar.navbar-menu-open .navbar-left .navbar-mobile-right {
 | 
				
			||||||
    justify-content: flex-end;
 | 
					    justify-content: flex-end;
 | 
				
			||||||
    width: 50%;
 | 
					    width: 50%;
 | 
				
			||||||
    min-height: 48px;
 | 
					    min-height: 49px;
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
  #navbar #mobile-stopwatch-icon,
 | 
					  #navbar #mobile-stopwatch-icon,
 | 
				
			||||||
  #navbar #mobile-notifications-icon {
 | 
					  #navbar #mobile-notifications-icon {
 | 
				
			||||||
    margin-right: 6px !important;
 | 
					    margin-right: 6px;
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#navbar .ui.dropdown .navbar-profile-admin {
 | 
				
			||||||
 | 
					  display: block;
 | 
				
			||||||
 | 
					  position: absolute;
 | 
				
			||||||
 | 
					  font-size: 10px;
 | 
				
			||||||
 | 
					  font-weight: var(--font-weight-bold);
 | 
				
			||||||
 | 
					  color: var(--color-nav-bg);
 | 
				
			||||||
 | 
					  background: var(--color-primary);
 | 
				
			||||||
 | 
					  padding: 2px 4px;
 | 
				
			||||||
 | 
					  border-radius: 10px;
 | 
				
			||||||
 | 
					  top: -1px;
 | 
				
			||||||
 | 
					  left: 18px;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#navbar a.item:hover .notification_count,
 | 
					#navbar a.item:hover .notification_count,
 | 
				
			||||||
#navbar a.item:hover .header-stopwatch-dot {
 | 
					#navbar a.item:hover .header-stopwatch-dot {
 | 
				
			||||||
  border-color: var(--color-nav-hover-bg);
 | 
					  border-color: var(--color-nav-hover-bg);
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user