diff --git a/models/repo_activity_custom.go b/models/repo_activity_custom.go index 698436e2a..7cfed2359 100644 --- a/models/repo_activity_custom.go +++ b/models/repo_activity_custom.go @@ -11,7 +11,8 @@ import ( type ContributorWithUserId struct { git.Contributor - UserId int64 + UserId int64 + IsAdmin bool } func GetRepoKPIStats(repo *Repository) (*git.RepoKPIStats, error) { @@ -144,6 +145,7 @@ func GetTop10Contributor(repoPath string) ([]ContributorWithUserId, error) { contributorDistinctDict[user.Email] = ContributorWithUserId{ contributor, user.ID, + user.IsAdmin, } } else { @@ -156,6 +158,7 @@ func GetTop10Contributor(repoPath string) ([]ContributorWithUserId, error) { contributorDistinctDict[contributor.Email] = ContributorWithUserId{ contributor, -1, + false, } } else { value.CommitCnt += contributor.CommitCnt diff --git a/modules/storage/obs.go b/modules/storage/obs.go index bd73281d0..8e72c03c4 100755 --- a/modules/storage/obs.go +++ b/modules/storage/obs.go @@ -178,6 +178,7 @@ func GetObsListObject(jobName, parentDir string) ([]FileInfo, error) { input := &obs.ListObjectsInput{} input.Bucket = setting.Bucket input.Prefix = strings.TrimPrefix(path.Join(setting.TrainJobModelPath, jobName, setting.OutPutPath, parentDir), "/") + strPrefix := strings.Split(input.Prefix, "/") output, err := ObsCli.ListObjects(input) fileInfos := make([]FileInfo, 0) if err == nil { @@ -186,15 +187,29 @@ func GetObsListObject(jobName, parentDir string) ([]FileInfo, error) { var isDir bool var fileName,nextParentDir string if strings.HasSuffix(val.Key, "/") { + //dirs in next level dir + if len(str1) - len(strPrefix) > 2 { + continue + } fileName = str1[len(str1)-2] isDir = true - nextParentDir = fileName - if fileName == parentDir || (fileName + "/") == setting.OutPutPath { + if parentDir == "" { + nextParentDir = fileName + } else { + nextParentDir = parentDir + "/" + fileName + } + + if fileName == strPrefix[len(strPrefix)-1] || (fileName + "/") == setting.OutPutPath { continue } } else { + //files in next level dir + if len(str1) - len(strPrefix) > 1 { + continue + } fileName = str1[len(str1)-1] isDir = false + nextParentDir = parentDir } fileInfo := FileInfo{ diff --git a/public/img/git-logo.svg b/public/img/git-logo.svg new file mode 100644 index 000000000..70e6ab484 --- /dev/null +++ b/public/img/git-logo.svg @@ -0,0 +1,41 @@ + + + + + + + + + + + + + diff --git a/routers/api/v1/repo/repo_dashbord.go b/routers/api/v1/repo/repo_dashbord.go index d9be6d5a7..6759470fb 100644 --- a/routers/api/v1/repo/repo_dashbord.go +++ b/routers/api/v1/repo/repo_dashbord.go @@ -151,6 +151,15 @@ func GetProjectLatestStatistics(ctx *context.Context) { for _, contributor := range contributors { mode := repository.GetCollaboratorMode(contributor.UserId) + if mode == -1 { + if contributor.IsAdmin { + mode = int(models.AccessModeAdmin) + } + if contributor.UserId == repository.OwnerID { + mode = int(models.AccessModeOwner) + } + } + pr := models.GetPullCountByUserAndRepoId(repoIdInt, contributor.UserId) userInfo := UserInfo{ User: contributor.Committer, diff --git a/routers/org/members.go b/routers/org/members.go old mode 100644 new mode 100755 diff --git a/routers/repo/view.go b/routers/repo/view.go index e0439f6d9..46665f860 100755 --- a/routers/repo/view.go +++ b/routers/repo/view.go @@ -245,6 +245,11 @@ func renderDirectory(ctx *context.Context, treeLink string) { ctx.Data["ReadmeInList"] = true ctx.Data["ReadmeExist"] = true ctx.Data["FileIsSymlink"] = readmeFile.isSymlink + ctx.Data["ReadmeName"] = readmeFile.name + + if ctx.Repo.CanEnableEditor() { + ctx.Data["CanEditFile"] = true + } dataRc, err := readmeFile.blob.DataAsync() if err != nil { diff --git a/routers/routes/routes.go b/routers/routes/routes.go index c8dad85a2..e2df14b26 100755 --- a/routers/routes/routes.go +++ b/routers/routes/routes.go @@ -311,7 +311,7 @@ func RegisterRoutes(m *macaron.Macaron) { m.Head("/", func() string { return "" }) - m.Get("/", routers.Dashboard) + m.Get("/", routers.Home) m.Get("/dashboard", routers.Dashboard) m.Group("/explore", func() { m.Get("", func(ctx *context.Context) { @@ -615,6 +615,11 @@ func RegisterRoutes(m *macaron.Macaron) { //reqRepoBlockChainWriter := context.RequireRepoWriter(models.UnitTypeBlockChain) // ***** START: Organization ***** + m.Group("/org", func() { + m.Group("/:org", func() { + m.Get("/members", org.Members) + }, context.OrgAssignment()) + }) m.Group("/org", func() { m.Group("", func() { m.Get("/create", org.Create) @@ -625,7 +630,7 @@ func RegisterRoutes(m *macaron.Macaron) { m.Get("/dashboard", user.Dashboard) m.Get("/^:type(issues|pulls)$", user.Issues) m.Get("/milestones", reqMilestonesDashboardPageEnabled, user.Milestones) - m.Get("/members", org.Members) + //m.Get("/members", org.Members) m.Post("/members/action/:action", org.MembersAction) m.Get("/teams", org.Teams) diff --git a/routers/user/auth.go b/routers/user/auth.go index 44c5ad97d..16af84b66 100755 --- a/routers/user/auth.go +++ b/routers/user/auth.go @@ -544,7 +544,7 @@ func handleSignInFull(ctx *context.Context, u *models.User, remember bool, obeyR if err := models.UpdateUserCols(u, "language"); err != nil { log.Error(fmt.Sprintf("Error updating user language [user: %d, locale: %s]", u.ID, u.Language)) - return setting.AppSubURL + "/" + return setting.AppSubURL + "/dashboard" } } else { // Language setting of the user use the one previously set @@ -562,7 +562,7 @@ func handleSignInFull(ctx *context.Context, u *models.User, remember bool, obeyR u.SetLastLogin() if err := models.UpdateUserCols(u, "last_login_unix"); err != nil { ctx.ServerError("UpdateUserCols", err) - return setting.AppSubURL + "/" + return setting.AppSubURL + "/dashboard" } if redirectTo := ctx.GetCookie("redirect_to"); len(redirectTo) > 0 && !util.IsExternalURL(redirectTo) { @@ -574,9 +574,9 @@ func handleSignInFull(ctx *context.Context, u *models.User, remember bool, obeyR } if obeyRedirect { - ctx.Redirect(setting.AppSubURL + "/") + ctx.Redirect(setting.AppSubURL + "/dashboard") } - return setting.AppSubURL + "/" + return setting.AppSubURL + "/dashboard" } // SignInOAuth handles the OAuth2 login buttons diff --git a/templates/base/head_navbar.tmpl b/templates/base/head_navbar.tmpl index c22cb9fa7..57df408c9 100755 --- a/templates/base/head_navbar.tmpl +++ b/templates/base/head_navbar.tmpl @@ -7,6 +7,14 @@ +
+
+ + + +
+ + {{if .IsSigned}} {{.i18n.Tr "index"}} diff --git a/templates/org/home.tmpl b/templates/org/home.tmpl old mode 100644 new mode 100755 index a81e8ac17..ad5a8e02d --- a/templates/org/home.tmpl +++ b/templates/org/home.tmpl @@ -38,11 +38,12 @@

{{.i18n.Tr "org.people"}} - {{if .IsOrganizationMember}} - - {{end}} + + + +

{{$isMember := .IsOrganizationMember}} diff --git a/templates/org/navber.tmpl b/templates/org/navber.tmpl index 9ff92845e..7bb2ff69c 100755 --- a/templates/org/navber.tmpl +++ b/templates/org/navber.tmpl @@ -3,10 +3,10 @@ {{svg "octicon-home" 16}} {{$.i18n.Tr "org.home"}} + + {{svg "octicon-organization" 16}} {{$.i18n.Tr "org.people"}} + {{if or ($.IsOrganizationMember) ($.IsOrganizationOwner)}} - - {{svg "octicon-organization" 16}} {{$.i18n.Tr "org.people"}} - {{svg "octicon-jersey" 16}} {{$.i18n.Tr "org.teams"}} @@ -23,10 +23,10 @@ {{svg "octicon-home" 16}} {{$.i18n.Tr "org.home"}} {{end}} + + {{svg "octicon-organization" 16}} {{$.i18n.Tr "org.people"}} + {{if or ($.IsOrganizationMember) ($.IsOrganizationOwner)}} - - {{svg "octicon-organization" 16}} {{$.i18n.Tr "org.people"}} - {{svg "octicon-jersey" 16}} {{$.i18n.Tr "org.teams"}} diff --git a/templates/repo/view_file.tmpl b/templates/repo/view_file.tmpl old mode 100644 new mode 100755 index 1216b5f40..a0cae31f3 --- a/templates/repo/view_file.tmpl +++ b/templates/repo/view_file.tmpl @@ -34,6 +34,21 @@
{{end}}
+ + {{if .ReadmeInList}} +
+
+ {{if .Repository.CanEnableEditor}} + {{if .CanEditFile}} + {{svg "octicon-pencil" 16}} + {{else}} + {{svg "octicon-pencil" 16}} + {{end}} + {{end}} +
+
+ {{end}} + {{if not .ReadmeInList}}
diff --git a/web_src/js/components/EditAboutInfo.vue b/web_src/js/components/EditAboutInfo.vue index fbbf185d7..662a83d75 100644 --- a/web_src/js/components/EditAboutInfo.vue +++ b/web_src/js/components/EditAboutInfo.vue @@ -70,7 +70,7 @@ export default { this.info.desc = el; }, getWeb() { - const el = $('a.link').text(); + const el = $('a.link.edit-link').text(); this.info.index_web = el; }, getRepoName() { diff --git a/web_src/less/openi.less b/web_src/less/openi.less index bfebeb9b6..e073dca0a 100644 --- a/web_src/less/openi.less +++ b/web_src/less/openi.less @@ -298,7 +298,7 @@ display: block; display: none; position: absolute; background-color: #ffffff; - min-width: 160px; + min-width: 180px; z-index: 999; border: 1px solid transparent; border-color: #d4d4d5;