From ffe0ba562c2d749ea904e7171b424ae251c1f62e Mon Sep 17 00:00:00 2001 From: FuXiaoHei Date: Sun, 2 Mar 2014 21:47:55 +0800 Subject: [PATCH] ui for user/profile page, only skeleton --- public/css/gogs.css | 60 +++++++++++++++++++++++++++++++++++++ public/js/app.js | 17 +++++++++++ routers/user/user.go | 7 +++++ templates/base/head.tmpl | 2 +- templates/user/delete.tmpl | 2 +- templates/user/profile.tmpl | 37 +++++++++++++++++++++++ templates/user/signup.tmpl | 2 +- web.go | 1 + 8 files changed, 125 insertions(+), 3 deletions(-) create mode 100644 public/js/app.js create mode 100644 templates/user/profile.tmpl diff --git a/public/css/gogs.css b/public/css/gogs.css index 68c2b8a41b8..39796f6e39a 100755 --- a/public/css/gogs.css +++ b/public/css/gogs.css @@ -8,6 +8,22 @@ body { background: #F6F6F6; } +/* override bs3 */ + +.tooltip-inner{ + border-radius: 3px; + background: #333; + border: none; +} + +.tooltip-arrow{ + border-bottom-color: #333 !important; +} + +.fa{ + margin: 0 .5em; +} + /* gogits nav header */ .gogs-masthead { background-color: #428bca; @@ -110,4 +126,48 @@ body { #gogs-social-login .btn{ float: none; margin: auto; +} + +/* gogs-user-profile */ + +#gogs-user-avatar{ + width: 200px; + height: 200px; + border-radius: 6px; +} + +#gogs-user-name{ + margin-top: 20px; + font-size: 1.6em; + font-weight: bold; + margin-bottom: 20px; +} + +#gogs-user-profile .profile-info .list-group-item{ + background-color: transparent; + padding-top: 18px; + color: #666; +} + +#gogs-user-profile .profile-info .list-group-item a{ + margin: 0; + padding: 0; + display: inline; + color: #0093c4; +} + +#gogs-user-profile .profile-info .list-group{ + border-top: 1px solid #ccc; + padding-bottom: 18px; + border-bottom: 1px solid #ccc; + padding-left: 18px; + padding-right: 18px; +} + +#gogs-user-activity .tab-pane{ + padding: 20px; +} + +#gogs-user-act-tabs li.active a{ + border-bottom-color: #ddd; } \ No newline at end of file diff --git a/public/js/app.js b/public/js/app.js new file mode 100644 index 00000000000..a8220f46e1b --- /dev/null +++ b/public/js/app.js @@ -0,0 +1,17 @@ +var Gogits = {}; + +(function($){ + Gogits.showTooltips = function(){ + $("body").tooltip({ + selector: "[data-toggle=tooltip]" + //container: "body" + }); + }; + Gogits.showTab = function (selector, index) { + if (!index) { + index = 0; + } + $(selector).tab("show"); + $(selector).find("li:eq(" + index + ") a").tab("show"); + } +})(jQuery); \ No newline at end of file diff --git a/routers/user/user.go b/routers/user/user.go index 241a9f35897..7cd8bca5504 100644 --- a/routers/user/user.go +++ b/routers/user/user.go @@ -16,6 +16,13 @@ import ( "github.com/gogits/gogs/utils/log" ) +func Profile(r render.Render) { + r.HTML(200, "user/profile", map[string]interface{}{ + "Title": "Username", + }) + return +} + func SignIn(req *http.Request, r render.Render) { if req.Method == "GET" { r.HTML(200, "user/signin", map[string]interface{}{ diff --git a/templates/base/head.tmpl b/templates/base/head.tmpl index ac0b9594e64..4358bf02bfa 100644 --- a/templates/base/head.tmpl +++ b/templates/base/head.tmpl @@ -15,7 +15,7 @@ - + {{.Title}} | {{AppName}} diff --git a/templates/user/delete.tmpl b/templates/user/delete.tmpl index 55993633db5..939048b4212 100644 --- a/templates/user/delete.tmpl +++ b/templates/user/delete.tmpl @@ -1,6 +1,6 @@ {{template "base/head" .}} {{template "base/navbar" .}} -
+
diff --git a/templates/user/profile.tmpl b/templates/user/profile.tmpl new file mode 100644 index 00000000000..f32601001de --- /dev/null +++ b/templates/user/profile.tmpl @@ -0,0 +1,37 @@ +{{template "base/head" .}} +{{template "base/navbar" .}} +
+
+
+ + user-avatar + + Username +
+
+ +
+
+
+ +
+
repo
+
activity
+
+
+
+ +{{template "base/footer" .}} \ No newline at end of file diff --git a/templates/user/signup.tmpl b/templates/user/signup.tmpl index 2e127a62ef2..0bac3244a83 100644 --- a/templates/user/signup.tmpl +++ b/templates/user/signup.tmpl @@ -37,7 +37,7 @@ diff --git a/web.go b/web.go index 71529a8e8db..77226f57883 100644 --- a/web.go +++ b/web.go @@ -54,6 +54,7 @@ func runWeb(*cli.Context) { m.Any("/sign-up", user.SignUp) m.Any("/user/signup", user.SignUp) + m.Get("/user/profile", user.Profile) // should be /username m.Any("/user/delete", user.Delete) m.Any("/user/publickey/add", user.AddPublicKey) m.Any("/repo/create", repo.Create)