diff --git a/models/repo.go b/models/repo.go index 70e2673d3..6fc590566 100644 --- a/models/repo.go +++ b/models/repo.go @@ -27,6 +27,13 @@ type Repo struct { Updated time.Time `xorm:"updated"` } +type Star struct { + Id int64 + RepoId int64 + UserId int64 + Created time.Time `xorm:"created"` +} + // check if repository is exist func IsRepositoryExist(user *User, reposName string) (bool, error) { repo := Repo{OwnerId: user.Id} @@ -121,6 +128,10 @@ func UnWatchRepository() { } +func ForkRepository(reposName string, userId int64) { + +} + func RepoPath(userName, repoName string) string { return filepath.Join(UserPath(userName), repoName+".git") } diff --git a/public/css/gogs.css b/public/css/gogs.css index ff3d7a995..08dada045 100755 --- a/public/css/gogs.css +++ b/public/css/gogs.css @@ -5,31 +5,182 @@ */ body { - padding-top: 70px; + background: #F6F6F6; } -.navbar { - min-height: 45px; + +/* override bs3 */ + +.tooltip-inner{ + border-radius: 3px; + background: #333; + border: none; } -.navbar-brand { - height: 45px; - padding: 5px 10px 0px 10px; - border-left: 1px solid #e5e5e5; - border-right: 1px solid #e5e5e5; + +.tooltip-arrow{ + border-bottom-color: #333 !important; } -.navbar-inverse .navbar-brand:focus, .navbar-inverse .navbar-brand:hover { - background-color: #f0f0f0; + +.fa{ + margin: 0 .5em; } -.navbar-brand img { - width: 32px; + +/* gogits nav header */ +.gogs-masthead { + background-color: #428bca; + box-shadow: inset 0 -2px 5px rgba(0, 0, 0, .1); + min-height: 45px; + padding: 2px 16px; } -.navbar-nav > li > a { - font-size: 16px; - padding-top: 13px; + +/* gogits nav item link */ +.gogs-nav-item { + position: relative; + display: inline-block; + padding: 10px; + font-weight: bold; + color: #EEE; + font-size: 100%; } -.navbar-inverse .navbar-nav > li > a:hover, .navbar-inverse .navbar-nav > li > a:focus { - color: rgb(153, 153, 153); + +.gogs-nav-item:hover, +.gogs-nav-item:focus { + color: #fff; + text-decoration: none; } -.navbar-btn, .navbar .btn { - padding: 5px 15px; - margin-top: 7px; + +.gogs-nav-item.navbar-btn { + cursor: pointer; + margin-top: 8px; + padding: 5px 15px; +} + +/* gogits nav item active status */ +.gogs-nav .active { + color: #fff; +} + +.gogs-nav .active:after { + position: absolute; + bottom: -2px; + left: 50%; + width: 0; + height: 0; + margin-left: -5px; + vertical-align: middle; + content: " "; + border-right: 5px solid transparent; + border-bottom: 5px solid; + border-left: 5px solid transparent; +} + +/* gogits logo */ +#gogs-logo { + width: 28px; +} + +/* gogits body */ +#gogs-body { + padding-top: 30px; + padding-bottom: 60px; +} + +/* gogits login card */ +.gogs-card{ + margin: auto; + padding: 30px; + background: #fff; + border: 1px solid #ccc; + border-radius: 5px; + box-sizing: border-box; +} + +.gogs-card h3 { + margin-top: 0; + margin-bottom: 30px; + padding-bottom: 20px; + border-bottom: 1px solid #ccc; +} + +#gogs-login-card{ + width: 600px; +} + +#gogs-login-card .form-control { + padding: 6px 12px; + box-sizing: content-box; +} + +#gogs-login-card .control-label { + height: 44px; + line-height: 30px; +} + +.gogs-card .btn{ + cursor: pointer; + margin-right: 1.2em; +} + +#gogs-social-login{ + margin-top: 30px; + padding-top: 20px; + border-top: 1px solid #ccc; +} + +#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; +} + +/* gogits repo create */ + +#gogs-repo-create{ + width: 800px; +} + +#gogs-repo-create textarea[name=desc]{ + height: 8em; } \ No newline at end of file diff --git a/public/img/checkmark.png b/public/img/checkmark.png new file mode 100644 index 000000000..ad85a9102 Binary files /dev/null and b/public/img/checkmark.png differ diff --git a/public/js/app.js b/public/js/app.js new file mode 100644 index 000000000..a8220f46e --- /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/ssh.go b/routers/user/ssh.go index c7fae4b4b..7b5a1d325 100644 --- a/routers/user/ssh.go +++ b/routers/user/ssh.go @@ -13,7 +13,7 @@ import ( "github.com/gogits/gogs/models" ) -func AddPublickKey(req *http.Request, r render.Render) { +func AddPublicKey(req *http.Request, r render.Render) { if req.Method == "GET" { r.HTML(200, "user/publickey_add", map[string]interface{}{ "Title": "Add Public Key", diff --git a/routers/user/user.go b/routers/user/user.go index 6fafcc47d..cf1314086 100644 --- a/routers/user/user.go +++ b/routers/user/user.go @@ -16,8 +16,30 @@ import ( "github.com/gogits/gogs/utils/log" ) -func SignIn(r render.Render) { - r.Redirect("/user/signup", 302) +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{}{ + "Title": "Log In", + }) + return + } + + // todo sign in + _, err := models.LoginUserPlain(req.FormValue("account"), req.FormValue("passwd")) + if err != nil { + r.HTML(200, "base/error", map[string]interface{}{ + "Error": fmt.Sprintf("%v", err), + }) + return + } + r.Redirect("/") } func SignUp(req *http.Request, r render.Render) { @@ -47,9 +69,16 @@ func SignUp(req *http.Request, r render.Render) { } err = models.RegisterUser(u) - r.HTML(403, "status/403", map[string]interface{}{ - "Title": fmt.Sprintf("%v", err), - }) + if err != nil { + if err != nil { + r.HTML(200, "base/error", map[string]interface{}{ + "Error": fmt.Sprintf("%v", err), + }) + return + } + } + + r.Redirect("/") } func Delete(req *http.Request, r render.Render) { diff --git a/templates/base/error.tmpl b/templates/base/error.tmpl new file mode 100644 index 000000000..8d3c36be9 --- /dev/null +++ b/templates/base/error.tmpl @@ -0,0 +1,6 @@ +{{template "base/head" .}} +{{template "base/navbar" .}} +