Conflicts: models/repo.go modules/base/tool.go serve.gotags/v1.2.0-rc1
| @@ -2,7 +2,7 @@ Gogs(Go Git Service) is a Self Hosted Git Service in the Go Programming Language | |||
|  | |||
| ##### Current version: 0.1.7 Alpha | |||
| ##### Current version: 0.1.8 Alpha | |||
| #### Other language version | |||
| @@ -17,7 +17,7 @@ More importantly, Gogs only needs one binary to setup your own project hosting o | |||
| ## Overview | |||
| - Please see [Wiki](https://github.com/gogits/gogs/wiki) for project design, develop specification, change log and road map. | |||
| - See [Trello Broad](https://trello.com/b/uxAoeLUl/gogs-go-git-service) to follow the develop team. | |||
| - See [Trello Board](https://trello.com/b/uxAoeLUl/gogs-go-git-service) to follow the develop team. | |||
| - Try it before anything? Do it [online](http://try.gogits.org/Unknown/gogs) or go down to **Installation -> Install from binary** section! | |||
| - Having troubles? Get help from [Troubleshooting](https://github.com/gogits/gogs/wiki/Troubleshooting). | |||
| @@ -29,7 +29,7 @@ More importantly, Gogs only needs one binary to setup your own project hosting o | |||
| - Create/delete/watch public repository. | |||
| - User profile page. | |||
| - Repository viewer. | |||
| - Gravatar support. | |||
| - Gravatar and cache support. | |||
| - Mail service(register). | |||
| - Administration panel. | |||
| - Supports MySQL, PostgreSQL and SQLite3(binary release only). | |||
| @@ -5,7 +5,7 @@ Gogs(Go Git Service) 是一个由 Go 语言编写的自助 Git 托管服务。 | |||
|  | |||
| ##### 当前版本:0.1.7 Alpha | |||
| ##### 当前版本:0.1.8 Alpha | |||
| ## 开发目的 | |||
| @@ -16,7 +16,7 @@ Gogs 完全使用 Go 语言来实现对 Git 数据的操作,实现 **零** 依 | |||
| ## 项目概览 | |||
| - 有关项目设计、开发说明、变更日志和路线图,请通过 [Wiki](https://github.com/gogits/gogs/wiki) 查看。 | |||
| - 您可以到 [Trello Broad](https://trello.com/b/uxAoeLUl/gogs-go-git-service) 跟随开发团队的脚步。 | |||
| - 您可以到 [Trello Board](https://trello.com/b/uxAoeLUl/gogs-go-git-service) 跟随开发团队的脚步。 | |||
| - 想要先睹为快?通过 [在线体验](http://try.gogits.org/Unknown/gogs) 或查看 **安装部署 -> 二进制安装** 小节。 | |||
| - 使用过程中遇到问题?尝试从 [故障排查](https://github.com/gogits/gogs/wiki/Troubleshooting) 页面获取帮助。 | |||
| @@ -28,7 +28,7 @@ Gogs 完全使用 Go 语言来实现对 Git 数据的操作,实现 **零** 依 | |||
| - 创建/删除/关注公开仓库 | |||
| - 用户个人信息页面 | |||
| - 仓库浏览器 | |||
| - Gravatar 支持 | |||
| - Gravatar 以及缓存支持 | |||
| - 邮件服务(注册) | |||
| - 管理员面板 | |||
| - 支持 MySQL、PostgreSQL 以及 SQLite3(仅限二进制版本) | |||
| @@ -1,8 +1,8 @@ | |||
| ; App name that shows on every page title | |||
| APP_NAME = Gogs: Go Git Service | |||
| APP_LOGO = img/favicon.png | |||
| ; !!MUST CHANGE TO YOUR USER NAME!! | |||
| RUN_USER = lunny | |||
| ; Change it if you run locally | |||
| RUN_USER = git | |||
| ; Either "dev", "prod" or "test", default is "dev" | |||
| RUN_MODE = dev | |||
| @@ -164,4 +164,4 @@ RECEIVERS = | |||
| [log.database] | |||
| LEVEL = | |||
| Driver = | |||
| CONN = | |||
| CONN = | |||
| @@ -0,0 +1,137 @@ | |||
| commit c1a3d4fefbbbf332cd1cedda66e93bf40cc9713d | |||
| Author: Unknown <joe2010xtmf@163.com> | |||
| Date: Tue Mar 25 21:37:18 2014 -0400 | |||
| Add mail notify for creating issue | |||
| diff --git a/gogs.go b/gogs.go | |||
| index b62580f..f5a328a 100644 | |||
| --- a/gogs.go | |||
| +++ b/gogs.go | |||
| @@ -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.7.0325" | |||
| +const APP_VER = "0.1.8.0325" | |||
| func init() { | |||
| base.AppVer = APP_VER | |||
| diff --git a/models/issue.go b/models/issue.go | |||
| index 2bdd083..2de6568 100644 | |||
| --- a/models/issue.go | |||
| +++ b/models/issue.go | |||
| @@ -59,7 +59,6 @@ func CreateIssue(userId, repoId, milestoneId, assigneeId int64, name, labels, co | |||
| Content: content, | |||
| } | |||
| _, err = orm.Insert(issue) | |||
| - // TODO: newIssueAction | |||
| return issue, err | |||
| } | |||
| diff --git a/modules/mailer/mail.go b/modules/mailer/mail.go | |||
| index 92acd20..d0decbe 100644 | |||
| --- a/modules/mailer/mail.go | |||
| +++ b/modules/mailer/mail.go | |||
| @@ -6,6 +6,7 @@ package mailer | |||
| import ( | |||
| "encoding/hex" | |||
| + "errors" | |||
| "fmt" | |||
| "github.com/gogits/gogs/models" | |||
| @@ -15,12 +16,17 @@ import ( | |||
| ) | |||
| // Create New mail message use MailFrom and MailUser | |||
| -func NewMailMessage(To []string, subject, body string) Message { | |||
| - msg := NewHtmlMessage(To, base.MailService.User, subject, body) | |||
| +func NewMailMessageFrom(To []string, from, subject, body string) Message { | |||
| + msg := NewHtmlMessage(To, from, subject, body) | |||
| msg.User = base.MailService.User | |||
| return msg | |||
| } | |||
| +// Create New mail message use MailFrom and MailUser | |||
| +func NewMailMessage(To []string, subject, body string) Message { | |||
| + return NewMailMessageFrom(To, base.MailService.User, subject, body) | |||
| +} | |||
| + | |||
| func GetMailTmplData(user *models.User) map[interface{}]interface{} { | |||
| data := make(map[interface{}]interface{}, 10) | |||
| data["AppName"] = base.AppName | |||
| @@ -84,3 +90,33 @@ func SendActiveMail(r *middleware.Render, user *models.User) { | |||
| SendAsync(&msg) | |||
| } | |||
| + | |||
| +// SendNotifyMail sends mail notification of all watchers. | |||
| +func SendNotifyMail(userId, repoId int64, userName, repoName, subject, content string) error { | |||
| + watches, err := models.GetWatches(repoId) | |||
| + if err != nil { | |||
| + return errors.New("mail.NotifyWatchers(get watches): " + err.Error()) | |||
| + } | |||
| + | |||
| + tos := make([]string, 0, len(watches)) | |||
| + for i := range watches { | |||
| + uid := watches[i].UserId | |||
| + if userId == uid { | |||
| + continue | |||
| + } | |||
| + u, err := models.GetUserById(uid) | |||
| + if err != nil { | |||
| + return errors.New("mail.NotifyWatchers(get user): " + err.Error()) | |||
| + } | |||
| + tos = append(tos, u.Email) | |||
| + } | |||
| + | |||
| + if len(tos) == 0 { | |||
| + return nil | |||
| + } | |||
| + | |||
| + msg := NewMailMessageFrom(tos, userName, subject, content) | |||
| + msg.Info = fmt.Sprintf("Subject: %s, send notify emails", subject) | |||
| + SendAsync(&msg) | |||
| + return nil | |||
| +} | |||
| diff --git a/modules/mailer/mailer.go b/modules/mailer/mailer.go | |||
| index da63e01..63861d8 100644 | |||
| --- a/modules/mailer/mailer.go | |||
| +++ b/modules/mailer/mailer.go | |||
| @@ -33,7 +33,7 @@ func (m Message) Content() string { | |||
| } | |||
| // create mail content | |||
| - content := "From: " + m.User + "<" + m.From + | |||
| + content := "From: " + m.From + "<" + m.User + | |||
| ">\r\nSubject: " + m.Subject + "\r\nContent-Type: " + contentType + "\r\n\r\n" + m.Body | |||
| return content | |||
| } | |||
| diff --git a/routers/repo/issue.go b/routers/repo/issue.go | |||
| index fc5bb98..242593f 100644 | |||
| --- a/routers/repo/issue.go | |||
| +++ b/routers/repo/issue.go | |||
| @@ -13,6 +13,7 @@ import ( | |||
| "github.com/gogits/gogs/modules/auth" | |||
| "github.com/gogits/gogs/modules/base" | |||
| "github.com/gogits/gogs/modules/log" | |||
| + "github.com/gogits/gogs/modules/mailer" | |||
| "github.com/gogits/gogs/modules/middleware" | |||
| ) | |||
| @@ -86,6 +87,14 @@ func CreateIssue(ctx *middleware.Context, params martini.Params, form auth.Creat | |||
| return | |||
| } | |||
| + // Mail watchers. | |||
| + if base.Service.NotifyMail { | |||
| + if err = mailer.SendNotifyMail(ctx.User.Id, ctx.Repo.Repository.Id, ctx.User.Name, ctx.Repo.Repository.Name, issue.Name, issue.Content); err != nil { | |||
| + ctx.Handle(200, "issue.CreateIssue", err) | |||
| + return | |||
| + } | |||
| + } | |||
| + | |||
| log.Trace("%d Issue created: %d", ctx.Repo.Repository.Id, issue.Id) | |||
| ctx.Redirect(fmt.Sprintf("/%s/%s/issues/%d", params["username"], params["reponame"], issue.Index)) | |||
| } | |||
| @@ -7,7 +7,6 @@ package main | |||
| import ( | |||
| "os" | |||
| // "os/user" | |||
| "runtime" | |||
| "github.com/codegangsta/cli" | |||
| @@ -20,28 +19,14 @@ 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.7.0324" | |||
| const APP_VER = "0.1.8.0325" | |||
| func init() { | |||
| base.AppVer = APP_VER | |||
| runtime.GOMAXPROCS(runtime.NumCPU()) | |||
| } | |||
| // func checkRunUser() bool { | |||
| // u, err := user.Current() | |||
| // if err != nil { | |||
| // // TODO: log | |||
| // return false | |||
| // } | |||
| // return u.Username == base.Cfg.MustValue("", "RUN_USER") | |||
| // } | |||
| func main() { | |||
| /*if !checkRunUser() { | |||
| println("The command should be run as", base.Cfg.MustValue("", "RUN_USER")) | |||
| return | |||
| }*/ | |||
| app := cli.NewApp() | |||
| app.Name = "Gogs" | |||
| app.Usage = "Go Git Service" | |||
| @@ -19,6 +19,7 @@ const ( | |||
| OP_STAR_REPO | |||
| OP_FOLLOW_REPO | |||
| OP_COMMIT_REPO | |||
| OP_CREATE_ISSUE | |||
| OP_PULL_REQUEST | |||
| ) | |||
| @@ -59,7 +60,7 @@ func (a Action) GetContent() string { | |||
| // CommitRepoAction records action for commit repository. | |||
| func CommitRepoAction(userId int64, userName string, | |||
| repoId int64, repoName string, refName string, commits *base.PushCommits) error { | |||
| log.Trace("action.CommitRepoAction: %d/%s", userId, repoName) | |||
| log.Trace("action.CommitRepoAction(start): %d/%s", userId, repoName) | |||
| bs, err := json.Marshal(commits) | |||
| if err != nil { | |||
| @@ -67,32 +68,8 @@ func CommitRepoAction(userId int64, userName string, | |||
| return err | |||
| } | |||
| // Add feeds for user self and all watchers. | |||
| watches, err := GetWatches(repoId) | |||
| if err != nil { | |||
| log.Error("action.CommitRepoAction(get watches): %d/%s", userId, repoName) | |||
| return err | |||
| } | |||
| watches = append(watches, Watch{UserId: userId}) | |||
| for i := range watches { | |||
| if userId == watches[i].UserId && i > 0 { | |||
| continue // Do not add twice in case author watches his/her repository. | |||
| } | |||
| _, err = orm.InsertOne(&Action{ | |||
| UserId: watches[i].UserId, | |||
| ActUserId: userId, | |||
| ActUserName: userName, | |||
| OpType: OP_COMMIT_REPO, | |||
| Content: string(bs), | |||
| RepoId: repoId, | |||
| RepoName: repoName, | |||
| RefName: refName, | |||
| }) | |||
| if err != nil { | |||
| log.Error("action.CommitRepoAction(notify watches): %d/%s", userId, repoName) | |||
| } | |||
| if err = NotifyWatchers(userId, repoId, OP_COMMIT_REPO, userName, repoName, refName, string(bs)); err != nil { | |||
| log.Error("action.CommitRepoAction(notify watchers): %d/%s", userId, repoName) | |||
| return err | |||
| } | |||
| @@ -107,6 +84,8 @@ func CommitRepoAction(userId int64, userName string, | |||
| log.Error("action.CommitRepoAction(UpdateRepository): %d/%s", userId, repoName) | |||
| return err | |||
| } | |||
| log.Trace("action.CommitRepoAction(end): %d/%s", userId, repoName) | |||
| return nil | |||
| } | |||
| @@ -0,0 +1,274 @@ | |||
| // Copyright 2014 The Gogs Authors. All rights reserved. | |||
| // Use of this source code is governed by a MIT-style | |||
| // license that can be found in the LICENSE file. | |||
| package models | |||
| import ( | |||
| "container/list" | |||
| "fmt" | |||
| "path" | |||
| "strings" | |||
| "github.com/Unknwon/com" | |||
| "github.com/gogits/git" | |||
| ) | |||
| // RepoFile represents a file object in git repository. | |||
| type RepoFile struct { | |||
| *git.TreeEntry | |||
| Path string | |||
| Size int64 | |||
| Repo *git.Repository | |||
| Commit *git.Commit | |||
| } | |||
| // LookupBlob returns the content of an object. | |||
| func (file *RepoFile) LookupBlob() (*git.Blob, error) { | |||
| if file.Repo == nil { | |||
| return nil, ErrRepoFileNotLoaded | |||
| } | |||
| return file.Repo.LookupBlob(file.Id) | |||
| } | |||
| // GetBranches returns all branches of given repository. | |||
| func GetBranches(userName, reposName string) ([]string, error) { | |||
| repo, err := git.OpenRepository(RepoPath(userName, reposName)) | |||
| if err != nil { | |||
| return nil, err | |||
| } | |||
| refs, err := repo.AllReferences() | |||
| if err != nil { | |||
| return nil, err | |||
| } | |||
| brs := make([]string, len(refs)) | |||
| for i, ref := range refs { | |||
| brs[i] = ref.Name | |||
| } | |||
| return brs, nil | |||
| } | |||
| func GetTargetFile(userName, reposName, branchName, commitId, rpath string) (*RepoFile, error) { | |||
| repo, err := git.OpenRepository(RepoPath(userName, reposName)) | |||
| if err != nil { | |||
| return nil, err | |||
| } | |||
| commit, err := repo.GetCommit(branchName, commitId) | |||
| if err != nil { | |||
| return nil, err | |||
| } | |||
| parts := strings.Split(path.Clean(rpath), "/") | |||
| var entry *git.TreeEntry | |||
| tree := commit.Tree | |||
| for i, part := range parts { | |||
| if i == len(parts)-1 { | |||
| entry = tree.EntryByName(part) | |||
| if entry == nil { | |||
| return nil, ErrRepoFileNotExist | |||
| } | |||
| } else { | |||
| tree, err = repo.SubTree(tree, part) | |||
| if err != nil { | |||
| return nil, err | |||
| } | |||
| } | |||
| } | |||
| size, err := repo.ObjectSize(entry.Id) | |||
| if err != nil { | |||
| return nil, err | |||
| } | |||
| repoFile := &RepoFile{ | |||
| entry, | |||
| rpath, | |||
| size, | |||
| repo, | |||
| commit, | |||
| } | |||
| return repoFile, nil | |||
| } | |||
| // GetReposFiles returns a list of file object in given directory of repository. | |||
| func GetReposFiles(userName, reposName, branchName, commitId, rpath string) ([]*RepoFile, error) { | |||
| repo, err := git.OpenRepository(RepoPath(userName, reposName)) | |||
| if err != nil { | |||
| return nil, err | |||
| } | |||
| commit, err := repo.GetCommit(branchName, commitId) | |||
| if err != nil { | |||
| return nil, err | |||
| } | |||
| var repodirs []*RepoFile | |||
| var repofiles []*RepoFile | |||
| commit.Tree.Walk(func(dirname string, entry *git.TreeEntry) int { | |||
| if dirname == rpath { | |||
| // TODO: size get method shoule be improved | |||
| size, err := repo.ObjectSize(entry.Id) | |||
| if err != nil { | |||
| return 0 | |||
| } | |||
| var cm = commit | |||
| var i int | |||
| for { | |||
| i = i + 1 | |||
| //fmt.Println(".....", i, cm.Id(), cm.ParentCount()) | |||
| if cm.ParentCount() == 0 { | |||
| break | |||
| } else if cm.ParentCount() == 1 { | |||
| pt, _ := repo.SubTree(cm.Parent(0).Tree, dirname) | |||
| if pt == nil { | |||
| break | |||
| } | |||
| pEntry := pt.EntryByName(entry.Name) | |||
| if pEntry == nil || !pEntry.Id.Equal(entry.Id) { | |||
| break | |||
| } else { | |||
| cm = cm.Parent(0) | |||
| } | |||
| } else { | |||
| var emptyCnt = 0 | |||
| var sameIdcnt = 0 | |||
| var lastSameCm *git.Commit | |||
| //fmt.Println(".....", cm.ParentCount()) | |||
| for i := 0; i < cm.ParentCount(); i++ { | |||
| //fmt.Println("parent", i, cm.Parent(i).Id()) | |||
| p := cm.Parent(i) | |||
| pt, _ := repo.SubTree(p.Tree, dirname) | |||
| var pEntry *git.TreeEntry | |||
| if pt != nil { | |||
| pEntry = pt.EntryByName(entry.Name) | |||
| } | |||
| //fmt.Println("pEntry", pEntry) | |||
| if pEntry == nil { | |||
| emptyCnt = emptyCnt + 1 | |||
| if emptyCnt+sameIdcnt == cm.ParentCount() { | |||
| if lastSameCm == nil { | |||
| goto loop | |||
| } else { | |||
| cm = lastSameCm | |||
| break | |||
| } | |||
| } | |||
| } else { | |||
| //fmt.Println(i, "pEntry", pEntry.Id, "entry", entry.Id) | |||
| if !pEntry.Id.Equal(entry.Id) { | |||
| goto loop | |||
| } else { | |||
| lastSameCm = cm.Parent(i) | |||
| sameIdcnt = sameIdcnt + 1 | |||
| if emptyCnt+sameIdcnt == cm.ParentCount() { | |||
| // TODO: now follow the first parent commit? | |||
| cm = lastSameCm | |||
| //fmt.Println("sameId...") | |||
| break | |||
| } | |||
| } | |||
| } | |||
| } | |||
| } | |||
| } | |||
| loop: | |||
| rp := &RepoFile{ | |||
| entry, | |||
| path.Join(dirname, entry.Name), | |||
| size, | |||
| repo, | |||
| cm, | |||
| } | |||
| if entry.IsFile() { | |||
| repofiles = append(repofiles, rp) | |||
| } else if entry.IsDir() { | |||
| repodirs = append(repodirs, rp) | |||
| } | |||
| } | |||
| return 0 | |||
| }) | |||
| return append(repodirs, repofiles...), nil | |||
| } | |||
| func GetCommit(userName, repoName, branchname, commitid string) (*git.Commit, error) { | |||
| repo, err := git.OpenRepository(RepoPath(userName, repoName)) | |||
| if err != nil { | |||
| return nil, err | |||
| } | |||
| return repo.GetCommit(branchname, commitid) | |||
| } | |||
| // GetCommits returns all commits of given branch of repository. | |||
| func GetCommits(userName, reposName, branchname string) (*list.List, error) { | |||
| repo, err := git.OpenRepository(RepoPath(userName, reposName)) | |||
| if err != nil { | |||
| return nil, err | |||
| } | |||
| r, err := repo.LookupReference(fmt.Sprintf("refs/heads/%s", branchname)) | |||
| if err != nil { | |||
| return nil, err | |||
| } | |||
| return r.AllCommits() | |||
| } | |||
| type DiffFile struct { | |||
| Name string | |||
| Addition, Deletion int | |||
| Type string | |||
| Content []string | |||
| } | |||
| type Diff struct { | |||
| NumFiles int // Number of file has been changed. | |||
| TotalAddition, TotalDeletion int | |||
| Files []*DiffFile | |||
| } | |||
| func GetDiff(repoPath, commitid string) (*Diff, error) { | |||
| stdout, _, err := com.ExecCmdDir(repoPath, "git", "show", commitid) | |||
| if err != nil { | |||
| return nil, err | |||
| } | |||
| // Sperate parts by file. | |||
| startIndex := strings.Index(stdout, "diff --git ") + 12 | |||
| // First part is commit information. | |||
| // Check if it's a merge. | |||
| mergeIndex := strings.Index(stdout[:startIndex], "merge") | |||
| if mergeIndex > -1 { | |||
| mergeCommit := strings.SplitN(strings.Split(stdout[:startIndex], "\n")[1], "", 3)[2] | |||
| return GetDiff(repoPath, mergeCommit) | |||
| } | |||
| parts := strings.Split(stdout[startIndex:], "diff --git ") | |||
| diff := &Diff{NumFiles: len(parts)} | |||
| diff.Files = make([]*DiffFile, 0, diff.NumFiles) | |||
| for _, part := range parts { | |||
| infos := strings.SplitN(part, "\n", 6) | |||
| maxIndex := len(infos) - 1 | |||
| infos[maxIndex] = strings.TrimSuffix(strings.TrimSuffix(infos[maxIndex], "\n"), "\n\\ No newline at end of file") | |||
| file := &DiffFile{ | |||
| Name: strings.TrimPrefix(strings.Split(infos[0], " ")[0], "a/"), | |||
| Content: strings.Split(infos[maxIndex], "\n"), | |||
| } | |||
| diff.Files = append(diff.Files, file) | |||
| } | |||
| return diff, nil | |||
| } | |||
| @@ -23,6 +23,7 @@ type Issue struct { | |||
| Name string | |||
| RepoId int64 `xorm:"index"` | |||
| PosterId int64 | |||
| Poster *User `xorm:"-"` | |||
| MilestoneId int64 | |||
| AssigneeId int64 | |||
| IsPull bool // Indicates whether is a pull request or not. | |||
| @@ -58,7 +59,6 @@ func CreateIssue(userId, repoId, milestoneId, assigneeId int64, name, labels, co | |||
| Content: content, | |||
| } | |||
| _, err = orm.Insert(issue) | |||
| // TODO: newIssueAction | |||
| return issue, err | |||
| } | |||
| @@ -5,17 +5,14 @@ | |||
| package models | |||
| import ( | |||
| "container/list" | |||
| "errors" | |||
| "fmt" | |||
| "io/ioutil" | |||
| "os" | |||
| "os/exec" | |||
| "path" | |||
| "path/filepath" | |||
| "regexp" | |||
| "strings" | |||
| "sync" | |||
| "time" | |||
| "unicode/utf8" | |||
| @@ -36,8 +33,6 @@ var ( | |||
| ErrRepoFileNotLoaded = fmt.Errorf("repo file not loaded") | |||
| ) | |||
| var gitInitLocker = sync.Mutex{} | |||
| var ( | |||
| LanguageIgns, Licenses []string | |||
| ) | |||
| @@ -222,33 +217,21 @@ func extractGitBareZip(repoPath string) error { | |||
| } | |||
| // initRepoCommit temporarily changes with work directory. | |||
| func initRepoCommit(tmpPath string, sig *git.Signature) error { | |||
| gitInitLocker.Lock() | |||
| defer gitInitLocker.Unlock() | |||
| // Change work directory. | |||
| curPath, err := os.Getwd() | |||
| if err != nil { | |||
| return err | |||
| } else if err = os.Chdir(tmpPath); err != nil { | |||
| return err | |||
| } | |||
| defer os.Chdir(curPath) | |||
| func initRepoCommit(tmpPath string, sig *git.Signature) (err error) { | |||
| var stderr string | |||
| if _, stderr, err = com.ExecCmd("git", "add", "--all"); err != nil { | |||
| if _, stderr, err = com.ExecCmdDir(tmpPath, "git", "add", "--all"); err != nil { | |||
| return err | |||
| } | |||
| log.Info("stderr(1): %s", stderr) | |||
| if _, stderr, err = com.ExecCmd("git", "commit", fmt.Sprintf("--author='%s <%s>'", sig.Name, sig.Email), | |||
| log.Trace("stderr(1): %s", stderr) | |||
| if _, stderr, err = com.ExecCmdDir(tmpPath, "git", "commit", fmt.Sprintf("--author='%s <%s>'", sig.Name, sig.Email), | |||
| "-m", "Init commit"); err != nil { | |||
| return err | |||
| } | |||
| log.Info("stderr(2): %s", stderr) | |||
| if _, stderr, err = com.ExecCmd("git", "push", "origin", "master"); err != nil { | |||
| log.Trace("stderr(2): %s", stderr) | |||
| if _, stderr, err = com.ExecCmdDir(tmpPath, "git", "push", "origin", "master"); err != nil { | |||
| return err | |||
| } | |||
| log.Info("stderr(3): %s", stderr) | |||
| log.Trace("stderr(3): %s", stderr) | |||
| return nil | |||
| } | |||
| @@ -272,18 +255,6 @@ func initRepository(f string, user *User, repo *Repository, initReadme bool, rep | |||
| return err | |||
| } | |||
| /*// hook/post-update | |||
| pu2, err := os.OpenFile(filepath.Join(repoPath, "hooks", "post-receive"), os.O_CREATE|os.O_WRONLY, 0777) | |||
| if err != nil { | |||
| return err | |||
| } | |||
| defer pu2.Close() | |||
| // TODO: Windows .bat | |||
| if _, err = pu2.WriteString("#!/usr/bin/env bash\ngit update-server-info\n"); err != nil { | |||
| return err | |||
| } | |||
| */ | |||
| // Initialize repository according to user's choice. | |||
| fileName := map[string]string{} | |||
| if initReadme { | |||
| @@ -505,239 +476,43 @@ func GetWatches(repoId int64) ([]Watch, error) { | |||
| return watches, err | |||
| } | |||
| // IsWatching checks if user has watched given repository. | |||
| func IsWatching(userId, repoId int64) bool { | |||
| has, _ := orm.Get(&Watch{0, repoId, userId}) | |||
| return has | |||
| } | |||
| func StarReposiory(user *User, repoName string) error { | |||
| return nil | |||
| } | |||
| func UnStarRepository() { | |||
| } | |||
| func WatchRepository() { | |||
| } | |||
| func UnWatchRepository() { | |||
| } | |||
| func ForkRepository(reposName string, userId int64) { | |||
| } | |||
| // RepoFile represents a file object in git repository. | |||
| type RepoFile struct { | |||
| *git.TreeEntry | |||
| Path string | |||
| Size int64 | |||
| Repo *git.Repository | |||
| Commit *git.Commit | |||
| } | |||
| // LookupBlob returns the content of an object. | |||
| func (file *RepoFile) LookupBlob() (*git.Blob, error) { | |||
| if file.Repo == nil { | |||
| return nil, ErrRepoFileNotLoaded | |||
| } | |||
| return file.Repo.LookupBlob(file.Id) | |||
| } | |||
| // GetBranches returns all branches of given repository. | |||
| func GetBranches(userName, reposName string) ([]string, error) { | |||
| repo, err := git.OpenRepository(RepoPath(userName, reposName)) | |||
| if err != nil { | |||
| return nil, err | |||
| } | |||
| refs, err := repo.AllReferences() | |||
| if err != nil { | |||
| return nil, err | |||
| } | |||
| brs := make([]string, len(refs)) | |||
| for i, ref := range refs { | |||
| brs[i] = ref.BranchName() | |||
| } | |||
| return brs, nil | |||
| } | |||
| func GetTargetFile(userName, reposName, branchName, commitId, rpath string) (*RepoFile, error) { | |||
| repo, err := git.OpenRepository(RepoPath(userName, reposName)) | |||
| // NotifyWatchers creates batch of actions for every watcher. | |||
| func NotifyWatchers(userId, repoId int64, opType int, userName, repoName, refName, content string) error { | |||
| // Add feeds for user self and all watchers. | |||
| watches, err := GetWatches(repoId) | |||
| if err != nil { | |||
| return nil, err | |||
| return errors.New("repo.NotifyWatchers(get watches): " + err.Error()) | |||
| } | |||
| watches = append(watches, Watch{UserId: userId}) | |||
| commit, err := repo.GetCommit(branchName, commitId) | |||
| if err != nil { | |||
| return nil, err | |||
| } | |||
| parts := strings.Split(path.Clean(rpath), "/") | |||
| var entry *git.TreeEntry | |||
| tree := commit.Tree | |||
| for i, part := range parts { | |||
| if i == len(parts)-1 { | |||
| entry = tree.EntryByName(part) | |||
| if entry == nil { | |||
| return nil, ErrRepoFileNotExist | |||
| } | |||
| } else { | |||
| tree, err = repo.SubTree(tree, part) | |||
| if err != nil { | |||
| return nil, err | |||
| } | |||
| for i := range watches { | |||
| if userId == watches[i].UserId && i > 0 { | |||
| continue // Do not add twice in case author watches his/her repository. | |||
| } | |||
| } | |||
| size, err := repo.ObjectSize(entry.Id) | |||
| if err != nil { | |||
| return nil, err | |||
| } | |||
| repoFile := &RepoFile{ | |||
| entry, | |||
| rpath, | |||
| size, | |||
| repo, | |||
| commit, | |||
| _, err = orm.InsertOne(&Action{ | |||
| UserId: watches[i].UserId, | |||
| ActUserId: userId, | |||
| ActUserName: userName, | |||
| OpType: opType, | |||
| Content: content, | |||
| RepoId: repoId, | |||
| RepoName: repoName, | |||
| RefName: refName, | |||
| }) | |||
| if err != nil { | |||
| return errors.New("repo.NotifyWatchers(create action): " + err.Error()) | |||
| } | |||
| } | |||
| return repoFile, nil | |||
| return nil | |||
| } | |||
| // GetReposFiles returns a list of file object in given directory of repository. | |||
| func GetReposFiles(userName, reposName, branchName, commitId, rpath string) ([]*RepoFile, error) { | |||
| repo, err := git.OpenRepository(RepoPath(userName, reposName)) | |||
| if err != nil { | |||
| return nil, err | |||
| } | |||
| commit, err := repo.GetCommit(branchName, commitId) | |||
| if err != nil { | |||
| return nil, err | |||
| } | |||
| var repodirs []*RepoFile | |||
| var repofiles []*RepoFile | |||
| commit.Tree.Walk(func(dirname string, entry *git.TreeEntry) int { | |||
| if dirname == rpath { | |||
| // TODO: size get method shoule be improved | |||
| size, err := repo.ObjectSize(entry.Id) | |||
| if err != nil { | |||
| return 0 | |||
| } | |||
| var cm = commit | |||
| var i int | |||
| for { | |||
| i = i + 1 | |||
| //fmt.Println(".....", i, cm.Id(), cm.ParentCount()) | |||
| if cm.ParentCount() == 0 { | |||
| break | |||
| } else if cm.ParentCount() == 1 { | |||
| pt, _ := repo.SubTree(cm.Parent(0).Tree, dirname) | |||
| if pt == nil { | |||
| break | |||
| } | |||
| pEntry := pt.EntryByName(entry.Name) | |||
| if pEntry == nil || !pEntry.Id.Equal(entry.Id) { | |||
| break | |||
| } else { | |||
| cm = cm.Parent(0) | |||
| } | |||
| } else { | |||
| var emptyCnt = 0 | |||
| var sameIdcnt = 0 | |||
| var lastSameCm *git.Commit | |||
| //fmt.Println(".....", cm.ParentCount()) | |||
| for i := 0; i < cm.ParentCount(); i++ { | |||
| //fmt.Println("parent", i, cm.Parent(i).Id()) | |||
| p := cm.Parent(i) | |||
| pt, _ := repo.SubTree(p.Tree, dirname) | |||
| var pEntry *git.TreeEntry | |||
| if pt != nil { | |||
| pEntry = pt.EntryByName(entry.Name) | |||
| } | |||
| //fmt.Println("pEntry", pEntry) | |||
| if pEntry == nil { | |||
| emptyCnt = emptyCnt + 1 | |||
| if emptyCnt+sameIdcnt == cm.ParentCount() { | |||
| if lastSameCm == nil { | |||
| goto loop | |||
| } else { | |||
| cm = lastSameCm | |||
| break | |||
| } | |||
| } | |||
| } else { | |||
| //fmt.Println(i, "pEntry", pEntry.Id, "entry", entry.Id) | |||
| if !pEntry.Id.Equal(entry.Id) { | |||
| goto loop | |||
| } else { | |||
| lastSameCm = cm.Parent(i) | |||
| sameIdcnt = sameIdcnt + 1 | |||
| if emptyCnt+sameIdcnt == cm.ParentCount() { | |||
| // TODO: now follow the first parent commit? | |||
| cm = lastSameCm | |||
| //fmt.Println("sameId...") | |||
| break | |||
| } | |||
| } | |||
| } | |||
| } | |||
| } | |||
| } | |||
| loop: | |||
| rp := &RepoFile{ | |||
| entry, | |||
| path.Join(dirname, entry.Name), | |||
| size, | |||
| repo, | |||
| cm, | |||
| } | |||
| if entry.IsFile() { | |||
| repofiles = append(repofiles, rp) | |||
| } else if entry.IsDir() { | |||
| repodirs = append(repodirs, rp) | |||
| } | |||
| } | |||
| return 0 | |||
| }) | |||
| return append(repodirs, repofiles...), nil | |||
| // IsWatching checks if user has watched given repository. | |||
| func IsWatching(userId, repoId int64) bool { | |||
| has, _ := orm.Get(&Watch{0, repoId, userId}) | |||
| return has | |||
| } | |||
| func GetCommit(userName, repoName, branchname, commitid string) (*git.Commit, error) { | |||
| repo, err := git.OpenRepository(RepoPath(userName, repoName)) | |||
| if err != nil { | |||
| return nil, err | |||
| } | |||
| return repo.GetCommit(branchname, commitid) | |||
| } | |||
| func ForkRepository(reposName string, userId int64) { | |||
| // GetCommits returns all commits of given branch of repository. | |||
| func GetCommits(userName, reposName, branchname string) (*list.List, error) { | |||
| repo, err := git.OpenRepository(RepoPath(userName, reposName)) | |||
| if err != nil { | |||
| return nil, err | |||
| } | |||
| r, err := repo.LookupReference(fmt.Sprintf("refs/heads/%s", branchname)) | |||
| if err != nil { | |||
| return nil, err | |||
| } | |||
| return r.AllCommits() | |||
| } | |||
| @@ -17,9 +17,8 @@ import ( | |||
| ) | |||
| type CreateIssueForm struct { | |||
| IssueName string `form:"name" binding:"Required;MaxSize(50)"` | |||
| RepoId int64 `form:"repoid" binding:"Required"` | |||
| MilestoneId int64 `form:"milestoneid" binding:"Required"` | |||
| IssueName string `form:"title" binding:"Required;MaxSize(50)"` | |||
| MilestoneId int64 `form:"milestoneid"` | |||
| AssigneeId int64 `form:"assigneeid"` | |||
| Labels string `form:"labels"` | |||
| Content string `form:"content"` | |||
| @@ -27,9 +26,7 @@ type CreateIssueForm struct { | |||
| func (f *CreateIssueForm) Name(field string) string { | |||
| names := map[string]string{ | |||
| "IssueName": "Issue name", | |||
| "RepoId": "Repository ID", | |||
| "MilestoneId": "Milestone ID", | |||
| "IssueName": "Issue name", | |||
| } | |||
| return names[field] | |||
| } | |||
| @@ -30,8 +30,9 @@ import ( | |||
| "sync" | |||
| "time" | |||
| "github.com/gogits/gogs/modules/log" | |||
| "github.com/nfnt/resize" | |||
| "github.com/gogits/gogs/modules/log" | |||
| ) | |||
| var ( | |||
| @@ -251,8 +252,8 @@ var client = &http.Client{} | |||
| func (this *thunderTask) fetch() error { | |||
| req, _ := http.NewRequest("GET", this.Url, nil) | |||
| req.Header.Set("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8") | |||
| req.Header.Set("Accept-Encoding", "gzip,deflate,sdch") | |||
| req.Header.Set("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,image/jpeg,image/png,*/*;q=0.8") | |||
| req.Header.Set("Accept-Encoding", "deflate,sdch") | |||
| req.Header.Set("Accept-Language", "zh-CN,zh;q=0.8") | |||
| req.Header.Set("Cache-Control", "no-cache") | |||
| req.Header.Set("User-Agent", "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/33.0.1750.154 Safari/537.36") | |||
| @@ -71,7 +71,7 @@ var Service struct { | |||
| ResetPwdCodeLives int | |||
| } | |||
| func exeDir() (string, error) { | |||
| func ExecDir() (string, error) { | |||
| file, err := exec.LookPath(os.Args[0]) | |||
| if err != nil { | |||
| return "", err | |||
| @@ -244,7 +244,7 @@ func newNotifyMailService() { | |||
| func NewConfigContext() { | |||
| //var err error | |||
| workDir, err := exeDir() | |||
| workDir, err := ExecDir() | |||
| if err != nil { | |||
| fmt.Printf("Fail to get work directory: %s\n", err) | |||
| os.Exit(2) | |||
| @@ -259,16 +259,11 @@ func NewConfigContext() { | |||
| Cfg.BlockMode = false | |||
| cfgPath = filepath.Join(workDir, "custom/conf/app.ini") | |||
| if !com.IsFile(cfgPath) { | |||
| fmt.Println("Custom configuration not found(custom/conf/app.ini)\n" + | |||
| "Please create it and make your own configuration!") | |||
| os.Exit(2) | |||
| } | |||
| if err = Cfg.AppendFiles(cfgPath); err != nil { | |||
| fmt.Printf("Cannot load config file '%s'\n", cfgPath) | |||
| os.Exit(2) | |||
| if com.IsFile(cfgPath) { | |||
| if err = Cfg.AppendFiles(cfgPath); err != nil { | |||
| fmt.Printf("Cannot load config file '%s'\n", cfgPath) | |||
| os.Exit(2) | |||
| } | |||
| } | |||
| AppName = Cfg.MustValue("", "APP_NAME", "Gogs: Go Git Service") | |||
| @@ -276,7 +271,16 @@ func NewConfigContext() { | |||
| AppUrl = Cfg.MustValue("server", "ROOT_URL") | |||
| Domain = Cfg.MustValue("server", "DOMAIN") | |||
| SecretKey = Cfg.MustValue("security", "SECRET_KEY") | |||
| RunUser = Cfg.MustValue("", "RUN_USER") | |||
| curUser := os.Getenv("USERNAME") | |||
| if len(curUser) == 0 { | |||
| curUser = os.Getenv("USER") | |||
| } | |||
| if RunUser != curUser { | |||
| fmt.Printf("Expect user(%s) but current user is: %s\n", RunUser, curUser) | |||
| os.Exit(2) | |||
| } | |||
| EnableHttpsClone = Cfg.MustBool("security", "ENABLE_HTTPS_CLONE", false) | |||
| @@ -102,7 +102,10 @@ func CreateTimeLimitCode(data string, minutes int, startInf interface{}) string | |||
| // AvatarLink returns avatar link by given e-mail. | |||
| func AvatarLink(email string) string { | |||
| return "/avatar/" + EncodeMd5(email) | |||
| if Service.EnableCacheAvatar { | |||
| return "/avatar/" + EncodeMd5(email) | |||
| } | |||
| return "http://1.gravatar.com/avatar/" + EncodeMd5(email) | |||
| } | |||
| // Seconds-based time units | |||
| @@ -483,15 +486,19 @@ func ActionIcon(opType int) string { | |||
| return "plus-circle" | |||
| case 5: // Commit repository. | |||
| return "arrow-circle-o-right" | |||
| case 6: // Create issue. | |||
| return "exclamation-circle" | |||
| default: | |||
| return "invalid type" | |||
| } | |||
| } | |||
| const ( | |||
| TPL_CREATE_REPO = `<a href="/user/%s">%s</a> created repository <a href="/%s/%s">%s</a>` | |||
| TPL_COMMIT_REPO = `<a href="/user/%s">%s</a> pushed to <a href="/%s/%s/src/%s">%s</a> at <a href="/%s/%s">%s/%s</a>%s` | |||
| TPL_COMMIT_REPO_LI = `<div><img id="gogs-user-avatar-commit" src="%s?s=16" alt="user-avatar" title="username"/> <a href="/%s/%s/commit/%s">%s</a> %s</div>` | |||
| TPL_CREATE_REPO = `<a href="/user/%s">%s</a> created repository <a href="/%s">%s</a>` | |||
| TPL_COMMIT_REPO = `<a href="/user/%s">%s</a> pushed to <a href="/%s/src/%s">%s</a> at <a href="/%s">%s</a>%s` | |||
| TPL_COMMIT_REPO_LI = `<div><img src="%s?s=16" alt="user-avatar"/> <a href="/%s/commit/%s">%s</a> %s</div>` | |||
| TPL_CREATE_Issue = `<a href="/user/%s">%s</a> opened issue <a href="/%s/issues/%s">%s#%s</a> | |||
| <div><img src="%s?s=16" alt="user-avatar"/> %s</div>` | |||
| ) | |||
| type PushCommits struct { | |||
| @@ -504,11 +511,12 @@ type PushCommits struct { | |||
| func ActionDesc(act Actioner, avatarLink string) string { | |||
| actUserName := act.GetActUserName() | |||
| repoName := act.GetRepoName() | |||
| repoLink := actUserName + "/" + repoName | |||
| branch := act.GetBranch() | |||
| content := act.GetContent() | |||
| switch act.GetOpType() { | |||
| case 1: // Create repository. | |||
| return fmt.Sprintf(TPL_CREATE_REPO, actUserName, actUserName, actUserName, repoName, repoName) | |||
| return fmt.Sprintf(TPL_CREATE_REPO, actUserName, actUserName, repoLink, repoName) | |||
| case 5: // Commit repository. | |||
| var push *PushCommits | |||
| if err := json.Unmarshal([]byte(content), &push); err != nil { | |||
| @@ -516,13 +524,17 @@ func ActionDesc(act Actioner, avatarLink string) string { | |||
| } | |||
| buf := bytes.NewBuffer([]byte("\n")) | |||
| for _, commit := range push.Commits { | |||
| buf.WriteString(fmt.Sprintf(TPL_COMMIT_REPO_LI, avatarLink, actUserName, repoName, commit[0], commit[0][:7], commit[1]) + "\n") | |||
| buf.WriteString(fmt.Sprintf(TPL_COMMIT_REPO_LI, avatarLink, repoLink, commit[0], commit[0][:7], commit[1]) + "\n") | |||
| } | |||
| if push.Len > 3 { | |||
| buf.WriteString(fmt.Sprintf(`<div><a href="/%s/%s/commits/%s">%d other commits >></a></div>`, actUserName, repoName, branch, push.Len)) | |||
| } | |||
| return fmt.Sprintf(TPL_COMMIT_REPO, actUserName, actUserName, actUserName, repoName, branch, branch, actUserName, repoName, actUserName, repoName, | |||
| return fmt.Sprintf(TPL_COMMIT_REPO, actUserName, actUserName, repoLink, branch, branch, repoLink, repoLink, | |||
| buf.String()) | |||
| case 6: // Create issue. | |||
| infos := strings.SplitN(content, "|", 2) | |||
| return fmt.Sprintf(TPL_CREATE_Issue, actUserName, actUserName, repoLink, infos[0], repoLink, infos[0], | |||
| avatarLink, infos[1]) | |||
| default: | |||
| return "invalid type" | |||
| } | |||
| @@ -9,7 +9,10 @@ import ( | |||
| "github.com/gogits/logs" | |||
| ) | |||
| var logger *logs.BeeLogger | |||
| var ( | |||
| logger *logs.BeeLogger | |||
| Mode, Config string | |||
| ) | |||
| func init() { | |||
| logger = logs.NewLogger(10000) | |||
| @@ -17,6 +20,7 @@ func init() { | |||
| } | |||
| func NewLogger(bufLen int64, mode, config string) { | |||
| Mode, Config = mode, config | |||
| logger = logs.NewLogger(bufLen) | |||
| logger.SetLogger(mode, config) | |||
| } | |||
| @@ -6,6 +6,7 @@ package mailer | |||
| import ( | |||
| "encoding/hex" | |||
| "errors" | |||
| "fmt" | |||
| "github.com/gogits/gogs/models" | |||
| @@ -15,12 +16,17 @@ import ( | |||
| ) | |||
| // Create New mail message use MailFrom and MailUser | |||
| func NewMailMessage(To []string, subject, body string) Message { | |||
| msg := NewHtmlMessage(To, base.MailService.User, subject, body) | |||
| func NewMailMessageFrom(To []string, from, subject, body string) Message { | |||
| msg := NewHtmlMessage(To, from, subject, body) | |||
| msg.User = base.MailService.User | |||
| return msg | |||
| } | |||
| // Create New mail message use MailFrom and MailUser | |||
| func NewMailMessage(To []string, subject, body string) Message { | |||
| return NewMailMessageFrom(To, base.MailService.User, subject, body) | |||
| } | |||
| func GetMailTmplData(user *models.User) map[interface{}]interface{} { | |||
| data := make(map[interface{}]interface{}, 10) | |||
| data["AppName"] = base.AppName | |||
| @@ -84,3 +90,33 @@ func SendActiveMail(r *middleware.Render, user *models.User) { | |||
| SendAsync(&msg) | |||
| } | |||
| // SendNotifyMail sends mail notification of all watchers. | |||
| func SendNotifyMail(userId, repoId int64, userName, repoName, subject, content string) error { | |||
| watches, err := models.GetWatches(repoId) | |||
| if err != nil { | |||
| return errors.New("mail.NotifyWatchers(get watches): " + err.Error()) | |||
| } | |||
| tos := make([]string, 0, len(watches)) | |||
| for i := range watches { | |||
| uid := watches[i].UserId | |||
| if userId == uid { | |||
| continue | |||
| } | |||
| u, err := models.GetUserById(uid) | |||
| if err != nil { | |||
| return errors.New("mail.NotifyWatchers(get user): " + err.Error()) | |||
| } | |||
| tos = append(tos, u.Email) | |||
| } | |||
| if len(tos) == 0 { | |||
| return nil | |||
| } | |||
| msg := NewMailMessageFrom(tos, userName, subject, content) | |||
| msg.Info = fmt.Sprintf("Subject: %s, send notify emails", subject) | |||
| SendAsync(&msg) | |||
| return nil | |||
| } | |||
| @@ -33,7 +33,7 @@ func (m Message) Content() string { | |||
| } | |||
| // create mail content | |||
| content := "From: " + m.User + "<" + m.From + | |||
| content := "From: " + m.From + "<" + m.User + | |||
| ">\r\nSubject: " + m.Subject + "\r\nContent-Type: " + contentType + "\r\n\r\n" + m.Body | |||
| return content | |||
| } | |||
| @@ -73,9 +73,14 @@ func RepoAssignment(redirect bool) martini.Handler { | |||
| if base.EnableHttpsClone { | |||
| scheme = "https" | |||
| } | |||
| ctx.Repo.CloneLink.SSH = fmt.Sprintf("git@%s:%s/%s.git", 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) | |||
| if len(params["branchname"]) == 0 { | |||
| params["branchname"] = "master" | |||
| } | |||
| ctx.Data["Branchname"] = params["branchname"] | |||
| ctx.Data["IsRepositoryValid"] = true | |||
| ctx.Data["Repository"] = repo | |||
| ctx.Data["Owner"] = user | |||
| @@ -52,14 +52,14 @@ html, body { | |||
| } | |||
| /* gogits nav header */ | |||
| .gogs-masthead { | |||
| .masthead { | |||
| background-color: #428bca; | |||
| box-shadow: inset 0 -2px 5px rgba(0, 0, 0, .1); | |||
| margin: 0; | |||
| } | |||
| /* gogits nav item link */ | |||
| .gogs-nav-item { | |||
| .nav-item { | |||
| position: relative; | |||
| display: inline-block; | |||
| padding: 10px; | |||
| @@ -69,39 +69,39 @@ html, body { | |||
| height: 46px; | |||
| } | |||
| #gogs-nav-logo { | |||
| #nav-logo { | |||
| padding-left: 0; | |||
| padding-right: 0; | |||
| margin-right: 10px; | |||
| } | |||
| .gogs-nav-item:hover, | |||
| .gogs-nav-item:focus { | |||
| .nav-item:hover, | |||
| .nav-item:focus { | |||
| color: #fff; | |||
| text-decoration: none; | |||
| } | |||
| .gogs-nav-item.navbar-right { | |||
| .nav-item.navbar-right { | |||
| margin-top: 3px; | |||
| } | |||
| .gogs-nav-item.navbar-btn { | |||
| .nav-item.navbar-btn { | |||
| cursor: pointer; | |||
| margin-top: 8px; | |||
| padding: 5px 15px; | |||
| height: 30px; | |||
| } | |||
| .gogs-nav-item.navbar-right .fa { | |||
| .nav-item.navbar-right .fa { | |||
| margin: 0; | |||
| } | |||
| /* gogits nav item active status */ | |||
| .gogs-nav .active { | |||
| #masthead .nav .active { | |||
| color: #fff; | |||
| } | |||
| .gogs-nav .active:after { | |||
| #masthead .nav .active:after { | |||
| position: absolute; | |||
| bottom: -1px; | |||
| left: 50%; | |||
| @@ -115,29 +115,29 @@ html, body { | |||
| border-left: 5px solid transparent; | |||
| } | |||
| #gogs-nav-logo:after { | |||
| #nav-logo:after { | |||
| bottom: -4px !important; | |||
| } | |||
| #gogs-nav-avatar:after { | |||
| #nav-avatar:after { | |||
| bottom: -4px !important; | |||
| } | |||
| .gogs-nav .tooltip { | |||
| .nav .tooltip { | |||
| border: none; | |||
| } | |||
| /* gogits logo */ | |||
| #gogs-nav-avatar { | |||
| #nav-avatar { | |||
| margin-top: 0; | |||
| } | |||
| #gogs-logo, #gogs-nav-avatar img { | |||
| #logo, #nav-avatar img { | |||
| width: 28px; | |||
| height: 28px; | |||
| } | |||
| #gogs-nav-out { | |||
| #nav-out { | |||
| margin-top: 10px; | |||
| padding: 5px 0; | |||
| margin-left: 10px; | |||
| @@ -145,56 +145,56 @@ html, body { | |||
| float: right; | |||
| } | |||
| #gogs-nav-signin, #gogs-nav-signup { | |||
| #nav-signin, #nav-signup { | |||
| float: right; | |||
| margin-left: 1em; | |||
| } | |||
| #gogs-nav-out .fa { | |||
| #nav-out .fa { | |||
| vertical-align: -10%; | |||
| margin: 0 .5em; | |||
| } | |||
| /* gogits body */ | |||
| #gogs-body { | |||
| #body { | |||
| padding-bottom: 60px; | |||
| margin-top: 30px; | |||
| } | |||
| #gogs-body .btn-default { | |||
| #body .btn-default { | |||
| background-color: #FFF; | |||
| background-image: linear-gradient(to bottom, #FFF 0, #FAFAFA 100%); | |||
| } | |||
| #gogs-body-nav { | |||
| #body-nav { | |||
| background-color: #FFF; | |||
| border-bottom: 1px solid #DDD; | |||
| height: 66px | |||
| } | |||
| #gogs-body-nav .nav { | |||
| #body-nav .nav { | |||
| font-size: 14px; | |||
| margin-top: 12px; | |||
| } | |||
| #gogs-body-nav .nav-pills li a { | |||
| #body-nav .nav-pills li a { | |||
| color: #444; | |||
| } | |||
| #gogs-body-nav .nav-pills li.active a { | |||
| #body-nav .nav-pills li.active a { | |||
| font-weight: bold; | |||
| border-bottom: 2px solid #d26911; | |||
| background-color: transparent; | |||
| color: #444; | |||
| } | |||
| #gogs-body-nav .nav-pills li:hover a { | |||
| #body-nav .nav-pills li:hover a { | |||
| background-color: transparent; | |||
| text-decoration: underline; | |||
| } | |||
| /* gogits login card */ | |||
| .gogs-card { | |||
| .card { | |||
| margin: auto; | |||
| padding: 30px; | |||
| background: #fff; | |||
| @@ -203,87 +203,87 @@ html, body { | |||
| box-sizing: border-box; | |||
| } | |||
| .gogs-card h3 { | |||
| .card h3 { | |||
| margin-top: 0; | |||
| margin-bottom: 30px; | |||
| padding-bottom: 20px; | |||
| border-bottom: 1px solid #ccc; | |||
| } | |||
| #gogs-login-card { | |||
| #login-card { | |||
| width: 600px; | |||
| } | |||
| #gogs-login-card .form-control { | |||
| #login-card .form-control { | |||
| padding: 6px 12px; | |||
| box-sizing: content-box; | |||
| } | |||
| #gogs-login-card .control-label { | |||
| #login-card .control-label { | |||
| height: 44px; | |||
| line-height: 30px; | |||
| } | |||
| #gogs-install-card{ | |||
| #install-card { | |||
| width: 800px; | |||
| } | |||
| #gogs-install-card .form-group { | |||
| #install-card .form-group { | |||
| margin-left: 0; | |||
| margin-right: 0; | |||
| } | |||
| .gogs-card .btn { | |||
| .card .btn { | |||
| cursor: pointer; | |||
| margin-right: 1.2em; | |||
| } | |||
| #gogs-social-login { | |||
| #social-login { | |||
| margin-top: 30px; | |||
| padding-top: 20px; | |||
| border-top: 1px solid #ccc; | |||
| } | |||
| #gogs-social-login .btn { | |||
| #social-login .btn { | |||
| float: none; | |||
| margin: auto; | |||
| } | |||
| /* gogs-user-profile */ | |||
| #gogs-user-avatar { | |||
| #user-avatar { | |||
| width: 200px; | |||
| height: 200px; | |||
| border-radius: 6px; | |||
| } | |||
| #gogs-user-avatar-commit { | |||
| #user-avatar-commit { | |||
| width: 16px; | |||
| height: 16px; | |||
| border-radius: 2px; | |||
| } | |||
| #gogs-user-name { | |||
| #user-name { | |||
| margin-top: 20px; | |||
| font-size: 1.6em; | |||
| font-weight: bold; | |||
| margin-bottom: 20px; | |||
| } | |||
| #gogs-user-profile .profile-info .list-group-item { | |||
| #user-profile .profile-info .list-group-item { | |||
| background-color: transparent; | |||
| padding-top: 18px; | |||
| color: #666; | |||
| } | |||
| #gogs-user-profile .profile-info .list-group-item a { | |||
| #user-profile .profile-info .list-group-item a { | |||
| margin: 0; | |||
| padding: 0; | |||
| display: inline; | |||
| color: #0093c4; | |||
| } | |||
| #gogs-user-profile .profile-info .list-group { | |||
| #user-profile .profile-info .list-group { | |||
| border-top: 1px solid #ccc; | |||
| padding-bottom: 18px; | |||
| border-bottom: 1px solid #ccc; | |||
| @@ -291,50 +291,50 @@ html, body { | |||
| padding-right: 18px; | |||
| } | |||
| #gogs-user-activity .tab-pane { | |||
| #user-activity .tab-pane { | |||
| padding: 20px; | |||
| } | |||
| #gogs-user-act-tabs li.active a { | |||
| #user-act-tabs li.active a { | |||
| border-bottom-color: #ddd; | |||
| } | |||
| /* gogits repo create */ | |||
| #gogs-repo-create { | |||
| #repo-create { | |||
| width: 800px; | |||
| } | |||
| #gogs-repo-create textarea[name=desc] { | |||
| #repo-create textarea[name=desc] { | |||
| height: 8em; | |||
| } | |||
| /* gogits user setting */ | |||
| #gogs-user-setting-nav > h4, #gogs-user-setting-container > h4, #gogs-user-setting-container > div > h4, | |||
| #gogs-ssh-keys > h4, #gogs-user-delete > h4, #gogs-repo-setting-container .tab-pane > h4 { | |||
| #user-setting-nav > h4, #user-setting-container > h4, #user-setting-container > div > h4, | |||
| #ssh-keys > h4, #user-delete > h4, #repo-setting-container .tab-pane > h4 { | |||
| padding-bottom: 18px; | |||
| margin-bottom: 18px; | |||
| border-bottom: 1px solid #CCC; | |||
| } | |||
| #gogs-user-setting-nav .list-group .list-group-item a { | |||
| #user-setting-nav .list-group .list-group-item a { | |||
| margin-left: 0; | |||
| padding: .6em; | |||
| font-size: 14px; | |||
| color: #3B73AF; | |||
| } | |||
| #gogs-user-setting-nav .list-group .list-group-item { | |||
| #user-setting-nav .list-group .list-group-item { | |||
| background-color: transparent; | |||
| } | |||
| #gogs-user-setting-nav .list-group .list-group-item-success a { | |||
| #user-setting-nav .list-group .list-group-item-success a { | |||
| font-weight: bold; | |||
| color: #444; | |||
| } | |||
| .gogs-admin-nav { | |||
| .admin-nav { | |||
| background-color: #FFF; | |||
| padding-top: 10px; | |||
| padding-left: 0; | |||
| @@ -342,49 +342,49 @@ html, body { | |||
| border: 1px solid #D8D8D8; | |||
| } | |||
| .gogs-admin-nav li { | |||
| .admin-nav li { | |||
| margin-bottom: 8px; | |||
| border-left: 4px solid transparent; | |||
| } | |||
| .gogs-admin-nav li:hover { | |||
| .admin-nav li:hover { | |||
| border-left-color: #EEE; | |||
| } | |||
| .gogs-admin-nav li.active:hover { | |||
| .admin-nav li.active:hover { | |||
| border-left: 4px solid #DD4B39; | |||
| } | |||
| #gogs-repo-setting-container .form-horizontal label { | |||
| #repo-setting-container .form-horizontal label { | |||
| line-height: 30px; | |||
| } | |||
| /* gogits user ssh keys */ | |||
| #gogs-ssh-keys .list-group-item { | |||
| #ssh-keys .list-group-item { | |||
| padding: 15px 0; | |||
| border-bottom: 1px solid #DDD; | |||
| } | |||
| #gogs-ssh-keys .list-group-item .delete { | |||
| #ssh-keys .list-group-item .delete { | |||
| margin: -5px 50px 0; | |||
| } | |||
| #gogs-ssh-keys .list-group-item:after { | |||
| #ssh-keys .list-group-item:after { | |||
| clear: both; | |||
| } | |||
| #gogs-ssh-keys .name { | |||
| #ssh-keys .name { | |||
| font-size: 14px; | |||
| font-weight: bold; | |||
| } | |||
| #gogs-ssh-keys .print { | |||
| #ssh-keys .print { | |||
| padding-left: 1em; | |||
| color: #888; | |||
| } | |||
| #gogs-ssh-add { | |||
| #ssh-add { | |||
| display: inline-block; | |||
| color: white; | |||
| cursor: pointer; | |||
| @@ -392,25 +392,25 @@ html, body { | |||
| border-radius: 3px; | |||
| } | |||
| #gogs-ssh-form textarea { | |||
| #ssh-form textarea { | |||
| height: 16em; | |||
| } | |||
| /* #gogs-feed */ | |||
| /* #feed */ | |||
| #gogs-feed-right .repo-panel .panel-heading .btn { | |||
| #feed-right .repo-panel .panel-heading .btn { | |||
| margin-top: -4px; | |||
| } | |||
| #gogs-feed-right .repo-panel .panel-body { | |||
| #feed-right .repo-panel .panel-body { | |||
| padding: 0; | |||
| } | |||
| #gogs-feed-right .repo-panel .list-group { | |||
| #feed-right .repo-panel .list-group { | |||
| margin-bottom: 0; | |||
| } | |||
| #gogs-feed-right .repo-panel .list-group-item a { | |||
| #feed-right .repo-panel .list-group-item a { | |||
| display: block; | |||
| margin-left: 0; | |||
| background-color: transparent; | |||
| @@ -418,11 +418,11 @@ html, body { | |||
| font-weight: bold; | |||
| } | |||
| #gogs-feed-right .repo-panel .list-group-item .fa { | |||
| #feed-right .repo-panel .list-group-item .fa { | |||
| color: #666; | |||
| } | |||
| #gogs-feed-right .repo-panel .list-group-item { | |||
| #feed-right .repo-panel .list-group-item { | |||
| font-size: 14px; | |||
| line-height: 32px; | |||
| border-bottom: 1px solid #DDD; | |||
| @@ -430,97 +430,109 @@ html, body { | |||
| clear: both; | |||
| } | |||
| #gogs-feed-right .repo-panel .list-group-item:last-child { | |||
| #feed-right .repo-panel .list-group-item:last-child { | |||
| border-bottom: none; | |||
| } | |||
| #gogs-feed-right .repo-panel .list-group-item:hover { | |||
| #feed-right .repo-panel .list-group-item:hover { | |||
| background-color: #eafffd; | |||
| background-color: rgba(65, 131, 196, 0.1); | |||
| } | |||
| #gogs-feed-right .repo-panel span.stars { | |||
| #feed-right .repo-panel span.stars { | |||
| color: #666; | |||
| margin-right: 1em; | |||
| } | |||
| /* gogits repo single page */ | |||
| #gogs-body-nav.gogs-repo-nav { | |||
| #body-nav.repo-nav { | |||
| padding-top: 16px; | |||
| padding-bottom: 30px; | |||
| height: auto; | |||
| } | |||
| .gogs-repo-nav .name { | |||
| .repo-nav .name { | |||
| margin-top: 15px; | |||
| } | |||
| .gogs-repo-nav .desc { | |||
| .repo-nav .desc { | |||
| color: #888; | |||
| margin-bottom: 0; | |||
| } | |||
| .gogs-repo-nav h3 .fa { | |||
| .repo-nav h3 .fa { | |||
| color: #BBB; | |||
| margin-left: 0; | |||
| } | |||
| .gogs-repo-nav .actions { | |||
| .repo-nav .actions { | |||
| padding-top: 20px; | |||
| } | |||
| .gogs-repo-nav .btn-default { | |||
| .repo-nav .btn-default { | |||
| font-family: Tahoma, Arial, sans-serif; | |||
| } | |||
| #gogs-repo-watching .dropdown-menu { | |||
| #repo-watching .dropdown-menu { | |||
| width: 280px; | |||
| padding: 0; | |||
| } | |||
| #gogs-repo-watching .dropdown-menu .dropdown-item:hover .dropdown-header, #gogs-repo-watching .dropdown-item .dropdown-header.text-primary { | |||
| #repo-watching .dropdown-menu .dropdown-item:hover .dropdown-header, #repo-watching .dropdown-item .dropdown-header.text-primary { | |||
| color: rgb(65, 131, 196); | |||
| cursor: pointer; | |||
| } | |||
| #gogs-repo-watching .dropdown-menu .description { | |||
| #repo-watching .dropdown-menu .description { | |||
| padding: 0 20px; | |||
| color: #888; | |||
| } | |||
| #gogs-repo-watching .dropdown-menu .dropdown-header { | |||
| #repo-watching .dropdown-menu .dropdown-header { | |||
| color: #444; | |||
| font-weight: bold; | |||
| font-size: 14px; | |||
| margin-bottom: 4px; | |||
| } | |||
| #gogs-repo-toolbar { | |||
| #repo-toolbar { | |||
| border-bottom: 1px solid #DDD; | |||
| background-color: #FFF; | |||
| height: 40px; | |||
| font-size: 14px; | |||
| } | |||
| #gogs-repo-toolbar .navbar-default { | |||
| #repo-toolbar .navbar-default { | |||
| border: none; | |||
| height: 39px; | |||
| } | |||
| #gogs-repo-toolbar .nav > li > a { | |||
| #repo-toolbar .nav > li > a { | |||
| height: 39px; | |||
| } | |||
| #gogs-repo-toolbar .navbar-toolbar.navbar-default .navbar-nav > .active > a:after { | |||
| #repo-toolbar .nav .tmp a:hover { | |||
| text-decoration: none; | |||
| } | |||
| #repo-toolbar .nav .tmp .btn { | |||
| margin-top: -2px; | |||
| } | |||
| #repo-toolbar .nav .active { | |||
| color: #F6F6F6; | |||
| } | |||
| #repo-toolbar .nav > .active > a:after { | |||
| border-bottom-color: #999; | |||
| } | |||
| #gogs-repo-toolbar .navbar.nav-toolbar { | |||
| #repo-toolbar .navbar.nav-toolbar { | |||
| margin-bottom: 0; | |||
| } | |||
| #gogs-repo-toolbar .navbar-collapse { | |||
| #repo-toolbar .navbar-collapse { | |||
| padding: 0; | |||
| } | |||
| @@ -588,29 +600,29 @@ html, body { | |||
| min-width: 200px; | |||
| } | |||
| #gogs-repo-clone .dropdown-menu { | |||
| #repo-clone .dropdown-menu { | |||
| width: 400px; | |||
| padding: 20px; | |||
| } | |||
| #gogs-repo-clone .input-group { | |||
| #repo-clone .input-group { | |||
| margin-bottom: 15px; | |||
| } | |||
| /* #gogs-source */ | |||
| #gogs-source { | |||
| /* #source */ | |||
| #source, #commits { | |||
| margin-top: -20px; | |||
| } | |||
| #gogs-source .source-toolbar:after { | |||
| #source .source-toolbar:after { | |||
| clear: both; | |||
| } | |||
| #gogs-source .source-toolbar .branch-switch { | |||
| #source .source-toolbar .branch-switch { | |||
| display: inline-block; | |||
| } | |||
| #gogs-source .source-toolbar .breadcrumb { | |||
| #source .source-toolbar .breadcrumb { | |||
| margin: 0 .5em; | |||
| padding: 6px 15px; | |||
| font-size: 16px; | |||
| @@ -619,9 +631,9 @@ html, body { | |||
| background-color: transparent; | |||
| } | |||
| #gogs-source .source-toolbar, | |||
| #gogs-source .info-box, | |||
| #gogs-source .file-content { | |||
| #source .source-toolbar, | |||
| #source .info-box, | |||
| #source .file-content { | |||
| margin: 0 0 10px; | |||
| } | |||
| @@ -853,7 +865,7 @@ html, body { | |||
| } | |||
| .guide-box, .diff-head-box { | |||
| margin-top: 20px; | |||
| margin-top: 4px; | |||
| } | |||
| .diff-head-box h4 { | |||
| @@ -941,7 +953,7 @@ html, body { | |||
| color: #888; | |||
| } | |||
| #gogs-source .file-content.diff-file-box { | |||
| #source .file-content.diff-file-box { | |||
| margin-bottom: 20px; | |||
| } | |||
| @@ -987,6 +999,102 @@ html, body { | |||
| color: #AAA; | |||
| } | |||
| /* issue */ | |||
| #issue-create-form .avatar { | |||
| width: 50px; | |||
| height: 50px; | |||
| } | |||
| #issue-create-form .panel-body { | |||
| padding: 15px 0 0 0; | |||
| } | |||
| #issue-create-form .panel-body.form-group, #issue-create-form .tab-pane .form-group { | |||
| margin-bottom: 0; | |||
| } | |||
| #issue-create-form .nav-tabs { | |||
| margin-bottom: 10px; | |||
| } | |||
| #issue-create-form .md-help { | |||
| margin-top: 6px; | |||
| } | |||
| #issue .filter-list a { | |||
| padding: 6px 10px; | |||
| font-size: 14px; | |||
| display: block; | |||
| margin-bottom: 6px; | |||
| border-radius: 3px; | |||
| color: #444; | |||
| } | |||
| #issue .filter-list a.sm { | |||
| font-size: 13px; | |||
| } | |||
| #issue .filter-list hr { | |||
| border-color: #CCC; | |||
| } | |||
| #issue .filter-list a:hover { | |||
| background-color: #DDD; | |||
| text-decoration: none; | |||
| } | |||
| #issue .filter-list a.active { | |||
| background-color: #4183c4; | |||
| color: #FFF; | |||
| } | |||
| #issue .filter-option { | |||
| margin-bottom: 12px; | |||
| } | |||
| #issue .list-group .list-group-item { | |||
| background-color: #FFF; | |||
| } | |||
| #issue .issue-item:hover { | |||
| background-color: rgba(19, 95, 215, 0.03); | |||
| } | |||
| #issue .list-group .list-group-item.unread { | |||
| border-left: 2px solid #DD4B39; | |||
| } | |||
| #issue .issue-item .title { | |||
| margin-bottom: 16px; | |||
| font-weight: bold; | |||
| } | |||
| #issue .issue-item h5.title a { | |||
| color: #444; | |||
| } | |||
| #issue .issue-item .info span { | |||
| margin-right: 12px; | |||
| color: #888; | |||
| line-height: 20px; | |||
| } | |||
| #issue .issue-item .info a, #issue .issue-item .number { | |||
| color: #888; | |||
| } | |||
| #issue .issue-item .number { | |||
| margin-top: 8px; | |||
| } | |||
| #issue .issue-item .avatar { | |||
| margin-right: 8px; | |||
| width: 20px; | |||
| height: 20px; | |||
| vertical-align: top; | |||
| } | |||
| /* wrapper and footer */ | |||
| #wrapper { | |||
| @@ -111,6 +111,7 @@ var Gogits = { | |||
| }; | |||
| Gogits.initTabs = function () { | |||
| var $tabs = $('[data-init=tabs]'); | |||
| $tabs.tab("show"); | |||
| $tabs.find("li:eq(0) a").tab("show"); | |||
| }; | |||
| // fix dropdown inside click | |||
| @@ -243,7 +244,7 @@ function initCore() { | |||
| function initRegister() { | |||
| $.getScript("/js/jquery.validate.min.js", function () { | |||
| Gogits.validateForm("#gogs-login-card", { | |||
| Gogits.validateForm("#login-card", { | |||
| rules: { | |||
| "username": { | |||
| required: true, | |||
| @@ -268,7 +269,7 @@ function initRegister() { | |||
| } | |||
| function initUserSetting() { | |||
| $('#gogs-ssh-keys .delete').confirmation({ | |||
| $('#ssh-keys .delete').confirmation({ | |||
| singleton: true, | |||
| onConfirm: function (e, $this) { | |||
| Gogits.ajaxDelete("", {"id": $this.data("del")}, function (json) { | |||
| @@ -303,7 +304,7 @@ function initRepository() { | |||
| // watching script | |||
| (function () { | |||
| var $watch = $('#gogs-repo-watching'), | |||
| var $watch = $('#repo-watching'), | |||
| watchLink = $watch.data("watch"), | |||
| unwatchLink = $watch.data("unwatch"); | |||
| $watch.on('click', '.to-watch',function () { | |||
| @@ -354,14 +355,14 @@ function initRepository() { | |||
| (function ($) { | |||
| $(function () { | |||
| initCore(); | |||
| var body = $("#gogs-body"); | |||
| var body = $("#body"); | |||
| if (body.data("page") == "user-signup") { | |||
| initRegister(); | |||
| } | |||
| if (body.data("page") == "user") { | |||
| initUserSetting(); | |||
| } | |||
| if ($('.gogs-repo-nav').length) { | |||
| if ($('.repo-nav').length) { | |||
| initRepository(); | |||
| } | |||
| }); | |||
| @@ -26,11 +26,6 @@ func Branches(ctx *middleware.Context, params martini.Params) { | |||
| ctx.Data["Username"] = params["username"] | |||
| ctx.Data["Reponame"] = params["reponame"] | |||
| if len(params["branchname"]) == 0 { | |||
| params["branchname"] = "master" | |||
| } | |||
| ctx.Data["Branchname"] = params["branchname"] | |||
| ctx.Data["Branches"] = brs | |||
| ctx.Data["IsRepoToolbarBranches"] = true | |||
| @@ -34,8 +34,24 @@ func Commits(ctx *middleware.Context, params martini.Params) { | |||
| ctx.HTML(200, "repo/commits") | |||
| } | |||
| func Diff(ctx *middleware.Context,params martini.Params){ | |||
| ctx.Data["Title"] = "commit-sha" | |||
| func Diff(ctx *middleware.Context, params martini.Params) { | |||
| commit, err := models.GetCommit(params["username"], params["reponame"], params["branchname"], params["commitid"]) | |||
| if err != nil { | |||
| ctx.Handle(404, "repo.Diff", err) | |||
| return | |||
| } | |||
| diff, err := models.GetDiff(models.RepoPath(params["username"], params["reponame"]), params["commitid"]) | |||
| if err != nil { | |||
| ctx.Handle(404, "repo.Diff", err) | |||
| return | |||
| } | |||
| shortSha := params["commitid"][:7] | |||
| ctx.Data["Title"] = commit.Message() + " · " + shortSha | |||
| ctx.Data["Commit"] = commit | |||
| ctx.Data["ShortSha"] = shortSha | |||
| ctx.Data["Diff"] = diff | |||
| ctx.Data["IsRepoToolbarCommits"] = true | |||
| ctx.HTML(200,"repo/diff") | |||
| ctx.HTML(200, "repo/diff") | |||
| } | |||
| @@ -13,6 +13,7 @@ import ( | |||
| "github.com/gogits/gogs/modules/auth" | |||
| "github.com/gogits/gogs/modules/base" | |||
| "github.com/gogits/gogs/modules/log" | |||
| "github.com/gogits/gogs/modules/mailer" | |||
| "github.com/gogits/gogs/modules/middleware" | |||
| ) | |||
| @@ -23,19 +24,34 @@ func Issues(ctx *middleware.Context, params martini.Params) { | |||
| milestoneId, _ := base.StrTo(params["milestone"]).Int() | |||
| page, _ := base.StrTo(params["page"]).Int() | |||
| var err error | |||
| ctx.Data["Issues"], err = models.GetIssues(0, ctx.Repo.Repository.Id, 0, | |||
| // Get issues. | |||
| issues, err := models.GetIssues(0, ctx.Repo.Repository.Id, 0, | |||
| int64(milestoneId), page, params["state"] == "closed", false, params["labels"], params["sortType"]) | |||
| if err != nil { | |||
| ctx.Handle(200, "issue.Issues: %v", err) | |||
| return | |||
| } | |||
| if len(params["branchname"]) == 0 { | |||
| params["branchname"] = "master" | |||
| var closedCount int | |||
| // Get posters. | |||
| for i := range issues { | |||
| u, err := models.GetUserById(issues[i].PosterId) | |||
| if err != nil { | |||
| ctx.Handle(200, "issue.Issues(get poster): %v", err) | |||
| return | |||
| } | |||
| if issues[i].IsClosed { | |||
| closedCount++ | |||
| } | |||
| issues[i].Poster = u | |||
| } | |||
| ctx.Data["Branchname"] = params["branchname"] | |||
| ctx.HTML(200, "repo/issues") | |||
| ctx.Data["Issues"] = issues | |||
| ctx.Data["IssueCount"] = len(issues) | |||
| ctx.Data["OpenCount"] = len(issues) - closedCount | |||
| ctx.Data["ClosedCount"] = closedCount | |||
| ctx.HTML(200, "issue/list") | |||
| } | |||
| func CreateIssue(ctx *middleware.Context, params martini.Params, form auth.CreateIssueForm) { | |||
| @@ -57,14 +73,30 @@ func CreateIssue(ctx *middleware.Context, params martini.Params, form auth.Creat | |||
| return | |||
| } | |||
| issue, err := models.CreateIssue(ctx.User.Id, form.RepoId, form.MilestoneId, form.AssigneeId, | |||
| issue, err := models.CreateIssue(ctx.User.Id, ctx.Repo.Repository.Id, form.MilestoneId, form.AssigneeId, | |||
| form.IssueName, form.Labels, form.Content, false) | |||
| if err == nil { | |||
| log.Trace("%s Issue created: %d", form.RepoId, issue.Id) | |||
| ctx.Redirect(fmt.Sprintf("/%s/%s/issues/%d", params["username"], params["reponame"], issue.Index)) | |||
| if err != nil { | |||
| ctx.Handle(200, "issue.CreateIssue", err) | |||
| return | |||
| } | |||
| // Notify watchers. | |||
| if err = models.NotifyWatchers(ctx.User.Id, ctx.Repo.Repository.Id, models.OP_CREATE_ISSUE, | |||
| ctx.User.Name, ctx.Repo.Repository.Name, "", fmt.Sprintf("%d|%s", issue.Index, issue.Name)); err != nil { | |||
| ctx.Handle(200, "issue.CreateIssue", err) | |||
| return | |||
| } | |||
| ctx.Handle(200, "issue.CreateIssue", err) | |||
| // Mail watchers. | |||
| if base.Service.NotifyMail { | |||
| if err = mailer.SendNotifyMail(ctx.User.Id, ctx.Repo.Repository.Id, ctx.User.Name, ctx.Repo.Repository.Name, issue.Name, issue.Content); err != nil { | |||
| ctx.Handle(200, "issue.CreateIssue", err) | |||
| return | |||
| } | |||
| } | |||
| log.Trace("%d Issue created: %d", ctx.Repo.Repository.Id, issue.Id) | |||
| ctx.Redirect(fmt.Sprintf("/%s/%s/issues/%d", params["username"], params["reponame"], issue.Index)) | |||
| } | |||
| func ViewIssue(ctx *middleware.Context, params martini.Params) { | |||
| @@ -12,10 +12,5 @@ import ( | |||
| func Pulls(ctx *middleware.Context, params martini.Params) { | |||
| ctx.Data["IsRepoToolbarPulls"] = true | |||
| if len(params["branchname"]) == 0 { | |||
| params["branchname"] = "master" | |||
| } | |||
| ctx.Data["Branchname"] = params["branchname"] | |||
| ctx.HTML(200, "repo/pulls") | |||
| } | |||
| @@ -57,10 +57,6 @@ func Single(ctx *middleware.Context, params martini.Params) { | |||
| return | |||
| } | |||
| if len(params["branchname"]) == 0 { | |||
| params["branchname"] = "master" | |||
| } | |||
| // Get tree path | |||
| treename := params["_1"] | |||
| @@ -177,7 +173,6 @@ func Single(ctx *middleware.Context, params martini.Params) { | |||
| ctx.Data["Username"] = params["username"] | |||
| ctx.Data["Reponame"] = params["reponame"] | |||
| ctx.Data["Branchname"] = params["branchname"] | |||
| var treenames []string | |||
| Paths := make([]string, 0) | |||
| @@ -216,10 +211,6 @@ func SingleDownload(ctx *middleware.Context, params martini.Params) { | |||
| return | |||
| } | |||
| if len(params["branchname"]) == 0 { | |||
| params["branchname"] = "master" | |||
| } | |||
| // Get tree path | |||
| treename := params["_1"] | |||
| @@ -290,11 +281,6 @@ func Setting(ctx *middleware.Context, params martini.Params) { | |||
| title = t | |||
| } | |||
| if len(params["branchname"]) == 0 { | |||
| params["branchname"] = "master" | |||
| } | |||
| ctx.Data["Branchname"] = params["branchname"] | |||
| ctx.Data["Title"] = title + " - settings" | |||
| ctx.HTML(200, "repo/setting") | |||
| } | |||
| @@ -285,7 +285,8 @@ func Feeds(ctx *middleware.Context, form auth.FeedsForm) { | |||
| } | |||
| func Issues(ctx *middleware.Context) { | |||
| ctx.HTML(200, "user/issues") | |||
| ctx.Data["Title"] = "Your Issues" | |||
| ctx.HTML(200, "issue/user") | |||
| } | |||
| func Pulls(ctx *middleware.Context) { | |||
| @@ -9,6 +9,7 @@ import ( | |||
| "fmt" | |||
| "os" | |||
| "os/exec" | |||
| "path" | |||
| "strconv" | |||
| "strings" | |||
| @@ -42,11 +43,12 @@ gogs serv provide access auth for repositories`, | |||
| Flags: []cli.Flag{}, | |||
| } | |||
| func init() { | |||
| func newLogger(execDir string) { | |||
| level := "0" | |||
| os.MkdirAll("log", os.ModePerm) | |||
| log.NewLogger(10000, "file", fmt.Sprintf(`{"level":%s,"filename":"%s"}`, level, "log/serv.log")) | |||
| log.Info("start logging...") | |||
| logPath := execDir + "/log/serv.log" | |||
| os.MkdirAll(path.Dir(logPath), os.ModePerm) | |||
| log.NewLogger(10000, "file", fmt.Sprintf(`{"level":%s,"filename":"%s"}`, level, logPath)) | |||
| log.Trace("start logging...") | |||
| } | |||
| func parseCmd(cmd string) (string, string) { | |||
| @@ -70,6 +72,10 @@ func In(b string, sl map[string]int) bool { | |||
| } | |||
| func runServ(k *cli.Context) { | |||
| execDir, _ := base.ExecDir() | |||
| newLogger(execDir) | |||
| log.Trace("new serv request " + log.Mode + ":" + log.Config) | |||
| base.NewConfigContext() | |||
| models.LoadModelsConfig() | |||
| models.NewEngine() | |||
| @@ -77,17 +83,20 @@ func runServ(k *cli.Context) { | |||
| keys := strings.Split(os.Args[2], "-") | |||
| if len(keys) != 2 { | |||
| fmt.Println("auth file format error") | |||
| log.Error("auth file format error") | |||
| return | |||
| } | |||
| keyId, err := strconv.ParseInt(keys[1], 10, 64) | |||
| if err != nil { | |||
| fmt.Println("auth file format error") | |||
| log.Error("auth file format error") | |||
| return | |||
| } | |||
| user, err := models.GetUserByKeyId(keyId) | |||
| if err != nil { | |||
| fmt.Println("You have no right to access") | |||
| log.Error("You have no right to access") | |||
| return | |||
| } | |||
| @@ -102,6 +111,7 @@ func runServ(k *cli.Context) { | |||
| rr := strings.SplitN(rRepo, "/", 2) | |||
| if len(rr) != 2 { | |||
| println("Unavilable repository", args) | |||
| log.Error("Unavilable repository %v", args) | |||
| return | |||
| } | |||
| repoName := rr[1] | |||
| @@ -112,21 +122,22 @@ func runServ(k *cli.Context) { | |||
| isWrite := In(verb, COMMANDS_WRITE) | |||
| isRead := In(verb, COMMANDS_READONLY) | |||
| //repo, err := models.GetRepositoryByName(user.Id, repoName) | |||
| /*//repo, err := models.GetRepositoryByName(user.Id, repoName) | |||
| //var isExist bool = true | |||
| if err != nil { | |||
| if err == models.ErrRepoNotExist { | |||
| //isExist = false | |||
| if isRead { | |||
| println("Repository", user.Name+"/"+repoName, "is not exist") | |||
| log.Error("Repository " + user.Name + "/" + repoName + " is not exist") | |||
| return | |||
| } | |||
| } else { | |||
| println("Get repository error:", err) | |||
| log.Error(err.Error()) | |||
| log.Error("Get repository error: " + err.Error()) | |||
| return | |||
| } | |||
| } | |||
| }*/ | |||
| // access check | |||
| switch { | |||
| @@ -139,6 +150,7 @@ func runServ(k *cli.Context) { | |||
| } | |||
| if !has { | |||
| println("You have no right to write this repository") | |||
| log.Error("You have no right to access this repository") | |||
| return | |||
| } | |||
| case isRead: | |||
| @@ -158,10 +170,12 @@ func runServ(k *cli.Context) { | |||
| } | |||
| if !has { | |||
| println("You have no right to access this repository") | |||
| log.Error("You have no right to access this repository") | |||
| return | |||
| } | |||
| default: | |||
| println("Unknown command") | |||
| log.Error("Unknown command") | |||
| return | |||
| } | |||
| @@ -178,7 +192,7 @@ func runServ(k *cli.Context) { | |||
| if err = gitcmd.Run(); err != nil { | |||
| println("execute command error:", err.Error()) | |||
| log.Error(err.Error()) | |||
| log.Error("execute command error: " + err.Error()) | |||
| return | |||
| } | |||
| } | |||
| @@ -1,8 +1,8 @@ | |||
| {{template "base/head" .}} | |||
| {{template "base/navbar" .}} | |||
| <div id="gogs-body" class="container" data-page="admin"> | |||
| <div id="body" class="container" data-page="admin"> | |||
| {{template "admin/nav" .}} | |||
| <div id="gogs-admin-container" class="col-md-9"> | |||
| <div id="admin-container" class="col-md-9"> | |||
| <div class="panel panel-default"> | |||
| <div class="panel-heading"> | |||
| Server Configuration | |||
| @@ -1,8 +1,8 @@ | |||
| {{template "base/head" .}} | |||
| {{template "base/navbar" .}} | |||
| <div id="gogs-body" class="container" data-page="admin"> | |||
| <div id="body" class="container" data-page="admin"> | |||
| {{template "admin/nav" .}} | |||
| <div id="gogs-admin-container" class="col-md-9"> | |||
| <div id="admin-container" class="col-md-9"> | |||
| <div class="panel panel-default"> | |||
| <div class="panel-heading"> | |||
| Statistic | |||
| @@ -1,5 +1,5 @@ | |||
| <div id="gogs-user-setting-nav" class="col-md-3 gogs-admin-nav"> | |||
| <ul class="list-group" data-init="tabs"> | |||
| <div id="user-setting-nav" class="col-md-3 admin-nav"> | |||
| <ul class="list-group"> | |||
| <li class="list-group-item{{if .PageIsDashboard}} active{{end}}"><a href="/admin"><i class="fa fa-tachometer fa-lg"></i> Dashboard</a></li> | |||
| <li class="list-group-item{{if .PageIsUsers}} active{{end}}"><a href="/admin/users"><i class="fa fa-users fa-lg"></i> Users</a></li> | |||
| <li class="list-group-item{{if .PageIsRepos}} active{{end}}"><a href="/admin/repos"><i class="fa fa-book fa-lg"></i> Repositories</a></li> | |||
| @@ -1,8 +1,8 @@ | |||
| {{template "base/head" .}} | |||
| {{template "base/navbar" .}} | |||
| <div id="gogs-body" class="container" data-page="admin"> | |||
| <div id="body" class="container" data-page="admin"> | |||
| {{template "admin/nav" .}} | |||
| <div id="gogs-admin-container" class="col-md-9"> | |||
| <div id="admin-container" class="col-md-9"> | |||
| <div class="panel panel-default"> | |||
| <div class="panel-heading"> | |||
| Repository Management | |||
| @@ -1,8 +1,8 @@ | |||
| {{template "base/head" .}} | |||
| {{template "base/navbar" .}} | |||
| <div id="gogs-body" class="container" data-page="admin"> | |||
| <div id="body" class="container" data-page="admin"> | |||
| {{template "admin/nav" .}} | |||
| <div id="gogs-admin-container" class="col-md-9"> | |||
| <div id="admin-container" class="col-md-9"> | |||
| <div class="panel panel-default"> | |||
| <div class="panel-heading"> | |||
| User Management | |||
| @@ -1,8 +1,8 @@ | |||
| {{template "base/head" .}} | |||
| {{template "base/navbar" .}} | |||
| <div id="gogs-body" class="container" data-page="admin"> | |||
| <div id="body" class="container" data-page="admin"> | |||
| {{template "admin/nav" .}} | |||
| <div id="gogs-admin-container" class="col-md-9"> | |||
| <div id="admin-container" class="col-md-9"> | |||
| <div class="panel panel-default"> | |||
| <div class="panel-heading"> | |||
| Edit Account | |||
| @@ -1,8 +1,8 @@ | |||
| {{template "base/head" .}} | |||
| {{template "base/navbar" .}} | |||
| <div id="gogs-body" class="container" data-page="admin"> | |||
| <div id="body" class="container" data-page="admin"> | |||
| {{template "admin/nav" .}} | |||
| <div id="gogs-admin-container" class="col-md-9"> | |||
| <div id="admin-container" class="col-md-9"> | |||
| <div class="panel panel-default"> | |||
| <div class="panel-heading"> | |||
| New Account | |||
| @@ -1,25 +1,25 @@ | |||
| <div class="gogs-masthead navbar" id="masthead"> | |||
| <div class="masthead navbar" id="masthead"> | |||
| <div class="container"> | |||
| <nav class="gogs-nav"> | |||
| <a id="gogs-nav-logo" class="gogs-nav-item{{if .PageIsHome}} active{{end}}" href="/"><img src="/img/favicon.png" alt="Gogs Logo" id="gogs-logo"></a> | |||
| <a class="gogs-nav-item{{if .PageIsUserDashboard}} active{{end}}" href="/">Dashboard</a> | |||
| <a class="gogs-nav-item{{if .PageIsHelp}} active{{end}}" href="/help">Help</a>{{if .IsSigned}} | |||
| <a id="gogs-nav-out" class="gogs-nav-item navbar-right navbar-btn btn btn-danger" href="/user/logout/"><i class="fa fa-power-off fa-lg"></i></a> | |||
| <a id="gogs-nav-avatar" class="gogs-nav-item navbar-right{{if .PageIsUserProfile}} active{{end}}" href="{{.SignedUser.HomeLink}}" data-toggle="tooltip" data-placement="bottom" title="{{.SignedUserName}}"> | |||
| <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 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"/> | |||
| </a> | |||
| <a class="navbar-right gogs-nav-item{{if .PageIsNewRepo}} active{{end}}" 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{{if .PageIsUserSetting}} active{{end}}" href="/user/setting" data-toggle="tooltip" data-placement="bottom" title="Setting"><i class="fa fa-cogs fa-lg"></i></a> | |||
| {{if .IsAdmin}}<a class="navbar-right gogs-nav-item{{if .PageIsAdmin}} active{{end}}" href="/admin" data-toggle="tooltip" data-placement="bottom" title="Admin"><i class="fa fa-gear fa-lg"></i></a>{{end}} | |||
| {{else}}<a id="gogs-nav-signin" class="gogs-nav-item navbar-right navbar-btn btn btn-danger" href="/user/login/">Sign In</a> | |||
| <a id="gogs-nav-signup" class="gogs-nav-item navbar-right" href="/user/sign_up/">Sign Up</a>{{end}} | |||
| <a class="navbar-right nav-item{{if .PageIsNewRepo}} active{{end}}" 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 nav-item{{if .PageIsUserSetting}} active{{end}}" href="/user/setting" data-toggle="tooltip" data-placement="bottom" title="Setting"><i class="fa fa-cogs fa-lg"></i></a> | |||
| {{if .IsAdmin}}<a class="navbar-right nav-item{{if .PageIsAdmin}} active{{end}}" href="/admin" data-toggle="tooltip" data-placement="bottom" title="Admin"><i class="fa fa-gear fa-lg"></i></a>{{end}} | |||
| {{else}}<a id="nav-signin" class="nav-item navbar-right navbar-btn btn btn-danger" href="/user/login/">Sign In</a> | |||
| <a id="nav-signup" class="nav-item navbar-right" href="/user/sign_up/">Sign Up</a>{{end}} | |||
| </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"> | |||
| <button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#navbar-collapse"> | |||
| <i class="fa fa-bars"></i> | |||
| </button> | |||
| <a class="navbar-brand" href="/"><img src="/img/favicon.png" alt="Gogs Logo"></a> | |||
| @@ -1,11 +1,11 @@ | |||
| {{template "base/head" .}} | |||
| {{template "base/navbar" .}} | |||
| <div id="gogs-body-nav"> | |||
| <div id="body-nav"> | |||
| <div class="container"> | |||
| <h3>Help</h3> | |||
| </div> | |||
| </div> | |||
| <div id="gogs-body" class="container" data-page="user"> | |||
| <div id="body" class="container" data-page="user"> | |||
| {{if .HasInfo}}<div class="alert alert-info">{{.InfoMsg}}</div>{{end}} | |||
| </div> | |||
| {{template "base/footer" .}} | |||
| @@ -1,6 +1,6 @@ | |||
| {{template "base/head" .}} | |||
| {{template "base/navbar" .}} | |||
| <div id="gogs-body" class="container"> | |||
| Welcome to the land of Gogs! There will be some indroduction! | |||
| <div id="body" class="container"> | |||
| Welcome to the land of Gogs! We will add an introduction soon! | |||
| </div> | |||
| {{template "base/footer" .}} | |||
| {{template "base/footer" .}} | |||
| @@ -1,6 +1,6 @@ | |||
| {{template "base/head" .}} | |||
| <div id="gogs-body" class="container"> | |||
| <form action="/install" method="post" class="form-horizontal gogs-card" id="gogs-install-card"> | |||
| <div id="body" class="container"> | |||
| <form action="/install" method="post" class="form-horizontal card" id="install-card"> | |||
| {{.CsrfTokenHtml}} | |||
| <h3>Install Steps</h3> | |||
| <div class="alert alert-danger form-error{{if .HasError}}{{else}} hidden{{end}}">{{.ErrorMsg}}</div> | |||
| @@ -2,9 +2,42 @@ | |||
| {{template "base/navbar" .}} | |||
| {{template "repo/nav" .}} | |||
| {{template "repo/toolbar" .}} | |||
| <div id="gogs-body" class="container"> | |||
| <div id="gogs-source"> | |||
| new-issues | |||
| <div id="body" class="container"> | |||
| <div id="issue"> | |||
| <form class="form" action="/{{.RepositoryLink}}/issues/new" method="post" id="issue-create-form"> | |||
| {{.CsrfTokenHtml}} | |||
| <div class="col-md-1"> | |||
| <img class="avatar" src="{{.SignedUser.AvatarLink}}" alt=""/> | |||
| </div> | |||
| <div class="col-md-8 panel panel-default"> | |||
| <div class="form-group panel-body"> | |||
| <input class="form-control input-lg" type="text" name="title" required="required" placeholder="Title" value="{{.title}}" /> | |||
| </div> | |||
| <div class="form-group panel-body"> | |||
| <div class="md-help pull-right"><!-- todo help link --> | |||
| Content with <a href="#">Markdown</a> | |||
| </div> | |||
| <ul class="nav nav-tabs" data-init="tabs"> | |||
| <li class="active"><a href="#issue-textarea" data-toggle="tab">Write</a></li> | |||
| <li><a href="#issue-preview" data-toggle="tab">Preview</a></li> | |||
| </ul> | |||
| <div class="tab-content"> | |||
| <div class="tab-pane" id="issue-textarea"> | |||
| <div class="form-group"> | |||
| <textarea class="form-control" name="content" id="issue-content" rows="10" placeholder="Write some content">{{.content}}</textarea> | |||
| </div> | |||
| </div> | |||
| <div class="tab-pane" id="issue-preview">preview</div> | |||
| </div> | |||
| </div> | |||
| <div class="text-right panel-body"> | |||
| <div class="form-group"> | |||
| <input type="hidden" value="id" name="repo-id"/> | |||
| <button class="btn-success btn">Create new issue</button> | |||
| </div> | |||
| </div> | |||
| </div> | |||
| </form> | |||
| </div> | |||
| </div> | |||
| {{template "base/footer" .}} | |||
| @@ -0,0 +1,39 @@ | |||
| {{template "base/head" .}} | |||
| {{template "base/navbar" .}} | |||
| {{template "repo/nav" .}} | |||
| {{template "repo/toolbar" .}} | |||
| <div id="body" class="container"> | |||
| <div id="issue"> | |||
| <div class="col-md-3 filter-list"> | |||
| <ul class="list-unstyled"> | |||
| <li><a href="#" class="active">All Issues <strong class="pull-right">{{.IssueCount}}</strong></a></li> | |||
| <li><a href="#">My Issues</a></li> | |||
| <li><a href="#">Mentioned</a></li> | |||
| </ul> | |||
| </div> | |||
| <div class="col-md-9"> | |||
| <div class="filter-option"> | |||
| <div class="btn-group"> | |||
| <a class="btn btn-default active issue-open" href="#">{{.OpenCount}} Open</a> | |||
| <a class="btn btn-default issue-close" href="#">{{.ClosedCount}} Closed</a> | |||
| </div> | |||
| </div> | |||
| <div class="issues list-group"> | |||
| {{range .Issues}} | |||
| <div class="list-group-item issue-item" id="{{.Id}}"> | |||
| <span class="number pull-right">#{{.Index}}</span> | |||
| <h5 class="title"><a href="/{{$.RepositoryLink}}/issues/{{.Index}}">{{.Name}}</a></h5> | |||
| <p class="info"> | |||
| <span class="author"><img class="avatar" src="{{.Poster.AvatarLink}}" alt="" width="20"/> | |||
| <a href="/user/{{.Poster.Name}}">{{.Poster.Name}}</a></span> | |||
| <span class="time">{{TimeSince .Created}}</span> | |||
| <span class="comment"><i class="fa fa-comments"></i> {{.NumComments}}</span> | |||
| </p> | |||
| </div> | |||
| {{end}} | |||
| </div> | |||
| </div> | |||
| </div> | |||
| </div> | |||
| </div> | |||
| {{template "base/footer" .}} | |||
| @@ -0,0 +1,70 @@ | |||
| {{template "base/head" .}} | |||
| {{template "base/navbar" .}} | |||
| <div id="body-nav"> | |||
| <div class="container"> | |||
| <ul class="nav nav-pills pull-right"> | |||
| <li><a href="/">Feed</a></li> | |||
| <li class="active"><a href="/issues">Issues</a></li> | |||
| <!-- <li><a href="/pulls">Pull Requests</a></li> | |||
| <li><a href="/stars">Stars</a></li> --> | |||
| </ul> | |||
| <h3>Your Issues</h3> | |||
| </div> | |||
| </div> | |||
| <div id="body" class="container" data-page="user"> | |||
| {{if .HasInfo}}<div class="alert alert-info">{{.InfoMsg}}</div>{{end}} | |||
| <div id="issue"> | |||
| <div class="col-md-3 filter-list"> | |||
| <ul class="list-unstyled"> | |||
| <li><a href="#" class="active">In your repositories <strong class="pull-right">10</strong></a></li> | |||
| <li><a href="#">Created by you</a></li> | |||
| <li><a href="#">Assigned to you</a></li> | |||
| <li><hr/></li> | |||
| <li><a href="" class="sm">gogits/gogs <strong class="pull-right">12</strong></a></li> | |||
| <li><a href="" class="sm">gogits/session <strong class="pull-right">8</strong></a></li> | |||
| <li><a href="" class="sm">gogits/git <strong class="pull-right">2</strong></a></li> | |||
| </ul> | |||
| </div> | |||
| <div class="col-md-9"> | |||
| <div class="filter-option"> | |||
| <div class="btn-group"> | |||
| <a class="btn btn-default active issue-open" href="#">27 Open</a> | |||
| <a class="btn btn-default issue-close" href="#">Close 128</a> | |||
| </div> | |||
| </div> | |||
| <div class="issues list-group"> | |||
| <div class="list-group-item unread issue-item" id="issue-id"> | |||
| <span class="number pull-right">#123</span> | |||
| <h5 class="title"><a href="#">Bug: When running tests after generating a beego app, templates do not load.</a></h5> | |||
| <p class="info"> | |||
| <span class="author"><img class="avatar" src="http://tp2.sinaimg.cn/5068084885/50/40050297589/1" alt="" width="20"/> | |||
| <a href="#">Obama</a></span> | |||
| <span class="time">3 days ago</span> | |||
| <span class="comment"><i class="fa fa-comments"></i> 3</span> | |||
| </p> | |||
| </div> | |||
| <div class="list-group-item issue-item" id="issue-id2"> | |||
| <span class="number pull-right">#123</span> | |||
| <h5 class="title"><a href="#">Bug: When running tests after generating a beego app, templates do not load.</a></h5> | |||
| <p class="info"> | |||
| <span class="author"><img class="avatar" src="http://tp2.sinaimg.cn/5068084885/50/40050297589/1" alt="" width="20"/> | |||
| <a href="#">Obama</a></span> | |||
| <span class="time">3 days ago</span> | |||
| <span class="comment"><i class="fa fa-comments"></i> 3</span> | |||
| </p> | |||
| </div> | |||
| <div class="list-group-item issue-item" id="issue-id3"> | |||
| <span class="number pull-right">#123</span> | |||
| <h5 class="title"><a href="#">Bug: When running tests after generating a beego app, templates do not load.</a></h5> | |||
| <p class="info"> | |||
| <span class="author"><img class="avatar" src="http://tp2.sinaimg.cn/5068084885/50/40050297589/1" alt="" width="20"/> | |||
| <a href="#">Obama</a></span> | |||
| <span class="time">3 days ago</span> | |||
| <span class="comment"><i class="fa fa-comments"></i> 3</span> | |||
| </p> | |||
| </div> | |||
| </div> | |||
| </div> | |||
| </div> | |||
| </div> | |||
| {{template "base/footer" .}} | |||
| @@ -2,8 +2,8 @@ | |||
| {{template "base/navbar" .}} | |||
| {{template "repo/nav" .}} | |||
| {{template "repo/toolbar" .}} | |||
| <div id="gogs-body" class="container"> | |||
| <div id="gogs-source"> | |||
| <div id="body" class="container"> | |||
| <div id="source"> | |||
| <div class="panel panel-default branch-box info-box"> | |||
| <div class="panel-heading info-head"> | |||
| <h4>Branches</h4> | |||
| @@ -2,8 +2,8 @@ | |||
| {{template "base/navbar" .}} | |||
| {{template "repo/nav" .}} | |||
| {{template "repo/toolbar" .}} | |||
| <div id="gogs-body" class="container"> | |||
| <div id="gogs-commits"> | |||
| <div id="body" class="container"> | |||
| <div id="commits"> | |||
| <div class="panel panel-default commit-box info-box"> | |||
| <div class="panel-heading info-head"> | |||
| <div class="search pull-right form"> | |||
| @@ -1,7 +1,7 @@ | |||
| {{template "base/head" .}} | |||
| {{template "base/navbar" .}} | |||
| <div class="container" id="gogs-body"> | |||
| <form action="/repo/create" method="post" class="form-horizontal gogs-card" id="gogs-repo-create"> | |||
| <div class="container" id="body"> | |||
| <form action="/repo/create" method="post" class="form-horizontal card" id="repo-create"> | |||
| {{.CsrfTokenHtml}} | |||
| <h3>Create New Repository</h3> | |||
| <div class="alert alert-danger form-error{{if .HasError}}{{else}} hidden{{end}}">{{.ErrorMsg}}</div> | |||
| @@ -2,244 +2,208 @@ | |||
| {{template "base/navbar" .}} | |||
| {{template "repo/nav" .}} | |||
| {{template "repo/toolbar" .}} | |||
| <div id="gogs-body" class="container" data-page="repo"> | |||
| <div id="gogs-source"> | |||
| <div id="body" class="container" data-page="repo"> | |||
| <div id="source"> | |||
| <div class="panel panel-info diff-box diff-head-box"> | |||
| <div class="panel-heading"> | |||
| <a class="pull-right btn btn-primary btn-sm" href="#commit-source">Browse Source</a> | |||
| <h4>bsongen: support for custom tags</h4> | |||
| <h4>{{.Commit.Message}}</h4> | |||
| </div> | |||
| <div class="panel-body"> | |||
| <span class="pull-right"> | |||
| commit <span class="label label-default sha">commit-sha</span> | |||
| commit <span class="label label-default sha">{{.ShortSha}}</span> | |||
| </span> | |||
| <p class="author"> | |||
| <img class="avatar" src="#" alt=""/> | |||
| <a class="name" href="#"><strong>author-name</strong></a> | |||
| <span class="time">times-ago</span> | |||
| <img class="avatar" src="{{AvatarLink .Commit.Author.Email}}" alt=""/> | |||
| <a class="name" href="#"><strong>{{.Commit.Author.Name}}</strong></a> | |||
| <span class="time">{{TimeSince .Commit.Author.When}}</span> | |||
| </p> | |||
| </div> | |||
| </div> | |||
| <div class="diff-detail-box diff-box"> | |||
| <a class="pull-right btn btn-default" data-toggle="collapse" data-target="#diff-files">Show Diff Files</a> | |||
| <a class="pull-right btn btn-default" data-toggle="collapse" data-target="#diff-files">Show Diff Stats</a> | |||
| <p class="showing"> | |||
| <i class="fa fa-retweet"></i> | |||
| <strong> 5 changed files</strong> with <strong>25 additions</strong> and <strong>9 deletions</strong>. | |||
| <strong> {{.Diff.NumFiles}} changed files</strong> with <strong>{{.Diff.TotalAddition}} additions</strong> and <strong>{{.Diff.TotalDeletion}} deletions</strong>. | |||
| </p> | |||
| <ol class="detail-files collapse" id="diff-files"> | |||
| {{range .Diff.Files}} | |||
| <li> | |||
| <div class="diff-counter count pull-right"> | |||
| <span class="add" data-line="2">2</span> | |||
| <span class="add" data-line="{{.Addition}}">{{.Addition}}</span> | |||
| <span class="bar"> | |||
| <span class="pull-left add"></span> | |||
| <span class="pull-left del"></span> | |||
| </span> | |||
| <span class="del" data-line="4">4</span> | |||
| <span class="del" data-line="{{.Deletion}}">{{.Deletion}}</span> | |||
| </div> | |||
| <!-- todo finish all file status, now modify, add, delete and rename --> | |||
| <span class="status modify" data-toggle="tooltip" data-placement="right" title="modify"> </span> | |||
| <a class="file" href="#diff-1">gopmweb.go</a> | |||
| </li> | |||
| <li> | |||
| <div class="diff-counter count pull-right"> | |||
| <span class="add" data-line="666">666</span> | |||
| <span class="bar"> | |||
| <span class="pull-left add"></span> | |||
| <span class="pull-left del"></span> | |||
| </span> | |||
| <span class="del" data-line="44">44</span> | |||
| </div> | |||
| <span class="status add" data-toggle="tooltip" data-placement="right" title="add"> </span> | |||
| <a class="file" href="#diff-2">static/img/favicon.png</a> | |||
| </li> | |||
| <li> | |||
| <span class="status del" data-toggle="tooltip" data-placement="right" title="delete"> </span> | |||
| <a class="file" href="#diff-2">static/img/favicon.png</a> | |||
| </li> | |||
| <li> | |||
| <span class="status rename" data-toggle="tooltip" data-placement="right" title="rename"> </span> | |||
| <a class="file" href="#diff-2">static/img/favicon.png</a> | |||
| <a class="file" href="#diff-1">{{.Name}}</a> | |||
| </li> | |||
| {{end}} | |||
| </ol> | |||
| </div> | |||
| <div class="panel panel-default diff-file-box diff-box file-content" id="diff-1"> | |||
| <div class="panel-heading"> | |||
| <div class="diff-counter count pull-left"> | |||
| <span class="add" data-line="1">BIN</span> | |||
| <span class="bar"> | |||
| <span class="pull-left add"></span> | |||
| <span class="pull-left del"></span> | |||
| </span> | |||
| <span class="del" data-line="0"></span> | |||
| </div> | |||
| <a class="btn btn-default btn-sm pull-right" href="#">View File</a> | |||
| <span class="file">data/test/bson_test/simple_type.png</span> | |||
| </div> | |||
| <div class="panel-body file-body file-code code-view code-bin"> | |||
| <table> | |||
| <tbody> | |||
| <tr class="text-center"><td><img src="http://1.gravatar.com/avatar/f72f7454ce9d710baa506394f68f4132?s=200" alt=""/></td></tr> | |||
| </tbody> | |||
| </table> | |||
| </div> | |||
| </div> | |||
| {{range .Diff.Files}} | |||
| <div class="panel panel-default diff-file-box diff-box file-content" id="diff-2"> | |||
| <div class="panel-heading"> | |||
| <div class="diff-counter count pull-left"> | |||
| <span class="add" data-line="30">+ 30</span> | |||
| <span class="add" data-line="{{.Addition}}">+ {{.Addition}}</span> | |||
| <span class="bar"> | |||
| <span class="pull-left add"></span> | |||
| <span class="pull-left del"></span> | |||
| </span> | |||
| <span class="del" data-line="4">- 4</span> | |||
| <span class="del" data-line="{{.Deletion}}">- {{.Deletion}}</span> | |||
| </div> | |||
| <a class="btn btn-default btn-sm pull-right" href="#">View File</a> | |||
| <span class="file">data/test/bson_test/simple_type.go</span> | |||
| <span class="file">{{.Name}}</span> | |||
| </div> | |||
| <div class="panel-body file-body file-code code-view code-diff"> | |||
| <table> | |||
| <tbody> | |||
| <tr class="same-code nl-1 ol-1"> | |||
| <td class="lines-num lines-num-old"> | |||
| <span rel="L1">1</span> | |||
| </td> | |||
| <td class="lines-num lines-num-new"> | |||
| <span rel="L1">1</span> | |||
| </td> | |||
| <td class="lines-code"> | |||
| <pre> "github.com/youtube/vitess/go/bson"</pre> | |||
| </td> | |||
| </tr> | |||
| <tr class="same-code nl-2 ol-2"> | |||
| <td class="lines-num lines-num-old"> | |||
| <span rel="L1">2</span> | |||
| </td> | |||
| <td class="lines-num lines-num-new"> | |||
| <span rel="L1">2</span> | |||
| </td> | |||
| <td class="lines-code"> | |||
| <pre> "github.com/youtube/vitess/go/bson"</pre> | |||
| </td> | |||
| </tr> | |||
| <tr class="same-code nl-3 ol-3"> | |||
| <td class="lines-num lines-num-old"> | |||
| <span rel="L3">3</span> | |||
| </td> | |||
| <td class="lines-num lines-num-new"> | |||
| <span rel="L3">3</span> | |||
| </td> | |||
| <td class="lines-code"> | |||
| <pre> "github.com/youtube/vitess/go/bson"</pre> | |||
| </td> | |||
| </tr> | |||
| <tr class="add-code nl-4 ol-0"> | |||
| <td class="lines-num lines-num-old"> | |||
| <span rel="add">+</span> | |||
| </td> | |||
| <td class="lines-num lines-num-new"> | |||
| <span rel="L4">4</span> | |||
| </td> | |||
| <td class="lines-code"> | |||
| <pre> "github.com/youtube/vitess/go/bson"</pre> | |||
| </td> | |||
| </tr> | |||
| <tr class="add-code nl-5 ol-0"> | |||
| <td class="lines-num lines-num-old"> | |||
| <span rel="add">+</span> | |||
| </td> | |||
| <td class="lines-num lines-num-new"> | |||
| <span rel="L5">5</span> | |||
| </td> | |||
| <td class="lines-code"> | |||
| <pre> "github.com/youtube/vitess/go/bson"</pre> | |||
| </td> | |||
| </tr> | |||
| <tr class="del-code nl-0 ol-4"> | |||
| <td class="lines-num lines-num-old"> | |||
| <span rel="L4">4</span> | |||
| </td> | |||
| <td class="lines-num lines-num-new"> | |||
| <span rel="del">-</span> | |||
| </td> | |||
| <td class="lines-code"> | |||
| <pre> "github.com/youtube/vitess/go/bson"</pre> | |||
| </td> | |||
| </tr> | |||
| <tr class="del-code nl-0 ol-5"> | |||
| <td class="lines-num lines-num-old"> | |||
| <span rel="L5">5</span> | |||
| </td> | |||
| <td class="lines-num lines-num-new"> | |||
| <span rel="del">-</span> | |||
| </td> | |||
| <td class="lines-code"> | |||
| <pre> "github.com/youtube/vitess/go/bson"</pre> | |||
| </td> | |||
| </tr> | |||
| <tr class="del-code nl-0 ol-6"> | |||
| <td class="lines-num lines-num-old"> | |||
| <span rel="L6">6</span> | |||
| </td> | |||
| <td class="lines-num lines-num-new"> | |||
| <span rel="del">-</span> | |||
| </td> | |||
| <td class="lines-code"> | |||
| <pre> "github.com/youtube/vitess/go/bson"</pre> | |||
| </td> | |||
| </tr> | |||
| <tr class="del-code nl-0 ol-7"> | |||
| <td class="lines-num lines-num-old"> | |||
| <span rel="L7">7</span> | |||
| </td> | |||
| <td class="lines-num lines-num-new"> | |||
| <span rel="del">-</span> | |||
| </td> | |||
| <td class="lines-code"> | |||
| <pre> "github.com/youtube/vitess/go/bson"</pre> | |||
| </td> | |||
| </tr> | |||
| <tr class="same-code nl-6 ol-8"> | |||
| <td class="lines-num lines-num-old"> | |||
| <span rel="L8">8</span> | |||
| </td> | |||
| <td class="lines-num lines-num-new"> | |||
| <span rel="L6">6</span> | |||
| </td> | |||
| <td class="lines-code"> | |||
| <pre> "github.com/youtube/vitess/go/bson"</pre> | |||
| </td> | |||
| </tr> | |||
| <tr class="same-code nl-7 ol-9"> | |||
| <td class="lines-num lines-num-old"> | |||
| <span rel="L1">9</span> | |||
| </td> | |||
| <td class="lines-num lines-num-new"> | |||
| <span rel="L1">7</span> | |||
| </td> | |||
| <td class="lines-code"> | |||
| <pre> "github.com/youtube/vitess/go/bson"</pre> | |||
| </td> | |||
| </tr> | |||
| <tr class="same-code nl-8 ol-10"> | |||
| <td class="lines-num lines-num-old"> | |||
| <span rel="L1">10</span> | |||
| </td> | |||
| <td class="lines-num lines-num-new"> | |||
| <span rel="L1">8</span> | |||
| </td> | |||
| <td class="lines-code"> | |||
| <pre> "github.com/youtube/vitess/go/bson"</pre> | |||
| </td> | |||
| </tr> | |||
| {{range .Content}} | |||
| <tr class="same-code nl-1 ol-1"> | |||
| <td class="lines-num lines-num-old"> | |||
| <span rel="L1"></span> | |||
| </td> | |||
| <td class="lines-num lines-num-new"> | |||
| <span rel="L1"></span> | |||
| </td> | |||
| <td class="lines-code"> | |||
| <pre>{{.}}</pre> | |||
| </td> | |||
| </tr> | |||
| {{end}} | |||
| <!-- <tr class="same-code nl-2 ol-2"> | |||
| <td class="lines-num lines-num-old"> | |||
| <span rel="L1">2</span> | |||
| </td> | |||
| <td class="lines-num lines-num-new"> | |||
| <span rel="L1">2</span> | |||
| </td> | |||
| <td class="lines-code"> | |||
| <pre> "github.com/youtube/vitess/go/bson"</pre> | |||
| </td> | |||
| </tr> | |||
| <tr class="same-code nl-3 ol-3"> | |||
| <td class="lines-num lines-num-old"> | |||
| <span rel="L3">3</span> | |||
| </td> | |||
| <td class="lines-num lines-num-new"> | |||
| <span rel="L3">3</span> | |||
| </td> | |||
| <td class="lines-code"> | |||
| <pre> "github.com/youtube/vitess/go/bson"</pre> | |||
| </td> | |||
| </tr> | |||
| <tr class="add-code nl-4 ol-0"> | |||
| <td class="lines-num lines-num-old"> | |||
| <span rel="add">+</span> | |||
| </td> | |||
| <td class="lines-num lines-num-new"> | |||
| <span rel="L4">4</span> | |||
| </td> | |||
| <td class="lines-code"> | |||
| <pre> "github.com/youtube/vitess/go/bson"</pre> | |||
| </td> | |||
| </tr> | |||
| <tr class="add-code nl-5 ol-0"> | |||
| <td class="lines-num lines-num-old"> | |||
| <span rel="add">+</span> | |||
| </td> | |||
| <td class="lines-num lines-num-new"> | |||
| <span rel="L5">5</span> | |||
| </td> | |||
| <td class="lines-code"> | |||
| <pre> "github.com/youtube/vitess/go/bson"</pre> | |||
| </td> | |||
| </tr> | |||
| <tr class="del-code nl-0 ol-4"> | |||
| <td class="lines-num lines-num-old"> | |||
| <span rel="L4">4</span> | |||
| </td> | |||
| <td class="lines-num lines-num-new"> | |||
| <span rel="del">-</span> | |||
| </td> | |||
| <td class="lines-code"> | |||
| <pre> "github.com/youtube/vitess/go/bson"</pre> | |||
| </td> | |||
| </tr> | |||
| <tr class="del-code nl-0 ol-5"> | |||
| <td class="lines-num lines-num-old"> | |||
| <span rel="L5">5</span> | |||
| </td> | |||
| <td class="lines-num lines-num-new"> | |||
| <span rel="del">-</span> | |||
| </td> | |||
| <td class="lines-code"> | |||
| <pre> "github.com/youtube/vitess/go/bson"</pre> | |||
| </td> | |||
| </tr> | |||
| <tr class="del-code nl-0 ol-6"> | |||
| <td class="lines-num lines-num-old"> | |||
| <span rel="L6">6</span> | |||
| </td> | |||
| <td class="lines-num lines-num-new"> | |||
| <span rel="del">-</span> | |||
| </td> | |||
| <td class="lines-code"> | |||
| <pre> "github.com/youtube/vitess/go/bson"</pre> | |||
| </td> | |||
| </tr> | |||
| <tr class="del-code nl-0 ol-7"> | |||
| <td class="lines-num lines-num-old"> | |||
| <span rel="L7">7</span> | |||
| </td> | |||
| <td class="lines-num lines-num-new"> | |||
| <span rel="del">-</span> | |||
| </td> | |||
| <td class="lines-code"> | |||
| <pre> "github.com/youtube/vitess/go/bson"</pre> | |||
| </td> | |||
| </tr> | |||
| <tr class="same-code nl-6 ol-8"> | |||
| <td class="lines-num lines-num-old"> | |||
| <span rel="L8">8</span> | |||
| </td> | |||
| <td class="lines-num lines-num-new"> | |||
| <span rel="L6">6</span> | |||
| </td> | |||
| <td class="lines-code"> | |||
| <pre> "github.com/youtube/vitess/go/bson"</pre> | |||
| </td> | |||
| </tr> | |||
| <tr class="same-code nl-7 ol-9"> | |||
| <td class="lines-num lines-num-old"> | |||
| <span rel="L1">9</span> | |||
| </td> | |||
| <td class="lines-num lines-num-new"> | |||
| <span rel="L1">7</span> | |||
| </td> | |||
| <td class="lines-code"> | |||
| <pre> "github.com/youtube/vitess/go/bson"</pre> | |||
| </td> | |||
| </tr> | |||
| <tr class="same-code nl-8 ol-10"> | |||
| <td class="lines-num lines-num-old"> | |||
| <span rel="L1">10</span> | |||
| </td> | |||
| <td class="lines-num lines-num-new"> | |||
| <span rel="L1">8</span> | |||
| </td> | |||
| <td class="lines-code"> | |||
| <pre> "github.com/youtube/vitess/go/bson"</pre> | |||
| </td> | |||
| </tr> --> | |||
| </tbody> | |||
| </table> | |||
| </div> | |||
| </div> | |||
| {{end}} | |||
| <div class="panel panel-default diff-file-box diff-box file-content"> | |||
| <!-- <div class="panel panel-default diff-file-box diff-box file-content"> | |||
| <div class="panel-heading"> | |||
| <div class="diff-counter count pull-left"> | |||
| <span class="add" data-line="2">+ 2</span> | |||
| @@ -442,7 +406,7 @@ | |||
| </tbody> | |||
| </table> | |||
| </div> | |||
| </div> | |||
| </div> --> | |||
| </div> | |||
| </div> | |||
| {{template "base/footer" .}} | |||
| @@ -1,10 +0,0 @@ | |||
| {{template "base/head" .}} | |||
| {{template "base/navbar" .}} | |||
| {{template "repo/nav" .}} | |||
| {{template "repo/toolbar" .}} | |||
| <div id="gogs-body" class="container"> | |||
| <div id="gogs-source"> | |||
| issues | |||
| </div> | |||
| </div> | |||
| {{template "base/footer" .}} | |||
| @@ -1,6 +1,6 @@ | |||
| {{template "base/head" .}} | |||
| {{template "base/navbar" .}} | |||
| <div class="container" id="gogs-body"> | |||
| <div class="container" id="body"> | |||
| <ul> | |||
| {{range .Repos}} | |||
| <li>{{.Name}} stars: {{.NumStars}} forks: {{.NumForks}} watches:{{.NumWatchs}}</li> | |||
| @@ -1,19 +1,19 @@ | |||
| <div id="gogs-body-nav" class="gogs-repo-nav"> | |||
| <div id="body-nav" class="repo-nav"> | |||
| <div class="container"> | |||
| <div class="row"> | |||
| <div class="col-md-7"> | |||
| <h3 class="name"><i class="fa fa-book fa-lg"></i><a href="{{.Owner.HomeLink}}">{{.Owner.Name}}</a> / {{.Repository.Name}}</h3> | |||
| <h3 class="name"><i class="fa fa-book fa-lg"></i><a href="{{.Owner.HomeLink}}">{{.Owner.Name}}</a> / <a href="/{{.Owner.Name}}/{{.Repository.Name}}">{{.Repository.Name}}</a></h3> | |||
| <p class="desc">{{.Repository.Description}}{{if .Repository.Website}} <a href="{{.Repository.Website}}">{{.Repository.Website}}</a>{{end}}</p> | |||
| </div> | |||
| <div class="col-md-5 actions text-right clone-group-btn"> | |||
| {{if not .IsBareRepo}} | |||
| <!--<div class="btn-group" id="gogs-repo-clone"> | |||
| <!--<div class="btn-group" id="repo-clone"> | |||
| <button type="button" class="btn btn-default"><i class="fa fa-download fa-lg fa-m"></i></button> | |||
| <button type="button" class="btn btn-default dropdown-toggle" data-container="body" data-toggle="popover" data-placement="bottom" data-content="<label>SSH:</label><div class='input-group'><input type='text' class='form-control' value='{{.CloneLink.SSH}}'></div>" data-html="1"> | |||
| <span class="caret"></span> | |||
| </button> | |||
| </div>--> | |||
| <div class="btn-group" id="gogs-repo-clone"> | |||
| <div class="btn-group" id="repo-clone"> | |||
| <button type="button" class="btn btn-default"><i class="fa fa-download fa-lg fa-m"></i></button> | |||
| <button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown"> | |||
| <span class="caret"></span> | |||
| @@ -36,7 +36,7 @@ | |||
| </div> | |||
| </div> | |||
| </div> | |||
| <div class="btn-group {{if .IsRepositoryWatching}}watching{{else}}no-watching{{end}}" id="gogs-repo-watching" data-watch="/{{.Owner.Name}}/{{.Repository.Name}}/action/watch" data-unwatch="/{{.Owner.Name}}/{{.Repository.Name}}/action/unwatch"> | |||
| <div class="btn-group {{if .IsRepositoryWatching}}watching{{else}}no-watching{{end}}" id="repo-watching" data-watch="/{{.Owner.Name}}/{{.Repository.Name}}/action/watch" data-unwatch="/{{.Owner.Name}}/{{.Repository.Name}}/action/unwatch"> | |||
| {{if .IsRepositoryWatching}} | |||
| <button type="button" class="btn btn-default"><i class="fa fa-eye fa-lg fa-m"></i></button> | |||
| {{else}} | |||
| @@ -2,8 +2,8 @@ | |||
| {{template "base/navbar" .}} | |||
| {{template "repo/nav" .}} | |||
| {{template "repo/toolbar" .}} | |||
| <div id="gogs-body" class="container"> | |||
| <div id="gogs-source"> | |||
| <div id="body" class="container"> | |||
| <div id="source"> | |||
| </div> | |||
| </div> | |||
| {{template "base/footer" .}} | |||
| @@ -2,16 +2,16 @@ | |||
| {{template "base/navbar" .}} | |||
| {{template "repo/nav" .}} | |||
| {{template "repo/toolbar" .}} | |||
| <div id="gogs-body" class="container"> | |||
| <div id="gogs-user-setting-nav" class="col-md-3"> | |||
| <ul class="list-group" data-init="tabs"> | |||
| <div id="body" class="container"> | |||
| <div id="user-setting-nav" class="col-md-3"> | |||
| <ul class="list-group"> | |||
| <li class="list-group-item active"><a href="/{{.Owner.Name}}/{{.Repository.Name}}/settings">Options</a></li> | |||
| <!--<li class="list-group-item"><a href="#">Collaborators</a></li> | |||
| <li class="list-group-item"><a href="#">Notifications</a></li>--> | |||
| </ul> | |||
| </div> | |||
| <div id="gogs-repo-setting-container" class="col-md-9"> | |||
| <div id="repo-setting-container" class="col-md-9"> | |||
| {{if .IsSuccess}}<p class="alert alert-success">Repository option has been successfully updated.</p>{{else if .HasError}}<p class="alert alert-danger form-error">{{.ErrorMsg}}</p>{{end}} | |||
| <div class="panel panel-default"> | |||
| <div class="panel-heading"> | |||
| @@ -2,8 +2,8 @@ | |||
| {{template "base/navbar" .}} | |||
| {{template "repo/nav" .}} | |||
| {{template "repo/toolbar" .}} | |||
| <div id="gogs-body" class="container"> | |||
| <div id="gogs-source"> | |||
| <div id="body" class="container"> | |||
| <div id="source"> | |||
| {{if .IsBareRepo}} | |||
| {{template "repo/single_bare" .}} | |||
| {{else}} | |||
| @@ -1,4 +1,4 @@ | |||
| <div id="gogs-repo-toolbar"> | |||
| <div id="repo-toolbar"> | |||
| <div class="container"> | |||
| <nav class="navbar navbar-toolbar navbar-default" role="navigation"> | |||
| <div class="collapse navbar-collapse"> | |||
| @@ -9,6 +9,11 @@ | |||
| <!-- <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> | |||
| {{if .IsRepoToolbarIssues}} | |||
| <li class="tmp"><a href="/{{.RepositoryLink}}/issues/new"> | |||
| <button class="btn btn-primary btn-sm">New Issue</button> | |||
| </a></li> | |||
| {{end}} | |||
| <!-- <li class="dropdown"> | |||
| <a href="#" class="dropdown-toggle" data-toggle="dropdown">More <b class="caret"></b></a> | |||
| <ul class="dropdown-menu"> | |||
| @@ -1,6 +1,6 @@ | |||
| {{template "base/head" .}} | |||
| {{template "base/navbar" .}} | |||
| <div id="gogs-body" class="container"> | |||
| <div id="body" class="container"> | |||
| <p>An error is occurred : {{.ErrorMsg}}</p> | |||
| <p>Application Version: {{AppVer}}</p> | |||
| </div> | |||
| @@ -1,6 +1,6 @@ | |||
| {{template "base/head" .}} | |||
| {{template "base/navbar" .}} | |||
| <div id="gogs-body" class="container text-center"> | |||
| <div id="body" class="container text-center"> | |||
| <p style="margin-top: 80px"><img src="/img/404.png" alt="404"/></p> | |||
| <hr/> | |||
| <p>Application Version: {{AppVer}}</p> | |||
| @@ -1,6 +1,6 @@ | |||
| {{template "base/head" .}} | |||
| {{template "base/navbar" .}} | |||
| <div id="gogs-body" class="container text-center"> | |||
| <div id="body" class="container text-center"> | |||
| <p style="margin-top: 80px"><img src="/img/500.png" alt="404"/></p> | |||
| <hr/> | |||
| <p>An error is occurred : {{.ErrorMsg}}</p> | |||
| @@ -1,7 +1,7 @@ | |||
| {{template "base/head" .}} | |||
| {{template "base/navbar" .}} | |||
| <div id="gogs-body" class="container"> | |||
| <form action="/user/activate" method="post" class="form-horizontal gogs-card" id="gogs-login-card"> | |||
| <div id="body" class="container"> | |||
| <form action="/user/activate" method="post" class="form-horizontal card" id="login-card"> | |||
| {{.CsrfTokenHtml}} | |||
| <h3>Activate Your Account</h3> | |||
| {{if .IsActivatePage}} | |||
| @@ -1,6 +1,6 @@ | |||
| {{template "base/head" .}} | |||
| {{template "base/navbar" .}} | |||
| <div id="gogs-body-nav"> | |||
| <div id="body-nav"> | |||
| <div class="container"> | |||
| <ul class="nav nav-pills pull-right"> | |||
| <li class="active"><a href="/">Feed</a></li> | |||
| @@ -11,9 +11,9 @@ | |||
| <h3>News Feed</h3> | |||
| </div> | |||
| </div> | |||
| <div id="gogs-body" class="container" data-page="user"> | |||
| <div id="body" class="container" data-page="user"> | |||
| {{if .HasInfo}}<div class="alert alert-info">{{.InfoMsg}}</div>{{end}} | |||
| <div id="gogs-feed-left" class="col-md-8"> | |||
| <div id="feed-left" class="col-md-8"> | |||
| <ul class="list-unstyled activity-list"> | |||
| {{range .Feeds}} | |||
| <li> | |||
| @@ -26,7 +26,7 @@ | |||
| {{end}} | |||
| </ul> | |||
| </div> | |||
| <div id="gogs-feed-right" class="col-md-4"> | |||
| <div id="feed-right" class="col-md-4"> | |||
| <div class="panel panel-default repo-panel"> | |||
| <div class="panel-heading">Your Repositories | |||
| <a class="btn btn-success pull-right btn-sm" href="/repo/create"><i class="fa fa-plus-square"></i>New Repo</a> | |||
| @@ -1,27 +1,27 @@ | |||
| {{template "base/head" .}} | |||
| {{template "base/navbar" .}} | |||
| <div id="gogs-body" class="container" data-page="user"> | |||
| <div id="gogs-user-setting-nav" class="col-md-3"> | |||
| <div id="body" class="container" data-page="user"> | |||
| <div id="user-setting-nav" class="col-md-3"> | |||
| <h4>Account Setting</h4> | |||
| <ul class="list-group"> | |||
| <li class="list-group-item"><a href="/user/setting">Account Profile</a></li> | |||
| <li class="list-group-item"><a href="/user/setting/password">Password</a></li> | |||
| <li class="list-group-item"><a href="/user/setting/notification">Notifications</a></li> | |||
| <!-- <li class="list-group-item"><a href="/user/setting/notification">Notifications</a></li> --> | |||
| <li class="list-group-item"><a href="/user/setting/ssh/">SSH Keys</a></li> | |||
| <li class="list-group-item"><a href="/user/setting/security">Security</a></li> | |||
| <!-- <li class="list-group-item"><a href="/user/setting/security">Security</a></li> --> | |||
| <li class="list-group-item list-group-item-success"><a href="/user/delete">Delete Account</a></li> | |||
| </ul> | |||
| </div> | |||
| <div id="gogs-user-setting-container" class="col-md-9"> | |||
| <div id="user-setting-container" class="col-md-9"> | |||
| <h4>Delete Account</h4> | |||
| <p class="alert alert-danger">{{if not .HasError}}The operation will delete your account permanently. Sorry to see you go, but we know you'll back soon.{{else}}{{.ErrorMsg}}{{end}}</p> | |||
| <div class="form-group"> | |||
| <button type="submit" class="btn btn-danger btn-lg" href="#delete-account-modal" id="gogs-delete-account" data-toggle="modal">Delete Account</button> | |||
| <button type="submit" class="btn btn-danger btn-lg" href="#delete-account-modal" id="delete-account" data-toggle="modal">Delete Account</button> | |||
| </div> | |||
| </div> | |||
| <div class="modal fade" id="delete-account-modal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true"> | |||
| <div class="modal-dialog"> | |||
| <form action="/user/delete" method="post" class="modal-content" id="gogs-user-delete"> | |||
| <form action="/user/delete" method="post" class="modal-content" id="user-delete"> | |||
| {{.CsrfTokenHtml}} | |||
| <div class="modal-header"> | |||
| <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button> | |||
| @@ -1,17 +0,0 @@ | |||
| {{template "base/head" .}} | |||
| {{template "base/navbar" .}} | |||
| <div id="gogs-body-nav"> | |||
| <div class="container"> | |||
| <ul class="nav nav-pills pull-right"> | |||
| <li><a href="/">Feed</a></li> | |||
| <li class="active"><a href="/issues">Issues</a></li> | |||
| <!-- <li><a href="/pulls">Pull Requests</a></li> | |||
| <li><a href="/stars">Stars</a></li> --> | |||
| </ul> | |||
| <h3>Issues</h3> | |||
| </div> | |||
| </div> | |||
| <div id="gogs-body" class="container" data-page="user"> | |||
| {{if .HasInfo}}<div class="alert alert-info">{{.InfoMsg}}</div>{{end}} | |||
| </div> | |||
| {{template "base/footer" .}} | |||
| @@ -1,8 +1,8 @@ | |||
| {{template "base/head" .}} | |||
| {{template "base/navbar" .}} | |||
| <div id="gogs-body" class="container" data-page="user"> | |||
| <div id="body" class="container" data-page="user"> | |||
| {{template "user/setting_nav" .}} | |||
| <div id="gogs-user-setting-container" class="col-md-9"> | |||
| <div id="user-setting-container" class="col-md-9"> | |||
| <h4>Notification</h4> | |||
| </div> | |||
| </div> | |||
| @@ -1,11 +1,11 @@ | |||
| {{template "base/head" .}} | |||
| {{template "base/navbar" .}} | |||
| <div id="gogs-body" class="container" data-page="user"> | |||
| <div id="body" class="container" data-page="user"> | |||
| {{template "user/setting_nav" .}} | |||
| <div id="gogs-user-setting-container" class="col-md-9"> | |||
| <div id="gogs-setting-pwd"> | |||
| <div id="user-setting-container" class="col-md-9"> | |||
| <div id="setting-pwd"> | |||
| <h4>Password</h4> | |||
| <form class="form-horizontal" id="gogs-password-form" method="post" action="/user/setting/password"> | |||
| <form class="form-horizontal" id="password-form" method="post" action="/user/setting/password"> | |||
| {{.CsrfTokenHtml}} | |||
| {{if .IsSuccess}} | |||
| <p class="alert alert-success">Password is changed successfully. You can now sign in via new password.</p>{{else if .HasError}}<p class="alert alert-danger form-error">{{.ErrorMsg}}</p>{{end}} | |||
| @@ -1,12 +1,12 @@ | |||
| {{template "base/head" .}} | |||
| {{template "base/navbar" .}} | |||
| <div id="gogs-body" class="container" data-page="user"> | |||
| <div id="gogs-user-profile" class="col-md-3"> | |||
| <div id="body" class="container" data-page="user"> | |||
| <div id="user-profile" class="col-md-3"> | |||
| <div class="profile-avatar text-center"> | |||
| <a href="http://gravatar.com/emails/" class="center-block" data-toggle="tooltip" data-placement="bottom" title="Change your avatar at gravatar.com"> | |||
| <img id="gogs-user-avatar" src="{{.Owner.AvatarLink}}?s=200" alt="user-avatar" title="{{.Owner.Name}}"/> | |||
| <img id="user-avatar" src="{{.Owner.AvatarLink}}?s=200" alt="user-avatar" title="{{.Owner.Name}}"/> | |||
| </a> | |||
| <span id="gogs-user-name" class="center-block">{{.Owner.Name}}</span> | |||
| <span id="user-name" class="center-block">{{.Owner.Name}}</span> | |||
| </div> | |||
| <div class="profile-info"> | |||
| <ul class="list-group"> | |||
| @@ -23,8 +23,8 @@ | |||
| </ul> | |||
| </div> | |||
| </div> | |||
| <div id="gogs-user-activity" class="col-md-9"> | |||
| <ul class="nav nav-tabs" id="gogs-user-act-tabs" data-init="tabs"> | |||
| <div id="user-activity" class="col-md-9"> | |||
| <ul class="nav nav-tabs" id="user-act-tabs"> | |||
| <li{{if not .TabName}} class="active"{{end}}><a href="{{.Owner.HomeLink}}"><i class="fa fa-gittip"></i>Repositories</a></li> | |||
| <li{{if eq .TabName "activity"}} class="active"{{end}}><a href="{{.Owner.HomeLink}}?tab=activity"><i class="fa fa-rss"></i>Public Activity</a></li> | |||
| </ul> | |||
| @@ -1,12 +1,12 @@ | |||
| {{template "base/head" .}} | |||
| {{template "base/navbar" .}} | |||
| <div id="gogs-body" class="container" data-page="user"> | |||
| <div id="body" class="container" data-page="user"> | |||
| {{template "user/setting_nav" .}} | |||
| <div id="gogs-user-setting-container" class="col-md-9"> | |||
| <div id="gogs-ssh-keys"> | |||
| <div id="user-setting-container" class="col-md-9"> | |||
| <div id="ssh-keys"> | |||
| <h4>SSH Keys</h4>{{if .AddSSHKeySuccess}} | |||
| <p class="alert alert-success">New SSH Key has been added !</p>{{else if .HasError}}<p class="alert alert-danger">{{.ErrorMsg}}</p>{{end}} | |||
| <ul id="gogs-ssh-keys-list" class="list-group"> | |||
| <ul id="ssh-keys-list" class="list-group"> | |||
| <li class="list-group-item"><span class="name">SSH Key's name</span></li> | |||
| {{range .Keys}} | |||
| <li class="list-group-item"> | |||
| @@ -16,12 +16,12 @@ | |||
| </li> | |||
| {{end}} | |||
| <li class="list-group-item"> | |||
| <a class="btn btn-link btn-primary" href="#ssh-add-modal" id="gogs-ssh-add" data-toggle="modal">Add SSH Key</a> | |||
| <a class="btn btn-link btn-primary" href="#ssh-add-modal" id="ssh-add" data-toggle="modal">Add SSH Key</a> | |||
| </li> | |||
| </ul> | |||
| <div class="modal fade" id="ssh-add-modal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true"> | |||
| <div class="modal-dialog"> | |||
| <form class="modal-content form-horizontal" id="gogs-ssh-form" method="post" action="/user/setting/ssh/"> | |||
| <form class="modal-content form-horizontal" id="ssh-form" method="post" action="/user/setting/ssh/"> | |||
| {{.CsrfTokenHtml}} | |||
| <div class="modal-header"> | |||
| <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button> | |||
| @@ -1,6 +1,6 @@ | |||
| {{template "base/head" .}} | |||
| {{template "base/navbar" .}} | |||
| <div id="gogs-body-nav"> | |||
| <div id="body-nav"> | |||
| <div class="container"> | |||
| <ul class="nav nav-pills pull-right"> | |||
| <li><a href="/">Feed</a></li> | |||
| @@ -11,7 +11,7 @@ | |||
| <h3>Pull Requests</h3> | |||
| </div> | |||
| </div> | |||
| <div id="gogs-body" class="container" data-page="user"> | |||
| <div id="body" class="container" data-page="user"> | |||
| {{if .HasInfo}}<div class="alert alert-info">{{.InfoMsg}}</div>{{end}} | |||
| </div> | |||
| {{template "base/footer" .}} | |||
| @@ -1,8 +1,8 @@ | |||
| {{template "base/head" .}} | |||
| {{template "base/navbar" .}} | |||
| <div id="gogs-body" class="container" data-page="user"> | |||
| <div id="body" class="container" data-page="user"> | |||
| {{template "user/setting_nav" .}} | |||
| <div id="gogs-user-setting-container" class="col-md-9"> | |||
| <div id="user-setting-container" class="col-md-9"> | |||
| <h4>Security</h4> | |||
| </div> | |||
| </div> | |||
| @@ -1,11 +1,11 @@ | |||
| {{template "base/head" .}} | |||
| {{template "base/navbar" .}} | |||
| <div id="gogs-body" class="container" data-page="user"> | |||
| <div id="body" class="container" data-page="user"> | |||
| {{template "user/setting_nav" .}} | |||
| <div id="gogs-user-setting-container" class="col-md-9"> | |||
| <div id="gogs-setting-pwd"> | |||
| <div id="user-setting-container" class="col-md-9"> | |||
| <div id="setting-pwd"> | |||
| <h4>Account Profile</h4> | |||
| <form class="form-horizontal" id="gogs-password-form" method="post" action="/user/setting"> | |||
| <form class="form-horizontal" id="password-form" method="post" action="/user/setting"> | |||
| {{.CsrfTokenHtml}} | |||
| {{if .IsSuccess}}<p class="alert alert-success">Your profile has been successfully updated.</p>{{else if .HasError}}<p class="alert alert-danger form-error">{{.ErrorMsg}}</p>{{end}} | |||
| <p>Your Email will be public and used for Account related notifications and any web based operations made via the web.</p> | |||
| @@ -1,4 +1,4 @@ | |||
| <div id="gogs-user-setting-nav" class="col-md-3"> | |||
| <div id="user-setting-nav" class="col-md-3"> | |||
| <h4>Account Setting</h4> | |||
| <ul class="list-group"> | |||
| <li class="list-group-item{{if .IsUserPageSetting}} list-group-item-success{{end}}"><a href="/user/setting">Account Profile</a></li> | |||
| @@ -1,7 +1,7 @@ | |||
| {{template "base/head" .}} | |||
| {{template "base/navbar" .}} | |||
| <div class="container" id="gogs-body" data-page="user-signin"> | |||
| <form action="/user/login" method="post" class="form-horizontal gogs-card" id="gogs-login-card"> | |||
| <div class="container" id="body" data-page="user-signin"> | |||
| <form action="/user/login" method="post" class="form-horizontal card" id="login-card"> | |||
| {{.CsrfTokenHtml}} | |||
| <h3>Log in</h3> | |||
| <div class="alert alert-danger form-error{{if .HasError}}{{else}} hidden{{end}}">{{.ErrorMsg}}</div> | |||
| @@ -43,7 +43,7 @@ | |||
| </div> | |||
| </div> | |||
| <div class="form-group text-center" id="gogs-social-login"> | |||
| <div class="form-group text-center" id="social-login"> | |||
| <a class="btn btn-danger btn-lg">Register new account</a> | |||
| </div> | |||
| </form> | |||
| @@ -1,7 +1,7 @@ | |||
| {{template "base/head" .}} | |||
| {{template "base/navbar" .}} | |||
| <div class="container" id="gogs-body" data-page="user-signup"> | |||
| <form action="/user/sign_up" method="post" class="form-horizontal gogs-card" id="gogs-login-card"> | |||
| <div class="container" id="body" data-page="user-signup"> | |||
| <form action="/user/sign_up" method="post" class="form-horizontal card" id="login-card"> | |||
| {{.CsrfTokenHtml}} | |||
| {{if .DisenableRegisteration}} | |||
| Sorry, registeration has been disenabled, you can only get account from administrator. | |||
| @@ -1,6 +1,6 @@ | |||
| {{template "base/head" .}} | |||
| {{template "base/navbar" .}} | |||
| <div id="gogs-body-nav"> | |||
| <div id="body-nav"> | |||
| <div class="container"> | |||
| <ul class="nav nav-pills pull-right"> | |||
| <li><a href="/">Feed</a></li> | |||
| @@ -11,7 +11,7 @@ | |||
| <h3>Stars</h3> | |||
| </div> | |||
| </div> | |||
| <div id="gogs-body" class="container" data-page="user"> | |||
| <div id="body" class="container" data-page="user"> | |||
| {{if .HasInfo}}<div class="alert alert-info">{{.InfoMsg}}</div>{{end}} | |||
| </div> | |||
| {{template "base/footer" .}} | |||
| @@ -90,7 +90,7 @@ func runWeb(*cli.Context) { | |||
| // Routers. | |||
| m.Get("/", ignSignIn, routers.Home) | |||
| m.Get("/install",routers.Install) | |||
| m.Get("/install", routers.Install) | |||
| m.Get("/issues", reqSignIn, user.Issues) | |||
| m.Get("/pulls", reqSignIn, user.Pulls) | |||
| m.Get("/stars", reqSignIn, user.Stars) | |||
| @@ -142,13 +142,13 @@ func runWeb(*cli.Context) { | |||
| r.Post("/settings", repo.SettingPost) | |||
| r.Get("/settings", repo.Setting) | |||
| r.Get("/action/:action", repo.Action) | |||
| r.Any("/issues/new", binding.BindIgnErr(auth.CreateIssueForm{}), repo.CreateIssue) | |||
| r.Post("/issues/:index", binding.BindIgnErr(auth.CreateIssueForm{}), repo.UpdateIssue) | |||
| }, reqSignIn, middleware.RepoAssignment(true)) | |||
| m.Group("/:username/:reponame", func(r martini.Router) { | |||
| r.Get("/commits/:branchname", repo.Commits) | |||
| r.Get("/issues", repo.Issues) | |||
| r.Any("/issues/new", binding.BindIgnErr(auth.CreateIssueForm{}), repo.CreateIssue) | |||
| r.Get("/issues/:index", repo.ViewIssue) | |||
| r.Post("/issues/:index", binding.BindIgnErr(auth.CreateIssueForm{}), repo.UpdateIssue) | |||
| r.Get("/pulls", repo.Pulls) | |||
| r.Get("/branches", repo.Branches) | |||
| r.Get("/src/:branchname", repo.Single) | |||