Parcourir la source

add dashboard context switch button

fuxiaohei il y a 10 ans
Parent
commit
bf703ef617
4 fichiers modifiés avec 57 ajouts et 2 suppressions
  1. 1 1
      cmd/web.go
  2. 41 0
      public/css/gogs.css
  3. 1 1
      routers/dashboard.go
  4. 14 0
      templates/user/dashboard.tmpl

+ 1 - 1
cmd/web.go

@@ -96,7 +96,7 @@ func runWeb(*cli.Context) {
 		r.Get("/stars", user.Stars)
 	}, reqSignIn)
 
-	m.Group("/api", func(r martini.Router) {
+	m.Group("/api", func(_ martini.Router) {
 		m.Group("/v1", func(r martini.Router) {
 			// Miscellaneous.
 			r.Post("/markdown", bindIgnErr(apiv1.MarkdownForm{}), v1.Markdown)

+ 41 - 0
public/css/gogs.css

@@ -638,6 +638,47 @@ html, body {
     margin: 0 .5em;
 }
 
+#dashboard-switch .btn {
+    height: 40px;
+}
+
+#dashboard-switch {
+    margin-top: 14px;
+    margin-right: 18px;
+}
+
+#dashboard-switch .dropdown-menu {
+    padding: 0;
+}
+
+#dashboard-switch-menu {
+    width: 180px;
+    margin-bottom: 0;
+    padding-bottom: 0;
+}
+
+#dashboard-switch-menu > li > a {
+    display: block;
+    padding: .8em 1.2em;
+}
+
+#dashboard-switch-menu > li {
+    border-bottom: 1px solid #eaeaea;
+}
+
+#dashboard-switch-menu > li .fa {
+    opacity: 0;
+    margin-right: 16px;
+}
+
+#dashboard-switch-menu > li.checked .fa {
+    opacity: 1;
+}
+
+#dashboard-switch-menu > li:last-child {
+    border-bottom: none;
+}
+
 /* gogits repo single page */
 
 #body-nav.repo-nav {

+ 1 - 1
routers/dashboard.go

@@ -26,7 +26,7 @@ func Home(ctx *middleware.Context) {
 
 	ctx.Data["PageIsHome"] = true
 
-	// Show recent updated repositoires for new visiters.
+	// Show recent updated repositories for new visitors.
 	repos, err := models.GetRecentUpdatedRepositories()
 	if err != nil {
 		ctx.Handle(500, "dashboard.Home(GetRecentUpdatedRepositories)", err)

+ 14 - 0
templates/user/dashboard.tmpl

@@ -2,6 +2,20 @@
 {{template "base/navbar" .}}
 <div id="body-nav">
     <div class="container">
+        <div class="btn-group pull-left" id="dashboard-switch">
+            <button type="button" class="btn btn-default">
+                <img src="//1.gravatar.com/avatar/f72f7454ce9d710baa506394f68f4132?s=28" alt="user-avatar" title="username">
+                fuxiaohei
+            </button>
+            <button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown">
+                <span class="caret"></span>
+            </button>
+            <div class="dropdown-menu clone-group-btn no-propagation">
+                <ul id="dashboard-switch-menu" class="list-unstyled">
+                    <li class="checked"><a href="#"><i class="fa fa-check"></i> gogits/gogs</a></li>
+                </ul>
+            </div>
+        </div>
         <ul class="nav nav-pills pull-right">
             <li class="active"><a href="/">Feed</a></li>
             <li><a href="/issues">Issues</a></li>