diff --git a/models/org.go b/models/org.go index e8006d55f..85fb157ae 100755 --- a/models/org.go +++ b/models/org.go @@ -180,8 +180,8 @@ func CreateOrganization(org, owner *User) (err error) { // Add initial creator to organization and owner team. if _, err = sess.Insert(&OrgUser{ - UID: owner.ID, - OrgID: org.ID, + UID: owner.ID, + OrgID: org.ID, IsPublic: setting.Service.DefaultOrgMemberVisible, }); err != nil { return fmt.Errorf("insert org-user relation: %v", err) diff --git a/models/topic.go b/models/topic.go index 5533da7bc..0b19bc1f0 100644 --- a/models/topic.go +++ b/models/topic.go @@ -324,3 +324,16 @@ func SaveTopics(repoID int64, topicNames ...string) error { return sess.Commit() } + +func GetOrgTopics(orgId int64) ([]Topic, error) { + result := make([]Topic, 0) + sql := "select distinct(t.*) from repository r " + + "inner join repo_topic rt on rt.repo_id = r.id " + + "inner join topic t on rt.topic_id = t.id " + + "where r.owner_id = ? order by repo_count desc limit 50" + if e := x.SQL(sql, orgId).Find(&result); e != nil { + return nil, e + } + + return result, nil +} diff --git a/modules/repository/fork.go b/modules/repository/fork.go index da9039d00..e3ebbfee2 100644 --- a/modules/repository/fork.go +++ b/modules/repository/fork.go @@ -86,5 +86,11 @@ func ForkRepository(doer, owner *models.User, oldRepo *models.Repository, name, if err := models.CopyLanguageStat(oldRepo, repo); err != nil { log.Error("Copy language stat from oldRepo failed") } + //inherit parent repo's topics + if len(oldRepo.Topics) > 0 { + if err := models.SaveTopics(repo.ID, oldRepo.Topics...); err != nil { + log.Error("SaveTopics failed when fork,e=%v", err) + } + } return repo, models.CopyLFS(ctx, repo, oldRepo) } diff --git a/options/locale/locale_en-US.ini b/options/locale/locale_en-US.ini index 5cac5133a..fdd3f7f94 100755 --- a/options/locale/locale_en-US.ini +++ b/options/locale/locale_en-US.ini @@ -2089,6 +2089,7 @@ team_unit_disabled = (Disabled) selected_couse=Selected Courses release_course = Publish Course all_keywords=All keywords +all_org_topics=All max_selectedPro= Select up to 9 public projects custom_select_courses = Customize selected courses recommend_remain_pro = Remain @@ -2097,6 +2098,8 @@ select_again = Select more than 9, please select again! custom_select_projects = Customize selected projects customize = Customize selected_project=Selected Projects +fold = Fold +unfold = Unfold form.name_reserved = The organization name '%s' is reserved. form.name_pattern_not_allowed = The pattern '%s' is not allowed in an organization name. diff --git a/options/locale/locale_zh-CN.ini b/options/locale/locale_zh-CN.ini index 2eeb72735..982dc1a49 100755 --- a/options/locale/locale_zh-CN.ini +++ b/options/locale/locale_zh-CN.ini @@ -2096,6 +2096,7 @@ team_unit_disabled=(已禁用) selected_couse=精选课程 release_course = 发布课程 all_keywords=全部关键字 +all_org_topics=全部 max_selectedPro= 最多可选9个公开项目 custom_select_courses = 自定义精选课程 recommend_remain_pro = 还能推荐 @@ -2104,6 +2105,8 @@ select_again = 选择超过9个,请重新选择! custom_select_projects = 自定义精选项目 customize = 自定义 selected_project=精选项目 +fold = 折叠 +unfold = 展开 form.name_reserved=组织名称 '%s' 是被保留的。 form.name_pattern_not_allowed=组织名称中不允许使用 "%s"。 diff --git a/routers/org/home.go b/routers/org/home.go index c9769f559..3ffb4fd86 100755 --- a/routers/org/home.go +++ b/routers/org/home.go @@ -94,6 +94,13 @@ func Home(ctx *context.Context) { recommendCourseKeyWords, _ := repository.GetRecommendCourseKeyWords() ctx.Data["CoursesKeywords"] = recommendCourseKeyWords + } else { + orgTopics, err := models.GetOrgTopics(org.ID) + if err != nil { + ctx.Error(500, "GetOrgTopics failed") + return + } + ctx.Data["OrgTopics"] = orgTopics } repos, count, err = models.SearchRepository(&models.SearchRepoOptions{ diff --git a/templates/org/home.tmpl b/templates/org/home.tmpl index 865a780a8..3ac59d079 100755 --- a/templates/org/home.tmpl +++ b/templates/org/home.tmpl @@ -23,21 +23,50 @@ {{template "org/navber" .}} {{template "org/select_pro" .}}
+ +
+
+
+ {{if .OrgTopics}} + {{$.i18n.Tr "org.all_org_topics"}} + {{end}} + + {{range .OrgTopics}} + {{if ne .Name ""}} + + {{.Name}} + + {{end}} + {{end}} +
+
+  {{.i18n.Tr "org.unfold"}} +
+ +
+
+
+
- {{if .CanCreateOrgRepo}} + {{template "org/repo_list" .}} {{template "base/paginate" .}}
-

+ {{if .CanCreateOrgRepo}} + + {{end}} +

{{.i18n.Tr "org.people"}}

{{template "base/footer" .}} + + \ No newline at end of file diff --git a/templates/org/home_courses.tmpl b/templates/org/home_courses.tmpl index 03ca8c41e..0f553687d 100644 --- a/templates/org/home_courses.tmpl +++ b/templates/org/home_courses.tmpl @@ -32,27 +32,13 @@ .organization-info >.container { padding-bottom:0px !important; } - .tag_bg{ - background-color: #0366D6 !important; - color:#FFFFFF !important; - } .course{ padding:10px 0 15px !important; } .course_color{ color: #FA8C16; } - .tag_lable{ - border: 1px solid rgba(232, 232, 232, 100) ; - border-radius: 4px; - color: rgba(65, 80, 88, 100); - font-family: Microsoft Yahei; - font-size: 14px; - padding: 0.3em 0.5em; - height: 30px; - text-align: center; - margin: 0.2em; - } + .tag_lable_first{ border: 1px solid rgba(232, 232, 232, 100) ; border-radius: 4px; @@ -65,17 +51,11 @@ margin: 0.2em; margin-left: none; } - .tag_key{ - max-width:100%; - margin: 3px 3px; - display:inline-flex; - } + .bpadding{ padding:10px 40px } - .omit{ - overflow: hidden; white-space: nowrap; text-overflow: ellipsis; - } + .noborder{ border: none !important; } @@ -83,7 +63,7 @@ text-align: center; margin-top: 5px; margin-top: 10px; - } + } diff --git a/web_src/less/openi.less b/web_src/less/openi.less index 6598f5f40..ff43f94e6 100644 --- a/web_src/less/openi.less +++ b/web_src/less/openi.less @@ -734,4 +734,38 @@ display: block; } .el-pagination.is-background .el-pager li:hover { color: #5bb973 !important; - } \ No newline at end of file + } + +.tag_key{ + max-width:100%; + margin: 3px 3px; + display:inline-flex; +} +.tag_lable{ + border: 1px solid rgba(232, 232, 232, 100) ; + border-radius: 4px; + color: rgba(65, 80, 88, 100); + font-family: Microsoft Yahei; + font-size: 14px; + padding: 0.3em 0.5em; + height: 30px; + text-align: center; + margin: 0.2em; +} +.omit{ + overflow: hidden; white-space: nowrap; text-overflow: ellipsis; +} +.tag_bg{ + background-color: #0366D6 !important; + color:#FFFFFF !important; +} +.margin-top20{ + margin-top: 20px; +} +.maxheight{ + max-height: 88px; + overflow: hidden; +} +.pad-botom{ + padding-bottom:0px !important; +} \ No newline at end of file