This commit is contained in:
Lunny Xiao 2014-03-03 23:24:29 +08:00
commit fea660f1d7
7 changed files with 97 additions and 47 deletions

View File

@ -10,17 +10,17 @@ body {
/* override bs3 */ /* override bs3 */
.tooltip-inner{ .tooltip-inner {
border-radius: 3px; border-radius: 3px;
background: #333; background: #333;
border: none; border: none;
} }
.tooltip-arrow{ .tooltip-arrow {
border-bottom-color: #333 !important; border-bottom-color: #333 !important;
} }
.fa{ .fa {
margin: 0 .5em; margin: 0 .5em;
} }
@ -28,8 +28,7 @@ body {
.gogs-masthead { .gogs-masthead {
background-color: #428bca; background-color: #428bca;
box-shadow: inset 0 -2px 5px rgba(0, 0, 0, .1); box-shadow: inset 0 -2px 5px rgba(0, 0, 0, .1);
min-height: 45px; padding: 0 16px;
padding: 2px 16px;
} }
/* gogits nav item link */ /* gogits nav item link */
@ -54,6 +53,14 @@ body {
padding: 5px 15px; padding: 5px 15px;
} }
.gogs-nav-item.navbar-right {
margin-top: 3px;
}
.gogs-nav-item.navbar-right .fa{
margin: 0;
}
/* gogits nav item active status */ /* gogits nav item active status */
.gogs-nav .active { .gogs-nav .active {
color: #fff; color: #fff;
@ -73,19 +80,41 @@ body {
border-left: 5px solid transparent; border-left: 5px solid transparent;
} }
.gogs-nav .tooltip{
border: none;
}
/* gogits logo */ /* gogits logo */
#gogs-logo { #gogs-nav-avatar {
margin-top: 0;
}
#gogs-logo, #gogs-nav-avatar img {
width: 28px; width: 28px;
height: 28px;
}
#gogs-nav-out {
margin-top: 10px;
padding: 5px 0;
margin-left: 10px;
height: 28px;
}
#gogs-nav-out .fa {
vertical-align: -10%;
margin: 0 .5em;
} }
/* gogits body */ /* gogits body */
#gogs-body { #gogs-body {
padding-top: 30px; padding-top: 30px;
padding-bottom: 60px; padding-bottom: 60px;
margin-top: 50px;
} }
/* gogits login card */ /* gogits login card */
.gogs-card{ .gogs-card {
margin: auto; margin: auto;
padding: 30px; padding: 30px;
background: #fff; background: #fff;
@ -101,7 +130,7 @@ body {
border-bottom: 1px solid #ccc; border-bottom: 1px solid #ccc;
} }
#gogs-login-card{ #gogs-login-card {
width: 600px; width: 600px;
} }
@ -115,51 +144,51 @@ body {
line-height: 30px; line-height: 30px;
} }
.gogs-card .btn{ .gogs-card .btn {
cursor: pointer; cursor: pointer;
margin-right: 1.2em; margin-right: 1.2em;
} }
#gogs-social-login{ #gogs-social-login {
margin-top: 30px; margin-top: 30px;
padding-top: 20px; padding-top: 20px;
border-top: 1px solid #ccc; border-top: 1px solid #ccc;
} }
#gogs-social-login .btn{ #gogs-social-login .btn {
float: none; float: none;
margin: auto; margin: auto;
} }
/* gogs-user-profile */ /* gogs-user-profile */
#gogs-user-avatar{ #gogs-user-avatar {
width: 200px; width: 200px;
height: 200px; height: 200px;
border-radius: 6px; border-radius: 6px;
} }
#gogs-user-name{ #gogs-user-name {
margin-top: 20px; margin-top: 20px;
font-size: 1.6em; font-size: 1.6em;
font-weight: bold; font-weight: bold;
margin-bottom: 20px; margin-bottom: 20px;
} }
#gogs-user-profile .profile-info .list-group-item{ #gogs-user-profile .profile-info .list-group-item {
background-color: transparent; background-color: transparent;
padding-top: 18px; padding-top: 18px;
color: #666; color: #666;
} }
#gogs-user-profile .profile-info .list-group-item a{ #gogs-user-profile .profile-info .list-group-item a {
margin: 0; margin: 0;
padding: 0; padding: 0;
display: inline; display: inline;
color: #0093c4; color: #0093c4;
} }
#gogs-user-profile .profile-info .list-group{ #gogs-user-profile .profile-info .list-group {
border-top: 1px solid #ccc; border-top: 1px solid #ccc;
padding-bottom: 18px; padding-bottom: 18px;
border-bottom: 1px solid #ccc; border-bottom: 1px solid #ccc;
@ -167,20 +196,20 @@ body {
padding-right: 18px; padding-right: 18px;
} }
#gogs-user-activity .tab-pane{ #gogs-user-activity .tab-pane {
padding: 20px; padding: 20px;
} }
#gogs-user-act-tabs li.active a{ #gogs-user-act-tabs li.active a {
border-bottom-color: #ddd; border-bottom-color: #ddd;
} }
/* gogits repo create */ /* gogits repo create */
#gogs-repo-create{ #gogs-repo-create {
width: 800px; width: 800px;
} }
#gogs-repo-create textarea[name=desc]{ #gogs-repo-create textarea[name=desc] {
height: 8em; height: 8em;
} }

View File

@ -15,3 +15,8 @@ var Gogits = {};
$(selector).find("li:eq(" + index + ") a").tab("show"); $(selector).find("li:eq(" + index + ") a").tab("show");
} }
})(jQuery); })(jQuery);
function initCore(){
Gogits.showTooltips();
}

View File

@ -25,24 +25,28 @@ func Profile(r render.Render) {
} }
func SignIn(req *http.Request, r render.Render, session sessions.Session) { func SignIn(req *http.Request, r render.Render, session sessions.Session) {
if req.Method == "GET" { var (
r.HTML(200, "user/signin", map[string]interface{}{ errString string
"Title": "Log In", account string
}) )
return if req.Method == "POST" {
} account = req.FormValue("account")
user, err := models.LoginUserPlain(account, req.FormValue("passwd"))
// TODO: LDAP sign in if err == nil {
user, err := models.LoginUserPlain(req.FormValue("account"), req.FormValue("passwd")) // login success
if err != nil {
r.HTML(200, "base/error", map[string]interface{}{
"Error": fmt.Sprintf("%v", err),
})
return
}
session.Set("userId", user.Id) session.Set("userId", user.Id)
session.Set("userName", user.Name) session.Set("userName", user.Name)
r.Redirect("/") r.Redirect("/")
return
}
// login fail
errString = fmt.Sprintf("%v", err)
}
r.HTML(200, "user/signin", map[string]interface{}{
"Title": "Log In",
"Error": errString,
"Account": account,
})
} }
func SignUp(req *http.Request, r render.Render) { func SignUp(req *http.Request, r render.Render) {

View File

@ -1,2 +1,7 @@
</body> <script>
$(function(){
initCore();
});
</script>
</body>
</html> </html>

View File

@ -1,13 +1,18 @@
<div class="gogs-masthead" id="masthead"> <div class="gogs-masthead navbar navbar-fixed-top" id="masthead">
<div class="container"> <div class="container">
<nav class="gogs-nav"> <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 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="#">Dashboard</a>
<a class="gogs-nav-item" href="#">Explore</a> <a class="gogs-nav-item" href="#">Explore</a>
<a class="gogs-nav-item" href="#">Help</a> <a class="gogs-nav-item" href="#">Help</a>
<a class="gogs-nav-item navbar-right navbar-btn btn btn-danger" href="/repo/create">Create a repository</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 navbar-btn btn btn-danger" href="/login/">Sign in</a>-->
<!--<a class="gogs-nav-item navbar-right" href="#">Profile</a>--> <a id="gogs-nav-out" class="gogs-nav-item navbar-right navbar-btn btn btn-danger" href="/login/"><i class="fa fa-power-off fa-lg"></i></a>
<a id="gogs-nav-avatar" class="gogs-nav-item navbar-right" href="/user/profile" data-toggle="tooltip" data-placement="bottom" title="Username">
<img src="http://1.gravatar.com/avatar/x?s=28" alt="user-avatar" title="username"/>
</a>
<a class="navbar-right gogs-nav-item" href="/repo/create" data-toggle="tooltip" data-placement="bottom" title="New Repository"><i class="fa fa-plus fa-lg"></i></a>
<a class="navbar-right gogs-nav-item" href="#" data-toggle="tooltip" data-placement="bottom" title="Setting"><i class="fa fa-cogs fa-lg"></i></a>
</nav> </nav>
</div> </div>
</div> </div>

View File

@ -30,7 +30,6 @@
</div> </div>
<script> <script>
$(function () { $(function () {
Gogits.showTooltips();
Gogits.showTab("#gogs-user-act-tabs"); Gogits.showTab("#gogs-user-act-tabs");
}); });
</script> </script>

View File

@ -2,17 +2,20 @@
{{template "base/navbar" .}} {{template "base/navbar" .}}
<div class="container" id="gogs-body"> <div class="container" id="gogs-body">
<form action="/user/signin" method="post" class="form-horizontal gogs-card" id="gogs-login-card"> <form action="/user/signin" method="post" class="form-horizontal gogs-card" id="gogs-login-card">
<h3>Log in</h3> <h3>Log in</h3>{{if .Error}}
<div class="form-group">
<div class="col-md-6 col-md-offset-3 alert alert-danger text-center"><strong>{{.Error}}</strong></div>
</div>{{end}}
<div class="form-group"> <div class="form-group">
<label class="col-md-4 control-label">Username or Email: </label> <label class="col-md-4 control-label">Username or Email: </label>
<div class="col-md-6"> <div class="col-md-6">
<input name="account" class="form-control" placeholder="Type your username or e-mail address"> <input name="account" class="form-control" placeholder="Type your username or e-mail address" value="{{.Account}}" required="required">
</div> </div>
</div> </div>
<div class="form-group"> <div class="form-group">
<label class="col-md-4 control-label">Password: </label> <label class="col-md-4 control-label">Password: </label>
<div class="col-md-6"> <div class="col-md-6">
<input name="passwd" type="password" class="form-control" placeholder="Type your password"> <input name="passwd" type="password" class="form-control" placeholder="Type your password" required="required">
</div> </div>
</div> </div>
<div class="form-group"> <div class="form-group">