Merge branch 'master' of github.com:gogits/gogs

tokarchuk/v1.17
Lunny Xiao 11 years ago
commit f48fc24670
  1. 6
      conf/app.ini
  2. 2
      gogs.go
  3. 4
      models/git.go
  4. 6
      models/models.go
  5. 1
      models/repo.go
  6. 50
      modules/auth/auth.go
  7. 13
      modules/base/conf.go
  8. 6
      modules/middleware/repo.go
  9. 21
      public/css/gogs.css
  10. 1
      routers/admin/admin.go
  11. 26
      routers/install.go
  12. 23
      routers/repo/issue.go
  13. 2
      serve.go
  14. 1
      templates/admin/config.tmpl
  15. 2
      templates/base/navbar.tmpl
  16. 4
      templates/home.tmpl
  17. 65
      templates/install.tmpl
  18. 32
      templates/issue/view.tmpl
  19. 2
      templates/repo/toolbar.tmpl
  20. 2
      update.go
  21. 2
      web.go

@ -7,7 +7,7 @@ RUN_USER = git
RUN_MODE = dev RUN_MODE = dev
[repository] [repository]
ROOT = /Users/%(RUN_USER)s/git/gogs-repositories ROOT =
LANG_IGNS = Google Go|C|C++|Python|Ruby|C Sharp LANG_IGNS = Google Go|C|C++|Python|Ruby|C Sharp
LICENSES = Apache v2 License|GPL v2|MIT License|Affero GPL|Artistic License 2.0|BSD (3-Clause) License LICENSES = Apache v2 License|GPL v2|MIT License|Affero GPL|Artistic License 2.0|BSD (3-Clause) License
@ -20,7 +20,7 @@ HTTP_PORT = 3000
[database] [database]
; Either "mysql", "postgres" or "sqlite3"(binary release only), it's your choice ; Either "mysql", "postgres" or "sqlite3"(binary release only), it's your choice
DB_TYPE = mysql DB_TYPE = mysql
HOST = HOST = 127.0.0.1:3306
NAME = gogs NAME = gogs
USER = root USER = root
PASSWD = PASSWD =
@ -33,8 +33,6 @@ PATH = data/gogs.db
[security] [security]
INSTALL_LOCK = false INSTALL_LOCK = false
; Use HTTPS to clone repository, otherwise use HTTP.
ENABLE_HTTPS_CLONE = false
; !!CHANGE THIS TO KEEP YOUR USER DATA SAFE!! ; !!CHANGE THIS TO KEEP YOUR USER DATA SAFE!!
SECRET_KEY = !#@FDEWREWR&*( SECRET_KEY = !#@FDEWREWR&*(
; Auto-login remember days ; Auto-login remember days

@ -19,7 +19,7 @@ import (
// Test that go1.2 tag above is included in builds. main.go refers to this definition. // Test that go1.2 tag above is included in builds. main.go refers to this definition.
const go12tag = true const go12tag = true
const APP_VER = "0.1.9.0327 Alpha" const APP_VER = "0.1.9.0328 Alpha"
func init() { func init() {
base.AppVer = APP_VER base.AppVer = APP_VER

@ -244,11 +244,11 @@ func GetCommitsByCommitId(userName, repoName, commitId string) (*list.List, erro
if err != nil { if err != nil {
return nil, err return nil, err
} }
r, err := repo.LookupReference(commitId) oid, err := git.NewOidFromString(commitId)
if err != nil { if err != nil {
return nil, err return nil, err
} }
return r.AllCommits() return repo.CommitsBefore(oid)
} }
// Diff line types. // Diff line types.

@ -34,11 +34,11 @@ func LoadModelsConfig() {
DbCfg.Path = base.Cfg.MustValue("database", "PATH", "data/gogs.db") DbCfg.Path = base.Cfg.MustValue("database", "PATH", "data/gogs.db")
} }
func setEngine() { func SetEngine() {
var err error var err error
switch DbCfg.Type { switch DbCfg.Type {
case "mysql": case "mysql":
orm, err = xorm.NewEngine("mysql", fmt.Sprintf("%s:%s@%s/%s?charset=utf8", orm, err = xorm.NewEngine("mysql", fmt.Sprintf("%s:%s@tcp(%s)/%s?charset=utf8",
DbCfg.User, DbCfg.Pwd, DbCfg.Host, DbCfg.Name)) DbCfg.User, DbCfg.Pwd, DbCfg.Host, DbCfg.Name))
case "postgres": case "postgres":
orm, err = xorm.NewEngine("postgres", fmt.Sprintf("user=%s password=%s dbname=%s sslmode=%s", orm, err = xorm.NewEngine("postgres", fmt.Sprintf("user=%s password=%s dbname=%s sslmode=%s",
@ -70,7 +70,7 @@ func setEngine() {
} }
func NewEngine() { func NewEngine() {
setEngine() SetEngine()
if err := orm.Sync(new(User), new(PublicKey), new(Repository), new(Watch), if err := orm.Sync(new(User), new(PublicKey), new(Repository), new(Watch),
new(Action), new(Access), new(Issue), new(Comment)); err != nil { new(Action), new(Access), new(Issue), new(Comment)); err != nil {
fmt.Printf("sync database struct error: %v\n", err) fmt.Printf("sync database struct error: %v\n", err)

@ -510,6 +510,7 @@ func NotifyWatchers(act *Action) error {
continue continue
} }
act.Id = 0
act.UserId = watches[i].UserId act.UserId = watches[i].UserId
if _, err = orm.InsertOne(act); err != nil { if _, err = orm.InsertOne(act); err != nil {
return errors.New("repo.NotifyWatchers(create action): " + err.Error()) return errors.New("repo.NotifyWatchers(create action): " + err.Error())

@ -161,3 +161,53 @@ func AssignForm(form interface{}, data base.TmplData) {
data[fieldName] = val.Field(i).Interface() data[fieldName] = val.Field(i).Interface()
} }
} }
type InstallForm struct {
Database string `form:"database" binding:"Required"`
Host string `form:"host"`
User string `form:"user"`
Passwd string `form:"passwd"`
DatabaseName string `form:"database_name"`
SslMode string `form:"ssl_mode"`
DatabasePath string `form:"database_path"`
RepoRootPath string `form:"repo_path"`
RunUser string `form:"run_user"`
AppUrl string `form:"app_url"`
AdminName string `form:"admin_name" binding:"Required"`
AdminPasswd string `form:"admin_pwd" binding:"Required;MinSize(6);MaxSize(30)"`
AdminEmail string `form:"admin_email" binding:"Required;Email;MaxSize(50)"`
SmtpHost string `form:"smtp_host"`
SmtpEmail string `form:"mailer_user"`
SmtpPasswd string `form:"mailer_pwd"`
RegisterConfirm string `form:"register_confirm"`
MailNotify string `form:"mail_notify"`
}
func (f *InstallForm) Name(field string) string {
names := map[string]string{
"Database": "Database name",
"AdminName": "Admin user name",
"AdminPasswd": "Admin password",
"AdminEmail": "Admin e-maill address",
}
return names[field]
}
func (f *InstallForm) Validate(errors *binding.Errors, req *http.Request, context martini.Context) {
if req.Method == "GET" || errors.Count() == 0 {
return
}
data := context.Get(reflect.TypeOf(base.TmplData{})).Interface().(base.TmplData)
data["HasError"] = true
AssignForm(f, data)
if len(errors.Overall) > 0 {
for _, err := range errors.Overall {
log.Error("InstallForm.Validate: %v", err)
}
return
}
validate(errors, data, f)
}

@ -38,7 +38,7 @@ var (
RunUser string RunUser string
RepoRootPath string RepoRootPath string
EnableHttpsClone bool InstallLock bool
LogInRememberDays int LogInRememberDays int
CookieUserName string CookieUserName string
@ -282,7 +282,7 @@ func NewConfigContext() {
os.Exit(2) os.Exit(2)
} }
EnableHttpsClone = Cfg.MustBool("security", "ENABLE_HTTPS_CLONE", false) InstallLock = Cfg.MustBool("security", "INSTALL_LOCK", false)
LogInRememberDays = Cfg.MustInt("security", "LOGIN_REMEMBER_DAYS") LogInRememberDays = Cfg.MustInt("security", "LOGIN_REMEMBER_DAYS")
CookieUserName = Cfg.MustValue("security", "COOKIE_USERNAME") CookieUserName = Cfg.MustValue("security", "COOKIE_USERNAME")
@ -291,9 +291,14 @@ func NewConfigContext() {
PictureService = Cfg.MustValue("picture", "SERVICE") PictureService = Cfg.MustValue("picture", "SERVICE")
// Determine and create root git reposiroty path. // Determine and create root git reposiroty path.
RepoRootPath = Cfg.MustValue("repository", "ROOT") homeDir, err := com.HomeDir()
if err != nil {
fmt.Printf("Fail to get home directory): %v\n", err)
os.Exit(2)
}
RepoRootPath = Cfg.MustValue("repository", "ROOT", filepath.Join(homeDir, "git/gogs-repositories"))
if err = os.MkdirAll(RepoRootPath, os.ModePerm); err != nil { if err = os.MkdirAll(RepoRootPath, os.ModePerm); err != nil {
fmt.Printf("models.init(fail to create RepoRootPath(%s)): %v\n", RepoRootPath, err) fmt.Printf("Fail to create RepoRootPath(%s): %v\n", RepoRootPath, err)
os.Exit(2) os.Exit(2)
} }
} }

@ -71,12 +71,8 @@ func RepoAssignment(redirect bool) martini.Handler {
ctx.Repo.IsWatching = models.IsWatching(ctx.User.Id, repo.Id) ctx.Repo.IsWatching = models.IsWatching(ctx.User.Id, repo.Id)
} }
ctx.Repo.Repository = repo ctx.Repo.Repository = repo
scheme := "http"
if base.EnableHttpsClone {
scheme = "https"
}
ctx.Repo.CloneLink.SSH = fmt.Sprintf("%s@%s:%s/%s.git", base.RunUser, base.Domain, user.LowerName, repo.LowerName) ctx.Repo.CloneLink.SSH = fmt.Sprintf("%s@%s:%s/%s.git", base.RunUser, base.Domain, user.LowerName, repo.LowerName)
ctx.Repo.CloneLink.HTTPS = fmt.Sprintf("%s://%s/%s/%s.git", scheme, base.Domain, user.LowerName, repo.LowerName) ctx.Repo.CloneLink.HTTPS = fmt.Sprintf("%s%s/%s.git", base.AppUrl, user.LowerName, repo.LowerName)
if len(params["branchname"]) == 0 { if len(params["branchname"]) == 0 {
params["branchname"] = "master" params["branchname"] = "master"

@ -856,6 +856,7 @@ html, body {
.commit-list .sha a { .commit-list .sha a {
font-family: Consolas, Menlo, Monaco, "Lucida Console", monospace; font-family: Consolas, Menlo, Monaco, "Lucida Console", monospace;
font-size: 14px;
} }
.guide-box pre, .guide-box .input-group { .guide-box pre, .guide-box .input-group {
@ -1165,7 +1166,7 @@ html, body {
font-weight: normal; font-weight: normal;
} }
#issue .issue-child .panel-heading .user { #issue .issue-child .panel-heading .user,#issue .issue-closed a.user,#issue .issue-opened a.user {
font-weight: bold; font-weight: bold;
} }
@ -1173,6 +1174,10 @@ html, body {
border-color: #CCC; border-color: #CCC;
} }
#issue .issue-is-closed .issue-line{
display: none;
}
#issue .issue-head .info .btn { #issue .issue-head .info .btn {
margin-top: -8px; margin-top: -8px;
margin-left: 8px; margin-left: 8px;
@ -1188,6 +1193,20 @@ html, body {
width: 60%; width: 60%;
} }
#issue .issue-closed .issue-content,#issue .issue-opened .issue-content{
line-height: 42px;
}
#issue .issue-closed{
border-bottom: 3px solid #CCC;
margin-bottom: 24px;
padding-bottom: 24px;
}
#issue .issue-closed .btn-danger,#issue .issue-opened .btn-success{
margin: 0 .8em;
}
/* wrapper and footer */ /* wrapper and footer */
#wrapper { #wrapper {

@ -141,7 +141,6 @@ func Config(ctx *middleware.Context) {
ctx.Data["Domain"] = base.Domain ctx.Data["Domain"] = base.Domain
ctx.Data["RunUser"] = base.RunUser ctx.Data["RunUser"] = base.RunUser
ctx.Data["RunMode"] = strings.Title(martini.Env) ctx.Data["RunMode"] = strings.Title(martini.Env)
ctx.Data["EnableHttpsClone"] = base.EnableHttpsClone
ctx.Data["RepoRootPath"] = base.RepoRootPath ctx.Data["RepoRootPath"] = base.RepoRootPath
ctx.Data["Service"] = base.Service ctx.Data["Service"] = base.Service

@ -4,10 +4,30 @@
package routers package routers
import "github.com/gogits/gogs/modules/middleware" import (
"errors"
"github.com/gogits/gogs/models"
"github.com/gogits/gogs/modules/auth"
"github.com/gogits/gogs/modules/base"
"github.com/gogits/gogs/modules/middleware"
)
func Install(ctx *middleware.Context, form auth.InstallForm) {
if base.InstallLock {
ctx.Handle(404, "install.Install", errors.New("Installation is prohibited"))
return
}
func Install(ctx *middleware.Context){
ctx.Data["PageIsInstall"] = true
ctx.Data["Title"] = "Install" ctx.Data["Title"] = "Install"
ctx.Data["DbCfg"] = models.DbCfg
ctx.Data["RepoRootPath"] = base.RepoRootPath
ctx.Data["RunUser"] = base.RunUser
ctx.Data["AppUrl"] = base.AppUrl
ctx.Data["PageIsInstall"] = true
if ctx.Req.Method == "GET" {
ctx.HTML(200, "install") ctx.HTML(200, "install")
return
}
} }

@ -40,9 +40,7 @@ func Issues(ctx *middleware.Context) {
ctx.Redirect("/user/login/", 302) ctx.Redirect("/user/login/", 302)
return return
} }
posterId = ctx.User.Id
ctx.Data["ViewType"] = "created_by" ctx.Data["ViewType"] = "created_by"
ctx.Data["IssueCreatedCount"] = models.GetUserIssueCount(posterId, ctx.Repo.Repository.Id)
} }
// Get issues. // Get issues.
@ -53,6 +51,11 @@ func Issues(ctx *middleware.Context) {
return return
} }
if ctx.IsSigned {
posterId = ctx.User.Id
}
var createdByCount int
// Get posters. // Get posters.
for i := range issues { for i := range issues {
u, err := models.GetUserById(issues[i].PosterId) u, err := models.GetUserById(issues[i].PosterId)
@ -61,12 +64,16 @@ func Issues(ctx *middleware.Context) {
return return
} }
issues[i].Poster = u issues[i].Poster = u
if u.Id == posterId {
createdByCount++
}
} }
ctx.Data["Issues"] = issues ctx.Data["Issues"] = issues
ctx.Data["IssueCount"] = ctx.Repo.Repository.NumIssues ctx.Data["IssueCount"] = ctx.Repo.Repository.NumIssues
ctx.Data["OpenCount"] = ctx.Repo.Repository.NumIssues - ctx.Repo.Repository.NumClosedIssues ctx.Data["OpenCount"] = ctx.Repo.Repository.NumIssues - ctx.Repo.Repository.NumClosedIssues
ctx.Data["ClosedCount"] = ctx.Repo.Repository.NumClosedIssues ctx.Data["ClosedCount"] = ctx.Repo.Repository.NumClosedIssues
ctx.Data["IssueCreatedCount"] = createdByCount
ctx.Data["IsShowClosed"] = ctx.Query("state") == "closed" ctx.Data["IsShowClosed"] = ctx.Query("state") == "closed"
ctx.HTML(200, "issue/list") ctx.HTML(200, "issue/list")
} }
@ -224,6 +231,12 @@ func Comment(ctx *middleware.Context, params martini.Params) {
return return
} }
content := ctx.Query("content")
if len(content) == 0 {
ctx.Redirect(fmt.Sprintf("/%s/%s/issues/%d", ctx.User.Name, ctx.Repo.Repository.Name, index))
return
}
issue, err := models.GetIssueByIndex(ctx.Repo.Repository.Id, int64(index)) issue, err := models.GetIssueByIndex(ctx.Repo.Repository.Id, int64(index))
if err != nil { if err != nil {
if err == models.ErrIssueNotExist { if err == models.ErrIssueNotExist {
@ -234,12 +247,6 @@ func Comment(ctx *middleware.Context, params martini.Params) {
return return
} }
content := ctx.Query("content")
if len(content) == 0 {
ctx.Handle(404, "issue.Comment", err)
return
}
switch params["action"] { switch params["action"] {
case "new": case "new":
if err = models.CreateComment(ctx.User.Id, issue.Id, 0, 0, content); err != nil { if err = models.CreateComment(ctx.User.Id, issue.Id, 0, 0, content); err != nil {

@ -78,7 +78,7 @@ func runServ(k *cli.Context) {
base.NewConfigContext() base.NewConfigContext()
models.LoadModelsConfig() models.LoadModelsConfig()
models.NewEngine() models.SetEngine()
keys := strings.Split(os.Args[2], "-") keys := strings.Split(os.Args[2], "-")
if len(keys) != 2 { if len(keys) != 2 {

@ -17,7 +17,6 @@
<div><b>Run User:</b> {{.RunUser}}</div> <div><b>Run User:</b> {{.RunUser}}</div>
<div><b>Run Mode:</b> {{.RunMode}}</div> <div><b>Run Mode:</b> {{.RunMode}}</div>
<hr/> <hr/>
<div><b>Enable HTTPS Clone</b> <i class="fa fa{{if .EnableHttpsClone}}-check{{end}}-square-o"></i></div>
<div><b>Repository Root Path:</b> {{.RepoRootPath}}</div> <div><b>Repository Root Path:</b> {{.RepoRootPath}}</div>
</div> </div>
</div> </div>

@ -3,7 +3,7 @@
<nav class="nav"> <nav class="nav">
<a id="nav-logo" class="nav-item{{if .PageIsHome}} active{{end}}" href="/"><img src="/img/favicon.png" alt="Gogs Logo" id="logo"></a> <a id="nav-logo" class="nav-item{{if .PageIsHome}} active{{end}}" href="/"><img src="/img/favicon.png" alt="Gogs Logo" id="logo"></a>
<a class="nav-item{{if .PageIsUserDashboard}} active{{end}}" href="/">Dashboard</a> <a class="nav-item{{if .PageIsUserDashboard}} active{{end}}" href="/">Dashboard</a>
<a class="nav-item{{if .PageIsHelp}} active{{end}}" href="/help">Help</a>{{if .IsSigned}} <a class="nav-item{{if .PageIsHelp}} active{{end}}" href="https://github.com/gogits/gogs/wiki">Help</a>{{if .IsSigned}}
<a id="nav-out" class="nav-item navbar-right navbar-btn btn btn-danger" href="/user/logout/"><i class="fa fa-power-off fa-lg"></i></a> <a id="nav-out" class="nav-item navbar-right navbar-btn btn btn-danger" href="/user/logout/"><i class="fa fa-power-off fa-lg"></i></a>
<a id="nav-avatar" class="nav-item navbar-right{{if .PageIsUserProfile}} active{{end}}" href="{{.SignedUser.HomeLink}}" data-toggle="tooltip" data-placement="bottom" title="{{.SignedUserName}}"> <a id="nav-avatar" class="nav-item navbar-right{{if .PageIsUserProfile}} active{{end}}" href="{{.SignedUser.HomeLink}}" data-toggle="tooltip" data-placement="bottom" title="{{.SignedUserName}}">
<img src="{{.SignedUser.AvatarLink}}?s=28" alt="user-avatar" title="username"/> <img src="{{.SignedUser.AvatarLink}}?s=28" alt="user-avatar" title="username"/>

@ -1,6 +1,8 @@
{{template "base/head" .}} {{template "base/head" .}}
{{template "base/navbar" .}} {{template "base/navbar" .}}
<div id="body" class="container"> <div id="body" class="container">
Welcome to the land of Gogs! We will add an introduction soon! <h4>Hey there, welcome to the land of Gogs!</h4>
<p>If you just get your Gogs server running, go <a href="/install">install</a> guide page will help you setup things for your first-time run.</p>
<img src="http://gowalker.org/public/gogs_demo.gif">
</div> </div>
{{template "base/footer" .}} {{template "base/footer" .}}

@ -12,7 +12,7 @@
<select name="database" id="install-database" class="form-control"> <select name="database" id="install-database" class="form-control">
<option value="mysql">MySQL</option> <option value="mysql">MySQL</option>
<option value="pgsql">PostgreSQL</option> <option value="pgsql">PostgreSQL</option>
<option value="sqlite">SQLite</option> <option value="sqlite">SQLite3</option>
</select> </select>
</div> </div>
</div> </div>
@ -21,28 +21,21 @@
<label class="col-md-3 control-label">Host: </label> <label class="col-md-3 control-label">Host: </label>
<div class="col-md-8"> <div class="col-md-8">
<input name="host" class="form-control" placeholder="Type mysql server ip or domain" value="localhost" required="required"> <input name="host" class="form-control" placeholder="Type database server host, leave blank to keep default" value="{{.DbCfg.Host}}" required="required">
</div>
</div>
<div class="form-group">
<label class="col-md-3 control-label">Port: </label>
<div class="col-md-8">
<input name="port" class="form-control" placeholder="Type mysql server port" value="3306" required="required">
</div> </div>
</div> </div>
<div class="form-group"> <div class="form-group">
<label class="col-md-3 control-label">User: </label> <label class="col-md-3 control-label">User: </label>
<div class="col-md-8"> <div class="col-md-8">
<input name="user" class="form-control" placeholder="Type mysql username" required="required"> <input name="user" class="form-control" placeholder="Type database username" required="required" value="{{.DbCfg.User}}">
</div> </div>
</div> </div>
<div class="form-group"> <div class="form-group">
<label class="col-md-3 control-label">Password: </label> <label class="col-md-3 control-label">Password: </label>
<div class="col-md-8"> <div class="col-md-8">
<input name="passwd" type="password" class="form-control" placeholder="Type mysql password" required="required"> <input name="passwd" type="password" class="form-control" placeholder="Type database password" required="required" value="{{.DbCfg.Pwd}}">
</div> </div>
</div> </div>
@ -50,7 +43,7 @@
<label class="col-md-3 control-label">Database Name: </label> <label class="col-md-3 control-label">Database Name: </label>
<div class="col-md-8"> <div class="col-md-8">
<input name="database" type="text" class="form-control" placeholder="Type mysql database name" value="gogs" required="required"> <input name="database_name" type="text" class="form-control" placeholder="Type mysql database name" value="{{.DbCfg.Name}}" required="required">
<p class="help-block">Recommend use INNODB engine with utf8_general_ci charset.</p> <p class="help-block">Recommend use INNODB engine with utf8_general_ci charset.</p>
</div> </div>
</div> </div>
@ -71,18 +64,12 @@
<label class="col-md-3 control-label">Path: </label> <label class="col-md-3 control-label">Path: </label>
<div class="col-md-8"> <div class="col-md-8">
<input name="path" class="form-control" placeholder="Type sqlite file path" value="xxx/file.db"> <input name="database_path" class="form-control" placeholder="Type sqlite3 file path" value="{{.DbCfg.Path}}">
<p class="help-block">The file path of SQLite database.</p> <p class="help-block">The file path of SQLite3 database.</p>
</div> </div>
</div> </div>
</div> </div>
<!-- <div class="form-group">
<div class="col-md-8 col-md-offset-3">
<button class="btn btn-sm btn-info">Test Connection</button>
</div>
</div> -->
<hr/> <hr/>
<p class="help-block text-center">General Settings of Gogs</p> <p class="help-block text-center">General Settings of Gogs</p>
@ -91,20 +78,30 @@
<label class="col-md-3 control-label">Repository Path: </label> <label class="col-md-3 control-label">Repository Path: </label>
<div class="col-md-8"> <div class="col-md-8">
<input name="repo-path" type="text" class="form-control" placeholder="Type your repository directory" value="/var/gogs/repostiory" required="required"> <input name="repo_path" type="text" class="form-control" placeholder="Type your repository directory" value="{{.RepoRootPath}}" required="required">
<p class="help-block">The git copy of each repository is saved in this directory.</p> <p class="help-block">The git copy of each repository is saved in this directory.</p>
</div> </div>
</div> </div>
<div class="form-group"> <div class="form-group">
<label class="col-md-3 control-label">Run User: </label> <label class="col-md-3 control-label">Run User: </label>
<div class="col-md-8"> <div class="col-md-8">
<input name="system-user" type="text" class="form-control" placeholder="Type mysql password" value="root" required="required"> <input name="run_user" type="text" class="form-control" placeholder="Type system user name" value="{{.RunUser}}" required="required">
<p class="help-block">The user has access to visit and run Gogs.</p> <p class="help-block">The user has access to visit and run Gogs.</p>
</div> </div>
</div> </div>
<div class="form-group">
<label class="col-md-3 control-label">App URL: </label>
<div class="col-md-8">
<input name="app_url" type="text" class="form-control" placeholder="Type app root URL " value="{{.AppUrl}}" required="required">
<p class="help-block">This affects HTTP/HTTPS clone URL and somewhere in e-mail.</p>
</div>
</div>
<hr/> <hr/>
<p class="help-block text-center">Admin Account Settings</p> <p class="help-block text-center">Admin Account Settings</p>
@ -113,20 +110,30 @@
<label class="col-md-3 control-label">Username: </label> <label class="col-md-3 control-label">Username: </label>
<div class="col-md-8"> <div class="col-md-8">
<input name="repo-path" type="text" class="form-control" placeholder="Type admin user name" value="admin" required="required"> <input name="admin_name" type="text" class="form-control" placeholder="Type admin user name" value="admin" required="required">
</div> </div>
</div> </div>
<div class="form-group"> <div class="form-group">
<label class="col-md-3 control-label">Password: </label> <label class="col-md-3 control-label">Password: </label>
<div class="col-md-8"> <div class="col-md-8">
<input name="system-user" type="password" class="form-control" placeholder="Type admin user password" required="required"> <input name="admin_pwd" type="password" class="form-control" placeholder="Type admin user password" required="required">
</div>
</div>
<div class="form-group">
<label class="col-md-3 control-label">E-mail: </label>
<div class="col-md-8">
<input name="admin_email" type="text" class="form-control" placeholder="Type admin user e-mail" required="required">
</div> </div>
</div> </div>
<hr/> <hr/>
<div class="form-group text-center"> <div class="form-group text-center">
<button class="btn btn-primary btn-lg">Test Configuration</button>
<button class="btn btn-danger btn-lg">Install Gogs</button> <button class="btn btn-danger btn-lg">Install Gogs</button>
<button class="btn btn-default btn-sm" type="button" data-toggle="modal" data-target="#advance-options-modal"> <button class="btn btn-default btn-sm" type="button" data-toggle="modal" data-target="#advance-options-modal">
Advanced Options Advanced Options
@ -144,21 +151,21 @@
<label class="col-md-3 control-label">SMTP Host: </label> <label class="col-md-3 control-label">SMTP Host: </label>
<div class="col-md-8"> <div class="col-md-8">
<input name="repo-path" type="text" class="form-control" placeholder="Type admin user name"> <input name="smtp_host" type="text" class="form-control" placeholder="Type SMTP host address">
</div> </div>
</div> </div>
<div class="form-group"> <div class="form-group">
<label class="col-md-3 control-label">Email: </label> <label class="col-md-3 control-label">Email: </label>
<div class="col-md-8"> <div class="col-md-8">
<input name="repo-path" type="text" class="form-control" placeholder="Type admin user name"> <input name="mailer_user" type="text" class="form-control" placeholder="Type SMTP user e-mail address">
</div> </div>
</div> </div>
<div class="form-group"> <div class="form-group">
<label class="col-md-3 control-label">Password: </label> <label class="col-md-3 control-label">Password: </label>
<div class="col-md-8"> <div class="col-md-8">
<input name="system-user" type="password" class="form-control" placeholder="Type admin user password"> <input name="mailer_pwd" type="password" class="form-control" placeholder="Type SMTP user password">
</div> </div>
</div> </div>
<hr/> <hr/>
@ -168,7 +175,7 @@
<div class="col-md-offset-3 col-md-7"> <div class="col-md-offset-3 col-md-7">
<div class="checkbox"> <div class="checkbox">
<label> <label>
<input name="system-user" type="checkbox"> <input name="register_confirm" type="checkbox">
<strong>Enable Register Confirmation</strong> <strong>Enable Register Confirmation</strong>
</label> </label>
</div> </div>
@ -179,7 +186,7 @@
<div class="col-md-offset-3 col-md-7"> <div class="col-md-offset-3 col-md-7">
<div class="checkbox"> <div class="checkbox">
<label> <label>
<input name="system-user" type="checkbox"> <input name="mail_notify" type="checkbox">
<strong>Enable Mail Notification</strong> <strong>Enable Mail Notification</strong>
</label> </label>
</div> </div>

@ -4,14 +4,14 @@
{{template "repo/toolbar" .}} {{template "repo/toolbar" .}}
<div id="body" class="container"> <div id="body" class="container">
<div id="issue"> <div id="issue">
<div id="issue-{issue.id}" class="issue-whole"> <div id="issue-{issue.id}" class="issue-whole issue-is-opening">
<div class="issue-head clearfix"> <div class="issue-head clearfix">
<div class="number pull-right">#{{.Issue.Index}}</div> <div class="number pull-right">#{{.Issue.Index}}</div>
<a class="author pull-left" href="/user/{{.Issue.Poster.Name}}"><img class="avatar" src="{{.Issue.Poster.AvatarLink}}" alt="" width="30"/></a> <a class="author pull-left" href="/user/{{.Issue.Poster.Name}}"><img class="avatar" src="{{.Issue.Poster.AvatarLink}}" alt="" width="30"/></a>
<h1 class="title pull-left">{{.Issue.Name}}</h1> <h1 class="title pull-left">{{.Issue.Name}}</h1>
<input id="issue-edit-title" class="form-control input-lg pull-left hidden" type="text" value="{issue.title}" data-ajax-rel="issue-save"/> <input id="issue-edit-title" class="form-control input-lg pull-left hidden" type="text" value="{issue.title}" data-ajax-rel="issue-save"/>
<p class="info pull-left"> <p class="info pull-left">
<a class="btn btn-default pull-right issue-edit" href="#" id="issue-edit-btn">Edit</a> <!-- <a class="btn btn-default pull-right issue-edit" href="#" id="issue-edit-btn">Edit</a> -->
<a class="btn btn-danger pull-right issue-edit-cancel hidden" href="#">Cancel</a> <a class="btn btn-danger pull-right issue-edit-cancel hidden" href="#">Cancel</a>
<a class="btn btn-primary pull-right issue-edit-save hidden" href="#" data-ajax="{issue.save.link}" data-ajax-name="issue-save">Save</a> <a class="btn btn-primary pull-right issue-edit-save hidden" href="#" data-ajax="{issue.save.link}" data-ajax-name="issue-save">Save</a>
<span class="status label label-{{if .Issue.IsClosed}}danger{{else}}success{{end}}">{{if .Issue.IsClosed}}Closed{{else}}Open{{end}}</span> <span class="status label label-{{if .Issue.IsClosed}}danger{{else}}success{{end}}">{{if .Issue.IsClosed}}Closed{{else}}Open{{end}}</span>
@ -34,8 +34,8 @@
<div class="issue-content panel panel-default"> <div class="issue-content panel panel-default">
<div class="panel-heading"> <div class="panel-heading">
<a href="/user/{{.Poster.Name}}" class="user">{{.Poster.Name}}</a> commented <span class="time">{{TimeSince .Created}}</span> <a href="/user/{{.Poster.Name}}" class="user">{{.Poster.Name}}</a> commented <span class="time">{{TimeSince .Created}}</span>
<a class="issue-comment-del pull-right issue-action" href="#" title="Edit Comment"><i class="fa fa-times-circle"></i></a> <!-- <a class="issue-comment-del pull-right issue-action" href="#" title="Edit Comment"><i class="fa fa-times-circle"></i></a>
<a class="issue-comment-edit pull-right issue-action" href="#" title="Remove Comment" data-url="{remove-link}"><i class="fa fa-edit"></i></a> <a class="issue-comment-edit pull-right issue-action" href="#" title="Remove Comment" data-url="{remove-link}"><i class="fa fa-edit"></i></a> -->
<span class="role label label-default pull-right">Owner</span> <span class="role label label-default pull-right">Owner</span>
</div> </div>
<div class="panel-body markdown"> <div class="panel-body markdown">
@ -44,6 +44,22 @@
</div> </div>
</div> </div>
{{end}} {{end}}
<!-- <div class="issue-child issue-closed">
<a class="user pull-left" href="{user.link}"><img class="avatar" src="{user.avatar}" alt=""/></a>
<div class="issue-content">
<a class="user pull-left" href="{user.link}">{user.name}</a>
<span class="btn btn-danger">Closed</span> this
<span class="time">{close.time}</span>
</div>
</div>
<div class="issue-child issue-opened">
<a class="user pull-left" href="{user.link}"><img class="avatar" src="{user.avatar}" alt=""/></a>
<div class="issue-content">
<a class="user pull-left" href="{user.link}">{user.name}</a>
<span class="btn btn-success">Reopened</span> this
<span class="time">{close.time}</span>
</div>
</div> -->
<hr class="issue-line"/> <hr class="issue-line"/>
<div class="issue-child issue-reply"> <div class="issue-child issue-reply">
<a class="user pull-left" href="/user/{{.SignedUser.Name}}"><img class="avatar" src="{{.SignedUser.AvatarLink}}" alt=""/></a> <a class="user pull-left" href="/user/{{.SignedUser.Name}}"><img class="avatar" src="{{.SignedUser.AvatarLink}}" alt=""/></a>
@ -70,9 +86,11 @@
</div> </div>
<div class="text-right"> <div class="text-right">
<div class="form-group"> <div class="form-group">
<input type="hidden" value="id" name="repo-id"/> {{if .Issue.IsClosed}}
<button class="btn-default btn issue-open" id="issue-open-btn" data-origin="Open" data-text="Open & Comment">Open</button>&nbsp;&nbsp; <input type="hidden" value="reopen" name="change_status"/>
<button class="btn-default btn issue-close" id="issue-close-btn" data-origin="Close" data-text="Close & Comment">Close</button>&nbsp;&nbsp; <button class="btn-default btn issue-open" id="issue-open-btn" data-origin="Re-Open" data-text="Re-Open & Comment">Reopen</button>{{else}}
<input type="hidden" value="close" name="change_status"/>
<button class="btn-default btn issue-close" id="issue-close-btn" data-origin="Close" data-text="Close & Comment">Close</button>{{end}}&nbsp;&nbsp;
<button class="btn-success btn" id="issue-reply-btn">Comment</button> <button class="btn-success btn" id="issue-reply-btn">Comment</button>
</div> </div>
</div> </div>

@ -5,7 +5,7 @@
<ul class="nav navbar-nav"> <ul class="nav navbar-nav">
<li class="{{if .IsRepoToolbarSource}}active{{end}}"><a href="/{{.RepositoryLink}}">Source</a></li> <li class="{{if .IsRepoToolbarSource}}active{{end}}"><a href="/{{.RepositoryLink}}">Source</a></li>
{{if not .IsBareRepo}} {{if not .IsBareRepo}}
{{if .IsViewBranch}}<li class="{{if .IsRepoToolbarCommits}}active{{end}}"><a href="/{{.RepositoryLink}}/commits/{{.Branchname}}">Commits</a></li>{{end}} <li class="{{if .IsRepoToolbarCommits}}active{{end}}"><a href="/{{.RepositoryLink}}/commits/{{.Branchname}}">Commits</a></li>
<!-- <li class="{{if .IsRepoToolbarBranches}}active{{end}}"><a href="/{{.RepositoryLink}}/branches">Branches</a></li> --> <!-- <li class="{{if .IsRepoToolbarBranches}}active{{end}}"><a href="/{{.RepositoryLink}}/branches">Branches</a></li> -->
<!-- <li class="{{if .IsRepoToolbarPulls}}active{{end}}"><a href="/{{.RepositoryLink}}/pulls">Pull Requests</a></li> --> <!-- <li class="{{if .IsRepoToolbarPulls}}active{{end}}"><a href="/{{.RepositoryLink}}/pulls">Pull Requests</a></li> -->
<li class="{{if .IsRepoToolbarIssues}}active{{end}}"><a href="/{{.RepositoryLink}}/issues">Issues <!--<span class="badge">42</span>--></a></li> <li class="{{if .IsRepoToolbarIssues}}active{{end}}"><a href="/{{.RepositoryLink}}/issues">Issues <!--<span class="badge">42</span>--></a></li>

@ -32,7 +32,7 @@ gogs serv provide access auth for repositories`,
func runUpdate(c *cli.Context) { func runUpdate(c *cli.Context) {
base.NewConfigContext() base.NewConfigContext()
models.LoadModelsConfig() models.LoadModelsConfig()
models.NewEngine() models.SetEngine()
w, _ := os.Create("update.log") w, _ := os.Create("update.log")
defer w.Close() defer w.Close()

@ -90,7 +90,7 @@ func runWeb(*cli.Context) {
// Routers. // Routers.
m.Get("/", ignSignIn, routers.Home) m.Get("/", ignSignIn, routers.Home)
m.Get("/install", routers.Install) m.Any("/install", routers.Install)
m.Get("/issues", reqSignIn, user.Issues) m.Get("/issues", reqSignIn, user.Issues)
m.Get("/pulls", reqSignIn, user.Pulls) m.Get("/pulls", reqSignIn, user.Pulls)
m.Get("/stars", reqSignIn, user.Stars) m.Get("/stars", reqSignIn, user.Stars)

Loading…
Cancel
Save