summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorUnknown <joe2010xtmf@163.com>2014-03-02 15:25:14 -0500
committerUnknown <joe2010xtmf@163.com>2014-03-02 15:25:14 -0500
commit3f849ddfabbbbf77f66a18e0d88ba97a132f9812 (patch)
tree7f8365149c91ebc81c83c0767b3f51d53cc57de3
parente9487cb59cb7fcdc8891ccae93c33c9f587c576f (diff)
parent71bae3ebd37e20130131328923dbff2de35093b6 (diff)
downloadgitea-3f849ddfabbbbf77f66a18e0d88ba97a132f9812.tar.gz
gitea-3f849ddfabbbbf77f66a18e0d88ba97a132f9812.zip
Merge branch 'master' of github.com:gogits/gogs
-rw-r--r--models/repo.go11
-rwxr-xr-xpublic/css/gogs.css191
-rw-r--r--public/img/checkmark.pngbin0 -> 169 bytes
-rw-r--r--public/js/app.js17
-rw-r--r--routers/user/ssh.go2
-rw-r--r--routers/user/user.go39
-rw-r--r--templates/base/error.tmpl6
-rw-r--r--templates/base/head.tmpl2
-rw-r--r--templates/base/navbar.tmpl16
-rw-r--r--templates/dashboard.tmpl2
-rw-r--r--templates/repo/create.tmpl73
-rw-r--r--templates/user/delete.tmpl2
-rw-r--r--templates/user/profile.tmpl37
-rw-r--r--templates/user/signin.tmpl34
-rw-r--r--templates/user/signup.tmpl25
-rw-r--r--web.go9
16 files changed, 401 insertions, 65 deletions
diff --git a/models/repo.go b/models/repo.go
index 70e2673d34..6fc590566e 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 ff3d7a9954..08dada0457 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;
+}
+
+.tooltip-arrow{
+ border-bottom-color: #333 !important;
+}
+
+.fa{
+ margin: 0 .5em;
+}
+
+/* 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;
+}
+
+/* gogits nav item link */
+.gogs-nav-item {
+ position: relative;
+ display: inline-block;
+ padding: 10px;
+ font-weight: bold;
+ color: #EEE;
+ font-size: 100%;
+}
+
+.gogs-nav-item:hover,
+.gogs-nav-item:focus {
+ color: #fff;
+ text-decoration: none;
+}
+
+.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;
}
-.navbar-brand {
- height: 45px;
- padding: 5px 10px 0px 10px;
- border-left: 1px solid #e5e5e5;
- border-right: 1px solid #e5e5e5;
+
+#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;
}
-.navbar-inverse .navbar-brand:focus, .navbar-inverse .navbar-brand:hover {
- background-color: #f0f0f0;
+
+#gogs-user-name{
+ margin-top: 20px;
+ font-size: 1.6em;
+ font-weight: bold;
+ margin-bottom: 20px;
}
-.navbar-brand img {
- width: 32px;
+
+#gogs-user-profile .profile-info .list-group-item{
+ background-color: transparent;
+ padding-top: 18px;
+ color: #666;
}
-.navbar-nav > li > a {
- font-size: 16px;
- padding-top: 13px;
+
+#gogs-user-profile .profile-info .list-group-item a{
+ margin: 0;
+ padding: 0;
+ display: inline;
+ color: #0093c4;
}
-.navbar-inverse .navbar-nav > li > a:hover, .navbar-inverse .navbar-nav > li > a:focus {
- color: rgb(153, 153, 153);
+
+#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;
}
-.navbar-btn, .navbar .btn {
- padding: 5px 15px;
- margin-top: 7px;
+
+#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 0000000000..ad85a91027
--- /dev/null
+++ b/public/img/checkmark.png
Binary files differ
diff --git a/public/js/app.js b/public/js/app.js
new file mode 100644
index 0000000000..a8220f46e1
--- /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 c7fae4b4b8..7b5a1d325b 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 6fafcc47d8..cf1314086c 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 0000000000..8d3c36be9a
--- /dev/null
+++ b/templates/base/error.tmpl
@@ -0,0 +1,6 @@
+{{template "base/head" .}}
+{{template "base/navbar" .}}
+<div id="gogs-body" class="container">
+ An error is occupied : {{.Error}}
+</div>
+{{template "base/footer" .}} \ No newline at end of file
diff --git a/templates/base/head.tmpl b/templates/base/head.tmpl
index ac0b9594e6..4358bf02bf 100644
--- a/templates/base/head.tmpl
+++ b/templates/base/head.tmpl
@@ -15,7 +15,7 @@
<script src="/js/jquery-1.10.1.min.js"></script>
<script src="/js/bootstrap.min.js"></script>
-
+ <script src="/js/app.js"></script>
<title>{{.Title}} | {{AppName}}</title>
</head>
<body>
diff --git a/templates/base/navbar.tmpl b/templates/base/navbar.tmpl
index 16d76688de..ae908738a8 100644
--- a/templates/base/navbar.tmpl
+++ b/templates/base/navbar.tmpl
@@ -1,4 +1,16 @@
-<nav class="navbar navbar-inverse navbar-fixed-top">
+<div class="gogs-masthead" id="masthead">
+ <div class="container">
+ <nav class="gogs-nav">
+ <a class="gogs-nav-item active" href="/"><img src="/img/favicon.png" alt="Gogs Logo" id="gogs-logo"></a>
+ <a class="gogs-nav-item" href="#">Dashboard</a>
+ <a class="gogs-nav-item" href="#">Explore</a>
+ <a class="gogs-nav-item" href="#">Help</a>
+ <a class="gogs-nav-item navbar-right navbar-btn btn btn-danger" href="/login/">Sign in</a>
+ <!--<a class="gogs-nav-item navbar-right" href="#">Profile</a>-->
+ </nav>
+ </div>
+</div>
+<!--<nav class="navbar navbar-inverse navbar-fixed-top">
<div class="container">
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#gogs-navbar-collapse">
@@ -15,4 +27,4 @@
<a href="/user/signin" class="navbar-right btn btn-success navbar-btn">Sign In</a>
</div>
</div>
-</nav>
+</nav>-->
diff --git a/templates/dashboard.tmpl b/templates/dashboard.tmpl
index 25a63827b7..8cbb29ebb4 100644
--- a/templates/dashboard.tmpl
+++ b/templates/dashboard.tmpl
@@ -1,6 +1,6 @@
{{template "base/head" .}}
{{template "base/navbar" .}}
-<div class="container">
+<div id="gogs-body" class="container">
Website is still in the progress of building...please come back later!
</div>
{{template "base/footer" .}} \ No newline at end of file
diff --git a/templates/repo/create.tmpl b/templates/repo/create.tmpl
index c93f9386df..a3ad06df0d 100644
--- a/templates/repo/create.tmpl
+++ b/templates/repo/create.tmpl
@@ -1,24 +1,57 @@
{{template "base/head" .}}
{{template "base/navbar" .}}
-<div class="container">
- <form action="/repo/create" method="post" class="form-horizontal">
- <div class="form-group">
-<div class="col-md-offset-4 col-md-3">
- Owner: <input name="userId" type="hidden" value="1"/>lunny
- </div>
- <div class="col-md-offset-4 col-md-3">
- repo name: <input name="name" type="text"/>
- </div>
- <div class="col-md-offset-4 col-md-3">
- description(optional): <input name="desc" type="text"/>
- </div>
- <div class="col-md-offset-4 col-md-3">
-
- </div>
- <div class="col-md-offset-4 col-md-3">
- <button type="submit" class="btn btn-info">Create repository</button>
- </div>
- </div>
- </form>
+<div class="container" id="gogs-body">
+ <form action="/repo/create" method="post" class="form-horizontal gogs-card" id="gogs-repo-create">
+ <h3>Create New Repository</h3>
+ <div class="form-group">
+ <label class="col-md-2 control-label">Owner<strong class="text-danger">*</strong></label>
+ <div class="col-md-8">
+ <p class="form-control-static">Owner-name</p>
+ <input type="hidden" value="1" name="user-id"/>
+ </div>
+ </div>
+ <div class="form-group">
+ <label class="col-md-2 control-label">Repository<strong class="text-danger">*</strong></label>
+ <div class="col-md-8">
+ <input name="repo" type="text" class="form-control" placeholder="Type your repository name">
+ <span class="help-block">Great repository names are short and memorable. </span>
+ </div>
+ </div>
+ <div class="form-group">
+ <label class="col-md-2 control-label">Description</label>
+ <div class="col-md-8">
+ <textarea name="desc" class="form-control" placeholder="Type your repository name"></textarea>
+ </div>
+ </div>
+ <div class="form-group">
+ <label class="col-md-2 control-label">Language</label>
+ <div class="col-md-8">
+ <select class="form-control" name="language">
+ <option value="">Select a language</option>
+ <option value="ActionScript">ActionScript</option>
+ <option value="C#">C#</option>
+ <option value="Google Go">Google Go</option>
+ <option value="Java">Java</option>
+ <option value="PHP">PHP</option>
+ </select>
+ </div>
+ </div>
+ <div class="form-group">
+ <div class="col-md-8 col-md-offset-2">
+ <div class="checkbox">
+ <label>
+ <input type="checkbox" value="true" name="init-md">
+ <strong>Initialize this repository with a README</strong>
+ </label>
+ </div>
+ </div>
+ </div>
+ <div class="form-group">
+ <div class="col-md-offset-2 col-md-8">
+ <button type="submit" class="btn btn-lg btn-primary">Create repository</button>
+ <a href="/" class="text-danger">Cancel</a>
+ </div>
+ </div>
+ </form>
</div>
{{template "base/footer" .}} \ No newline at end of file
diff --git a/templates/user/delete.tmpl b/templates/user/delete.tmpl
index 55993633db..939048b421 100644
--- a/templates/user/delete.tmpl
+++ b/templates/user/delete.tmpl
@@ -1,6 +1,6 @@
{{template "base/head" .}}
{{template "base/navbar" .}}
-<div class="container">
+<div class="container" id="gogs-body">
<form action="/user/delete" method="post" class="form-horizontal">
<div class="form-group">
<div class="col-md-offset-4 col-md-3">
diff --git a/templates/user/profile.tmpl b/templates/user/profile.tmpl
new file mode 100644
index 0000000000..f32601001d
--- /dev/null
+++ b/templates/user/profile.tmpl
@@ -0,0 +1,37 @@
+{{template "base/head" .}}
+{{template "base/navbar" .}}
+<div id="gogs-body" class="container">
+ <div id="gogs-user-profile" class="col-md-3">
+ <div class="profile-avatar text-center">
+ <a href="#" class="center-block" data-toggle="tooltip" data-placement="bottom" title="Change Avatar">
+ <img id="gogs-user-avatar" src="http://1.gravatar.com/avatar/x?s=200" alt="user-avatar" title="username"/>
+ </a>
+ <span id="gogs-user-name" class="center-block" href="#">Username</span>
+ </div>
+ <div class="profile-info">
+ <ul class="list-group">
+ <li class="list-group-item"><i class="fa fa-thumb-tack"></i>City, County, State, Nation</li>
+ <li class="list-group-item"><i class="fa fa-envelope"></i><a href="#">Email@EmailAddress.com</a></li>
+ <li class="list-group-item"><i class="fa fa-link"></i><a href="#">http://yousite/</a></li>
+ <li class="list-group-item"><i class="fa fa-clock-o"></i>Joined At 03.02, 2014</li>
+ </ul>
+ </div>
+ </div>
+ <div id="gogs-user-activity" class="col-md-9">
+ <ul class="nav nav-tabs" id="gogs-user-act-tabs">
+ <li class="active"><a href="#repo" data-toggle="tab"><i class="fa fa-gittip"></i>Repositories</a></li>
+ <li><a href="#activity" data-toggle="tab"><i class="fa fa-rss"></i>Activity</a></li>
+ </ul>
+ <div class="tab-content">
+ <div class="tab-pane active" id="repo">repo</div>
+ <div class="tab-pane" id="activity">activity</div>
+ </div>
+ </div>
+</div>
+<script>
+ $(function () {
+ Gogits.showTooltips();
+ Gogits.showTab("#gogs-user-act-tabs");
+ });
+</script>
+{{template "base/footer" .}} \ No newline at end of file
diff --git a/templates/user/signin.tmpl b/templates/user/signin.tmpl
new file mode 100644
index 0000000000..856e46d97b
--- /dev/null
+++ b/templates/user/signin.tmpl
@@ -0,0 +1,34 @@
+{{template "base/head" .}}
+{{template "base/navbar" .}}
+<div class="container" id="gogs-body">
+ <form action="/user/signin" method="post" class="form-horizontal gogs-card" id="gogs-login-card">
+ <h3>Log in</h3>
+ <div class="form-group">
+ <label class="col-md-4 control-label">Username or Email: </label>
+ <div class="col-md-6">
+ <input name="account" class="form-control" placeholder="Type your username or e-mail address">
+ </div>
+ </div>
+ <div class="form-group">
+ <label class="col-md-4 control-label">Password: </label>
+ <div class="col-md-6">
+ <input name="passwd" type="password" class="form-control" placeholder="Type your password">
+ </div>
+ </div>
+ <div class="form-group">
+ <div class="col-md-offset-4 col-md-6">
+ <button type="submit" class="btn btn-lg btn-primary">Log In</button>
+ <a href="/forget-password/">Forgot your password?</a>
+ </div>
+ </div>
+ <div class="form-group">
+ <div class="col-md-offset-4 col-md-6">
+ <a href="/sign-up/">Need an account? Sign up free.</a>
+ </div>
+ </div>
+ <div class="form-group text-center" id="gogs-social-login">
+ <a class="btn btn-default btn-lg">Social Login</a>
+ </div>
+ </form>
+</div>
+{{template "base/footer" .}} \ No newline at end of file
diff --git a/templates/user/signup.tmpl b/templates/user/signup.tmpl
index 8e1f1493c0..48e50a0037 100644
--- a/templates/user/signup.tmpl
+++ b/templates/user/signup.tmpl
@@ -1,43 +1,44 @@
{{template "base/head" .}}
{{template "base/navbar" .}}
-<div class="container">
- <form action="/user/signup" method="post" class="form-horizontal">
+<div class="container" id="gogs-body">
+ <form action="/user/signup" method="post" class="form-horizontal gogs-card" id="gogs-login-card">
+ <h3>Sign Up</h3>
<div class="form-group">
<label class="col-md-4 control-label">Username: </label>
- <div class="col-md-3">
+ <div class="col-md-6">
<input name="username" class="form-control" placeholder="Type your username">
</div>
</div>
-
<div class="form-group">
<label class="col-md-4 control-label">Email: </label>
- <div class="col-md-3">
+ <div class="col-md-6">
<input name="email" class="form-control" placeholder="Type your e-mail address">
</div>
</div>
<div class="form-group">
<label class="col-md-4 control-label">Password: </label>
- <div class="col-md-3">
+ <div class="col-md-6">
<input name="passwd" type="password" class="form-control" placeholder="Type your password">
</div>
</div>
-
<div class="form-group">
<label class="col-md-4 control-label">Re-type: </label>
- <div class="col-md-3">
+ <div class="col-md-6">
<input type="password" class="form-control" placeholder="Re-type your password">
</div>
</div>
<div class="form-group">
- <div class="col-md-offset-4 col-md-3">
- <button type="submit" class="btn btn-info">Sign Up</button>
+ <div class="col-md-offset-4 col-md-6">
+ <button type="submit" class="btn btn-lg btn-primary">Create an account</button>
</div>
</div>
- <div class="col-md-offset-4 col-md-3">
- <a href="/user/signin">Already have an account? Sign in now!</a>
+ <div class="form-group">
+ <div class="col-md-offset-4 col-md-6">
+ <a href="/login/">Already have an account? Sign in now!</a>
+ </div>
</div>
</form>
</div>
diff --git a/web.go b/web.go
index 024a80f910..77226f5788 100644
--- a/web.go
+++ b/web.go
@@ -48,10 +48,15 @@ func runWeb(*cli.Context) {
// Routers.
m.Get("/", routers.Dashboard)
- m.Get("/user/signin", user.SignIn)
+ m.Any("/login", user.SignIn)
+ m.Any("/user/signin", user.SignIn)
+
+ 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.AddPublickKey)
+ m.Any("/user/publickey/add", user.AddPublicKey)
m.Any("/repo/create", repo.Create)
m.Any("/repo/delete", repo.Delete)