diff options
-rw-r--r-- | conf/app.ini | 6 | ||||
-rw-r--r-- | gogs.go | 2 | ||||
-rw-r--r-- | models/git.go | 4 | ||||
-rw-r--r-- | models/models.go | 6 | ||||
-rw-r--r-- | models/repo.go | 1 | ||||
-rw-r--r-- | modules/auth/auth.go | 50 | ||||
-rw-r--r-- | modules/base/conf.go | 13 | ||||
-rw-r--r-- | modules/middleware/repo.go | 6 | ||||
-rwxr-xr-x | public/css/gogs.css | 21 | ||||
-rw-r--r-- | routers/admin/admin.go | 1 | ||||
-rw-r--r-- | routers/install.go | 28 | ||||
-rw-r--r-- | routers/repo/issue.go | 23 | ||||
-rw-r--r-- | serve.go | 2 | ||||
-rw-r--r-- | templates/admin/config.tmpl | 1 | ||||
-rw-r--r-- | templates/base/navbar.tmpl | 2 | ||||
-rw-r--r-- | templates/home.tmpl | 4 | ||||
-rw-r--r-- | templates/install.tmpl | 65 | ||||
-rw-r--r-- | templates/issue/view.tmpl | 32 | ||||
-rw-r--r-- | templates/repo/toolbar.tmpl | 4 | ||||
-rw-r--r-- | update.go | 2 | ||||
-rw-r--r-- | web.go | 2 |
21 files changed, 198 insertions, 77 deletions
diff --git a/conf/app.ini b/conf/app.ini index d988b4acbc..abc27c39c4 100644 --- a/conf/app.ini +++ b/conf/app.ini @@ -7,7 +7,7 @@ RUN_USER = git RUN_MODE = dev [repository] -ROOT = /Users/%(RUN_USER)s/git/gogs-repositories +ROOT = 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 @@ -20,7 +20,7 @@ HTTP_PORT = 3000 [database] ; Either "mysql", "postgres" or "sqlite3"(binary release only), it's your choice DB_TYPE = mysql -HOST = +HOST = 127.0.0.1:3306 NAME = gogs USER = root PASSWD = @@ -33,8 +33,6 @@ PATH = data/gogs.db [security] INSTALL_LOCK = false -; Use HTTPS to clone repository, otherwise use HTTP. -ENABLE_HTTPS_CLONE = false ; !!CHANGE THIS TO KEEP YOUR USER DATA SAFE!! SECRET_KEY = !#@FDEWREWR&*( ; 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. const go12tag = true -const APP_VER = "0.1.9.0327 Alpha" +const APP_VER = "0.1.9.0328 Alpha" func init() { base.AppVer = APP_VER diff --git a/models/git.go b/models/git.go index e2ee52083d..34f0267f65 100644 --- a/models/git.go +++ b/models/git.go @@ -244,11 +244,11 @@ func GetCommitsByCommitId(userName, repoName, commitId string) (*list.List, erro if err != nil { return nil, err } - r, err := repo.LookupReference(commitId) + oid, err := git.NewOidFromString(commitId) if err != nil { return nil, err } - return r.AllCommits() + return repo.CommitsBefore(oid) } // Diff line types. diff --git a/models/models.go b/models/models.go index 813725be46..bafa1747e8 100644 --- a/models/models.go +++ b/models/models.go @@ -34,11 +34,11 @@ func LoadModelsConfig() { DbCfg.Path = base.Cfg.MustValue("database", "PATH", "data/gogs.db") } -func setEngine() { +func SetEngine() { var err error switch DbCfg.Type { 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)) case "postgres": orm, err = xorm.NewEngine("postgres", fmt.Sprintf("user=%s password=%s dbname=%s sslmode=%s", @@ -70,7 +70,7 @@ func setEngine() { } func NewEngine() { - setEngine() + SetEngine() if err := orm.Sync(new(User), new(PublicKey), new(Repository), new(Watch), new(Action), new(Access), new(Issue), new(Comment)); err != nil { fmt.Printf("sync database struct error: %v\n", err) diff --git a/models/repo.go b/models/repo.go index 726d435d33..4be655d287 100644 --- a/models/repo.go +++ b/models/repo.go @@ -510,6 +510,7 @@ func NotifyWatchers(act *Action) error { continue } + act.Id = 0 act.UserId = watches[i].UserId if _, err = orm.InsertOne(act); err != nil { return errors.New("repo.NotifyWatchers(create action): " + err.Error()) diff --git a/modules/auth/auth.go b/modules/auth/auth.go index 2e0555f6df..ac03a8f126 100644 --- a/modules/auth/auth.go +++ b/modules/auth/auth.go @@ -161,3 +161,53 @@ func AssignForm(form interface{}, data base.TmplData) { 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) +} diff --git a/modules/base/conf.go b/modules/base/conf.go index 2e56883937..fd77cfd3ce 100644 --- a/modules/base/conf.go +++ b/modules/base/conf.go @@ -38,7 +38,7 @@ var ( RunUser string RepoRootPath string - EnableHttpsClone bool + InstallLock bool LogInRememberDays int CookieUserName string @@ -282,7 +282,7 @@ func NewConfigContext() { 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") CookieUserName = Cfg.MustValue("security", "COOKIE_USERNAME") @@ -291,9 +291,14 @@ func NewConfigContext() { PictureService = Cfg.MustValue("picture", "SERVICE") // 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 { - 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) } } diff --git a/modules/middleware/repo.go b/modules/middleware/repo.go index cb4a8632a2..54b735af07 100644 --- a/modules/middleware/repo.go +++ b/modules/middleware/repo.go @@ -71,12 +71,8 @@ func RepoAssignment(redirect bool) martini.Handler { ctx.Repo.IsWatching = models.IsWatching(ctx.User.Id, repo.Id) } 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.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 { params["branchname"] = "master" diff --git a/public/css/gogs.css b/public/css/gogs.css index d4976460e6..d6c117c846 100755 --- a/public/css/gogs.css +++ b/public/css/gogs.css @@ -856,6 +856,7 @@ html, body { .commit-list .sha a { font-family: Consolas, Menlo, Monaco, "Lucida Console", monospace; + font-size: 14px; } .guide-box pre, .guide-box .input-group { @@ -1165,7 +1166,7 @@ html, body { 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; } @@ -1173,6 +1174,10 @@ html, body { border-color: #CCC; } +#issue .issue-is-closed .issue-line{ + display: none; +} + #issue .issue-head .info .btn { margin-top: -8px; margin-left: 8px; @@ -1188,6 +1193,20 @@ html, body { 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 { diff --git a/routers/admin/admin.go b/routers/admin/admin.go index 0b5e3d8e7d..f303439fd1 100644 --- a/routers/admin/admin.go +++ b/routers/admin/admin.go @@ -141,7 +141,6 @@ func Config(ctx *middleware.Context) { ctx.Data["Domain"] = base.Domain ctx.Data["RunUser"] = base.RunUser ctx.Data["RunMode"] = strings.Title(martini.Env) - ctx.Data["EnableHttpsClone"] = base.EnableHttpsClone ctx.Data["RepoRootPath"] = base.RepoRootPath ctx.Data["Service"] = base.Service diff --git a/routers/install.go b/routers/install.go index d7d5159efc..b5c3a9364b 100644 --- a/routers/install.go +++ b/routers/install.go @@ -4,10 +4,30 @@ 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.HTML(200,"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") + return + } } diff --git a/routers/repo/issue.go b/routers/repo/issue.go index 77e35bbae6..6ac8a53579 100644 --- a/routers/repo/issue.go +++ b/routers/repo/issue.go @@ -40,9 +40,7 @@ func Issues(ctx *middleware.Context) { ctx.Redirect("/user/login/", 302) return } - posterId = ctx.User.Id ctx.Data["ViewType"] = "created_by" - ctx.Data["IssueCreatedCount"] = models.GetUserIssueCount(posterId, ctx.Repo.Repository.Id) } // Get issues. @@ -53,6 +51,11 @@ func Issues(ctx *middleware.Context) { return } + if ctx.IsSigned { + posterId = ctx.User.Id + } + var createdByCount int + // Get posters. for i := range issues { u, err := models.GetUserById(issues[i].PosterId) @@ -61,12 +64,16 @@ func Issues(ctx *middleware.Context) { return } issues[i].Poster = u + if u.Id == posterId { + createdByCount++ + } } ctx.Data["Issues"] = issues ctx.Data["IssueCount"] = ctx.Repo.Repository.NumIssues ctx.Data["OpenCount"] = ctx.Repo.Repository.NumIssues - ctx.Repo.Repository.NumClosedIssues ctx.Data["ClosedCount"] = ctx.Repo.Repository.NumClosedIssues + ctx.Data["IssueCreatedCount"] = createdByCount ctx.Data["IsShowClosed"] = ctx.Query("state") == "closed" ctx.HTML(200, "issue/list") } @@ -224,6 +231,12 @@ func Comment(ctx *middleware.Context, params martini.Params) { 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)) if err != nil { if err == models.ErrIssueNotExist { @@ -234,12 +247,6 @@ func Comment(ctx *middleware.Context, params martini.Params) { return } - content := ctx.Query("content") - if len(content) == 0 { - ctx.Handle(404, "issue.Comment", err) - return - } - switch params["action"] { case "new": 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() models.LoadModelsConfig() - models.NewEngine() + models.SetEngine() keys := strings.Split(os.Args[2], "-") if len(keys) != 2 { diff --git a/templates/admin/config.tmpl b/templates/admin/config.tmpl index 39895aa311..ab805d8dea 100644 --- a/templates/admin/config.tmpl +++ b/templates/admin/config.tmpl @@ -17,7 +17,6 @@ <div><b>Run User:</b> {{.RunUser}}</div> <div><b>Run Mode:</b> {{.RunMode}}</div> <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> </div> diff --git a/templates/base/navbar.tmpl b/templates/base/navbar.tmpl index 829ecba62b..7d1f64e495 100644 --- a/templates/base/navbar.tmpl +++ b/templates/base/navbar.tmpl @@ -3,7 +3,7 @@ <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 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-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"/> diff --git a/templates/home.tmpl b/templates/home.tmpl index 8121a4e8c9..d3a8c0c343 100644 --- a/templates/home.tmpl +++ b/templates/home.tmpl @@ -1,6 +1,8 @@ {{template "base/head" .}} {{template "base/navbar" .}} <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> {{template "base/footer" .}} diff --git a/templates/install.tmpl b/templates/install.tmpl index 4fbef3cba0..d8f05fcaa7 100644 --- a/templates/install.tmpl +++ b/templates/install.tmpl @@ -12,7 +12,7 @@ <select name="database" id="install-database" class="form-control"> <option value="mysql">MySQL</option> <option value="pgsql">PostgreSQL</option> - <option value="sqlite">SQLite</option> + <option value="sqlite">SQLite3</option> </select> </div> </div> @@ -21,28 +21,21 @@ <label class="col-md-3 control-label">Host: </label> <div class="col-md-8"> - <input name="host" class="form-control" placeholder="Type mysql server ip or domain" value="localhost" 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"> + <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">User: </label> <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 class="form-group"> <label class="col-md-3 control-label">Password: </label> <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> @@ -50,7 +43,7 @@ <label class="col-md-3 control-label">Database Name: </label> <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> </div> </div> @@ -71,18 +64,12 @@ <label class="col-md-3 control-label">Path: </label> <div class="col-md-8"> - <input name="path" class="form-control" placeholder="Type sqlite file path" value="xxx/file.db"> - <p class="help-block">The file path of SQLite database.</p> + <input name="database_path" class="form-control" placeholder="Type sqlite3 file path" value="{{.DbCfg.Path}}"> + <p class="help-block">The file path of SQLite3 database.</p> </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/> <p class="help-block text-center">General Settings of Gogs</p> @@ -91,19 +78,29 @@ <label class="col-md-3 control-label">Repository Path: </label> <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> </div> </div> + <div class="form-group"> <label class="col-md-3 control-label">Run User: </label> <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> </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/> @@ -113,20 +110,30 @@ <label class="col-md-3 control-label">Username: </label> <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 class="form-group"> <label class="col-md-3 control-label">Password: </label> <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> <hr/> <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-default btn-sm" type="button" data-toggle="modal" data-target="#advance-options-modal"> Advanced Options @@ -144,21 +151,21 @@ <label class="col-md-3 control-label">SMTP Host: </label> <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 class="form-group"> <label class="col-md-3 control-label">Email: </label> <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 class="form-group"> <label class="col-md-3 control-label">Password: </label> <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> <hr/> @@ -168,7 +175,7 @@ <div class="col-md-offset-3 col-md-7"> <div class="checkbox"> <label> - <input name="system-user" type="checkbox"> + <input name="register_confirm" type="checkbox"> <strong>Enable Register Confirmation</strong> </label> </div> @@ -179,7 +186,7 @@ <div class="col-md-offset-3 col-md-7"> <div class="checkbox"> <label> - <input name="system-user" type="checkbox"> + <input name="mail_notify" type="checkbox"> <strong>Enable Mail Notification</strong> </label> </div> diff --git a/templates/issue/view.tmpl b/templates/issue/view.tmpl index 4d053930b9..6f0a384800 100644 --- a/templates/issue/view.tmpl +++ b/templates/issue/view.tmpl @@ -4,14 +4,14 @@ {{template "repo/toolbar" .}} <div id="body" class="container"> <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="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> <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"/> <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-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> @@ -34,8 +34,8 @@ <div class="issue-content panel panel-default"> <div class="panel-heading"> <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-edit pull-right issue-action" href="#" title="Remove Comment" data-url="{remove-link}"><i class="fa fa-edit"></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> --> <span class="role label label-default pull-right">Owner</span> </div> <div class="panel-body markdown"> @@ -44,6 +44,22 @@ </div> </div> {{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"/> <div class="issue-child issue-reply"> <a class="user pull-left" href="/user/{{.SignedUser.Name}}"><img class="avatar" src="{{.SignedUser.AvatarLink}}" alt=""/></a> @@ -70,9 +86,11 @@ </div> <div class="text-right"> <div class="form-group"> - <input type="hidden" value="id" name="repo-id"/> - <button class="btn-default btn issue-open" id="issue-open-btn" data-origin="Open" data-text="Open & Comment">Open</button> - <button class="btn-default btn issue-close" id="issue-close-btn" data-origin="Close" data-text="Close & Comment">Close</button> + {{if .Issue.IsClosed}} + <input type="hidden" value="reopen" name="change_status"/> + <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}} <button class="btn-success btn" id="issue-reply-btn">Comment</button> </div> </div> diff --git a/templates/repo/toolbar.tmpl b/templates/repo/toolbar.tmpl index ac516c37dd..75f1efdc8e 100644 --- a/templates/repo/toolbar.tmpl +++ b/templates/repo/toolbar.tmpl @@ -5,7 +5,7 @@ <ul class="nav navbar-nav"> <li class="{{if .IsRepoToolbarSource}}active{{end}}"><a href="/{{.RepositoryLink}}">Source</a></li> {{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 .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> @@ -40,4 +40,4 @@ </div> </nav> </div> -</div>
\ No newline at end of file +</div> @@ -32,7 +32,7 @@ gogs serv provide access auth for repositories`, func runUpdate(c *cli.Context) { base.NewConfigContext() models.LoadModelsConfig() - models.NewEngine() + models.SetEngine() w, _ := os.Create("update.log") defer w.Close() @@ -90,7 +90,7 @@ func runWeb(*cli.Context) { // Routers. m.Get("/", ignSignIn, routers.Home) - m.Get("/install", routers.Install) + m.Any("/install", routers.Install) m.Get("/issues", reqSignIn, user.Issues) m.Get("/pulls", reqSignIn, user.Pulls) m.Get("/stars", reqSignIn, user.Stars) |