mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2024-12-22 12:54:53 -05:00
Huge updates!!!!! Be careful to merge!!!!
This commit is contained in:
parent
3f38ff6c09
commit
5c4bc3c848
43 changed files with 2225 additions and 2125 deletions
152
cmd/web.go
152
cmd/web.go
|
@ -30,7 +30,7 @@ import (
|
||||||
"github.com/gogits/gogs/routers/admin"
|
"github.com/gogits/gogs/routers/admin"
|
||||||
"github.com/gogits/gogs/routers/api/v1"
|
"github.com/gogits/gogs/routers/api/v1"
|
||||||
"github.com/gogits/gogs/routers/dev"
|
"github.com/gogits/gogs/routers/dev"
|
||||||
// "github.com/gogits/gogs/routers/org"
|
"github.com/gogits/gogs/routers/org"
|
||||||
"github.com/gogits/gogs/routers/repo"
|
"github.com/gogits/gogs/routers/repo"
|
||||||
"github.com/gogits/gogs/routers/user"
|
"github.com/gogits/gogs/routers/user"
|
||||||
)
|
)
|
||||||
|
@ -101,8 +101,8 @@ func runWeb(*cli.Context) {
|
||||||
|
|
||||||
// Routers.
|
// Routers.
|
||||||
m.Get("/", ignSignIn, routers.Home)
|
m.Get("/", ignSignIn, routers.Home)
|
||||||
// m.Get("/install", bindIgnErr(auth.InstallForm{}), routers.Install)
|
m.Get("/install", bindIgnErr(auth.InstallForm{}), routers.Install)
|
||||||
// m.Post("/install", bindIgnErr(auth.InstallForm{}), routers.InstallPost)
|
m.Post("/install", bindIgnErr(auth.InstallForm{}), routers.InstallPost)
|
||||||
m.Group("", func(r *macaron.Router) {
|
m.Group("", func(r *macaron.Router) {
|
||||||
r.Get("/issues", user.Issues)
|
r.Get("/issues", user.Issues)
|
||||||
r.Get("/pulls", user.Pulls)
|
r.Get("/pulls", user.Pulls)
|
||||||
|
@ -151,6 +151,7 @@ func runWeb(*cli.Context) {
|
||||||
r.Get("/ssh", user.SettingsSSHKeys)
|
r.Get("/ssh", user.SettingsSSHKeys)
|
||||||
r.Post("/ssh", bindIgnErr(auth.AddSSHKeyForm{}), user.SettingsSSHKeysPost)
|
r.Post("/ssh", bindIgnErr(auth.AddSSHKeyForm{}), user.SettingsSSHKeysPost)
|
||||||
r.Get("/social", user.SettingsSocial)
|
r.Get("/social", user.SettingsSocial)
|
||||||
|
r.Get("/orgs", user.SettingsOrgs)
|
||||||
r.Route("/delete", "GET,POST", user.SettingsDelete)
|
r.Route("/delete", "GET,POST", user.SettingsDelete)
|
||||||
})
|
})
|
||||||
}, reqSignIn)
|
}, reqSignIn)
|
||||||
|
@ -173,8 +174,8 @@ func runWeb(*cli.Context) {
|
||||||
m.Group("/repo", func(r *macaron.Router) {
|
m.Group("/repo", func(r *macaron.Router) {
|
||||||
r.Get("/create", repo.Create)
|
r.Get("/create", repo.Create)
|
||||||
r.Post("/create", bindIgnErr(auth.CreateRepoForm{}), repo.CreatePost)
|
r.Post("/create", bindIgnErr(auth.CreateRepoForm{}), repo.CreatePost)
|
||||||
// r.Get("/migrate", repo.Migrate)
|
r.Get("/migrate", repo.Migrate)
|
||||||
// r.Post("/migrate", bindIgnErr(auth.MigrateRepoForm{}), repo.MigratePost)
|
r.Post("/migrate", bindIgnErr(auth.MigrateRepoForm{}), repo.MigratePost)
|
||||||
}, reqSignIn)
|
}, reqSignIn)
|
||||||
|
|
||||||
adminReq := middleware.Toggle(&middleware.ToggleOptions{SignInRequire: true, AdminRequire: true})
|
adminReq := middleware.Toggle(&middleware.ToggleOptions{SignInRequire: true, AdminRequire: true})
|
||||||
|
@ -210,91 +211,92 @@ func runWeb(*cli.Context) {
|
||||||
dev.RegisterDebugRoutes(m)
|
dev.RegisterDebugRoutes(m)
|
||||||
}
|
}
|
||||||
|
|
||||||
// reqTrueOwner := middleware.RequireTrueOwner()
|
reqTrueOwner := middleware.RequireTrueOwner()
|
||||||
|
|
||||||
// m.Group("/org", func(r *macaron.Router) {
|
// Organization routers.
|
||||||
// r.Get("/create", org.New)
|
m.Group("/org", func(r *macaron.Router) {
|
||||||
// r.Post("/create", bindIgnErr(auth.CreateOrgForm{}), org.NewPost)
|
r.Get("/create", org.New)
|
||||||
// r.Get("/:org", org.Home)
|
r.Post("/create", bindIgnErr(auth.CreateOrgForm{}), org.NewPost)
|
||||||
// r.Get("/:org/dashboard", org.Dashboard)
|
r.Get("/:org", org.Home)
|
||||||
// r.Get("/:org/members", org.Members)
|
r.Get("/:org/dashboard", org.Dashboard)
|
||||||
|
r.Get("/:org/members", org.Members)
|
||||||
|
|
||||||
// r.Get("/:org/teams", org.Teams)
|
r.Get("/:org/teams", org.Teams)
|
||||||
// r.Get("/:org/teams/new", org.NewTeam)
|
r.Get("/:org/teams/new", org.NewTeam)
|
||||||
// r.Post("/:org/teams/new", bindIgnErr(auth.CreateTeamForm{}), org.NewTeamPost)
|
r.Post("/:org/teams/new", bindIgnErr(auth.CreateTeamForm{}), org.NewTeamPost)
|
||||||
// r.Get("/:org/teams/:team/edit", org.EditTeam)
|
r.Get("/:org/teams/:team/edit", org.EditTeam)
|
||||||
|
|
||||||
// r.Get("/:org/team/:team", org.SingleTeam)
|
r.Get("/:org/team/:team", org.SingleTeam)
|
||||||
|
|
||||||
// r.Get("/:org/settings", org.Settings)
|
r.Get("/:org/settings", org.Settings)
|
||||||
// r.Post("/:org/settings", bindIgnErr(auth.OrgSettingForm{}), org.SettingsPost)
|
r.Post("/:org/settings", bindIgnErr(auth.OrgSettingForm{}), org.SettingsPost)
|
||||||
// r.Post("/:org/settings/delete", org.DeletePost)
|
r.Post("/:org/settings/delete", org.DeletePost)
|
||||||
// }, reqSignIn)
|
}, reqSignIn)
|
||||||
|
|
||||||
// m.Group("/:username/:reponame", func(r *macaron.Router) {
|
m.Group("/:username/:reponame", func(r *macaron.Router) {
|
||||||
// r.Get("/settings", repo.Setting)
|
r.Get("/settings", repo.Setting)
|
||||||
// r.Post("/settings", bindIgnErr(auth.RepoSettingForm{}), repo.SettingPost)
|
r.Post("/settings", bindIgnErr(auth.RepoSettingForm{}), repo.SettingPost)
|
||||||
|
|
||||||
// m.Group("/settings", func(r *macaron.Router) {
|
m.Group("/settings", func(r *macaron.Router) {
|
||||||
// r.Get("/collaboration", repo.Collaboration)
|
r.Get("/collaboration", repo.Collaboration)
|
||||||
// r.Post("/collaboration", repo.CollaborationPost)
|
r.Post("/collaboration", repo.CollaborationPost)
|
||||||
// r.Get("/hooks", repo.WebHooks)
|
r.Get("/hooks", repo.WebHooks)
|
||||||
// r.Get("/hooks/add", repo.WebHooksAdd)
|
r.Get("/hooks/add", repo.WebHooksAdd)
|
||||||
// r.Post("/hooks/add", bindIgnErr(auth.NewWebhookForm{}), repo.WebHooksAddPost)
|
r.Post("/hooks/add", bindIgnErr(auth.NewWebhookForm{}), repo.WebHooksAddPost)
|
||||||
// r.Get("/hooks/:id", repo.WebHooksEdit)
|
r.Get("/hooks/:id", repo.WebHooksEdit)
|
||||||
// r.Post("/hooks/:id", bindIgnErr(auth.NewWebhookForm{}), repo.WebHooksEditPost)
|
r.Post("/hooks/:id", bindIgnErr(auth.NewWebhookForm{}), repo.WebHooksEditPost)
|
||||||
// })
|
})
|
||||||
// }, reqSignIn, middleware.RepoAssignment(true), reqTrueOwner)
|
}, reqSignIn, middleware.RepoAssignment(true), reqTrueOwner)
|
||||||
|
|
||||||
// m.Group("/:username/:reponame", func(r *macaron.Router) {
|
m.Group("/:username/:reponame", func(r *macaron.Router) {
|
||||||
// r.Get("/action/:action", repo.Action)
|
// r.Get("/action/:action", repo.Action)
|
||||||
|
|
||||||
// m.Group("/issues", func(r *macaron.Router) {
|
m.Group("/issues", func(r *macaron.Router) {
|
||||||
// r.Get("/new", repo.CreateIssue)
|
r.Get("/new", repo.CreateIssue)
|
||||||
// r.Post("/new", bindIgnErr(auth.CreateIssueForm{}), repo.CreateIssuePost)
|
r.Post("/new", bindIgnErr(auth.CreateIssueForm{}), repo.CreateIssuePost)
|
||||||
// r.Post("/:index", bindIgnErr(auth.CreateIssueForm{}), repo.UpdateIssue)
|
r.Post("/:index", bindIgnErr(auth.CreateIssueForm{}), repo.UpdateIssue)
|
||||||
// r.Post("/:index/label", repo.UpdateIssueLabel)
|
r.Post("/:index/label", repo.UpdateIssueLabel)
|
||||||
// r.Post("/:index/milestone", repo.UpdateIssueMilestone)
|
r.Post("/:index/milestone", repo.UpdateIssueMilestone)
|
||||||
// r.Post("/:index/assignee", repo.UpdateAssignee)
|
r.Post("/:index/assignee", repo.UpdateAssignee)
|
||||||
// r.Get("/:index/attachment/:id", repo.IssueGetAttachment)
|
r.Get("/:index/attachment/:id", repo.IssueGetAttachment)
|
||||||
// r.Post("/labels/new", bindIgnErr(auth.CreateLabelForm{}), repo.NewLabel)
|
r.Post("/labels/new", bindIgnErr(auth.CreateLabelForm{}), repo.NewLabel)
|
||||||
// r.Post("/labels/edit", bindIgnErr(auth.CreateLabelForm{}), repo.UpdateLabel)
|
r.Post("/labels/edit", bindIgnErr(auth.CreateLabelForm{}), repo.UpdateLabel)
|
||||||
// r.Post("/labels/delete", repo.DeleteLabel)
|
r.Post("/labels/delete", repo.DeleteLabel)
|
||||||
// r.Get("/milestones", repo.Milestones)
|
r.Get("/milestones", repo.Milestones)
|
||||||
// r.Get("/milestones/new", repo.NewMilestone)
|
r.Get("/milestones/new", repo.NewMilestone)
|
||||||
// r.Post("/milestones/new", bindIgnErr(auth.CreateMilestoneForm{}), repo.NewMilestonePost)
|
r.Post("/milestones/new", bindIgnErr(auth.CreateMilestoneForm{}), repo.NewMilestonePost)
|
||||||
// r.Get("/milestones/:index/edit", repo.UpdateMilestone)
|
r.Get("/milestones/:index/edit", repo.UpdateMilestone)
|
||||||
// r.Post("/milestones/:index/edit", bindIgnErr(auth.CreateMilestoneForm{}), repo.UpdateMilestonePost)
|
r.Post("/milestones/:index/edit", bindIgnErr(auth.CreateMilestoneForm{}), repo.UpdateMilestonePost)
|
||||||
// r.Get("/milestones/:index/:action", repo.UpdateMilestone)
|
r.Get("/milestones/:index/:action", repo.UpdateMilestone)
|
||||||
// })
|
})
|
||||||
|
|
||||||
// r.Post("/comment/:action", repo.Comment)
|
r.Post("/comment/:action", repo.Comment)
|
||||||
// r.Get("/releases/new", repo.NewRelease)
|
r.Get("/releases/new", repo.NewRelease)
|
||||||
// r.Get("/releases/edit/:tagname", repo.EditRelease)
|
r.Get("/releases/edit/:tagname", repo.EditRelease)
|
||||||
// }, reqSignIn, middleware.RepoAssignment(true))
|
}, reqSignIn, middleware.RepoAssignment(true))
|
||||||
|
|
||||||
// m.Group("/:username/:reponame", func(r *macaron.Router) {
|
m.Group("/:username/:reponame", func(r *macaron.Router) {
|
||||||
// r.Post("/releases/new", bindIgnErr(auth.NewReleaseForm{}), repo.NewReleasePost)
|
r.Post("/releases/new", bindIgnErr(auth.NewReleaseForm{}), repo.NewReleasePost)
|
||||||
// r.Post("/releases/edit/:tagname", bindIgnErr(auth.EditReleaseForm{}), repo.EditReleasePost)
|
r.Post("/releases/edit/:tagname", bindIgnErr(auth.EditReleaseForm{}), repo.EditReleasePost)
|
||||||
// }, reqSignIn, middleware.RepoAssignment(true, true))
|
}, reqSignIn, middleware.RepoAssignment(true, true))
|
||||||
|
|
||||||
// m.Group("/:username/:reponame", func(r *macaron.Router) {
|
m.Group("/:username/:reponame", func(r *macaron.Router) {
|
||||||
// r.Get("/issues", repo.Issues)
|
r.Get("/issues", repo.Issues)
|
||||||
// r.Get("/issues/:index", repo.ViewIssue)
|
r.Get("/issues/:index", repo.ViewIssue)
|
||||||
// r.Get("/pulls", repo.Pulls)
|
r.Get("/pulls", repo.Pulls)
|
||||||
// r.Get("/branches", repo.Branches)
|
r.Get("/branches", repo.Branches)
|
||||||
// }, ignSignIn, middleware.RepoAssignment(true))
|
}, ignSignIn, middleware.RepoAssignment(true))
|
||||||
|
|
||||||
m.Group("/:username/:reponame", func(r *macaron.Router) {
|
m.Group("/:username/:reponame", func(r *macaron.Router) {
|
||||||
r.Get("/src/:branchname", repo.Home)
|
r.Get("/src/:branchname", repo.Home)
|
||||||
r.Get("/src/:branchname/*", repo.Home)
|
r.Get("/src/:branchname/*", repo.Home)
|
||||||
r.Get("/raw/:branchname/**", repo.SingleDownload)
|
r.Get("/raw/:branchname/*", repo.SingleDownload)
|
||||||
// r.Get("/commits/:branchname", repo.Commits)
|
r.Get("/commits/:branchname", repo.Commits)
|
||||||
// r.Get("/commits/:branchname/search", repo.SearchCommits)
|
r.Get("/commits/:branchname/search", repo.SearchCommits)
|
||||||
// r.Get("/commits/:branchname/**", repo.FileHistory)
|
r.Get("/commits/:branchname/*", repo.FileHistory)
|
||||||
// r.Get("/commit/:branchname", repo.Diff)
|
r.Get("/commit/:branchname", repo.Diff)
|
||||||
// r.Get("/commit/:branchname/**", repo.Diff)
|
r.Get("/commit/:branchname/*", repo.Diff)
|
||||||
// r.Get("/releases", repo.Releases)
|
r.Get("/releases", repo.Releases)
|
||||||
r.Get("/archive/*.*", repo.Download)
|
r.Get("/archive/*.*", repo.Download)
|
||||||
}, ignSignIn, middleware.RepoAssignment(true, true))
|
}, ignSignIn, middleware.RepoAssignment(true, true))
|
||||||
|
|
||||||
|
|
|
@ -89,6 +89,7 @@ profile = Profile
|
||||||
password = Password
|
password = Password
|
||||||
ssh_keys = SSH Keys
|
ssh_keys = SSH Keys
|
||||||
social = Social Accounts
|
social = Social Accounts
|
||||||
|
orgs = Organizations
|
||||||
delete = Delete Accoount
|
delete = Delete Accoount
|
||||||
|
|
||||||
public_profile = Public Profile
|
public_profile = Public Profile
|
||||||
|
@ -118,6 +119,7 @@ add_on = Added on
|
||||||
last_used = Last used on
|
last_used = Last used on
|
||||||
no_activity = No recent activity
|
no_activity = No recent activity
|
||||||
|
|
||||||
|
manage_orgs = Manage Organizations
|
||||||
manage_social = Manage Associated Social Accounts
|
manage_social = Manage Associated Social Accounts
|
||||||
|
|
||||||
delete_account = Delete Your Account
|
delete_account = Delete Your Account
|
||||||
|
|
|
@ -89,6 +89,7 @@ profile = 个人信息
|
||||||
password = 修改密码
|
password = 修改密码
|
||||||
ssh_keys = 管理 SSH 密钥
|
ssh_keys = 管理 SSH 密钥
|
||||||
social = 社交帐号绑定
|
social = 社交帐号绑定
|
||||||
|
orgs = 管理组织
|
||||||
delete = 删除帐户
|
delete = 删除帐户
|
||||||
|
|
||||||
public_profile = 公开信息
|
public_profile = 公开信息
|
||||||
|
@ -118,6 +119,7 @@ add_on = 增加于
|
||||||
last_used = 上次使用在
|
last_used = 上次使用在
|
||||||
no_activity = 没有最近活动
|
no_activity = 没有最近活动
|
||||||
|
|
||||||
|
manage_orgs = 管理我的组织
|
||||||
manage_social = 管理关联社交帐户
|
manage_social = 管理关联社交帐户
|
||||||
|
|
||||||
delete_account = 删除当前帐户
|
delete_account = 删除当前帐户
|
||||||
|
|
2
gogs.go
2
gogs.go
|
@ -17,7 +17,7 @@ import (
|
||||||
"github.com/gogits/gogs/modules/setting"
|
"github.com/gogits/gogs/modules/setting"
|
||||||
)
|
)
|
||||||
|
|
||||||
const APP_VER = "0.4.7.0725 Alpha"
|
const APP_VER = "0.4.7.0726 Alpha"
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
runtime.GOMAXPROCS(runtime.NumCPU())
|
runtime.GOMAXPROCS(runtime.NumCPU())
|
||||||
|
|
|
@ -10,7 +10,7 @@ import (
|
||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/gogits/git"
|
"github.com/gogits/gogs/modules/git"
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
|
|
|
@ -106,7 +106,6 @@ var TemplateFuncs template.FuncMap = map[string]interface{}{
|
||||||
"CreateCaptcha": func() string { return "" },
|
"CreateCaptcha": func() string { return "" },
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: Legacy
|
|
||||||
type Actioner interface {
|
type Actioner interface {
|
||||||
GetOpType() int
|
GetOpType() int
|
||||||
GetActUserName() string
|
GetActUserName() string
|
||||||
|
|
|
@ -73,6 +73,14 @@ func (c *Commit) CommitsCount() (int, error) {
|
||||||
return c.repo.commitsCount(c.Id)
|
return c.repo.commitsCount(c.Id)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (c *Commit) SearchCommits(keyword string) (*list.List, error) {
|
||||||
|
return c.repo.searchCommits(c.Id, keyword)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *Commit) CommitsByRange(page int) (*list.List, error) {
|
||||||
|
return c.repo.commitsByRange(c.Id, page)
|
||||||
|
}
|
||||||
|
|
||||||
func (c *Commit) GetCommitOfRelPath(relPath string) (*Commit, error) {
|
func (c *Commit) GetCommitOfRelPath(relPath string) (*Commit, error) {
|
||||||
return c.repo.getCommitOfRelPath(c.Id, relPath)
|
return c.repo.getCommitOfRelPath(c.Id, relPath)
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,7 +32,18 @@ func (repo *Repository) GetCommitOfBranch(branchName string) (*Commit, error) {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
return repo.GetCommit(commitId)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (repo *Repository) GetCommitIdOfTag(tagName string) (string, error) {
|
||||||
|
return repo.getCommitIdOfRef("refs/tags/" + tagName)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (repo *Repository) GetCommitOfTag(tagName string) (*Commit, error) {
|
||||||
|
commitId, err := repo.GetCommitIdOfTag(tagName)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
return repo.GetCommit(commitId)
|
return repo.GetCommit(commitId)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -212,6 +223,32 @@ func (repo *Repository) commitsBefore(lock *sync.Mutex, l *list.List, parent *li
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (repo *Repository) CommitsCount(commitId string) (int, error) {
|
||||||
|
id, err := NewIdFromString(commitId)
|
||||||
|
if err != nil {
|
||||||
|
return 0, err
|
||||||
|
}
|
||||||
|
return repo.commitsCount(id)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (repo *Repository) FileCommitsCount(branch, file string) (int, error) {
|
||||||
|
stdout, stderr, err := com.ExecCmdDir(repo.Path, "git", "rev-list", "--count",
|
||||||
|
branch, "--", file)
|
||||||
|
if err != nil {
|
||||||
|
return 0, errors.New(stderr)
|
||||||
|
}
|
||||||
|
return com.StrTo(strings.TrimSpace(stdout)).Int()
|
||||||
|
}
|
||||||
|
|
||||||
|
func (repo *Repository) CommitsByFileAndRange(branch, file string, page int) (*list.List, error) {
|
||||||
|
stdout, stderr, err := com.ExecCmdDirBytes(repo.Path, "git", "log", branch,
|
||||||
|
"--skip="+com.ToStr((page-1)*50), "--max-count=50", prettyLogFormat, "--", file)
|
||||||
|
if err != nil {
|
||||||
|
return nil, errors.New(string(stderr))
|
||||||
|
}
|
||||||
|
return parsePrettyFormatLog(repo, stdout)
|
||||||
|
}
|
||||||
|
|
||||||
func (repo *Repository) getCommitsBefore(id sha1) (*list.List, error) {
|
func (repo *Repository) getCommitsBefore(id sha1) (*list.List, error) {
|
||||||
l := list.New()
|
l := list.New()
|
||||||
lock := new(sync.Mutex)
|
lock := new(sync.Mutex)
|
||||||
|
@ -219,6 +256,26 @@ func (repo *Repository) getCommitsBefore(id sha1) (*list.List, error) {
|
||||||
return l, err
|
return l, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (repo *Repository) searchCommits(id sha1, keyword string) (*list.List, error) {
|
||||||
|
stdout, stderr, err := com.ExecCmdDirBytes(repo.Path, "git", "log", id.String(), "-100",
|
||||||
|
"-i", "--grep="+keyword, prettyLogFormat)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
} else if len(stderr) > 0 {
|
||||||
|
return nil, errors.New(string(stderr))
|
||||||
|
}
|
||||||
|
return parsePrettyFormatLog(repo, stdout)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (repo *Repository) commitsByRange(id sha1, page int) (*list.List, error) {
|
||||||
|
stdout, stderr, err := com.ExecCmdDirBytes(repo.Path, "git", "log", id.String(),
|
||||||
|
"--skip="+com.ToStr((page-1)*50), "--max-count=50", prettyLogFormat)
|
||||||
|
if err != nil {
|
||||||
|
return nil, errors.New(string(stderr))
|
||||||
|
}
|
||||||
|
return parsePrettyFormatLog(repo, stdout)
|
||||||
|
}
|
||||||
|
|
||||||
func (repo *Repository) getCommitOfRelPath(id sha1, relPath string) (*Commit, error) {
|
func (repo *Repository) getCommitOfRelPath(id sha1, relPath string) (*Commit, error) {
|
||||||
stdout, _, err := com.ExecCmdDir(repo.Path, "git", "log", "-1", prettyLogFormat, id.String(), "--", relPath)
|
stdout, _, err := com.ExecCmdDir(repo.Path, "git", "log", "-1", prettyLogFormat, id.String(), "--", relPath)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
|
@ -30,6 +30,14 @@ func (repo *Repository) GetTags() ([]string, error) {
|
||||||
return tags[:len(tags)-1], nil
|
return tags[:len(tags)-1], nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (repo *Repository) CreateTag(tagName, idStr string) error {
|
||||||
|
_, stderr, err := com.ExecCmdDir(repo.Path, "git", "tag", tagName, idStr)
|
||||||
|
if err != nil {
|
||||||
|
return errors.New(stderr)
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
func (repo *Repository) getTag(id sha1) (*Tag, error) {
|
func (repo *Repository) getTag(id sha1) (*Tag, error) {
|
||||||
if repo.tagCache != nil {
|
if repo.tagCache != nil {
|
||||||
if t, ok := repo.tagCache[id]; ok {
|
if t, ok := repo.tagCache[id]; ok {
|
||||||
|
|
|
@ -44,3 +44,16 @@ func (t *Tree) GetTreeEntryByPath(relpath string) (*TreeEntry, error) {
|
||||||
}
|
}
|
||||||
return nil, fmt.Errorf("GetTreeEntryByPath: %v", ErrNotExist)
|
return nil, fmt.Errorf("GetTreeEntryByPath: %v", ErrNotExist)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (t *Tree) GetBlobByPath(rpath string) (*Blob, error) {
|
||||||
|
entry, err := t.GetTreeEntryByPath(rpath)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
if !entry.IsDir() {
|
||||||
|
return entry.Blob(), nil
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil, ErrNotExist
|
||||||
|
}
|
||||||
|
|
|
@ -5,12 +5,33 @@
|
||||||
package git
|
package git
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"bytes"
|
||||||
|
"container/list"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
"strings"
|
"strings"
|
||||||
)
|
)
|
||||||
|
|
||||||
const prettyLogFormat = `--pretty=format:%H`
|
const prettyLogFormat = `--pretty=format:%H`
|
||||||
|
|
||||||
|
func parsePrettyFormatLog(repo *Repository, logByts []byte) (*list.List, error) {
|
||||||
|
l := list.New()
|
||||||
|
if len(logByts) == 0 {
|
||||||
|
return l, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
parts := bytes.Split(logByts, []byte{'\n'})
|
||||||
|
|
||||||
|
for _, commitId := range parts {
|
||||||
|
commit, err := repo.GetCommit(string(commitId))
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
l.PushBack(commit)
|
||||||
|
}
|
||||||
|
|
||||||
|
return l, nil
|
||||||
|
}
|
||||||
|
|
||||||
func RefEndName(refStr string) string {
|
func RefEndName(refStr string) string {
|
||||||
index := strings.LastIndex(refStr, "/")
|
index := strings.LastIndex(refStr, "/")
|
||||||
if index != -1 {
|
if index != -1 {
|
||||||
|
|
Binary file not shown.
Before Width: | Height: | Size: 6.8 KiB After Width: | Height: | Size: 6.1 KiB |
Binary file not shown.
Before Width: | Height: | Size: 16 KiB After Width: | Height: | Size: 12 KiB |
Binary file not shown.
Before Width: | Height: | Size: 96 KiB After Width: | Height: | Size: 96 KiB |
4
public/ng/css/font-awesome.min.css
vendored
4
public/ng/css/font-awesome.min.css
vendored
File diff suppressed because one or more lines are too long
|
@ -373,7 +373,7 @@ img.avatar-30 {
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
text-decoration: none;
|
text-decoration: none;
|
||||||
-webkit-font-smoothing: antialiased;
|
-webkit-font-smoothing: antialiased;
|
||||||
margin-right: 8px;
|
margin-left: 30px;
|
||||||
}
|
}
|
||||||
.markdown a span.octicon-link {
|
.markdown a span.octicon-link {
|
||||||
opacity: 0;
|
opacity: 0;
|
||||||
|
@ -1058,6 +1058,9 @@ The register and sign-in page style
|
||||||
}
|
}
|
||||||
#repo-bare-start pre {
|
#repo-bare-start pre {
|
||||||
margin: 0 40px;
|
margin: 0 40px;
|
||||||
|
padding: 6px 10px;
|
||||||
|
border: 1px solid #ddd;
|
||||||
|
background: #f8f8f8;
|
||||||
}
|
}
|
||||||
.repo-bare #repo-bare-start h2 {
|
.repo-bare #repo-bare-start h2 {
|
||||||
margin-top: 30px;
|
margin-top: 30px;
|
||||||
|
@ -1073,6 +1076,7 @@ The register and sign-in page style
|
||||||
margin-right: 200px;
|
margin-right: 200px;
|
||||||
}
|
}
|
||||||
.repo-bare #repo-clone-help {
|
.repo-bare #repo-clone-help {
|
||||||
|
clear: both;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
}
|
}
|
||||||
.repo-bare #repo-clone-url {
|
.repo-bare #repo-clone-url {
|
||||||
|
|
|
@ -5,12 +5,10 @@
|
||||||
package org
|
package org
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/go-martini/martini"
|
|
||||||
|
|
||||||
"github.com/gogits/gogs/modules/middleware"
|
"github.com/gogits/gogs/modules/middleware"
|
||||||
)
|
)
|
||||||
|
|
||||||
func Members(ctx *middleware.Context, params martini.Params) {
|
func Members(ctx *middleware.Context) {
|
||||||
ctx.Data["Title"] = "Organization " + params["org"] + " Members"
|
ctx.Data["Title"] = "Organization " + ctx.Params(":org") + " Members"
|
||||||
ctx.HTML(200, "org/members")
|
ctx.HTML(200, "org/members")
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,9 +5,7 @@
|
||||||
package org
|
package org
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/go-martini/martini"
|
"github.com/gogits/gogs/models"
|
||||||
|
|
||||||
"github.com/gogits/gogs-ng/models"
|
|
||||||
"github.com/gogits/gogs/modules/auth"
|
"github.com/gogits/gogs/modules/auth"
|
||||||
"github.com/gogits/gogs/modules/base"
|
"github.com/gogits/gogs/modules/base"
|
||||||
"github.com/gogits/gogs/modules/log"
|
"github.com/gogits/gogs/modules/log"
|
||||||
|
@ -21,10 +19,10 @@ const (
|
||||||
SETTINGS base.TplName = "org/settings"
|
SETTINGS base.TplName = "org/settings"
|
||||||
)
|
)
|
||||||
|
|
||||||
func Home(ctx *middleware.Context, params martini.Params) {
|
func Home(ctx *middleware.Context) {
|
||||||
ctx.Data["Title"] = "Organization " + params["org"]
|
ctx.Data["Title"] = "Organization " + ctx.Params(":org")
|
||||||
|
|
||||||
org, err := models.GetUserByName(params["org"])
|
org, err := models.GetUserByName(ctx.Params(":org"))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
if err == models.ErrUserNotExist {
|
if err == models.ErrUserNotExist {
|
||||||
ctx.Handle(404, "org.Home(GetUserByName)", err)
|
ctx.Handle(404, "org.Home(GetUserByName)", err)
|
||||||
|
@ -99,12 +97,12 @@ func NewPost(ctx *middleware.Context, form auth.CreateOrgForm) {
|
||||||
ctx.Redirect("/org/" + form.OrgName + "/dashboard")
|
ctx.Redirect("/org/" + form.OrgName + "/dashboard")
|
||||||
}
|
}
|
||||||
|
|
||||||
func Dashboard(ctx *middleware.Context, params martini.Params) {
|
func Dashboard(ctx *middleware.Context) {
|
||||||
ctx.Data["Title"] = "Dashboard"
|
ctx.Data["Title"] = "Dashboard"
|
||||||
ctx.Data["PageIsUserDashboard"] = true
|
ctx.Data["PageIsUserDashboard"] = true
|
||||||
ctx.Data["PageIsOrgDashboard"] = true
|
ctx.Data["PageIsOrgDashboard"] = true
|
||||||
|
|
||||||
org, err := models.GetUserByName(params["org"])
|
org, err := models.GetUserByName(ctx.Params(":org"))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
if err == models.ErrUserNotExist {
|
if err == models.ErrUserNotExist {
|
||||||
ctx.Handle(404, "org.Dashboard(GetUserByName)", err)
|
ctx.Handle(404, "org.Dashboard(GetUserByName)", err)
|
||||||
|
@ -114,11 +112,11 @@ func Dashboard(ctx *middleware.Context, params martini.Params) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
// if err := ctx.User.GetOrganizations(); err != nil {
|
if err := ctx.User.GetOrganizations(); err != nil {
|
||||||
// ctx.Handle(500, "home.Dashboard(GetOrganizations)", err)
|
ctx.Handle(500, "home.Dashboard(GetOrganizations)", err)
|
||||||
// return
|
return
|
||||||
// }
|
}
|
||||||
// ctx.Data["Orgs"] = ctx.User.Orgs
|
ctx.Data["Orgs"] = ctx.User.Orgs
|
||||||
ctx.Data["ContextUser"] = org
|
ctx.Data["ContextUser"] = org
|
||||||
|
|
||||||
ctx.Data["MyRepos"], err = models.GetRepositories(org.Id, true)
|
ctx.Data["MyRepos"], err = models.GetRepositories(org.Id, true)
|
||||||
|
@ -137,10 +135,10 @@ func Dashboard(ctx *middleware.Context, params martini.Params) {
|
||||||
ctx.HTML(200, user.DASHBOARD)
|
ctx.HTML(200, user.DASHBOARD)
|
||||||
}
|
}
|
||||||
|
|
||||||
func Settings(ctx *middleware.Context, params martini.Params) {
|
func Settings(ctx *middleware.Context) {
|
||||||
ctx.Data["Title"] = "Settings"
|
ctx.Data["Title"] = "Settings"
|
||||||
|
|
||||||
org, err := models.GetUserByName(params["org"])
|
org, err := models.GetUserByName(ctx.Params(":org"))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
if err == models.ErrUserNotExist {
|
if err == models.ErrUserNotExist {
|
||||||
ctx.Handle(404, "org.Settings(GetUserByName)", err)
|
ctx.Handle(404, "org.Settings(GetUserByName)", err)
|
||||||
|
@ -154,10 +152,10 @@ func Settings(ctx *middleware.Context, params martini.Params) {
|
||||||
ctx.HTML(200, SETTINGS)
|
ctx.HTML(200, SETTINGS)
|
||||||
}
|
}
|
||||||
|
|
||||||
func SettingsPost(ctx *middleware.Context, params martini.Params, form auth.OrgSettingForm) {
|
func SettingsPost(ctx *middleware.Context, form auth.OrgSettingForm) {
|
||||||
ctx.Data["Title"] = "Settings"
|
ctx.Data["Title"] = "Settings"
|
||||||
|
|
||||||
org, err := models.GetUserByName(params["org"])
|
org, err := models.GetUserByName(ctx.Params(":org"))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
if err == models.ErrUserNotExist {
|
if err == models.ErrUserNotExist {
|
||||||
ctx.Handle(404, "org.SettingsPost(GetUserByName)", err)
|
ctx.Handle(404, "org.SettingsPost(GetUserByName)", err)
|
||||||
|
@ -187,10 +185,10 @@ func SettingsPost(ctx *middleware.Context, params martini.Params, form auth.OrgS
|
||||||
ctx.Redirect("/org/" + org.Name + "/settings")
|
ctx.Redirect("/org/" + org.Name + "/settings")
|
||||||
}
|
}
|
||||||
|
|
||||||
func DeletePost(ctx *middleware.Context, params martini.Params) {
|
func DeletePost(ctx *middleware.Context) {
|
||||||
ctx.Data["Title"] = "Settings"
|
ctx.Data["Title"] = "Settings"
|
||||||
|
|
||||||
org, err := models.GetUserByName(params["org"])
|
org, err := models.GetUserByName(ctx.Params(":org"))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
if err == models.ErrUserNotExist {
|
if err == models.ErrUserNotExist {
|
||||||
ctx.Handle(404, "org.DeletePost(GetUserByName)", err)
|
ctx.Handle(404, "org.DeletePost(GetUserByName)", err)
|
||||||
|
|
|
@ -5,8 +5,6 @@
|
||||||
package org
|
package org
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/go-martini/martini"
|
|
||||||
|
|
||||||
"github.com/gogits/gogs/models"
|
"github.com/gogits/gogs/models"
|
||||||
"github.com/gogits/gogs/modules/auth"
|
"github.com/gogits/gogs/modules/auth"
|
||||||
"github.com/gogits/gogs/modules/base"
|
"github.com/gogits/gogs/modules/base"
|
||||||
|
@ -19,10 +17,10 @@ const (
|
||||||
TEAM_NEW base.TplName = "org/team_new"
|
TEAM_NEW base.TplName = "org/team_new"
|
||||||
)
|
)
|
||||||
|
|
||||||
func Teams(ctx *middleware.Context, params martini.Params) {
|
func Teams(ctx *middleware.Context) {
|
||||||
ctx.Data["Title"] = "Organization " + params["org"] + " Teams"
|
ctx.Data["Title"] = "Organization " + ctx.Params(":org") + " Teams"
|
||||||
|
|
||||||
org, err := models.GetUserByName(params["org"])
|
org, err := models.GetUserByName(ctx.Params(":org"))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
if err == models.ErrUserNotExist {
|
if err == models.ErrUserNotExist {
|
||||||
ctx.Handle(404, "org.Teams(GetUserByName)", err)
|
ctx.Handle(404, "org.Teams(GetUserByName)", err)
|
||||||
|
@ -48,8 +46,8 @@ func Teams(ctx *middleware.Context, params martini.Params) {
|
||||||
ctx.HTML(200, TEAMS)
|
ctx.HTML(200, TEAMS)
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewTeam(ctx *middleware.Context, params martini.Params) {
|
func NewTeam(ctx *middleware.Context) {
|
||||||
org, err := models.GetUserByName(params["org"])
|
org, err := models.GetUserByName(ctx.Params(":org"))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
if err == models.ErrUserNotExist {
|
if err == models.ErrUserNotExist {
|
||||||
ctx.Handle(404, "org.NewTeam(GetUserByName)", err)
|
ctx.Handle(404, "org.NewTeam(GetUserByName)", err)
|
||||||
|
@ -69,8 +67,8 @@ func NewTeam(ctx *middleware.Context, params martini.Params) {
|
||||||
ctx.HTML(200, TEAM_NEW)
|
ctx.HTML(200, TEAM_NEW)
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewTeamPost(ctx *middleware.Context, params martini.Params, form auth.CreateTeamForm) {
|
func NewTeamPost(ctx *middleware.Context, form auth.CreateTeamForm) {
|
||||||
org, err := models.GetUserByName(params["org"])
|
org, err := models.GetUserByName(ctx.Params(":org"))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
if err == models.ErrUserNotExist {
|
if err == models.ErrUserNotExist {
|
||||||
ctx.Handle(404, "org.NewTeamPost(GetUserByName)", err)
|
ctx.Handle(404, "org.NewTeamPost(GetUserByName)", err)
|
||||||
|
@ -125,12 +123,12 @@ func NewTeamPost(ctx *middleware.Context, params martini.Params, form auth.Creat
|
||||||
ctx.Redirect("/org/" + org.LowerName + "/teams/" + t.LowerName)
|
ctx.Redirect("/org/" + org.LowerName + "/teams/" + t.LowerName)
|
||||||
}
|
}
|
||||||
|
|
||||||
func EditTeam(ctx *middleware.Context, params martini.Params) {
|
func EditTeam(ctx *middleware.Context) {
|
||||||
ctx.Data["Title"] = "Organization " + params["org"] + " Edit Team"
|
ctx.Data["Title"] = "Organization " + ctx.Params(":org") + " Edit Team"
|
||||||
ctx.HTML(200, "org/edit_team")
|
ctx.HTML(200, "org/edit_team")
|
||||||
}
|
}
|
||||||
|
|
||||||
func SingleTeam(ctx *middleware.Context,params martini.Params){
|
func SingleTeam(ctx *middleware.Context) {
|
||||||
ctx.Data["Title"] = "single-team"+params["org"]
|
ctx.Data["Title"] = "single-team" + ctx.Params(":org")
|
||||||
ctx.HTML(200,"org/team")
|
ctx.HTML(200, "org/team")
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,224 +4,221 @@
|
||||||
|
|
||||||
package repo
|
package repo
|
||||||
|
|
||||||
// import (
|
import (
|
||||||
// "path"
|
"path"
|
||||||
|
|
||||||
// "github.com/Unknwon/com"
|
"github.com/Unknwon/com"
|
||||||
// "github.com/go-martini/martini"
|
|
||||||
|
|
||||||
// "github.com/gogits/gogs/models"
|
"github.com/gogits/gogs/models"
|
||||||
// "github.com/gogits/gogs/modules/base"
|
"github.com/gogits/gogs/modules/base"
|
||||||
// "github.com/gogits/gogs/modules/middleware"
|
"github.com/gogits/gogs/modules/middleware"
|
||||||
// )
|
)
|
||||||
|
|
||||||
// const (
|
const (
|
||||||
// COMMITS base.TplName = "repo/commits"
|
COMMITS base.TplName = "repo/commits"
|
||||||
// DIFF base.TplName = "repo/diff"
|
DIFF base.TplName = "repo/diff"
|
||||||
// )
|
)
|
||||||
|
|
||||||
// func Commits(ctx *middleware.Context, params martini.Params) {
|
func Commits(ctx *middleware.Context) {
|
||||||
// ctx.Data["IsRepoToolbarCommits"] = true
|
ctx.Data["IsRepoToolbarCommits"] = true
|
||||||
|
|
||||||
// userName := ctx.Repo.Owner.Name
|
userName := ctx.Repo.Owner.Name
|
||||||
// repoName := ctx.Repo.Repository.Name
|
repoName := ctx.Repo.Repository.Name
|
||||||
|
|
||||||
// brs, err := ctx.Repo.GitRepo.GetBranches()
|
brs, err := ctx.Repo.GitRepo.GetBranches()
|
||||||
// if err != nil {
|
if err != nil {
|
||||||
// ctx.Handle(500, "repo.Commits(GetBranches)", err)
|
ctx.Handle(500, "GetBranches", err)
|
||||||
// return
|
return
|
||||||
// } else if len(brs) == 0 {
|
} else if len(brs) == 0 {
|
||||||
// ctx.Handle(404, "repo.Commits(GetBranches)", nil)
|
ctx.Handle(404, "GetBranches", nil)
|
||||||
// return
|
return
|
||||||
// }
|
}
|
||||||
|
|
||||||
// commitsCount, err := ctx.Repo.Commit.CommitsCount()
|
commitsCount, err := ctx.Repo.Commit.CommitsCount()
|
||||||
// if err != nil {
|
if err != nil {
|
||||||
// ctx.Handle(500, "repo.Commits(GetCommitsCount)", err)
|
ctx.Handle(500, "GetCommitsCount", err)
|
||||||
// return
|
return
|
||||||
// }
|
}
|
||||||
|
|
||||||
// // Calculate and validate page number.
|
// Calculate and validate page number.
|
||||||
// page, _ := com.StrTo(ctx.Query("p")).Int()
|
page, _ := com.StrTo(ctx.Query("p")).Int()
|
||||||
// if page < 1 {
|
if page < 1 {
|
||||||
// page = 1
|
page = 1
|
||||||
// }
|
}
|
||||||
// lastPage := page - 1
|
lastPage := page - 1
|
||||||
// if lastPage < 0 {
|
if lastPage < 0 {
|
||||||
// lastPage = 0
|
lastPage = 0
|
||||||
// }
|
}
|
||||||
// nextPage := page + 1
|
nextPage := page + 1
|
||||||
// if nextPage*50 > commitsCount {
|
if nextPage*50 > commitsCount {
|
||||||
// nextPage = 0
|
nextPage = 0
|
||||||
// }
|
}
|
||||||
|
|
||||||
// // Both `git log branchName` and `git log commitId` work.
|
// Both `git log branchName` and `git log commitId` work.
|
||||||
// // ctx.Data["Commits"], err = ctx.Repo.Commit.CommitsByRange(page)
|
ctx.Data["Commits"], err = ctx.Repo.Commit.CommitsByRange(page)
|
||||||
// // if err != nil {
|
if err != nil {
|
||||||
// // ctx.Handle(500, "repo.Commits(CommitsByRange)", err)
|
ctx.Handle(500, "CommitsByRange", err)
|
||||||
// // return
|
return
|
||||||
// // }
|
}
|
||||||
|
|
||||||
// ctx.Data["Username"] = userName
|
ctx.Data["Username"] = userName
|
||||||
// ctx.Data["Reponame"] = repoName
|
ctx.Data["Reponame"] = repoName
|
||||||
// ctx.Data["CommitCount"] = commitsCount
|
ctx.Data["CommitCount"] = commitsCount
|
||||||
// ctx.Data["LastPageNum"] = lastPage
|
ctx.Data["LastPageNum"] = lastPage
|
||||||
// ctx.Data["NextPageNum"] = nextPage
|
ctx.Data["NextPageNum"] = nextPage
|
||||||
// ctx.HTML(200, COMMITS)
|
ctx.HTML(200, COMMITS)
|
||||||
// }
|
}
|
||||||
|
|
||||||
// func SearchCommits(ctx *middleware.Context, params martini.Params) {
|
func SearchCommits(ctx *middleware.Context) {
|
||||||
// ctx.Data["IsSearchPage"] = true
|
ctx.Data["IsSearchPage"] = true
|
||||||
// ctx.Data["IsRepoToolbarCommits"] = true
|
ctx.Data["IsRepoToolbarCommits"] = true
|
||||||
|
|
||||||
// keyword := ctx.Query("q")
|
keyword := ctx.Query("q")
|
||||||
// if len(keyword) == 0 {
|
if len(keyword) == 0 {
|
||||||
// ctx.Redirect(ctx.Repo.RepoLink + "/commits/" + ctx.Repo.BranchName)
|
ctx.Redirect(ctx.Repo.RepoLink + "/commits/" + ctx.Repo.BranchName)
|
||||||
// return
|
return
|
||||||
// }
|
}
|
||||||
|
|
||||||
// userName := params["username"]
|
userName := ctx.Params(":username")
|
||||||
// repoName := params["reponame"]
|
repoName := ctx.Params(":reponame")
|
||||||
|
|
||||||
// brs, err := ctx.Repo.GitRepo.GetBranches()
|
brs, err := ctx.Repo.GitRepo.GetBranches()
|
||||||
// if err != nil {
|
if err != nil {
|
||||||
// ctx.Handle(500, "repo.SearchCommits(GetBranches)", err)
|
ctx.Handle(500, "GetBranches", err)
|
||||||
// return
|
return
|
||||||
// } else if len(brs) == 0 {
|
} else if len(brs) == 0 {
|
||||||
// ctx.Handle(404, "repo.SearchCommits(GetBranches)", nil)
|
ctx.Handle(404, "GetBranches", nil)
|
||||||
// return
|
return
|
||||||
// }
|
}
|
||||||
|
|
||||||
// // commits, err := ctx.Repo.Commit.SearchCommits(keyword)
|
commits, err := ctx.Repo.Commit.SearchCommits(keyword)
|
||||||
// // if err != nil {
|
if err != nil {
|
||||||
// // ctx.Handle(500, "repo.SearchCommits(SearchCommits)", err)
|
ctx.Handle(500, "repo.SearchCommits(SearchCommits)", err)
|
||||||
// // return
|
return
|
||||||
// // }
|
}
|
||||||
|
|
||||||
// ctx.Data["Keyword"] = keyword
|
ctx.Data["Keyword"] = keyword
|
||||||
// ctx.Data["Username"] = userName
|
ctx.Data["Username"] = userName
|
||||||
// ctx.Data["Reponame"] = repoName
|
ctx.Data["Reponame"] = repoName
|
||||||
// // ctx.Data["CommitCount"] = commits.Len()
|
ctx.Data["CommitCount"] = commits.Len()
|
||||||
// // ctx.Data["Commits"] = commits
|
ctx.Data["Commits"] = commits
|
||||||
// ctx.HTML(200, COMMITS)
|
ctx.HTML(200, COMMITS)
|
||||||
// }
|
}
|
||||||
|
|
||||||
// func Diff(ctx *middleware.Context, params martini.Params) {
|
func Diff(ctx *middleware.Context) {
|
||||||
// ctx.Data["IsRepoToolbarCommits"] = true
|
ctx.Data["IsRepoToolbarCommits"] = true
|
||||||
|
|
||||||
// userName := ctx.Repo.Owner.Name
|
userName := ctx.Repo.Owner.Name
|
||||||
// repoName := ctx.Repo.Repository.Name
|
repoName := ctx.Repo.Repository.Name
|
||||||
// commitId := ctx.Repo.CommitId
|
commitId := ctx.Repo.CommitId
|
||||||
|
|
||||||
// commit := ctx.Repo.Commit
|
commit := ctx.Repo.Commit
|
||||||
|
|
||||||
// diff, err := models.GetDiff(models.RepoPath(userName, repoName), commitId)
|
diff, err := models.GetDiff(models.RepoPath(userName, repoName), commitId)
|
||||||
// if err != nil {
|
if err != nil {
|
||||||
// ctx.Handle(404, "repo.Diff(GetDiff)", err)
|
ctx.Handle(404, "GetDiff", err)
|
||||||
// return
|
return
|
||||||
// }
|
}
|
||||||
|
|
||||||
// isImageFile := func(name string) bool {
|
isImageFile := func(name string) bool {
|
||||||
// // blob, err := ctx.Repo.Commit.GetBlobByPath(name)
|
blob, err := ctx.Repo.Commit.GetBlobByPath(name)
|
||||||
// // if err != nil {
|
if err != nil {
|
||||||
// // return false
|
return false
|
||||||
// // }
|
}
|
||||||
|
|
||||||
// // dataRc, err := blob.Data()
|
dataRc, err := blob.Data()
|
||||||
// // if err != nil {
|
if err != nil {
|
||||||
// // return false
|
return false
|
||||||
// // }
|
}
|
||||||
// // buf := make([]byte, 1024)
|
buf := make([]byte, 1024)
|
||||||
// // n, _ := dataRc.Read(buf)
|
n, _ := dataRc.Read(buf)
|
||||||
// // if n > 0 {
|
if n > 0 {
|
||||||
// // buf = buf[:n]
|
buf = buf[:n]
|
||||||
// // }
|
}
|
||||||
// // dataRc.Close()
|
_, isImage := base.IsImageFile(buf)
|
||||||
// // _, isImage := base.IsImageFile(buf)
|
return isImage
|
||||||
// // return isImage
|
}
|
||||||
// return false
|
|
||||||
// }
|
|
||||||
|
|
||||||
// parents := make([]string, commit.ParentCount())
|
parents := make([]string, commit.ParentCount())
|
||||||
// for i := 0; i < commit.ParentCount(); i++ {
|
for i := 0; i < commit.ParentCount(); i++ {
|
||||||
// sha, err := commit.ParentId(i)
|
sha, err := commit.ParentId(i)
|
||||||
// parents[i] = sha.String()
|
parents[i] = sha.String()
|
||||||
// if err != nil {
|
if err != nil {
|
||||||
// ctx.Handle(404, "repo.Diff", err)
|
ctx.Handle(404, "repo.Diff", err)
|
||||||
// return
|
return
|
||||||
// }
|
}
|
||||||
// }
|
}
|
||||||
|
|
||||||
// ctx.Data["Username"] = userName
|
ctx.Data["Username"] = userName
|
||||||
// ctx.Data["Reponame"] = repoName
|
ctx.Data["Reponame"] = repoName
|
||||||
// ctx.Data["IsImageFile"] = isImageFile
|
ctx.Data["IsImageFile"] = isImageFile
|
||||||
// ctx.Data["Title"] = commit.Summary() + " · " + base.ShortSha(commitId)
|
ctx.Data["Title"] = commit.Summary() + " · " + base.ShortSha(commitId)
|
||||||
// ctx.Data["Commit"] = commit
|
ctx.Data["Commit"] = commit
|
||||||
// ctx.Data["Diff"] = diff
|
ctx.Data["Diff"] = diff
|
||||||
// ctx.Data["Parents"] = parents
|
ctx.Data["Parents"] = parents
|
||||||
// ctx.Data["DiffNotAvailable"] = diff.NumFiles() == 0
|
ctx.Data["DiffNotAvailable"] = diff.NumFiles() == 0
|
||||||
// ctx.Data["SourcePath"] = "/" + path.Join(userName, repoName, "src", commitId)
|
ctx.Data["SourcePath"] = "/" + path.Join(userName, repoName, "src", commitId)
|
||||||
// ctx.Data["RawPath"] = "/" + path.Join(userName, repoName, "raw", commitId)
|
ctx.Data["RawPath"] = "/" + path.Join(userName, repoName, "raw", commitId)
|
||||||
// ctx.HTML(200, DIFF)
|
ctx.HTML(200, DIFF)
|
||||||
// }
|
}
|
||||||
|
|
||||||
// func FileHistory(ctx *middleware.Context, params martini.Params) {
|
func FileHistory(ctx *middleware.Context) {
|
||||||
// ctx.Data["IsRepoToolbarCommits"] = true
|
ctx.Data["IsRepoToolbarCommits"] = true
|
||||||
|
|
||||||
// fileName := params["_1"]
|
fileName := ctx.Params("*")
|
||||||
// if len(fileName) == 0 {
|
if len(fileName) == 0 {
|
||||||
// Commits(ctx, params)
|
Commits(ctx)
|
||||||
// return
|
return
|
||||||
// }
|
}
|
||||||
|
|
||||||
// userName := ctx.Repo.Owner.Name
|
userName := ctx.Repo.Owner.Name
|
||||||
// repoName := ctx.Repo.Repository.Name
|
repoName := ctx.Repo.Repository.Name
|
||||||
// branchName := params["branchname"]
|
branchName := ctx.Params(":branchname")
|
||||||
|
|
||||||
// brs, err := ctx.Repo.GitRepo.GetBranches()
|
brs, err := ctx.Repo.GitRepo.GetBranches()
|
||||||
// if err != nil {
|
if err != nil {
|
||||||
// ctx.Handle(500, "repo.FileHistory", err)
|
ctx.Handle(500, "GetBranches", err)
|
||||||
// return
|
return
|
||||||
// } else if len(brs) == 0 {
|
} else if len(brs) == 0 {
|
||||||
// ctx.Handle(404, "repo.FileHistory", nil)
|
ctx.Handle(404, "GetBranches", nil)
|
||||||
// return
|
return
|
||||||
// }
|
}
|
||||||
|
|
||||||
// // commitsCount, err := ctx.Repo.GitRepo.FileCommitsCount(branchName, fileName)
|
commitsCount, err := ctx.Repo.GitRepo.FileCommitsCount(branchName, fileName)
|
||||||
// // if err != nil {
|
if err != nil {
|
||||||
// // ctx.Handle(500, "repo.FileHistory(GetCommitsCount)", err)
|
ctx.Handle(500, "repo.FileHistory(GetCommitsCount)", err)
|
||||||
// // return
|
return
|
||||||
// // } else if commitsCount == 0 {
|
} else if commitsCount == 0 {
|
||||||
// // ctx.Handle(404, "repo.FileHistory", nil)
|
ctx.Handle(404, "repo.FileHistory", nil)
|
||||||
// // return
|
return
|
||||||
// // }
|
}
|
||||||
|
|
||||||
// // Calculate and validate page number.
|
// Calculate and validate page number.
|
||||||
// // page, _ := base.StrTo(ctx.Query("p")).Int()
|
page := com.StrTo(ctx.Query("p")).MustInt()
|
||||||
// // if page < 1 {
|
if page < 1 {
|
||||||
// // page = 1
|
page = 1
|
||||||
// // }
|
}
|
||||||
// // lastPage := page - 1
|
lastPage := page - 1
|
||||||
// // if lastPage < 0 {
|
if lastPage < 0 {
|
||||||
// // lastPage = 0
|
lastPage = 0
|
||||||
// // }
|
}
|
||||||
// // nextPage := page + 1
|
nextPage := page + 1
|
||||||
// // if nextPage*50 > commitsCount {
|
if nextPage*50 > commitsCount {
|
||||||
// // nextPage = 0
|
nextPage = 0
|
||||||
// // }
|
}
|
||||||
|
|
||||||
// // ctx.Data["Commits"], err = ctx.Repo.GitRepo.CommitsByFileAndRange(
|
ctx.Data["Commits"], err = ctx.Repo.GitRepo.CommitsByFileAndRange(
|
||||||
// // branchName, fileName, page)
|
branchName, fileName, page)
|
||||||
// // if err != nil {
|
if err != nil {
|
||||||
// // ctx.Handle(500, "repo.FileHistory(CommitsByRange)", err)
|
ctx.Handle(500, "repo.FileHistory(CommitsByRange)", err)
|
||||||
// // return
|
return
|
||||||
// // }
|
}
|
||||||
|
|
||||||
// ctx.Data["Username"] = userName
|
ctx.Data["Username"] = userName
|
||||||
// ctx.Data["Reponame"] = repoName
|
ctx.Data["Reponame"] = repoName
|
||||||
// ctx.Data["FileName"] = fileName
|
ctx.Data["FileName"] = fileName
|
||||||
// // ctx.Data["CommitCount"] = commitsCount
|
ctx.Data["CommitCount"] = commitsCount
|
||||||
// // ctx.Data["LastPageNum"] = lastPage
|
ctx.Data["LastPageNum"] = lastPage
|
||||||
// // ctx.Data["NextPageNum"] = nextPage
|
ctx.Data["NextPageNum"] = nextPage
|
||||||
// ctx.HTML(200, COMMITS)
|
ctx.HTML(200, COMMITS)
|
||||||
// }
|
}
|
||||||
|
|
|
@ -5,50 +5,41 @@
|
||||||
package repo
|
package repo
|
||||||
|
|
||||||
import (
|
import (
|
||||||
// "io"
|
"io"
|
||||||
// "os"
|
"path"
|
||||||
// "path/filepath"
|
|
||||||
|
|
||||||
// "github.com/Unknwon/com"
|
"github.com/gogits/gogs/modules/base"
|
||||||
|
|
||||||
// "github.com/gogits/git"
|
|
||||||
|
|
||||||
// "github.com/gogits/gogs/modules/base"
|
|
||||||
"github.com/gogits/gogs/modules/middleware"
|
"github.com/gogits/gogs/modules/middleware"
|
||||||
)
|
)
|
||||||
|
|
||||||
func SingleDownload(ctx *middleware.Context) {
|
func SingleDownload(ctx *middleware.Context) {
|
||||||
// treename := params["_1"]
|
treename := ctx.Params("*")
|
||||||
|
|
||||||
// blob, err := ctx.Repo.Commit.GetBlobByPath(treename)
|
blob, err := ctx.Repo.Commit.GetBlobByPath(treename)
|
||||||
// if err != nil {
|
if err != nil {
|
||||||
// ctx.Handle(500, "repo.SingleDownload(GetBlobByPath)", err)
|
ctx.Handle(500, "GetBlobByPath", err)
|
||||||
// return
|
return
|
||||||
// }
|
}
|
||||||
|
|
||||||
// dataRc, err := blob.Data()
|
dataRc, err := blob.Data()
|
||||||
// if err != nil {
|
if err != nil {
|
||||||
// ctx.Handle(500, "repo.SingleDownload(Data)", err)
|
ctx.Handle(500, "repo.SingleDownload(Data)", err)
|
||||||
// return
|
return
|
||||||
// }
|
}
|
||||||
|
|
||||||
// buf := make([]byte, 1024)
|
buf := make([]byte, 1024)
|
||||||
// n, _ := dataRc.Read(buf)
|
n, _ := dataRc.Read(buf)
|
||||||
// if n > 0 {
|
if n > 0 {
|
||||||
// buf = buf[:n]
|
buf = buf[:n]
|
||||||
// }
|
}
|
||||||
|
|
||||||
// defer func() {
|
contentType, isTextFile := base.IsTextFile(buf)
|
||||||
// dataRc.Close()
|
_, isImageFile := base.IsImageFile(buf)
|
||||||
// }()
|
ctx.Resp.Header().Set("Content-Type", contentType)
|
||||||
|
if !isTextFile && !isImageFile {
|
||||||
// contentType, isTextFile := base.IsTextFile(buf)
|
ctx.Resp.Header().Set("Content-Disposition", "attachment; filename="+path.Base(treename))
|
||||||
// _, isImageFile := base.IsImageFile(buf)
|
ctx.Resp.Header().Set("Content-Transfer-Encoding", "binary")
|
||||||
// ctx.Res.Header().Set("Content-Type", contentType)
|
}
|
||||||
// if !isTextFile && !isImageFile {
|
ctx.Resp.Write(buf)
|
||||||
// ctx.Res.Header().Set("Content-Disposition", "attachment; filename="+filepath.Base(treename))
|
io.Copy(ctx.Resp, dataRc)
|
||||||
// ctx.Res.Header().Set("Content-Transfer-Encoding", "binary")
|
|
||||||
// }
|
|
||||||
// ctx.Res.Write(buf)
|
|
||||||
// io.Copy(ctx.Res, dataRc)
|
|
||||||
}
|
}
|
||||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -5,13 +5,11 @@
|
||||||
package repo
|
package repo
|
||||||
|
|
||||||
import (
|
import (
|
||||||
// "github.com/go-martini/martini"
|
"github.com/gogits/gogs/models"
|
||||||
|
"github.com/gogits/gogs/modules/auth"
|
||||||
// "github.com/gogits/gogs/models"
|
|
||||||
// "github.com/gogits/gogs/modules/auth"
|
|
||||||
"github.com/gogits/gogs/modules/base"
|
"github.com/gogits/gogs/modules/base"
|
||||||
// "github.com/gogits/gogs/modules/log"
|
"github.com/gogits/gogs/modules/log"
|
||||||
// "github.com/gogits/gogs/modules/middleware"
|
"github.com/gogits/gogs/modules/middleware"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
|
@ -20,215 +18,215 @@ const (
|
||||||
RELEASE_EDIT base.TplName = "repo/release/edit"
|
RELEASE_EDIT base.TplName = "repo/release/edit"
|
||||||
)
|
)
|
||||||
|
|
||||||
// func Releases(ctx *middleware.Context) {
|
func Releases(ctx *middleware.Context) {
|
||||||
// ctx.Data["Title"] = "Releases"
|
ctx.Data["Title"] = "Releases"
|
||||||
// ctx.Data["IsRepoToolbarReleases"] = true
|
ctx.Data["IsRepoToolbarReleases"] = true
|
||||||
// ctx.Data["IsRepoReleaseNew"] = false
|
ctx.Data["IsRepoReleaseNew"] = false
|
||||||
// rawTags, err := ctx.Repo.GitRepo.GetTags()
|
rawTags, err := ctx.Repo.GitRepo.GetTags()
|
||||||
// if err != nil {
|
if err != nil {
|
||||||
// ctx.Handle(500, "release.Releases(GetTags)", err)
|
ctx.Handle(500, "release.Releases(GetTags)", err)
|
||||||
// return
|
return
|
||||||
// }
|
}
|
||||||
|
|
||||||
// rels, err := models.GetReleasesByRepoId(ctx.Repo.Repository.Id)
|
rels, err := models.GetReleasesByRepoId(ctx.Repo.Repository.Id)
|
||||||
// if err != nil {
|
if err != nil {
|
||||||
// ctx.Handle(500, "release.Releases(GetReleasesByRepoId)", err)
|
ctx.Handle(500, "release.Releases(GetReleasesByRepoId)", err)
|
||||||
// return
|
return
|
||||||
// }
|
}
|
||||||
|
|
||||||
// commitsCount, err := ctx.Repo.Commit.CommitsCount()
|
commitsCount, err := ctx.Repo.Commit.CommitsCount()
|
||||||
// if err != nil {
|
if err != nil {
|
||||||
// ctx.Handle(500, "release.Releases(CommitsCount)", err)
|
ctx.Handle(500, "release.Releases(CommitsCount)", err)
|
||||||
// return
|
return
|
||||||
// }
|
}
|
||||||
|
|
||||||
// // Temproray cache commits count of used branches to speed up.
|
// Temproray cache commits count of used branches to speed up.
|
||||||
// countCache := make(map[string]int)
|
countCache := make(map[string]int)
|
||||||
|
|
||||||
// tags := make([]*models.Release, len(rawTags))
|
tags := make([]*models.Release, len(rawTags))
|
||||||
// for i, rawTag := range rawTags {
|
for i, rawTag := range rawTags {
|
||||||
// for _, rel := range rels {
|
for _, rel := range rels {
|
||||||
// if rel.IsDraft && !ctx.Repo.IsOwner {
|
if rel.IsDraft && !ctx.Repo.IsOwner {
|
||||||
// continue
|
continue
|
||||||
// }
|
}
|
||||||
// if rel.TagName == rawTag {
|
if rel.TagName == rawTag {
|
||||||
// rel.Publisher, err = models.GetUserById(rel.PublisherId)
|
rel.Publisher, err = models.GetUserById(rel.PublisherId)
|
||||||
// if err != nil {
|
if err != nil {
|
||||||
// ctx.Handle(500, "release.Releases(GetUserById)", err)
|
ctx.Handle(500, "GetUserById", err)
|
||||||
// return
|
return
|
||||||
// }
|
}
|
||||||
// // Get corresponding target if it's not the current branch.
|
// Get corresponding target if it's not the current branch.
|
||||||
// if ctx.Repo.BranchName != rel.Target {
|
if ctx.Repo.BranchName != rel.Target {
|
||||||
// // Get count if not exists.
|
// Get count if not exists.
|
||||||
// if _, ok := countCache[rel.Target]; !ok {
|
if _, ok := countCache[rel.Target]; !ok {
|
||||||
// commit, err := ctx.Repo.GitRepo.GetCommitOfTag(rel.TagName)
|
commit, err := ctx.Repo.GitRepo.GetCommitOfTag(rel.TagName)
|
||||||
// if err != nil {
|
if err != nil {
|
||||||
// ctx.Handle(500, "release.Releases(GetCommitOfTag)", err)
|
ctx.Handle(500, "GetCommitOfTag", err)
|
||||||
// return
|
return
|
||||||
// }
|
}
|
||||||
// countCache[rel.Target], err = commit.CommitsCount()
|
countCache[rel.Target], err = commit.CommitsCount()
|
||||||
// if err != nil {
|
if err != nil {
|
||||||
// ctx.Handle(500, "release.Releases(CommitsCount2)", err)
|
ctx.Handle(500, "CommitsCount2", err)
|
||||||
// return
|
return
|
||||||
// }
|
}
|
||||||
// }
|
}
|
||||||
// rel.NumCommitsBehind = countCache[rel.Target] - rel.NumCommits
|
rel.NumCommitsBehind = countCache[rel.Target] - rel.NumCommits
|
||||||
// } else {
|
} else {
|
||||||
// rel.NumCommitsBehind = commitsCount - rel.NumCommits
|
rel.NumCommitsBehind = commitsCount - rel.NumCommits
|
||||||
// }
|
}
|
||||||
|
|
||||||
// rel.Note = base.RenderMarkdownString(rel.Note, ctx.Repo.RepoLink)
|
rel.Note = base.RenderMarkdownString(rel.Note, ctx.Repo.RepoLink)
|
||||||
// tags[i] = rel
|
tags[i] = rel
|
||||||
// break
|
break
|
||||||
// }
|
}
|
||||||
// }
|
}
|
||||||
|
|
||||||
// if tags[i] == nil {
|
if tags[i] == nil {
|
||||||
// commit, err := ctx.Repo.GitRepo.GetCommitOfTag(rawTag)
|
commit, err := ctx.Repo.GitRepo.GetCommitOfTag(rawTag)
|
||||||
// if err != nil {
|
if err != nil {
|
||||||
// ctx.Handle(500, "release.Releases(GetCommitOfTag2)", err)
|
ctx.Handle(500, "GetCommitOfTag2", err)
|
||||||
// return
|
return
|
||||||
// }
|
}
|
||||||
|
|
||||||
// tags[i] = &models.Release{
|
tags[i] = &models.Release{
|
||||||
// Title: rawTag,
|
Title: rawTag,
|
||||||
// TagName: rawTag,
|
TagName: rawTag,
|
||||||
// Sha1: commit.Id.String(),
|
Sha1: commit.Id.String(),
|
||||||
// }
|
}
|
||||||
|
|
||||||
// tags[i].NumCommits, err = ctx.Repo.GitRepo.CommitsCount(commit.Id.String())
|
tags[i].NumCommits, err = ctx.Repo.GitRepo.CommitsCount(commit.Id.String())
|
||||||
// if err != nil {
|
if err != nil {
|
||||||
// ctx.Handle(500, "release.Releases(CommitsCount)", err)
|
ctx.Handle(500, "CommitsCount", err)
|
||||||
// return
|
return
|
||||||
// }
|
}
|
||||||
// tags[i].NumCommitsBehind = commitsCount - tags[i].NumCommits
|
tags[i].NumCommitsBehind = commitsCount - tags[i].NumCommits
|
||||||
// }
|
}
|
||||||
// }
|
}
|
||||||
// models.SortReleases(tags)
|
models.SortReleases(tags)
|
||||||
// ctx.Data["Releases"] = tags
|
ctx.Data["Releases"] = tags
|
||||||
// ctx.HTML(200, RELEASES)
|
ctx.HTML(200, RELEASES)
|
||||||
// }
|
}
|
||||||
|
|
||||||
// func NewRelease(ctx *middleware.Context) {
|
func NewRelease(ctx *middleware.Context) {
|
||||||
// if !ctx.Repo.IsOwner {
|
if !ctx.Repo.IsOwner {
|
||||||
// ctx.Handle(403, "release.ReleasesNew", nil)
|
ctx.Handle(403, "release.ReleasesNew", nil)
|
||||||
// return
|
return
|
||||||
// }
|
}
|
||||||
|
|
||||||
// ctx.Data["Title"] = "New Release"
|
ctx.Data["Title"] = "New Release"
|
||||||
// ctx.Data["IsRepoToolbarReleases"] = true
|
ctx.Data["IsRepoToolbarReleases"] = true
|
||||||
// ctx.Data["IsRepoReleaseNew"] = true
|
ctx.Data["IsRepoReleaseNew"] = true
|
||||||
// ctx.HTML(200, RELEASE_NEW)
|
ctx.HTML(200, RELEASE_NEW)
|
||||||
// }
|
}
|
||||||
|
|
||||||
// func NewReleasePost(ctx *middleware.Context, form auth.NewReleaseForm) {
|
func NewReleasePost(ctx *middleware.Context, form auth.NewReleaseForm) {
|
||||||
// if !ctx.Repo.IsOwner {
|
if !ctx.Repo.IsOwner {
|
||||||
// ctx.Handle(403, "release.ReleasesNew", nil)
|
ctx.Handle(403, "release.ReleasesNew", nil)
|
||||||
// return
|
return
|
||||||
// }
|
}
|
||||||
|
|
||||||
// ctx.Data["Title"] = "New Release"
|
ctx.Data["Title"] = "New Release"
|
||||||
// ctx.Data["IsRepoToolbarReleases"] = true
|
ctx.Data["IsRepoToolbarReleases"] = true
|
||||||
// ctx.Data["IsRepoReleaseNew"] = true
|
ctx.Data["IsRepoReleaseNew"] = true
|
||||||
|
|
||||||
// if ctx.HasError() {
|
if ctx.HasError() {
|
||||||
// ctx.HTML(200, RELEASE_NEW)
|
ctx.HTML(200, RELEASE_NEW)
|
||||||
// return
|
return
|
||||||
// }
|
}
|
||||||
|
|
||||||
// commitsCount, err := ctx.Repo.Commit.CommitsCount()
|
commitsCount, err := ctx.Repo.Commit.CommitsCount()
|
||||||
// if err != nil {
|
if err != nil {
|
||||||
// ctx.Handle(500, "release.ReleasesNewPost(CommitsCount)", err)
|
ctx.Handle(500, "release.ReleasesNewPost(CommitsCount)", err)
|
||||||
// return
|
return
|
||||||
// }
|
}
|
||||||
|
|
||||||
// if !ctx.Repo.GitRepo.IsBranchExist(form.Target) {
|
if !ctx.Repo.GitRepo.IsBranchExist(form.Target) {
|
||||||
// ctx.RenderWithErr("Target branch does not exist", "release/new", &form)
|
ctx.RenderWithErr("Target branch does not exist", "release/new", &form)
|
||||||
// return
|
return
|
||||||
// }
|
}
|
||||||
|
|
||||||
// rel := &models.Release{
|
rel := &models.Release{
|
||||||
// RepoId: ctx.Repo.Repository.Id,
|
RepoId: ctx.Repo.Repository.Id,
|
||||||
// PublisherId: ctx.User.Id,
|
PublisherId: ctx.User.Id,
|
||||||
// Title: form.Title,
|
Title: form.Title,
|
||||||
// TagName: form.TagName,
|
TagName: form.TagName,
|
||||||
// Target: form.Target,
|
Target: form.Target,
|
||||||
// Sha1: ctx.Repo.Commit.Id.String(),
|
Sha1: ctx.Repo.Commit.Id.String(),
|
||||||
// NumCommits: commitsCount,
|
NumCommits: commitsCount,
|
||||||
// Note: form.Content,
|
Note: form.Content,
|
||||||
// IsDraft: len(form.Draft) > 0,
|
IsDraft: len(form.Draft) > 0,
|
||||||
// IsPrerelease: form.Prerelease,
|
IsPrerelease: form.Prerelease,
|
||||||
// }
|
}
|
||||||
|
|
||||||
// if err = models.CreateRelease(ctx.Repo.GitRepo, rel); err != nil {
|
if err = models.CreateRelease(ctx.Repo.GitRepo, rel); err != nil {
|
||||||
// if err == models.ErrReleaseAlreadyExist {
|
if err == models.ErrReleaseAlreadyExist {
|
||||||
// ctx.RenderWithErr("Release with this tag name has already existed", "release/new", &form)
|
ctx.RenderWithErr("Release with this tag name has already existed", "release/new", &form)
|
||||||
// } else {
|
} else {
|
||||||
// ctx.Handle(500, "release.ReleasesNewPost(IsReleaseExist)", err)
|
ctx.Handle(500, "release.ReleasesNewPost(IsReleaseExist)", err)
|
||||||
// }
|
}
|
||||||
// return
|
return
|
||||||
// }
|
}
|
||||||
// log.Trace("%s Release created: %s/%s:%s", ctx.Req.RequestURI, ctx.User.LowerName, ctx.Repo.Repository.Name, form.TagName)
|
log.Trace("%s Release created: %s/%s:%s", ctx.Req.RequestURI, ctx.User.LowerName, ctx.Repo.Repository.Name, form.TagName)
|
||||||
|
|
||||||
// ctx.Redirect(ctx.Repo.RepoLink + "/releases")
|
ctx.Redirect(ctx.Repo.RepoLink + "/releases")
|
||||||
// }
|
}
|
||||||
|
|
||||||
// func EditRelease(ctx *middleware.Context, params martini.Params) {
|
func EditRelease(ctx *middleware.Context) {
|
||||||
// if !ctx.Repo.IsOwner {
|
if !ctx.Repo.IsOwner {
|
||||||
// ctx.Handle(403, "release.ReleasesEdit", nil)
|
ctx.Handle(403, "release.ReleasesEdit", nil)
|
||||||
// return
|
return
|
||||||
// }
|
}
|
||||||
|
|
||||||
// tagName := params["tagname"]
|
tagName := ctx.Params(":tagname")
|
||||||
// rel, err := models.GetRelease(ctx.Repo.Repository.Id, tagName)
|
rel, err := models.GetRelease(ctx.Repo.Repository.Id, tagName)
|
||||||
// if err != nil {
|
if err != nil {
|
||||||
// if err == models.ErrReleaseNotExist {
|
if err == models.ErrReleaseNotExist {
|
||||||
// ctx.Handle(404, "release.ReleasesEdit(GetRelease)", err)
|
ctx.Handle(404, "release.ReleasesEdit(GetRelease)", err)
|
||||||
// } else {
|
} else {
|
||||||
// ctx.Handle(500, "release.ReleasesEdit(GetRelease)", err)
|
ctx.Handle(500, "release.ReleasesEdit(GetRelease)", err)
|
||||||
// }
|
}
|
||||||
// return
|
return
|
||||||
// }
|
}
|
||||||
// ctx.Data["Release"] = rel
|
ctx.Data["Release"] = rel
|
||||||
|
|
||||||
// ctx.Data["Title"] = "Edit Release"
|
ctx.Data["Title"] = "Edit Release"
|
||||||
// ctx.Data["IsRepoToolbarReleases"] = true
|
ctx.Data["IsRepoToolbarReleases"] = true
|
||||||
// ctx.HTML(200, RELEASE_EDIT)
|
ctx.HTML(200, RELEASE_EDIT)
|
||||||
// }
|
}
|
||||||
|
|
||||||
// func EditReleasePost(ctx *middleware.Context, params martini.Params, form auth.EditReleaseForm) {
|
func EditReleasePost(ctx *middleware.Context, form auth.EditReleaseForm) {
|
||||||
// if !ctx.Repo.IsOwner {
|
if !ctx.Repo.IsOwner {
|
||||||
// ctx.Handle(403, "release.EditReleasePost", nil)
|
ctx.Handle(403, "release.EditReleasePost", nil)
|
||||||
// return
|
return
|
||||||
// }
|
}
|
||||||
|
|
||||||
// tagName := params["tagname"]
|
tagName := ctx.Params(":tagname")
|
||||||
// rel, err := models.GetRelease(ctx.Repo.Repository.Id, tagName)
|
rel, err := models.GetRelease(ctx.Repo.Repository.Id, tagName)
|
||||||
// if err != nil {
|
if err != nil {
|
||||||
// if err == models.ErrReleaseNotExist {
|
if err == models.ErrReleaseNotExist {
|
||||||
// ctx.Handle(404, "release.EditReleasePost(GetRelease)", err)
|
ctx.Handle(404, "release.EditReleasePost(GetRelease)", err)
|
||||||
// } else {
|
} else {
|
||||||
// ctx.Handle(500, "release.EditReleasePost(GetRelease)", err)
|
ctx.Handle(500, "release.EditReleasePost(GetRelease)", err)
|
||||||
// }
|
}
|
||||||
// return
|
return
|
||||||
// }
|
}
|
||||||
// ctx.Data["Release"] = rel
|
ctx.Data["Release"] = rel
|
||||||
|
|
||||||
// if ctx.HasError() {
|
if ctx.HasError() {
|
||||||
// ctx.HTML(200, RELEASE_EDIT)
|
ctx.HTML(200, RELEASE_EDIT)
|
||||||
// return
|
return
|
||||||
// }
|
}
|
||||||
|
|
||||||
// ctx.Data["Title"] = "Edit Release"
|
ctx.Data["Title"] = "Edit Release"
|
||||||
// ctx.Data["IsRepoToolbarReleases"] = true
|
ctx.Data["IsRepoToolbarReleases"] = true
|
||||||
|
|
||||||
// rel.Title = form.Title
|
rel.Title = form.Title
|
||||||
// rel.Note = form.Content
|
rel.Note = form.Content
|
||||||
// rel.IsDraft = len(form.Draft) > 0
|
rel.IsDraft = len(form.Draft) > 0
|
||||||
// rel.IsPrerelease = form.Prerelease
|
rel.IsPrerelease = form.Prerelease
|
||||||
// if err = models.UpdateRelease(ctx.Repo.GitRepo, rel); err != nil {
|
if err = models.UpdateRelease(ctx.Repo.GitRepo, rel); err != nil {
|
||||||
// ctx.Handle(500, "release.EditReleasePost(UpdateRelease)", err)
|
ctx.Handle(500, "release.EditReleasePost(UpdateRelease)", err)
|
||||||
// return
|
return
|
||||||
// }
|
}
|
||||||
// ctx.Redirect(ctx.Repo.RepoLink + "/releases")
|
ctx.Redirect(ctx.Repo.RepoLink + "/releases")
|
||||||
// }
|
}
|
||||||
|
|
|
@ -5,8 +5,10 @@
|
||||||
package repo
|
package repo
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"fmt"
|
||||||
"os"
|
"os"
|
||||||
"path"
|
"path"
|
||||||
|
"strings"
|
||||||
|
|
||||||
"github.com/Unknwon/com"
|
"github.com/Unknwon/com"
|
||||||
|
|
||||||
|
@ -34,22 +36,22 @@ func Create(ctx *middleware.Context) {
|
||||||
ctx.Data["Licenses"] = models.Licenses
|
ctx.Data["Licenses"] = models.Licenses
|
||||||
|
|
||||||
ctxUser := ctx.User
|
ctxUser := ctx.User
|
||||||
// orgId := com.StrTo(ctx.Query("org")).MustInt64()
|
orgId := com.StrTo(ctx.Query("org")).MustInt64()
|
||||||
// if orgId > 0 {
|
if orgId > 0 {
|
||||||
// org, err := models.GetUserById(orgId)
|
org, err := models.GetUserById(orgId)
|
||||||
// if err != nil && err != models.ErrUserNotExist {
|
if err != nil && err != models.ErrUserNotExist {
|
||||||
// ctx.Handle(500, "home.Dashboard(GetUserById)", err)
|
ctx.Handle(500, "home.Dashboard(GetUserById)", err)
|
||||||
// return
|
return
|
||||||
// }
|
}
|
||||||
// ctxUser = org
|
ctxUser = org
|
||||||
// }
|
}
|
||||||
ctx.Data["ContextUser"] = ctxUser
|
ctx.Data["ContextUser"] = ctxUser
|
||||||
|
|
||||||
// if err := ctx.User.GetOrganizations(); err != nil {
|
if err := ctx.User.GetOrganizations(); err != nil {
|
||||||
// ctx.Handle(500, "home.Dashboard(GetOrganizations)", err)
|
ctx.Handle(500, "home.Dashboard(GetOrganizations)", err)
|
||||||
// return
|
return
|
||||||
// }
|
}
|
||||||
// ctx.Data["AllUsers"] = append([]*models.User{ctx.User}, ctx.User.Orgs...)
|
ctx.Data["AllUsers"] = append([]*models.User{ctx.User}, ctx.User.Orgs...)
|
||||||
|
|
||||||
ctx.HTML(200, CREATE)
|
ctx.HTML(200, CREATE)
|
||||||
}
|
}
|
||||||
|
@ -62,22 +64,22 @@ func CreatePost(ctx *middleware.Context, form auth.CreateRepoForm) {
|
||||||
ctx.Data["Licenses"] = models.Licenses
|
ctx.Data["Licenses"] = models.Licenses
|
||||||
|
|
||||||
ctxUser := ctx.User
|
ctxUser := ctx.User
|
||||||
// orgId := com.StrTo(ctx.Query("org")).MustInt64()
|
orgId := com.StrTo(ctx.Query("org")).MustInt64()
|
||||||
// if orgId > 0 {
|
if orgId > 0 {
|
||||||
// org, err := models.GetUserById(orgId)
|
org, err := models.GetUserById(orgId)
|
||||||
// if err != nil && err != models.ErrUserNotExist {
|
if err != nil && err != models.ErrUserNotExist {
|
||||||
// ctx.Handle(500, "home.Dashboard(GetUserById)", err)
|
ctx.Handle(500, "home.Dashboard(GetUserById)", err)
|
||||||
// return
|
return
|
||||||
// }
|
}
|
||||||
// ctxUser = org
|
ctxUser = org
|
||||||
// }
|
}
|
||||||
ctx.Data["ContextUser"] = ctxUser
|
ctx.Data["ContextUser"] = ctxUser
|
||||||
|
|
||||||
// if err := ctx.User.GetOrganizations(); err != nil {
|
if err := ctx.User.GetOrganizations(); err != nil {
|
||||||
// ctx.Handle(500, "home.CreatePost(GetOrganizations)", err)
|
ctx.Handle(500, "home.CreatePost(GetOrganizations)", err)
|
||||||
// return
|
return
|
||||||
// }
|
}
|
||||||
// ctx.Data["Orgs"] = ctx.User.Orgs
|
ctx.Data["Orgs"] = ctx.User.Orgs
|
||||||
|
|
||||||
if ctx.HasError() {
|
if ctx.HasError() {
|
||||||
ctx.HTML(200, CREATE)
|
ctx.HTML(200, CREATE)
|
||||||
|
@ -127,78 +129,78 @@ func CreatePost(ctx *middleware.Context, form auth.CreateRepoForm) {
|
||||||
ctx.Handle(500, "CreateRepository", err)
|
ctx.Handle(500, "CreateRepository", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
// func Migrate(ctx *middleware.Context) {
|
func Migrate(ctx *middleware.Context) {
|
||||||
// ctx.Data["Title"] = "Migrate repository"
|
ctx.Data["Title"] = "Migrate repository"
|
||||||
// ctx.Data["PageIsNewRepo"] = true
|
ctx.Data["PageIsNewRepo"] = true
|
||||||
|
|
||||||
// if err := ctx.User.GetOrganizations(); err != nil {
|
if err := ctx.User.GetOrganizations(); err != nil {
|
||||||
// ctx.Handle(500, "home.Migrate(GetOrganizations)", err)
|
ctx.Handle(500, "home.Migrate(GetOrganizations)", err)
|
||||||
// return
|
return
|
||||||
// }
|
}
|
||||||
// ctx.Data["Orgs"] = ctx.User.Orgs
|
ctx.Data["Orgs"] = ctx.User.Orgs
|
||||||
|
|
||||||
// ctx.HTML(200, MIGRATE)
|
ctx.HTML(200, MIGRATE)
|
||||||
// }
|
}
|
||||||
|
|
||||||
// func MigratePost(ctx *middleware.Context, form auth.MigrateRepoForm) {
|
func MigratePost(ctx *middleware.Context, form auth.MigrateRepoForm) {
|
||||||
// ctx.Data["Title"] = "Migrate repository"
|
ctx.Data["Title"] = "Migrate repository"
|
||||||
// ctx.Data["PageIsNewRepo"] = true
|
ctx.Data["PageIsNewRepo"] = true
|
||||||
|
|
||||||
// if err := ctx.User.GetOrganizations(); err != nil {
|
if err := ctx.User.GetOrganizations(); err != nil {
|
||||||
// ctx.Handle(500, "home.MigratePost(GetOrganizations)", err)
|
ctx.Handle(500, "home.MigratePost(GetOrganizations)", err)
|
||||||
// return
|
return
|
||||||
// }
|
}
|
||||||
// ctx.Data["Orgs"] = ctx.User.Orgs
|
ctx.Data["Orgs"] = ctx.User.Orgs
|
||||||
|
|
||||||
// if ctx.HasError() {
|
if ctx.HasError() {
|
||||||
// ctx.HTML(200, MIGRATE)
|
ctx.HTML(200, MIGRATE)
|
||||||
// return
|
return
|
||||||
// }
|
}
|
||||||
|
|
||||||
// u := ctx.User
|
u := ctx.User
|
||||||
// // Not equal means current user is an organization.
|
// Not equal means current user is an organization.
|
||||||
// if u.Id != form.Uid {
|
if u.Id != form.Uid {
|
||||||
// var err error
|
var err error
|
||||||
// u, err = models.GetUserById(form.Uid)
|
u, err = models.GetUserById(form.Uid)
|
||||||
// if err != nil {
|
if err != nil {
|
||||||
// if err == models.ErrUserNotExist {
|
if err == models.ErrUserNotExist {
|
||||||
// ctx.Handle(404, "home.MigratePost(GetUserById)", err)
|
ctx.Handle(404, "home.MigratePost(GetUserById)", err)
|
||||||
// } else {
|
} else {
|
||||||
// ctx.Handle(500, "home.MigratePost(GetUserById)", err)
|
ctx.Handle(500, "home.MigratePost(GetUserById)", err)
|
||||||
// }
|
}
|
||||||
// return
|
return
|
||||||
// }
|
}
|
||||||
// }
|
}
|
||||||
|
|
||||||
// authStr := strings.Replace(fmt.Sprintf("://%s:%s",
|
authStr := strings.Replace(fmt.Sprintf("://%s:%s",
|
||||||
// form.AuthUserName, form.AuthPasswd), "@", "%40", -1)
|
form.AuthUserName, form.AuthPasswd), "@", "%40", -1)
|
||||||
// url := strings.Replace(form.Url, "://", authStr+"@", 1)
|
url := strings.Replace(form.Url, "://", authStr+"@", 1)
|
||||||
// repo, err := models.MigrateRepository(u, form.RepoName, form.Description, form.Private,
|
repo, err := models.MigrateRepository(u, form.RepoName, form.Description, form.Private,
|
||||||
// form.Mirror, url)
|
form.Mirror, url)
|
||||||
// if err == nil {
|
if err == nil {
|
||||||
// log.Trace("%s Repository migrated: %s/%s", ctx.Req.RequestURI, u.LowerName, form.RepoName)
|
log.Trace("%s Repository migrated: %s/%s", ctx.Req.RequestURI, u.LowerName, form.RepoName)
|
||||||
// ctx.Redirect("/" + u.Name + "/" + form.RepoName)
|
ctx.Redirect("/" + u.Name + "/" + form.RepoName)
|
||||||
// return
|
return
|
||||||
// } else if err == models.ErrRepoAlreadyExist {
|
} else if err == models.ErrRepoAlreadyExist {
|
||||||
// ctx.RenderWithErr("Repository name has already been used", MIGRATE, &form)
|
ctx.RenderWithErr("Repository name has already been used", MIGRATE, &form)
|
||||||
// return
|
return
|
||||||
// } else if err == models.ErrRepoNameIllegal {
|
} else if err == models.ErrRepoNameIllegal {
|
||||||
// ctx.RenderWithErr(models.ErrRepoNameIllegal.Error(), MIGRATE, &form)
|
ctx.RenderWithErr(models.ErrRepoNameIllegal.Error(), MIGRATE, &form)
|
||||||
// return
|
return
|
||||||
// }
|
}
|
||||||
|
|
||||||
// if repo != nil {
|
if repo != nil {
|
||||||
// if errDelete := models.DeleteRepository(u.Id, repo.Id, u.Name); errDelete != nil {
|
if errDelete := models.DeleteRepository(u.Id, repo.Id, u.Name); errDelete != nil {
|
||||||
// log.Error("repo.MigratePost(DeleteRepository): %v", errDelete)
|
log.Error(4, "DeleteRepository: %v", errDelete)
|
||||||
// }
|
}
|
||||||
// }
|
}
|
||||||
|
|
||||||
// if strings.Contains(err.Error(), "Authentication failed") {
|
if strings.Contains(err.Error(), "Authentication failed") {
|
||||||
// ctx.RenderWithErr(err.Error(), MIGRATE, &form)
|
ctx.RenderWithErr(err.Error(), MIGRATE, &form)
|
||||||
// return
|
return
|
||||||
// }
|
}
|
||||||
// ctx.Handle(500, "repo.Migrate(MigrateRepository)", err)
|
ctx.Handle(500, "MigrateRepository", err)
|
||||||
// }
|
}
|
||||||
|
|
||||||
// func Action(ctx *middleware.Context, params martini.Params) {
|
// func Action(ctx *middleware.Context, params martini.Params) {
|
||||||
// var err error
|
// var err error
|
||||||
|
|
|
@ -4,362 +4,362 @@
|
||||||
|
|
||||||
package repo
|
package repo
|
||||||
|
|
||||||
// import (
|
import (
|
||||||
// "fmt"
|
"fmt"
|
||||||
// "strings"
|
"strings"
|
||||||
// "time"
|
"time"
|
||||||
|
|
||||||
// "github.com/go-martini/martini"
|
"github.com/Unknwon/com"
|
||||||
|
|
||||||
// "github.com/gogits/gogs-ng/models"
|
"github.com/gogits/gogs/models"
|
||||||
// "github.com/gogits/gogs/modules/auth"
|
"github.com/gogits/gogs/modules/auth"
|
||||||
// "github.com/gogits/gogs/modules/base"
|
"github.com/gogits/gogs/modules/base"
|
||||||
// "github.com/gogits/gogs/modules/log"
|
"github.com/gogits/gogs/modules/log"
|
||||||
// "github.com/gogits/gogs/modules/mailer"
|
"github.com/gogits/gogs/modules/mailer"
|
||||||
// "github.com/gogits/gogs/modules/middleware"
|
"github.com/gogits/gogs/modules/middleware"
|
||||||
// "github.com/gogits/gogs/modules/setting"
|
"github.com/gogits/gogs/modules/setting"
|
||||||
// )
|
)
|
||||||
|
|
||||||
// const (
|
const (
|
||||||
// SETTING base.TplName = "repo/setting"
|
SETTING base.TplName = "repo/setting"
|
||||||
// COLLABORATION base.TplName = "repo/collaboration"
|
COLLABORATION base.TplName = "repo/collaboration"
|
||||||
|
|
||||||
// HOOKS base.TplName = "repo/hooks"
|
HOOKS base.TplName = "repo/hooks"
|
||||||
// HOOK_ADD base.TplName = "repo/hook_add"
|
HOOK_ADD base.TplName = "repo/hook_add"
|
||||||
// HOOK_EDIT base.TplName = "repo/hook_edit"
|
HOOK_EDIT base.TplName = "repo/hook_edit"
|
||||||
// )
|
)
|
||||||
|
|
||||||
// func Setting(ctx *middleware.Context) {
|
func Setting(ctx *middleware.Context) {
|
||||||
// ctx.Data["IsRepoToolbarSetting"] = true
|
ctx.Data["IsRepoToolbarSetting"] = true
|
||||||
// ctx.Data["Title"] = strings.TrimPrefix(ctx.Repo.RepoLink, "/") + " - settings"
|
ctx.Data["Title"] = strings.TrimPrefix(ctx.Repo.RepoLink, "/") + " - settings"
|
||||||
// ctx.HTML(200, SETTING)
|
ctx.HTML(200, SETTING)
|
||||||
// }
|
}
|
||||||
|
|
||||||
// func SettingPost(ctx *middleware.Context, form auth.RepoSettingForm) {
|
func SettingPost(ctx *middleware.Context, form auth.RepoSettingForm) {
|
||||||
// ctx.Data["IsRepoToolbarSetting"] = true
|
ctx.Data["IsRepoToolbarSetting"] = true
|
||||||
|
|
||||||
// switch ctx.Query("action") {
|
switch ctx.Query("action") {
|
||||||
// case "update":
|
case "update":
|
||||||
// if ctx.HasError() {
|
if ctx.HasError() {
|
||||||
// ctx.HTML(200, SETTING)
|
ctx.HTML(200, SETTING)
|
||||||
// return
|
return
|
||||||
// }
|
}
|
||||||
|
|
||||||
// newRepoName := form.RepoName
|
newRepoName := form.RepoName
|
||||||
// // Check if repository name has been changed.
|
// Check if repository name has been changed.
|
||||||
// if ctx.Repo.Repository.Name != newRepoName {
|
if ctx.Repo.Repository.Name != newRepoName {
|
||||||
// isExist, err := models.IsRepositoryExist(ctx.Repo.Owner, newRepoName)
|
isExist, err := models.IsRepositoryExist(ctx.Repo.Owner, newRepoName)
|
||||||
// if err != nil {
|
if err != nil {
|
||||||
// ctx.Handle(500, "setting.SettingPost(update: check existence)", err)
|
ctx.Handle(500, "setting.SettingPost(update: check existence)", err)
|
||||||
// return
|
return
|
||||||
// } else if isExist {
|
} else if isExist {
|
||||||
// ctx.RenderWithErr("Repository name has been taken in your repositories.", SETTING, nil)
|
ctx.RenderWithErr("Repository name has been taken in your repositories.", SETTING, nil)
|
||||||
// return
|
return
|
||||||
// } else if err = models.ChangeRepositoryName(ctx.Repo.Owner.Name, ctx.Repo.Repository.Name, newRepoName); err != nil {
|
} else if err = models.ChangeRepositoryName(ctx.Repo.Owner.Name, ctx.Repo.Repository.Name, newRepoName); err != nil {
|
||||||
// ctx.Handle(500, "setting.SettingPost(change repository name)", err)
|
ctx.Handle(500, "setting.SettingPost(change repository name)", err)
|
||||||
// return
|
return
|
||||||
// }
|
}
|
||||||
// log.Trace("%s Repository name changed: %s/%s -> %s", ctx.Req.RequestURI, ctx.User.Name, ctx.Repo.Repository.Name, newRepoName)
|
log.Trace("%s Repository name changed: %s/%s -> %s", ctx.Req.RequestURI, ctx.User.Name, ctx.Repo.Repository.Name, newRepoName)
|
||||||
|
|
||||||
// ctx.Repo.Repository.Name = newRepoName
|
ctx.Repo.Repository.Name = newRepoName
|
||||||
// }
|
}
|
||||||
|
|
||||||
// br := form.Branch
|
br := form.Branch
|
||||||
|
|
||||||
// if ctx.Repo.GitRepo.IsBranchExist(br) {
|
if ctx.Repo.GitRepo.IsBranchExist(br) {
|
||||||
// ctx.Repo.Repository.DefaultBranch = br
|
ctx.Repo.Repository.DefaultBranch = br
|
||||||
// }
|
}
|
||||||
// ctx.Repo.Repository.Description = form.Description
|
ctx.Repo.Repository.Description = form.Description
|
||||||
// ctx.Repo.Repository.Website = form.Website
|
ctx.Repo.Repository.Website = form.Website
|
||||||
// ctx.Repo.Repository.IsPrivate = form.Private
|
ctx.Repo.Repository.IsPrivate = form.Private
|
||||||
// ctx.Repo.Repository.IsGoget = form.GoGet
|
ctx.Repo.Repository.IsGoget = form.GoGet
|
||||||
// if err := models.UpdateRepository(ctx.Repo.Repository); err != nil {
|
if err := models.UpdateRepository(ctx.Repo.Repository); err != nil {
|
||||||
// ctx.Handle(404, "setting.SettingPost(update)", err)
|
ctx.Handle(404, "UpdateRepository", err)
|
||||||
// return
|
return
|
||||||
// }
|
}
|
||||||
// log.Trace("%s Repository updated: %s/%s", ctx.Req.RequestURI, ctx.Repo.Owner.Name, ctx.Repo.Repository.Name)
|
log.Trace("%s Repository updated: %s/%s", ctx.Req.RequestURI, ctx.Repo.Owner.Name, ctx.Repo.Repository.Name)
|
||||||
|
|
||||||
// if ctx.Repo.Repository.IsMirror {
|
if ctx.Repo.Repository.IsMirror {
|
||||||
// if form.Interval > 0 {
|
if form.Interval > 0 {
|
||||||
// ctx.Repo.Mirror.Interval = form.Interval
|
ctx.Repo.Mirror.Interval = form.Interval
|
||||||
// ctx.Repo.Mirror.NextUpdate = time.Now().Add(time.Duration(form.Interval) * time.Hour)
|
ctx.Repo.Mirror.NextUpdate = time.Now().Add(time.Duration(form.Interval) * time.Hour)
|
||||||
// if err := models.UpdateMirror(ctx.Repo.Mirror); err != nil {
|
if err := models.UpdateMirror(ctx.Repo.Mirror); err != nil {
|
||||||
// log.Error("setting.SettingPost(UpdateMirror): %v", err)
|
log.Error(4, "UpdateMirror: %v", err)
|
||||||
// }
|
}
|
||||||
// }
|
}
|
||||||
// }
|
}
|
||||||
|
|
||||||
// ctx.Flash.Success("Repository options has been successfully updated.")
|
ctx.Flash.Success("Repository options has been successfully updated.")
|
||||||
// ctx.Redirect(fmt.Sprintf("/%s/%s/settings", ctx.Repo.Owner.Name, ctx.Repo.Repository.Name))
|
ctx.Redirect(fmt.Sprintf("/%s/%s/settings", ctx.Repo.Owner.Name, ctx.Repo.Repository.Name))
|
||||||
// case "transfer":
|
case "transfer":
|
||||||
// if len(ctx.Repo.Repository.Name) == 0 || ctx.Repo.Repository.Name != ctx.Query("repository") {
|
if len(ctx.Repo.Repository.Name) == 0 || ctx.Repo.Repository.Name != ctx.Query("repository") {
|
||||||
// ctx.RenderWithErr("Please make sure you entered repository name is correct.", SETTING, nil)
|
ctx.RenderWithErr("Please make sure you entered repository name is correct.", SETTING, nil)
|
||||||
// return
|
return
|
||||||
// } else if ctx.Repo.Repository.IsMirror {
|
} else if ctx.Repo.Repository.IsMirror {
|
||||||
// ctx.Error(404)
|
ctx.Error(404)
|
||||||
// return
|
return
|
||||||
// }
|
}
|
||||||
|
|
||||||
// newOwner := ctx.Query("owner")
|
newOwner := ctx.Query("owner")
|
||||||
// // Check if new owner exists.
|
// Check if new owner exists.
|
||||||
// isExist, err := models.IsUserExist(newOwner)
|
isExist, err := models.IsUserExist(newOwner)
|
||||||
// if err != nil {
|
if err != nil {
|
||||||
// ctx.Handle(500, "setting.SettingPost(transfer: check existence)", err)
|
ctx.Handle(500, "setting.SettingPost(transfer: check existence)", err)
|
||||||
// return
|
return
|
||||||
// } else if !isExist {
|
} else if !isExist {
|
||||||
// ctx.RenderWithErr("Please make sure you entered owner name is correct.", SETTING, nil)
|
ctx.RenderWithErr("Please make sure you entered owner name is correct.", SETTING, nil)
|
||||||
// return
|
return
|
||||||
// } else if err = models.TransferOwnership(ctx.Repo.Owner, newOwner, ctx.Repo.Repository); err != nil {
|
} else if err = models.TransferOwnership(ctx.Repo.Owner, newOwner, ctx.Repo.Repository); err != nil {
|
||||||
// ctx.Handle(500, "setting.SettingPost(transfer repository)", err)
|
ctx.Handle(500, "setting.SettingPost(transfer repository)", err)
|
||||||
// return
|
return
|
||||||
// }
|
}
|
||||||
// log.Trace("%s Repository transfered: %s/%s -> %s", ctx.Req.RequestURI, ctx.User.Name, ctx.Repo.Repository.Name, newOwner)
|
log.Trace("%s Repository transfered: %s/%s -> %s", ctx.Req.RequestURI, ctx.User.Name, ctx.Repo.Repository.Name, newOwner)
|
||||||
|
|
||||||
// ctx.Redirect("/")
|
ctx.Redirect("/")
|
||||||
// case "delete":
|
case "delete":
|
||||||
// if len(ctx.Repo.Repository.Name) == 0 || ctx.Repo.Repository.Name != ctx.Query("repository") {
|
if len(ctx.Repo.Repository.Name) == 0 || ctx.Repo.Repository.Name != ctx.Query("repository") {
|
||||||
// ctx.RenderWithErr("Please make sure you entered repository name is correct.", SETTING, nil)
|
ctx.RenderWithErr("Please make sure you entered repository name is correct.", SETTING, nil)
|
||||||
// return
|
return
|
||||||
// }
|
}
|
||||||
|
|
||||||
// if ctx.Repo.Owner.IsOrganization() &&
|
if ctx.Repo.Owner.IsOrganization() &&
|
||||||
// !ctx.Repo.Owner.IsOrgOwner(ctx.User.Id) {
|
!ctx.Repo.Owner.IsOrgOwner(ctx.User.Id) {
|
||||||
// ctx.Error(403)
|
ctx.Error(403)
|
||||||
// return
|
return
|
||||||
// }
|
}
|
||||||
|
|
||||||
// if err := models.DeleteRepository(ctx.Repo.Owner.Id, ctx.Repo.Repository.Id, ctx.Repo.Owner.Name); err != nil {
|
if err := models.DeleteRepository(ctx.Repo.Owner.Id, ctx.Repo.Repository.Id, ctx.Repo.Owner.Name); err != nil {
|
||||||
// ctx.Handle(500, "setting.Delete(DeleteRepository)", err)
|
ctx.Handle(500, "setting.Delete(DeleteRepository)", err)
|
||||||
// return
|
return
|
||||||
// }
|
}
|
||||||
// log.Trace("%s Repository deleted: %s/%s", ctx.Req.RequestURI, ctx.Repo.Owner.LowerName, ctx.Repo.Repository.LowerName)
|
log.Trace("%s Repository deleted: %s/%s", ctx.Req.RequestURI, ctx.Repo.Owner.LowerName, ctx.Repo.Repository.LowerName)
|
||||||
|
|
||||||
// if ctx.Repo.Owner.IsOrganization() {
|
if ctx.Repo.Owner.IsOrganization() {
|
||||||
// ctx.Redirect("/org/" + ctx.Repo.Owner.Name + "/dashboard")
|
ctx.Redirect("/org/" + ctx.Repo.Owner.Name + "/dashboard")
|
||||||
// } else {
|
} else {
|
||||||
// ctx.Redirect("/")
|
ctx.Redirect("/")
|
||||||
// }
|
}
|
||||||
// }
|
}
|
||||||
// }
|
}
|
||||||
|
|
||||||
// func Collaboration(ctx *middleware.Context) {
|
func Collaboration(ctx *middleware.Context) {
|
||||||
// repoLink := strings.TrimPrefix(ctx.Repo.RepoLink, "/")
|
repoLink := strings.TrimPrefix(ctx.Repo.RepoLink, "/")
|
||||||
// ctx.Data["IsRepoToolbarCollaboration"] = true
|
ctx.Data["IsRepoToolbarCollaboration"] = true
|
||||||
// ctx.Data["Title"] = repoLink + " - collaboration"
|
ctx.Data["Title"] = repoLink + " - collaboration"
|
||||||
|
|
||||||
// // Delete collaborator.
|
// Delete collaborator.
|
||||||
// remove := strings.ToLower(ctx.Query("remove"))
|
remove := strings.ToLower(ctx.Query("remove"))
|
||||||
// if len(remove) > 0 && remove != ctx.Repo.Owner.LowerName {
|
if len(remove) > 0 && remove != ctx.Repo.Owner.LowerName {
|
||||||
// if err := models.DeleteAccess(&models.Access{UserName: remove, RepoName: repoLink}); err != nil {
|
if err := models.DeleteAccess(&models.Access{UserName: remove, RepoName: repoLink}); err != nil {
|
||||||
// ctx.Handle(500, "setting.Collaboration(DeleteAccess)", err)
|
ctx.Handle(500, "setting.Collaboration(DeleteAccess)", err)
|
||||||
// return
|
return
|
||||||
// }
|
}
|
||||||
// ctx.Flash.Success("Collaborator has been removed.")
|
ctx.Flash.Success("Collaborator has been removed.")
|
||||||
// ctx.Redirect(ctx.Repo.RepoLink + "/settings/collaboration")
|
ctx.Redirect(ctx.Repo.RepoLink + "/settings/collaboration")
|
||||||
// return
|
return
|
||||||
// }
|
}
|
||||||
|
|
||||||
// names, err := models.GetCollaboratorNames(repoLink)
|
names, err := models.GetCollaboratorNames(repoLink)
|
||||||
// if err != nil {
|
if err != nil {
|
||||||
// ctx.Handle(500, "setting.Collaboration(GetCollaborators)", err)
|
ctx.Handle(500, "setting.Collaboration(GetCollaborators)", err)
|
||||||
// return
|
return
|
||||||
// }
|
}
|
||||||
|
|
||||||
// us := make([]*models.User, len(names))
|
us := make([]*models.User, len(names))
|
||||||
// for i, name := range names {
|
for i, name := range names {
|
||||||
// us[i], err = models.GetUserByName(name)
|
us[i], err = models.GetUserByName(name)
|
||||||
// if err != nil {
|
if err != nil {
|
||||||
// ctx.Handle(500, "setting.Collaboration(GetUserByName)", err)
|
ctx.Handle(500, "setting.Collaboration(GetUserByName)", err)
|
||||||
// return
|
return
|
||||||
// }
|
}
|
||||||
// }
|
}
|
||||||
|
|
||||||
// ctx.Data["Collaborators"] = us
|
ctx.Data["Collaborators"] = us
|
||||||
// ctx.HTML(200, COLLABORATION)
|
ctx.HTML(200, COLLABORATION)
|
||||||
// }
|
}
|
||||||
|
|
||||||
// func CollaborationPost(ctx *middleware.Context) {
|
func CollaborationPost(ctx *middleware.Context) {
|
||||||
// repoLink := strings.TrimPrefix(ctx.Repo.RepoLink, "/")
|
repoLink := strings.TrimPrefix(ctx.Repo.RepoLink, "/")
|
||||||
// name := strings.ToLower(ctx.Query("collaborator"))
|
name := strings.ToLower(ctx.Query("collaborator"))
|
||||||
// if len(name) == 0 || ctx.Repo.Owner.LowerName == name {
|
if len(name) == 0 || ctx.Repo.Owner.LowerName == name {
|
||||||
// ctx.Redirect(ctx.Req.RequestURI)
|
ctx.Redirect(ctx.Req.RequestURI)
|
||||||
// return
|
return
|
||||||
// }
|
}
|
||||||
// has, err := models.HasAccess(name, repoLink, models.WRITABLE)
|
has, err := models.HasAccess(name, repoLink, models.WRITABLE)
|
||||||
// if err != nil {
|
if err != nil {
|
||||||
// ctx.Handle(500, "setting.CollaborationPost(HasAccess)", err)
|
ctx.Handle(500, "setting.CollaborationPost(HasAccess)", err)
|
||||||
// return
|
return
|
||||||
// } else if has {
|
} else if has {
|
||||||
// ctx.Redirect(ctx.Req.RequestURI)
|
ctx.Redirect(ctx.Req.RequestURI)
|
||||||
// return
|
return
|
||||||
// }
|
}
|
||||||
|
|
||||||
// u, err := models.GetUserByName(name)
|
u, err := models.GetUserByName(name)
|
||||||
// if err != nil {
|
if err != nil {
|
||||||
// if err == models.ErrUserNotExist {
|
if err == models.ErrUserNotExist {
|
||||||
// ctx.Flash.Error("Given user does not exist.")
|
ctx.Flash.Error("Given user does not exist.")
|
||||||
// ctx.Redirect(ctx.Req.RequestURI)
|
ctx.Redirect(ctx.Req.RequestURI)
|
||||||
// } else {
|
} else {
|
||||||
// ctx.Handle(500, "setting.CollaborationPost(GetUserByName)", err)
|
ctx.Handle(500, "setting.CollaborationPost(GetUserByName)", err)
|
||||||
// }
|
}
|
||||||
// return
|
return
|
||||||
// }
|
}
|
||||||
|
|
||||||
// if err = models.AddAccess(&models.Access{UserName: name, RepoName: repoLink,
|
if err = models.AddAccess(&models.Access{UserName: name, RepoName: repoLink,
|
||||||
// Mode: models.WRITABLE}); err != nil {
|
Mode: models.WRITABLE}); err != nil {
|
||||||
// ctx.Handle(500, "setting.CollaborationPost(AddAccess)", err)
|
ctx.Handle(500, "setting.CollaborationPost(AddAccess)", err)
|
||||||
// return
|
return
|
||||||
// }
|
}
|
||||||
|
|
||||||
// if setting.Service.EnableNotifyMail {
|
if setting.Service.EnableNotifyMail {
|
||||||
// if err = mailer.SendCollaboratorMail(ctx.Render, u, ctx.User, ctx.Repo.Repository); err != nil {
|
if err = mailer.SendCollaboratorMail(ctx.Render, u, ctx.User, ctx.Repo.Repository); err != nil {
|
||||||
// ctx.Handle(500, "setting.CollaborationPost(SendCollaboratorMail)", err)
|
ctx.Handle(500, "setting.CollaborationPost(SendCollaboratorMail)", err)
|
||||||
// return
|
return
|
||||||
// }
|
}
|
||||||
// }
|
}
|
||||||
|
|
||||||
// ctx.Flash.Success("New collaborator has been added.")
|
ctx.Flash.Success("New collaborator has been added.")
|
||||||
// ctx.Redirect(ctx.Req.RequestURI)
|
ctx.Redirect(ctx.Req.RequestURI)
|
||||||
// }
|
}
|
||||||
|
|
||||||
// func WebHooks(ctx *middleware.Context) {
|
func WebHooks(ctx *middleware.Context) {
|
||||||
// ctx.Data["IsRepoToolbarWebHooks"] = true
|
ctx.Data["IsRepoToolbarWebHooks"] = true
|
||||||
// ctx.Data["Title"] = strings.TrimPrefix(ctx.Repo.RepoLink, "/") + " - Webhooks"
|
ctx.Data["Title"] = strings.TrimPrefix(ctx.Repo.RepoLink, "/") + " - Webhooks"
|
||||||
|
|
||||||
// // Delete webhook.
|
// Delete webhook.
|
||||||
// remove, _ := base.StrTo(ctx.Query("remove")).Int64()
|
remove := com.StrTo(ctx.Query("remove")).MustInt64()
|
||||||
// if remove > 0 {
|
if remove > 0 {
|
||||||
// if err := models.DeleteWebhook(remove); err != nil {
|
if err := models.DeleteWebhook(remove); err != nil {
|
||||||
// ctx.Handle(500, "setting.WebHooks(DeleteWebhook)", err)
|
ctx.Handle(500, "setting.WebHooks(DeleteWebhook)", err)
|
||||||
// return
|
return
|
||||||
// }
|
}
|
||||||
// ctx.Flash.Success("Webhook has been removed.")
|
ctx.Flash.Success("Webhook has been removed.")
|
||||||
// ctx.Redirect(ctx.Repo.RepoLink + "/settings/hooks")
|
ctx.Redirect(ctx.Repo.RepoLink + "/settings/hooks")
|
||||||
// return
|
return
|
||||||
// }
|
}
|
||||||
|
|
||||||
// ws, err := models.GetWebhooksByRepoId(ctx.Repo.Repository.Id)
|
ws, err := models.GetWebhooksByRepoId(ctx.Repo.Repository.Id)
|
||||||
// if err != nil {
|
if err != nil {
|
||||||
// ctx.Handle(500, "setting.WebHooks(GetWebhooksByRepoId)", err)
|
ctx.Handle(500, "setting.WebHooks(GetWebhooksByRepoId)", err)
|
||||||
// return
|
return
|
||||||
// }
|
}
|
||||||
|
|
||||||
// ctx.Data["Webhooks"] = ws
|
ctx.Data["Webhooks"] = ws
|
||||||
// ctx.HTML(200, HOOKS)
|
ctx.HTML(200, HOOKS)
|
||||||
// }
|
}
|
||||||
|
|
||||||
// func WebHooksAdd(ctx *middleware.Context) {
|
func WebHooksAdd(ctx *middleware.Context) {
|
||||||
// ctx.Data["IsRepoToolbarWebHooks"] = true
|
ctx.Data["IsRepoToolbarWebHooks"] = true
|
||||||
// ctx.Data["Title"] = strings.TrimPrefix(ctx.Repo.RepoLink, "/") + " - Add Webhook"
|
ctx.Data["Title"] = strings.TrimPrefix(ctx.Repo.RepoLink, "/") + " - Add Webhook"
|
||||||
// ctx.HTML(200, HOOK_ADD)
|
ctx.HTML(200, HOOK_ADD)
|
||||||
// }
|
}
|
||||||
|
|
||||||
// func WebHooksAddPost(ctx *middleware.Context, form auth.NewWebhookForm) {
|
func WebHooksAddPost(ctx *middleware.Context, form auth.NewWebhookForm) {
|
||||||
// ctx.Data["IsRepoToolbarWebHooks"] = true
|
ctx.Data["IsRepoToolbarWebHooks"] = true
|
||||||
// ctx.Data["Title"] = strings.TrimPrefix(ctx.Repo.RepoLink, "/") + " - Add Webhook"
|
ctx.Data["Title"] = strings.TrimPrefix(ctx.Repo.RepoLink, "/") + " - Add Webhook"
|
||||||
|
|
||||||
// if ctx.HasError() {
|
if ctx.HasError() {
|
||||||
// ctx.HTML(200, HOOK_ADD)
|
ctx.HTML(200, HOOK_ADD)
|
||||||
// return
|
return
|
||||||
// }
|
}
|
||||||
|
|
||||||
// ct := models.JSON
|
ct := models.JSON
|
||||||
// if form.ContentType == "2" {
|
if form.ContentType == "2" {
|
||||||
// ct = models.FORM
|
ct = models.FORM
|
||||||
// }
|
}
|
||||||
|
|
||||||
// w := &models.Webhook{
|
w := &models.Webhook{
|
||||||
// RepoId: ctx.Repo.Repository.Id,
|
RepoId: ctx.Repo.Repository.Id,
|
||||||
// Url: form.Url,
|
Url: form.Url,
|
||||||
// ContentType: ct,
|
ContentType: ct,
|
||||||
// Secret: form.Secret,
|
Secret: form.Secret,
|
||||||
// HookEvent: &models.HookEvent{
|
HookEvent: &models.HookEvent{
|
||||||
// PushOnly: form.PushOnly,
|
PushOnly: form.PushOnly,
|
||||||
// },
|
},
|
||||||
// IsActive: form.Active,
|
IsActive: form.Active,
|
||||||
// }
|
}
|
||||||
// if err := w.UpdateEvent(); err != nil {
|
if err := w.UpdateEvent(); err != nil {
|
||||||
// ctx.Handle(500, "setting.WebHooksAddPost(UpdateEvent)", err)
|
ctx.Handle(500, "setting.WebHooksAddPost(UpdateEvent)", err)
|
||||||
// return
|
return
|
||||||
// } else if err := models.CreateWebhook(w); err != nil {
|
} else if err := models.CreateWebhook(w); err != nil {
|
||||||
// ctx.Handle(500, "setting.WebHooksAddPost(CreateWebhook)", err)
|
ctx.Handle(500, "setting.WebHooksAddPost(CreateWebhook)", err)
|
||||||
// return
|
return
|
||||||
// }
|
}
|
||||||
|
|
||||||
// ctx.Flash.Success("New webhook has been added.")
|
ctx.Flash.Success("New webhook has been added.")
|
||||||
// ctx.Redirect(ctx.Repo.RepoLink + "/settings/hooks")
|
ctx.Redirect(ctx.Repo.RepoLink + "/settings/hooks")
|
||||||
// }
|
}
|
||||||
|
|
||||||
// func WebHooksEdit(ctx *middleware.Context, params martini.Params) {
|
func WebHooksEdit(ctx *middleware.Context) {
|
||||||
// ctx.Data["IsRepoToolbarWebHooks"] = true
|
ctx.Data["IsRepoToolbarWebHooks"] = true
|
||||||
// ctx.Data["Title"] = strings.TrimPrefix(ctx.Repo.RepoLink, "/") + " - Webhook"
|
ctx.Data["Title"] = strings.TrimPrefix(ctx.Repo.RepoLink, "/") + " - Webhook"
|
||||||
|
|
||||||
// hookId, _ := base.StrTo(params["id"]).Int64()
|
hookId := com.StrTo(ctx.Params(":id")).MustInt64()
|
||||||
// if hookId == 0 {
|
if hookId == 0 {
|
||||||
// ctx.Handle(404, "setting.WebHooksEdit", nil)
|
ctx.Handle(404, "setting.WebHooksEdit", nil)
|
||||||
// return
|
return
|
||||||
// }
|
}
|
||||||
|
|
||||||
// w, err := models.GetWebhookById(hookId)
|
w, err := models.GetWebhookById(hookId)
|
||||||
// if err != nil {
|
if err != nil {
|
||||||
// if err == models.ErrWebhookNotExist {
|
if err == models.ErrWebhookNotExist {
|
||||||
// ctx.Handle(404, "setting.WebHooksEdit(GetWebhookById)", nil)
|
ctx.Handle(404, "setting.WebHooksEdit(GetWebhookById)", nil)
|
||||||
// } else {
|
} else {
|
||||||
// ctx.Handle(500, "setting.WebHooksEdit(GetWebhookById)", err)
|
ctx.Handle(500, "setting.WebHooksEdit(GetWebhookById)", err)
|
||||||
// }
|
}
|
||||||
// return
|
return
|
||||||
// }
|
}
|
||||||
|
|
||||||
// w.GetEvent()
|
w.GetEvent()
|
||||||
// ctx.Data["Webhook"] = w
|
ctx.Data["Webhook"] = w
|
||||||
// ctx.HTML(200, HOOK_EDIT)
|
ctx.HTML(200, HOOK_EDIT)
|
||||||
// }
|
}
|
||||||
|
|
||||||
// func WebHooksEditPost(ctx *middleware.Context, params martini.Params, form auth.NewWebhookForm) {
|
func WebHooksEditPost(ctx *middleware.Context, form auth.NewWebhookForm) {
|
||||||
// ctx.Data["IsRepoToolbarWebHooks"] = true
|
ctx.Data["IsRepoToolbarWebHooks"] = true
|
||||||
// ctx.Data["Title"] = strings.TrimPrefix(ctx.Repo.RepoLink, "/") + " - Webhook"
|
ctx.Data["Title"] = strings.TrimPrefix(ctx.Repo.RepoLink, "/") + " - Webhook"
|
||||||
|
|
||||||
// hookId, _ := base.StrTo(params["id"]).Int64()
|
hookId := com.StrTo(ctx.Params(":id")).MustInt64()
|
||||||
// if hookId == 0 {
|
if hookId == 0 {
|
||||||
// ctx.Handle(404, "setting.WebHooksEditPost", nil)
|
ctx.Handle(404, "setting.WebHooksEditPost", nil)
|
||||||
// return
|
return
|
||||||
// }
|
}
|
||||||
|
|
||||||
// w, err := models.GetWebhookById(hookId)
|
w, err := models.GetWebhookById(hookId)
|
||||||
// if err != nil {
|
if err != nil {
|
||||||
// if err == models.ErrWebhookNotExist {
|
if err == models.ErrWebhookNotExist {
|
||||||
// ctx.Handle(404, "setting.WebHooksEditPost(GetWebhookById)", nil)
|
ctx.Handle(404, "GetWebhookById", nil)
|
||||||
// } else {
|
} else {
|
||||||
// ctx.Handle(500, "setting.WebHooksEditPost(GetWebhookById)", err)
|
ctx.Handle(500, "GetWebhookById", err)
|
||||||
// }
|
}
|
||||||
// return
|
return
|
||||||
// }
|
}
|
||||||
|
|
||||||
// if ctx.HasError() {
|
if ctx.HasError() {
|
||||||
// ctx.HTML(200, HOOK_EDIT)
|
ctx.HTML(200, HOOK_EDIT)
|
||||||
// return
|
return
|
||||||
// }
|
}
|
||||||
|
|
||||||
// ct := models.JSON
|
ct := models.JSON
|
||||||
// if form.ContentType == "2" {
|
if form.ContentType == "2" {
|
||||||
// ct = models.FORM
|
ct = models.FORM
|
||||||
// }
|
}
|
||||||
|
|
||||||
// w.Url = form.Url
|
w.Url = form.Url
|
||||||
// w.ContentType = ct
|
w.ContentType = ct
|
||||||
// w.Secret = form.Secret
|
w.Secret = form.Secret
|
||||||
// w.HookEvent = &models.HookEvent{
|
w.HookEvent = &models.HookEvent{
|
||||||
// PushOnly: form.PushOnly,
|
PushOnly: form.PushOnly,
|
||||||
// }
|
}
|
||||||
// w.IsActive = form.Active
|
w.IsActive = form.Active
|
||||||
// if err := w.UpdateEvent(); err != nil {
|
if err := w.UpdateEvent(); err != nil {
|
||||||
// ctx.Handle(500, "setting.WebHooksEditPost(UpdateEvent)", err)
|
ctx.Handle(500, "UpdateEvent", err)
|
||||||
// return
|
return
|
||||||
// } else if err := models.UpdateWebhook(w); err != nil {
|
} else if err := models.UpdateWebhook(w); err != nil {
|
||||||
// ctx.Handle(500, "setting.WebHooksEditPost(WebHooksEditPost)", err)
|
ctx.Handle(500, "WebHooksEditPost", err)
|
||||||
// return
|
return
|
||||||
// }
|
}
|
||||||
|
|
||||||
// ctx.Flash.Success("Webhook has been updated.")
|
ctx.Flash.Success("Webhook has been updated.")
|
||||||
// ctx.Redirect(fmt.Sprintf("%s/settings/hooks/%d", ctx.Repo.RepoLink, hookId))
|
ctx.Redirect(fmt.Sprintf("%s/settings/hooks/%d", ctx.Repo.RepoLink, hookId))
|
||||||
// }
|
}
|
||||||
|
|
|
@ -28,11 +28,11 @@ func Dashboard(ctx *middleware.Context) {
|
||||||
ctx.Data["PageIsDashboard"] = true
|
ctx.Data["PageIsDashboard"] = true
|
||||||
ctx.Data["PageIsNews"] = true
|
ctx.Data["PageIsNews"] = true
|
||||||
|
|
||||||
// if err := ctx.User.GetOrganizations(); err != nil {
|
if err := ctx.User.GetOrganizations(); err != nil {
|
||||||
// ctx.Handle(500, "home.Dashboard(GetOrganizations)", err)
|
ctx.Handle(500, "home.Dashboard(GetOrganizations)", err)
|
||||||
// return
|
return
|
||||||
// }
|
}
|
||||||
// ctx.Data["Orgs"] = ctx.User.Orgs
|
ctx.Data["Orgs"] = ctx.User.Orgs
|
||||||
ctx.Data["ContextUser"] = ctx.User
|
ctx.Data["ContextUser"] = ctx.User
|
||||||
|
|
||||||
repos, err := models.GetRepositories(ctx.User.Id, true)
|
repos, err := models.GetRepositories(ctx.User.Id, true)
|
||||||
|
@ -40,13 +40,16 @@ func Dashboard(ctx *middleware.Context) {
|
||||||
ctx.Handle(500, "GetRepositories", err)
|
ctx.Handle(500, "GetRepositories", err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
for _, repo := range repos {
|
||||||
|
repo.Owner = ctx.User
|
||||||
|
}
|
||||||
ctx.Data["Repos"] = repos
|
ctx.Data["Repos"] = repos
|
||||||
|
|
||||||
// ctx.Data["CollaborativeRepos"], err = models.GetCollaborativeRepos(ctx.User.Name)
|
ctx.Data["CollaborativeRepos"], err = models.GetCollaborativeRepos(ctx.User.Name)
|
||||||
// if err != nil {
|
if err != nil {
|
||||||
// ctx.Handle(500, "home.Dashboard(GetCollaborativeRepos)", err)
|
ctx.Handle(500, "GetCollaborativeRepos", err)
|
||||||
// return
|
return
|
||||||
// }
|
}
|
||||||
|
|
||||||
actions, err := models.GetFeeds(ctx.User.Id, 0, true)
|
actions, err := models.GetFeeds(ctx.User.Id, 0, true)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
|
@ -19,6 +19,7 @@ const (
|
||||||
SETTINGS_PASSWORD base.TplName = "user/settings/password"
|
SETTINGS_PASSWORD base.TplName = "user/settings/password"
|
||||||
SETTINGS_SSH_KEYS base.TplName = "user/settings/sshkeys"
|
SETTINGS_SSH_KEYS base.TplName = "user/settings/sshkeys"
|
||||||
SETTINGS_SOCIAL base.TplName = "user/settings/social"
|
SETTINGS_SOCIAL base.TplName = "user/settings/social"
|
||||||
|
SETTINGS_ORGS base.TplName = "user/settings/orgs"
|
||||||
SETTINGS_DELETE base.TplName = "user/settings/delete"
|
SETTINGS_DELETE base.TplName = "user/settings/delete"
|
||||||
NOTIFICATION base.TplName = "user/notification"
|
NOTIFICATION base.TplName = "user/notification"
|
||||||
SECURITY base.TplName = "user/security"
|
SECURITY base.TplName = "user/security"
|
||||||
|
@ -232,6 +233,13 @@ func SettingsSocial(ctx *middleware.Context) {
|
||||||
ctx.HTML(200, SETTINGS_SOCIAL)
|
ctx.HTML(200, SETTINGS_SOCIAL)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func SettingsOrgs(ctx *middleware.Context) {
|
||||||
|
ctx.Data["Title"] = ctx.Tr("settings")
|
||||||
|
ctx.Data["PageIsUserSettings"] = true
|
||||||
|
ctx.Data["PageIsSettingsOrgs"] = true
|
||||||
|
ctx.HTML(200, SETTINGS_ORGS)
|
||||||
|
}
|
||||||
|
|
||||||
func SettingsDelete(ctx *middleware.Context) {
|
func SettingsDelete(ctx *middleware.Context) {
|
||||||
ctx.Data["Title"] = ctx.Tr("settings")
|
ctx.Data["Title"] = ctx.Tr("settings")
|
||||||
ctx.Data["PageIsUserSettings"] = true
|
ctx.Data["PageIsUserSettings"] = true
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
0.4.7.0725 Alpha
|
0.4.7.0726 Alpha
|
|
@ -176,11 +176,11 @@
|
||||||
<dt>Enable Set Cookie</dt>
|
<dt>Enable Set Cookie</dt>
|
||||||
<dd><i class="fa fa{{if .SessionConfig.EnableSetCookie}}-check{{end}}-square-o"></i></dd>
|
<dd><i class="fa fa{{if .SessionConfig.EnableSetCookie}}-check{{end}}-square-o"></i></dd>
|
||||||
<dt>GC Interval Time</dt>
|
<dt>GC Interval Time</dt>
|
||||||
<dd>{{.SessionConfig.GcIntervalTime}} seconds</dd>
|
<dd>{{.SessionConfig.Gclifetime}} seconds</dd>
|
||||||
<dt>Session Life Time</dt>
|
<dt>Session Life Time</dt>
|
||||||
<dd>{{.SessionConfig.SessionLifeTime}} seconds</dd>
|
<dd>{{.SessionConfig.Maxlifetime}} seconds</dd>
|
||||||
<dt>HTTPS Only</dt>
|
<dt>HTTPS Only</dt>
|
||||||
<dd><i class="fa fa{{if .SessionConfig.CookieSecure}}-check{{end}}-square-o"></i></dd>
|
<dd><i class="fa fa{{if .SessionConfig.Secure}}-check{{end}}-square-o"></i></dd>
|
||||||
<dt>Cookie Life Time</dt>
|
<dt>Cookie Life Time</dt>
|
||||||
<dd>{{.SessionConfig.CookieLifeTime}} seconds</dd>
|
<dd>{{.SessionConfig.CookieLifeTime}} seconds</dd>
|
||||||
<dt>Session ID Hash Function</dt>
|
<dt>Session ID Hash Function</dt>
|
||||||
|
|
|
@ -12,10 +12,10 @@
|
||||||
<!-- Stylesheet -->
|
<!-- Stylesheet -->
|
||||||
<link rel="stylesheet" href="/ng/css/ui.css">
|
<link rel="stylesheet" href="/ng/css/ui.css">
|
||||||
<link rel="stylesheet" href="/ng/css/gogs.css">
|
<link rel="stylesheet" href="/ng/css/gogs.css">
|
||||||
<link rel="stylesheet" href="/ng/css/font-awesome.min.css">
|
<link rel="stylesheet" href="/css/font-awesome.min.css">
|
||||||
<link rel="stylesheet" href="/ng/fonts/octicons.css">
|
<link rel="stylesheet" href="/ng/fonts/octicons.css">
|
||||||
<!-- <link rel="stylesheet" href="http://cdn.bootcss.com/highlight.js/8.1/styles/github.min.css"> -->
|
<!-- <link rel="stylesheet" href="http://cdn.bootcss.com/highlight.js/8.1/styles/github.min.css"> -->
|
||||||
<link rel="stylesheet" href="/ng/css/github.min.css">
|
<link rel="stylesheet" href="/css/github.min.css">
|
||||||
|
|
||||||
<!-- JavaScript -->
|
<!-- JavaScript -->
|
||||||
<script src="/ng/js/lib/jquery-1.11.1.min.js"></script>
|
<script src="/ng/js/lib/jquery-1.11.1.min.js"></script>
|
||||||
|
|
|
@ -34,7 +34,7 @@
|
||||||
<td class="author"><img class="avatar" src="{{AvatarLink .Author.Email}}" alt=""/><a href="/user/email2user?email={{.Author.Email}}">{{.Author.Name}}</a></td>
|
<td class="author"><img class="avatar" src="{{AvatarLink .Author.Email}}" alt=""/><a href="/user/email2user?email={{.Author.Email}}">{{.Author.Name}}</a></td>
|
||||||
<td class="sha"><a rel="nofollow" class="label label-success" href="/{{$username}}/{{$reponame}}/commit/{{.Id}} ">{{SubStr .Id.String 0 10}} </a></td>
|
<td class="sha"><a rel="nofollow" class="label label-success" href="/{{$username}}/{{$reponame}}/commit/{{.Id}} ">{{SubStr .Id.String 0 10}} </a></td>
|
||||||
<td class="message">{{.Summary}} </td>
|
<td class="message">{{.Summary}} </td>
|
||||||
<td class="date">{{TimeSince .Author.When}}</td>
|
<td class="date">{{TimeSince .Author.When $.Lang}}</td>
|
||||||
</tr>
|
</tr>
|
||||||
{{end}}
|
{{end}}
|
||||||
</tbody>
|
</tbody>
|
||||||
|
|
|
@ -20,7 +20,7 @@
|
||||||
<p class="author">
|
<p class="author">
|
||||||
<img class="avatar" src="{{AvatarLink .Commit.Author.Email}}" alt=""/>
|
<img class="avatar" src="{{AvatarLink .Commit.Author.Email}}" alt=""/>
|
||||||
<a class="name" href="/user/email2user?email={{.Commit.Author.Email}}"><strong>{{.Commit.Author.Name}}</strong></a>
|
<a class="name" href="/user/email2user?email={{.Commit.Author.Email}}"><strong>{{.Commit.Author.Name}}</strong></a>
|
||||||
<span class="time">{{TimeSince .Commit.Author.When}}</span>
|
<span class="time">{{TimeSince .Commit.Author.When $.Lang}}</span>
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -86,7 +86,7 @@
|
||||||
<p class="info">
|
<p class="info">
|
||||||
<span class="author"><img class="avatar" src="{{.Poster.AvatarLink}}" alt="" width="20"/>
|
<span class="author"><img class="avatar" src="{{.Poster.AvatarLink}}" alt="" width="20"/>
|
||||||
<a href="/user/{{.Poster.Name}}">{{.Poster.Name}}</a></span>
|
<a href="/user/{{.Poster.Name}}">{{.Poster.Name}}</a></span>
|
||||||
<span class="time">{{TimeSince .Created}}</span>
|
<span class="time">{{TimeSince .Created $.Lang}}</span>
|
||||||
<span class="comment"><i class="fa fa-comments"></i> {{.NumComments}}</span>
|
<span class="comment"><i class="fa fa-comments"></i> {{.NumComments}}</span>
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -18,7 +18,7 @@
|
||||||
<a class="btn btn-primary pull-right issue-edit-save hidden" href="#" data-ajax="{{.RepoLink}}/issues/{{.Issue.Index}}" data-ajax-name="issue-edit-save" data-ajax-method="post">Save</a>{{end}}
|
<a class="btn btn-primary pull-right issue-edit-save hidden" href="#" data-ajax="{{.RepoLink}}/issues/{{.Issue.Index}}" data-ajax-name="issue-edit-save" data-ajax-method="post">Save</a>{{end}}
|
||||||
<span class="status label label-{{if .Issue.IsClosed}}danger{{else}}success{{end}}">{{if .Issue.IsClosed}}Closed{{else}}Open{{end}}</span>
|
<span class="status label label-{{if .Issue.IsClosed}}danger{{else}}success{{end}}">{{if .Issue.IsClosed}}Closed{{else}}Open{{end}}</span>
|
||||||
<a href="/user/{{.Issue.Poster.Name}}" class="author"><strong>{{.Issue.Poster.Name}}</strong></a> opened this issue
|
<a href="/user/{{.Issue.Poster.Name}}" class="author"><strong>{{.Issue.Poster.Name}}</strong></a> opened this issue
|
||||||
<span class="time">{{TimeSince .Issue.Created}}</span> · {{.Issue.NumComments}} comments
|
<span class="time">{{TimeSince .Issue.Created $.Lang}}</span> · {{.Issue.NumComments}} comments
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
<div class="issue-main">
|
<div class="issue-main">
|
||||||
|
@ -66,7 +66,7 @@
|
||||||
<a class="user pull-left" href="/user/{{.Poster.Name}}"><img class="avatar" src="{{.Poster.AvatarLink}}" alt=""/></a>
|
<a class="user pull-left" href="/user/{{.Poster.Name}}"><img class="avatar" src="{{.Poster.AvatarLink}}" alt=""/></a>
|
||||||
<div class="issue-content panel panel-default">
|
<div class="issue-content panel panel-default">
|
||||||
<div class="panel-heading">
|
<div class="panel-heading">
|
||||||
<a href="/user/{{.Poster.Name}}" class="user">{{.Poster.Name}}</a> commented <span class="time">{{TimeSince .Created}}</span>
|
<a href="/user/{{.Poster.Name}}" class="user">{{.Poster.Name}}</a> commented <span class="time">{{TimeSince .Created $.Lang}}</span>
|
||||||
<!-- <a class="issue-comment-del pull-right issue-action" href="#" title="Edit Comment"><i class="fa fa-times-circle"></i></a>
|
<!-- <a class="issue-comment-del pull-right issue-action" href="#" title="Edit Comment"><i class="fa fa-times-circle"></i></a>
|
||||||
<a class="issue-comment-edit pull-right issue-action" href="#" title="Remove Comment" data-url="{remove-link}"><i class="fa fa-edit"></i></a> -->
|
<a class="issue-comment-edit pull-right issue-action" href="#" title="Remove Comment" data-url="{remove-link}"><i class="fa fa-edit"></i></a> -->
|
||||||
<span class="role label label-default pull-right">Owner</span>
|
<span class="role label label-default pull-right">Owner</span>
|
||||||
|
@ -95,14 +95,14 @@
|
||||||
<div class="issue-child issue-opened">
|
<div class="issue-child issue-opened">
|
||||||
<a class="user pull-left" href="/user/{{.Poster.Name}}"><img class="avatar" src="{{.Poster.AvatarLink}}" alt="" /></a>
|
<a class="user pull-left" href="/user/{{.Poster.Name}}"><img class="avatar" src="{{.Poster.AvatarLink}}" alt="" /></a>
|
||||||
<div class="issue-content">
|
<div class="issue-content">
|
||||||
<a class="user pull-left" href="/user/{{.Poster.Name}}">{{.Poster.Name}}</a> <span class="label label-success">Reopened</span> this issue <span class="time">{{TimeSince .Created}}</span>
|
<a class="user pull-left" href="/user/{{.Poster.Name}}">{{.Poster.Name}}</a> <span class="label label-success">Reopened</span> this issue <span class="time">{{TimeSince .Created $.Lang}}</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{{else if eq .Type 2}}
|
{{else if eq .Type 2}}
|
||||||
<div class="issue-child issue-closed">
|
<div class="issue-child issue-closed">
|
||||||
<a class="user pull-left" href="/user/{{.Poster.Name}}"><img class="avatar" src="{{.Poster.AvatarLink}}" alt=""/></a>
|
<a class="user pull-left" href="/user/{{.Poster.Name}}"><img class="avatar" src="{{.Poster.AvatarLink}}" alt=""/></a>
|
||||||
<div class="issue-content">
|
<div class="issue-content">
|
||||||
<a class="user pull-left" href="/user/{{.Poster.Name}}">{{.Poster.Name}}</a> <span class="label label-danger">Closed</span> this issue <span class="time">{{TimeSince .Created}}</span>
|
<a class="user pull-left" href="/user/{{.Poster.Name}}">{{.Poster.Name}}</a> <span class="label label-danger">Closed</span> this issue <span class="time">{{TimeSince .Created $.Lang}}</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{{else if eq .Type 4}}
|
{{else if eq .Type 4}}
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{{template "base/head" .}}
|
{{template "ng/base/head" .}}
|
||||||
{{template "base/header" .}}
|
{{template "ng/base/header" .}}
|
||||||
<div class="container">
|
<div class="container">
|
||||||
401 Unauthorized: {{.ErrorMsg}}
|
401 Unauthorized: {{.ErrorMsg}}
|
||||||
</div>
|
</div>
|
||||||
{{template "base/footer" .}}
|
{{template "ng/base/footer" .}}
|
|
@ -6,5 +6,6 @@
|
||||||
<br>
|
<br>
|
||||||
<p>Application Version: {{AppVer}}</p>
|
<p>Application Version: {{AppVer}}</p>
|
||||||
<p>If you think this is an error, please open an issue on <a href="https://github.com/gogits/gogs/issues/new">GitHub</a>.</p>
|
<p>If you think this is an error, please open an issue on <a href="https://github.com/gogits/gogs/issues/new">GitHub</a>.</p>
|
||||||
|
<h3>We're currently working on 0.5 beta version, many pages may be missing at this time. Sorry for confusion!</h3>
|
||||||
</div>
|
</div>
|
||||||
{{template "ng/base/footer" .}}
|
{{template "ng/base/footer" .}}
|
||||||
|
|
|
@ -70,15 +70,7 @@
|
||||||
<div class="panel-body">
|
<div class="panel-body">
|
||||||
<ul class="list-no-style">
|
<ul class="list-no-style">
|
||||||
{{range .Repos}}
|
{{range .Repos}}
|
||||||
<li {{if .IsPrivate}}class="private"{{end}}>
|
{{template "user/dashboard/repo_list" .}}
|
||||||
<a href="{{$.ContextUser.Name}}/{{.Name}}">
|
|
||||||
<i class="octicon octicon-{{if .IsPrivate}}lock{{else if .IsFork}}repo-forked{{else if .IsMirror}}repo-clone{{else}}repo{{end}}"></i>
|
|
||||||
<span class="repo-name">
|
|
||||||
<!-- <span class="repo-name-prefix">gogits / </span> -->
|
|
||||||
<strong class="repo">{{.Name}}</strong>
|
|
||||||
</span>
|
|
||||||
</a>
|
|
||||||
</li>
|
|
||||||
{{end}}
|
{{end}}
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
|
@ -87,42 +79,9 @@
|
||||||
</div>
|
</div>
|
||||||
<div class="panel-body">
|
<div class="panel-body">
|
||||||
<ul class="list-no-style">
|
<ul class="list-no-style">
|
||||||
<li>
|
{{range .CollaborativeRepos}}
|
||||||
<a href="#">
|
{{template "user/dashboard/repo_list" .}}
|
||||||
<i class="octicon octicon-repo"></i>
|
{{end}}
|
||||||
<span class="repo-name">
|
|
||||||
<span class="repo-name-prefix">gogits / </span>
|
|
||||||
<strong class="repo">gogs</strong>
|
|
||||||
</span>
|
|
||||||
<span class="right repo-star">
|
|
||||||
<i class="octicon octicon-star"></i>2048
|
|
||||||
</span>
|
|
||||||
</a>
|
|
||||||
</li>
|
|
||||||
<li>
|
|
||||||
<a href="#">
|
|
||||||
<i class="octicon octicon-repo"></i>
|
|
||||||
<span class="repo-name">
|
|
||||||
<span class="repo-name-prefix">astaxie / </span>
|
|
||||||
<strong class="repo">beego</strong>
|
|
||||||
</span>
|
|
||||||
<span class="right repo-star">
|
|
||||||
<i class="octicon octicon-star"></i>2301
|
|
||||||
</span>
|
|
||||||
</a>
|
|
||||||
</li>
|
|
||||||
<li>
|
|
||||||
<a href="#">
|
|
||||||
<i class="octicon octicon-repo"></i>
|
|
||||||
<span class="repo-name">
|
|
||||||
<span class="repo-name-prefix">gogits / </span>
|
|
||||||
<strong class="repo">scaffold</strong>
|
|
||||||
</span>
|
|
||||||
<span class="right repo-star">
|
|
||||||
<i class="octicon octicon-star"></i>0
|
|
||||||
</span>
|
|
||||||
</a>
|
|
||||||
</li>
|
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
12
templates/user/dashboard/repo_list.tmpl
Normal file
12
templates/user/dashboard/repo_list.tmpl
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
<li {{if .IsPrivate}}class="private"{{end}}>
|
||||||
|
<a href="{{.Owner.Name}}/{{.Name}}">
|
||||||
|
<i class="octicon octicon-{{if .IsPrivate}}lock{{else if .IsFork}}repo-forked{{else if .IsMirror}}repo-clone{{else}}repo{{end}}"></i>
|
||||||
|
<span class="repo-name">
|
||||||
|
<!-- <span class="repo-name-prefix">gogits / </span> -->
|
||||||
|
<strong class="repo">{{.Name}}</strong>
|
||||||
|
</span>
|
||||||
|
<span class="right repo-star">
|
||||||
|
<i class="octicon octicon-star"></i>{{.NumStars}}
|
||||||
|
</span>
|
||||||
|
</a>
|
||||||
|
</li>
|
|
@ -41,7 +41,7 @@
|
||||||
<p class="info">
|
<p class="info">
|
||||||
<span class="author"><img class="avatar" src="{{.Poster.AvatarLink}}" alt="" width="20"/>
|
<span class="author"><img class="avatar" src="{{.Poster.AvatarLink}}" alt="" width="20"/>
|
||||||
<a href="/user/{{.Poster.Name}}">{{.Poster.Name}}</a></span>
|
<a href="/user/{{.Poster.Name}}">{{.Poster.Name}}</a></span>
|
||||||
<span class="time">{{TimeSince .Created}}</span>
|
<span class="time">{{TimeSince .Created $.Lang}}</span>
|
||||||
<span class="comment"><i class="fa fa-comments"></i> {{.NumComments}}</span>
|
<span class="comment"><i class="fa fa-comments"></i> {{.NumComments}}</span>
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -50,8 +50,8 @@
|
||||||
<ul class="list-unstyled activity-list">
|
<ul class="list-unstyled activity-list">
|
||||||
{{range .Feeds}}
|
{{range .Feeds}}
|
||||||
<li>
|
<li>
|
||||||
<i class="icon fa fa-{{ActionIcon .OpType}}"></i>
|
<i class="icon fa fa-{{ActionIcon .GetOpType}}"></i>
|
||||||
<div class="info"><span class="meta">{{TimeSince .Created}}</span><br>{{ActionDesc . | str2html}}</div>
|
<div class="info"><span class="meta">{{TimeSince .Created $.Lang}}</span><br>{{ActionDesc . | str2html}}</div>
|
||||||
<span class="clearfix"></span>
|
<span class="clearfix"></span>
|
||||||
</li>
|
</li>
|
||||||
{{else}}
|
{{else}}
|
||||||
|
@ -69,7 +69,7 @@
|
||||||
<a href="/{{$.Owner.Name}}/{{.Name}}">{{.Name}}{{if .IsPrivate}} <span class="label label-default">Private</span>{{end}}</a>
|
<a href="/{{$.Owner.Name}}/{{.Name}}">{{.Name}}{{if .IsPrivate}} <span class="label label-default">Private</span>{{end}}</a>
|
||||||
</h4>
|
</h4>
|
||||||
<p class="desc">{{.Description}}</p>
|
<p class="desc">{{.Description}}</p>
|
||||||
<div class="info">Last updated {{.Updated|TimeSince}}</div>
|
<div class="info">Last updated {{TimeSince .Updated $.Lang}}</div>
|
||||||
</li>
|
</li>
|
||||||
{{end}}
|
{{end}}
|
||||||
</ul>
|
</ul>
|
||||||
|
|
|
@ -6,6 +6,7 @@
|
||||||
<li {{if .PageIsSettingsPassword}}class="current"{{end}}><a href="/user/settings/password">{{.i18n.Tr "settings.password"}}</a></li>
|
<li {{if .PageIsSettingsPassword}}class="current"{{end}}><a href="/user/settings/password">{{.i18n.Tr "settings.password"}}</a></li>
|
||||||
<li {{if .PageIsSettingsSSHKeys}}class="current"{{end}}><a href="/user/settings/ssh">{{.i18n.Tr "settings.ssh_keys"}}</a></li>
|
<li {{if .PageIsSettingsSSHKeys}}class="current"{{end}}><a href="/user/settings/ssh">{{.i18n.Tr "settings.ssh_keys"}}</a></li>
|
||||||
<li {{if .PageIsSettingsSocial}}class="current"{{end}}><a href="/user/settings/social">{{.i18n.Tr "settings.social"}}</a></li>
|
<li {{if .PageIsSettingsSocial}}class="current"{{end}}><a href="/user/settings/social">{{.i18n.Tr "settings.social"}}</a></li>
|
||||||
|
<li {{if .PageIsSettingsOrgs}}class="current"{{end}}><a href="/user/settings/orgs">{{.i18n.Tr "settings.orgs"}}</a></li>
|
||||||
<li {{if .PageIsSettingsDelete}}class="current"{{end}}><a href="/user/settings/delete">{{.i18n.Tr "settings.delete"}}</a></li>
|
<li {{if .PageIsSettingsDelete}}class="current"{{end}}><a href="/user/settings/delete">{{.i18n.Tr "settings.delete"}}</a></li>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
|
|
18
templates/user/settings/orgs.tmpl
Normal file
18
templates/user/settings/orgs.tmpl
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
{{template "ng/base/head" .}}
|
||||||
|
{{template "ng/base/header" .}}
|
||||||
|
<div id="setting-wrapper" class="main-wrapper">
|
||||||
|
<div id="user-profile-setting" class="container clear">
|
||||||
|
{{template "user/settings/nav" .}}
|
||||||
|
<div class="grid-4-5 left">
|
||||||
|
<div class="setting-content">
|
||||||
|
{{template "ng/base/alert" .}}
|
||||||
|
<div id="setting-content">
|
||||||
|
<div id="user-profile-setting-content" class="panel panel-radius">
|
||||||
|
<p class="panel-header"><strong>{{.i18n.Tr "settings.manage_orgs"}}</strong></p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{{template "ng/base/footer" .}}
|
Loading…
Reference in a new issue