From 491de2004c253c6422108a43f8d08faa38b2d91c Mon Sep 17 00:00:00 2001 From: yanchao Date: Sun, 20 Mar 2022 11:33:21 +0800 Subject: [PATCH 01/18] =?UTF-8?q?=E7=BB=84=E7=BB=87=E5=B9=BF=E5=9C=BA?= =?UTF-8?q?=E9=A1=B5=E9=9D=A2=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- models/models.go | 1 + models/org.go | 99 +++++++++++++++++++++++++++++++++++++ models/repo_statistic.go | 10 ++++ modules/cron/tasks_basic.go | 12 +++++ routers/home.go | 39 +++++++++++---- routers/private/internal.go | 2 + routers/private/tool.go | 4 ++ 7 files changed, 158 insertions(+), 9 deletions(-) diff --git a/models/models.go b/models/models.go index 0f4679b4f..fafb63018 100755 --- a/models/models.go +++ b/models/models.go @@ -137,6 +137,7 @@ func init() { new(OfficialTag), new(OfficialTagRepos), new(WechatBindLog), + new(OrgStatistic), ) tablesStatistic = append(tablesStatistic, diff --git a/models/org.go b/models/org.go index 85fb157ae..8b3e60ef8 100755 --- a/models/org.go +++ b/models/org.go @@ -8,6 +8,7 @@ package models import ( "fmt" "os" + "strconv" "strings" "code.gitea.io/gitea/modules/log" @@ -19,6 +20,17 @@ import ( "xorm.io/xorm" ) +type OrgStatistic struct { + ID int64 `xorm:"pk autoincr"` + OrgID int64 `xorm:"UNIQUE"` + NumScore int `xorm:"INDEX NOT NULL DEFAULT 0"` +} + +type OrgScore struct { + *User + Score string +} + // IsOwnedBy returns true if given user is in the owner team. func (org *User) IsOwnedBy(uid int64) (bool, error) { return IsOrganizationOwner(org.ID, uid) @@ -135,6 +147,93 @@ func (org *User) RemoveOrgRepo(repoID int64) error { return org.removeOrgRepo(x, repoID) } +func UpdateOrgStatistics() { + ids, err := GetOrganizationsId() + if err != nil { + return + } + for _, id := range ids { + org := User{ID: id} + orgStat := &OrgStatistic{OrgID: id} + numScore, err := org.getOrgStatistics() + if err == nil { + has, _ := x.Get(orgStat) + + orgStat.NumScore = numScore + if has { + x.ID(orgStat.ID).Cols("num_score").Update(&orgStat) + } else { + x.Insert(orgStat) + } + + } + } + +} + +func (org *User) getOrgStatistics() (int, error) { + count, err := getRepositoryCount(x, org) + if err != nil { + return 0, err + } + + err = org.GetRepositories(ListOptions{int(count), 1}) + + if err != nil { + return 0, err + } + var numScore = 0 + for _, repo := range org.Repos { + + numScore += int(getOpenIByRepoId(repo.ID)) + } + + return numScore, nil + +} + +func FindTopNStarsOrgs(n int) ([]*OrgScore, error) { + sql := "select a.id,sum(b.num_stars) score from \"user\" a ,repository b where a.id=b.owner_id and a.type=1 group by a.id order by score desc limit " + strconv.Itoa(n) + + return findTopNOrgs(sql) +} +func FindTopNMembersOrgs(n int) ([]*OrgScore, error) { + sql := "select id, count(user_id) score from" + + " (select org_id as id, uid as user_id from org_user " + + "union select a.id,b.user_id from \"user\" a,collaboration b,repository c " + + "where a.type=1 and a.id=c.owner_id and b.repo_id=c.id) d " + + "group by id order by score desc limit " + strconv.Itoa(n) + + return findTopNOrgs(sql) +} + +func FindTopNOpenIOrgs(n int) ([]*OrgScore, error) { + sql := "select org_id id,num_score score from org_statistic order by num_score desc limit 10" + strconv.Itoa(n) + + return findTopNOrgs(sql) +} + +func findTopNOrgs(sql string) ([]*OrgScore, error) { + resutls, err := x.QueryString(sql) + + if err != nil { + return nil, err + } + var orgScore []*OrgScore + for _, record := range resutls { + id, _ := strconv.ParseInt(record["id"], 10, 64) + user, err := getUserByID(x, id) + if err != nil { + continue + } + orgScore = append(orgScore, &OrgScore{user, record["score"]}) + + } + + return orgScore, nil + +} + // CreateOrganization creates record of a new organization. func CreateOrganization(org, owner *User) (err error) { if !owner.CanCreateOrganization() { diff --git a/models/repo_statistic.go b/models/repo_statistic.go index a9e9593af..4f8f13ed7 100755 --- a/models/repo_statistic.go +++ b/models/repo_statistic.go @@ -73,6 +73,16 @@ func (repo *RepoStatistic) DisplayName() string { return repo.Alias } +func getOpenIByRepoId(repoId int64) float64 { + repoStatistic := new(RepoStatistic) + has, err := xStatistic.Cols("radar_total").Where("repo_id=?", repoId).Desc("id").Limit(1).Get(repoStatistic) + if !has || err != nil { + return 0 + } + return repoStatistic.RadarTotal + +} + func DeleteRepoStatDaily(date string) error { sess := xStatistic.NewSession() defer sess.Close() diff --git a/modules/cron/tasks_basic.go b/modules/cron/tasks_basic.go index b9838e66f..b3a6c02a1 100755 --- a/modules/cron/tasks_basic.go +++ b/modules/cron/tasks_basic.go @@ -185,6 +185,17 @@ func registerHandleSummaryStatistic() { }) } +func registerHandleOrgStatistic() { + RegisterTaskFatal("handle_org_statistic", &BaseConfig{ + Enabled: true, + RunAtStart: false, + Schedule: "0 0 2 * * ?", + }, func(ctx context.Context, _ *models.User, _ Config) error { + models.UpdateOrgStatistics() + return nil + }) +} + func registerSyncCloudbrainStatus() { RegisterTaskFatal("sync_cloudbrain_status", &BaseConfig{ Enabled: true, @@ -215,4 +226,5 @@ func initBasicTasks() { registerHandleSummaryStatistic() registerSyncCloudbrainStatus() + registerHandleOrgStatistic() } diff --git a/routers/home.go b/routers/home.go index 2db8d2112..a9f05067b 100755 --- a/routers/home.go +++ b/routers/home.go @@ -418,17 +418,38 @@ func ExploreOrganizations(ctx *context.Context) { ctx.Data["PageIsExploreOrganizations"] = true ctx.Data["IsRepoIndexerEnabled"] = setting.Indexer.RepoIndexerEnabled - visibleTypes := []structs.VisibleType{structs.VisibleTypePublic} - if ctx.User != nil { - visibleTypes = append(visibleTypes, structs.VisibleTypeLimited, structs.VisibleTypePrivate) + N := 10 + starInfo, err := models.FindTopNStarsOrgs(N) + if err != nil { + log.Error("GetStarOrgInfos failed:%v", err.Error(), ctx.Data["MsgID"]) + ctx.ServerError("GetStarOrgInfos", err) + return + } + memberInfo, err := models.FindTopNMembersOrgs(N) + if err != nil { + log.Error("GetMemberOrgInfos failed:%v", err.Error(), ctx.Data["MsgID"]) + ctx.ServerError("GetMemberOrgInfos", err) + return + } + openIInfo, err := models.FindTopNOpenIOrgs(N) + if err != nil { + log.Error("GetOpenIOrgInfos failed:%v", err.Error(), ctx.Data["MsgID"]) + ctx.ServerError("GetOpenIOrgInfos", err) + return } - RenderUserSearch(ctx, &models.SearchUserOptions{ - Actor: ctx.User, - Type: models.UserTypeOrganization, - ListOptions: models.ListOptions{PageSize: setting.UI.ExplorePagingNum}, - Visible: visibleTypes, - }, tplExploreOrganizations) + recommendOrgs, err := models.GetRecommendOrgInfos() + if err != nil { + log.Error("GetRecommendOrgInfos failed:%v", err.Error(), ctx.Data["MsgID"]) + ctx.ServerError("GetRecommendOrgInfos", err) + return + } + ctx.Data["RecommendOrgs"] = recommendOrgs + ctx.Data["StarOrgs"] = starInfo + ctx.Data["MemberOrgs"] = memberInfo + ctx.Data["ActiveOrgs"] = openIInfo + + ctx.HTML(http.StatusOK, tplExploreOrganizations) } // ExploreCode render explore code page diff --git a/routers/private/internal.go b/routers/private/internal.go index 0dd725ca3..18dad5537 100755 --- a/routers/private/internal.go +++ b/routers/private/internal.go @@ -44,6 +44,8 @@ func RegisterRoutes(m *macaron.Macaron) { m.Post("/manager/flush-queues", bind(private.FlushOptions{}), FlushQueues) m.Post("/tool/update_all_repo_commit_cnt", UpdateAllRepoCommitCnt) m.Post("/tool/repo_stat/:date", RepoStatisticManually) + + m.Get("/tool/org_stat", OrgStatisticManually) m.Post("/tool/update_repo_visit/:date", UpdateRepoVisit) }, CheckInternalToken) diff --git a/routers/private/tool.go b/routers/private/tool.go index d01c5b2ab..122a41afe 100755 --- a/routers/private/tool.go +++ b/routers/private/tool.go @@ -45,6 +45,10 @@ func RepoStatisticManually(ctx *macaron.Context) { repo.TimingCountDataByDate(date) } +func OrgStatisticManually() { + models.UpdateOrgStatistics() +} + func UpdateRepoVisit(ctx *macaron.Context) { date := ctx.Params("date") log.Info("date(%s)", date) From 478dc4c59d3f364a19cfb8b25b44bf3393224d40 Mon Sep 17 00:00:00 2001 From: ychao_1983 Date: Mon, 21 Mar 2022 09:19:36 +0800 Subject: [PATCH 02/18] =?UTF-8?q?=E6=8F=90=E4=BA=A4=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- models/user.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/models/user.go b/models/user.go index f7857248b..a181a4d72 100755 --- a/models/user.go +++ b/models/user.go @@ -2103,6 +2103,12 @@ func GetOrganizationsCount() (int64, error) { } +func GetOrganizationsId() ([]int64, error) { + var ids []int64 + err := x.Table("user").Where("type=1").Cols("id").Find(&ids) + return ids, err +} + func GetBlockChainUnSuccessUsers() ([]*User, error) { users := make([]*User, 0, 10) err := x.Where("public_key = ''"). From ccb70b0c4a021b94b0026c3cc31f60b0f9127094 Mon Sep 17 00:00:00 2001 From: ychao_1983 Date: Tue, 22 Mar 2022 10:13:03 +0800 Subject: [PATCH 03/18] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E6=8E=A8=E8=8D=90?= =?UTF-8?q?=E7=BB=84=E7=BB=87?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- routers/home.go | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/routers/home.go b/routers/home.go index a9f05067b..8ce709c6d 100755 --- a/routers/home.go +++ b/routers/home.go @@ -438,7 +438,7 @@ func ExploreOrganizations(ctx *context.Context) { return } - recommendOrgs, err := models.GetRecommendOrgInfos() + recommendOrgs, err := GetRecommendOrg() if err != nil { log.Error("GetRecommendOrgInfos failed:%v", err.Error(), ctx.Data["MsgID"]) ctx.ServerError("GetRecommendOrgInfos", err) @@ -581,12 +581,12 @@ func NotFound(ctx *context.Context) { ctx.NotFound("home.NotFound", nil) } -func RecommendOrgFromPromote(ctx *context.Context) { +func GetRecommendOrg() ([]map[string]interface{}, error) { url := setting.RecommentRepoAddr + "organizations" result, err := repository.RecommendFromPromote(url) + if err != nil { - ctx.ServerError("500", err) - return + return nil, err } resultOrg := make([]map[string]interface{}, 0) for _, userName := range result { @@ -606,7 +606,15 @@ func RecommendOrgFromPromote(ctx *context.Context) { log.Info("query user error," + err.Error()) } } + return resultOrg, nil +} +func RecommendOrgFromPromote(ctx *context.Context) { + resultOrg, err := GetRecommendOrg() + if err != nil { + ctx.ServerError("500", err) + return + } ctx.JSON(200, resultOrg) } From 3b6e6e5f36392fa807d22d2b1f3a04e8e3902562 Mon Sep 17 00:00:00 2001 From: ychao_1983 Date: Tue, 22 Mar 2022 11:08:05 +0800 Subject: [PATCH 04/18] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E5=8F=82=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- routers/home.go | 1 + 1 file changed, 1 insertion(+) diff --git a/routers/home.go b/routers/home.go index 8ce709c6d..aeb67b638 100755 --- a/routers/home.go +++ b/routers/home.go @@ -596,6 +596,7 @@ func GetRecommendOrg() ([]map[string]interface{}, error) { userMap["Name"] = user.Name userMap["Description"] = user.Description userMap["FullName"] = user.FullName + userMap["HomeLink"] = user.HomeLink() userMap["ID"] = user.ID userMap["Avatar"] = user.RelAvatarLink() userMap["NumRepos"] = user.NumRepos From 53144be9b6ca9793d4d3649b6b50d029d7f3402a Mon Sep 17 00:00:00 2001 From: wangjr Date: Tue, 22 Mar 2022 16:46:19 +0800 Subject: [PATCH 05/18] =?UTF-8?q?=E7=BB=84=E7=BB=87=E6=8E=A8=E8=8D=90?= =?UTF-8?q?=E7=BB=84=E7=BB=87=E9=A6=96=E6=AC=A1=E6=8F=90=E4=BA=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- options/locale/locale_en-US.ini | 7 ++ options/locale/locale_zh-CN.ini | 8 +++ templates/explore/organizations.tmpl | 100 +++++++++++++++++++++++++++ 3 files changed, 115 insertions(+) diff --git a/options/locale/locale_en-US.ini b/options/locale/locale_en-US.ini index 226fa2147..e10b2d1b4 100755 --- a/options/locale/locale_en-US.ini +++ b/options/locale/locale_en-US.ini @@ -2104,6 +2104,13 @@ customize = Customize selected_project=Selected Projects fold = Fold unfold = Unfold +org_member = Member +org_members = Members +org_team = Team +org_teams = Teams +org_repository = Repository +org_repositories = Repositories + 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 ce5367d98..a8d1a7399 100755 --- a/options/locale/locale_zh-CN.ini +++ b/options/locale/locale_zh-CN.ini @@ -2111,6 +2111,14 @@ customize = 自定义 selected_project=精选项目 fold = 收起 unfold = 展开 +org_member = 成员 +org_members = 成员 +org_team = 团队 +org_teams = 团队 +org_repository = 项目 +org_repositories = 项目 + + form.name_reserved=组织名称 '%s' 是被保留的。 form.name_pattern_not_allowed=组织名称中不允许使用 "%s"。 diff --git a/templates/explore/organizations.tmpl b/templates/explore/organizations.tmpl index 1151c5a94..84a2d77a8 100644 --- a/templates/explore/organizations.tmpl +++ b/templates/explore/organizations.tmpl @@ -1,9 +1,76 @@ + + + + + + + {{template "base/head" .}}
{{template "explore/search" .}} + {{template "base/footer" .}} + + From 6982a591eadbf490a46cf7f56e19b90b229257b7 Mon Sep 17 00:00:00 2001 From: wangjr Date: Wed, 23 Mar 2022 10:05:26 +0800 Subject: [PATCH 06/18] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=8E=A8=E8=8D=90?= =?UTF-8?q?=E7=BB=84=E7=BB=87=E6=A0=B7=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- templates/explore/organizations.tmpl | 143 ++++++++++++++++----------- 1 file changed, 85 insertions(+), 58 deletions(-) diff --git a/templates/explore/organizations.tmpl b/templates/explore/organizations.tmpl index 84a2d77a8..872490c8a 100644 --- a/templates/explore/organizations.tmpl +++ b/templates/explore/organizations.tmpl @@ -4,72 +4,99 @@ + {{template "base/head" .}}
{{template "explore/search" .}} +
+
+

+ 推荐组织 +

+

这些优秀的组织正在使用启智AI开发协作平台;你的组织也想展示到这里, 点此提交

+
-
-
-
-
- -
-
- +
+
+
-
+fdf
+
+fdfd + +
+
+dfgfg + +
+
+ +
+ +
+
+ {{template "explore/navbar" .}}
@@ -140,7 +167,7 @@ window.onload = function() { var swiperOrg = new Swiper(".homeorg-list", { slidesPerView: 1, - slidesPerColumn: 4, + slidesPerColumn: 3, slidesPerColumnFill:'row', spaceBetween: 15, pagination: { @@ -153,10 +180,10 @@ window.onload = function() { }, breakpoints: { 768: { - slidesPerView: 2, + slidesPerView: 3, }, 1024: { - slidesPerView: 3, + slidesPerView: 4, }, }, From 92dfd40a0483da548a63fa541a7a7042da1e2961 Mon Sep 17 00:00:00 2001 From: ychao_1983 Date: Thu, 24 Mar 2022 17:06:21 +0800 Subject: [PATCH 07/18] =?UTF-8?q?=E6=8F=90=E4=BA=A4=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- routers/home.go | 1 + 1 file changed, 1 insertion(+) diff --git a/routers/home.go b/routers/home.go index aeb67b638..e7067524f 100755 --- a/routers/home.go +++ b/routers/home.go @@ -444,6 +444,7 @@ func ExploreOrganizations(ctx *context.Context) { ctx.ServerError("GetRecommendOrgInfos", err) return } + ctx.Data["RecommendURL"] = setting.RecommentRepoAddr ctx.Data["RecommendOrgs"] = recommendOrgs ctx.Data["StarOrgs"] = starInfo ctx.Data["MemberOrgs"] = memberInfo From 9ab71724f501a810cbf6d8d094be02d516b4ce2e Mon Sep 17 00:00:00 2001 From: ychao_1983 Date: Thu, 24 Mar 2022 17:55:05 +0800 Subject: [PATCH 08/18] =?UTF-8?q?=E6=8F=90=E4=BA=A4=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- routers/home.go | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/routers/home.go b/routers/home.go index e7067524f..55c077f66 100755 --- a/routers/home.go +++ b/routers/home.go @@ -49,7 +49,7 @@ func Home(ctx *context.Context) { ctx.HTML(200, tplHome) } -func setRecommendURL(ctx *context.Context) { +func setRecommendURLOnly(ctx *context.Context) { addr := setting.RecommentRepoAddr[10:] start := strings.Index(addr, "/") end := strings.Index(addr, "raw") @@ -58,7 +58,10 @@ func setRecommendURL(ctx *context.Context) { } else { ctx.Data["RecommendURL"] = setting.RecommentRepoAddr } +} +func setRecommendURL(ctx *context.Context) { + setRecommendURLOnly(ctx) ctx.Data["page_title"] = ctx.Tr("home.page_title") ctx.Data["page_small_title"] = ctx.Tr("home.page_small_title") ctx.Data["page_description"] = ctx.Tr("home.page_description") @@ -444,7 +447,7 @@ func ExploreOrganizations(ctx *context.Context) { ctx.ServerError("GetRecommendOrgInfos", err) return } - ctx.Data["RecommendURL"] = setting.RecommentRepoAddr + setRecommendURLOnly(ctx) ctx.Data["RecommendOrgs"] = recommendOrgs ctx.Data["StarOrgs"] = starInfo ctx.Data["MemberOrgs"] = memberInfo From 212b63c5a97de094142ab75e622872b1d9f6ea08 Mon Sep 17 00:00:00 2001 From: wangjr Date: Fri, 25 Mar 2022 10:50:02 +0800 Subject: [PATCH 09/18] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E7=BB=84=E7=BB=87?= =?UTF-8?q?=E5=B9=BF=E5=9C=BA=E6=8E=92=E5=90=8D=E5=88=97=E5=86=85=E5=AE=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- options/locale/locale_en-US.ini | 3 + options/locale/locale_zh-CN.ini | 4 +- templates/explore/organizations.tmpl | 207 +++++++++++++++------------ web_src/less/openi.less | 84 +++++++++++ 4 files changed, 208 insertions(+), 90 deletions(-) diff --git a/options/locale/locale_en-US.ini b/options/locale/locale_en-US.ini index 51e8a6c45..28250ab0c 100755 --- a/options/locale/locale_en-US.ini +++ b/options/locale/locale_en-US.ini @@ -2141,6 +2141,9 @@ org_teams = Teams org_repository = Repository org_repositories = Repositories +star = Star Top10 +member = Members Top10 +active = Active Top10 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 535f65ee1..18f6293f3 100755 --- a/options/locale/locale_zh-CN.ini +++ b/options/locale/locale_zh-CN.ini @@ -2145,7 +2145,9 @@ org_teams = 团队 org_repository = 项目 org_repositories = 项目 - +star = 点赞榜 +member = 成员榜 +active = 活跃榜 form.name_reserved=组织名称 '%s' 是被保留的。 form.name_pattern_not_allowed=组织名称中不允许使用 "%s"。 diff --git a/templates/explore/organizations.tmpl b/templates/explore/organizations.tmpl index 872490c8a..d88272e71 100644 --- a/templates/explore/organizations.tmpl +++ b/templates/explore/organizations.tmpl @@ -4,27 +4,15 @@ - - {{template "base/head" .}}
{{template "explore/search" .}}

- 推荐组织 + {{$.i18n.Tr "home.page_recommend_org"}}

-

这些优秀的组织正在使用启智AI开发协作平台;你的组织也想展示到这里, 点此提交

+

{{$.i18n.Tr "home.page_recommend_org_desc"}} {{$.i18n.Tr "home.page_recommend_org_commit"}}

@@ -76,88 +64,130 @@
-
-
-
- -fdf -
-
-fdfd - -
-
-dfgfg - -
-
- -
- -
-
- - - {{template "explore/navbar" .}} -
-

- {{.i18n.Tr "explore.organizations"}} -

- {{template "base/footer" .}} @@ -191,5 +221,4 @@ window.onload = function() { } - diff --git a/web_src/less/openi.less b/web_src/less/openi.less index 7871d8148..ad252dde7 100644 --- a/web_src/less/openi.less +++ b/web_src/less/openi.less @@ -779,4 +779,88 @@ display: block; border: none !important; color: #0366d6 !important; box-shadow: -15px 0px 10px #fff; +} + +.content_top10{ + padding:10px; + padding-top:0px; +} +.re_con{ + color: rgba(136, 136, 136, 100); + font-size: 14px; + text-align: center; + font-family: SourceHanSansSC-light; +} +.title_re{ + margin-top: 50px !important; +} +.card_list { + width: calc(33.33333333333333% - 2em); + margin-left: 1em; + margin-right: 1em +} +.list_title{ + height: 52px; + text-align: center +} +.star_title{ + background-color: #3291F8; +} +.memb_title{ + background-color: #706FE3; +} +.act_title{ + background-color: #13C28D; +} +.p_text{ + line-height: 50px; + text-align:left; + padding-left:15px; + font-size:18px; + color:#FFFFFF; +} +.orgs { + display: flex; + flex-flow: row wrap; + padding: 0; + margin-top:20px +} +.orgs li { + display: flex; + border-bottom: 0!important; + padding: 3px!important; +} +.p_score{ + line-height: 28px; + width: 100%; + + /* padding-right: 20px; */ + text-align: right; +} +.org_line_hight{ + line-height: 28px; +} +.org_icon{ + margin-top: 10px; + margin-right: 10px; + padding-left: 15px; +} +.org_icon_num{ + margin-left: 2px; + margin-right: 12px; +} +.org_icon_color{ + color: #FA8C16; +} +.li_name{ + list-style:none; + width: 55%; +} +.li_avatar{ + list-style: none; + width: 10%; +} +.li_score{ + list-style:none; + margin-left: 2px; } \ No newline at end of file From 0025a23161b938c2ccb77e6c8e42578ca84972da Mon Sep 17 00:00:00 2001 From: wangjr Date: Fri, 1 Apr 2022 09:32:09 +0800 Subject: [PATCH 10/18] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E6=90=9C=E7=B4=A2?= =?UTF-8?q?=E8=B7=B3=E8=BD=AC=E5=85=A8=E5=B1=80=E6=90=9C=E7=B4=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- templates/explore/organizations.tmpl | 16 +++++++++++++++- web_src/less/openi.less | 1 + 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/templates/explore/organizations.tmpl b/templates/explore/organizations.tmpl index d88272e71..757e80556 100644 --- a/templates/explore/organizations.tmpl +++ b/templates/explore/organizations.tmpl @@ -6,7 +6,21 @@ {{template "base/head" .}}
- {{template "explore/search" .}} + +
+
+
+
+
+ + + +
+
+
+
+
+

diff --git a/web_src/less/openi.less b/web_src/less/openi.less index 6202c582b..0be3027ac 100644 --- a/web_src/less/openi.less +++ b/web_src/less/openi.less @@ -893,6 +893,7 @@ display: block; .li_score{ list-style:none; margin-left: 2px; +} /**seach**/ /**搜索导航条适配窄屏**/ .seachnav{ From 2b00415c2468eb18c46b7d1768843862476fa8cc Mon Sep 17 00:00:00 2001 From: zouap Date: Fri, 1 Apr 2022 10:06:37 +0800 Subject: [PATCH 11/18] =?UTF-8?q?=E6=8F=90=E4=BA=A4=E4=BB=A3=E7=A0=81?= =?UTF-8?q?=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: zouap --- public/home/search.js | 67 +++++++++++++++++++++++++++---------------- 1 file changed, 42 insertions(+), 25 deletions(-) diff --git a/public/home/search.js b/public/home/search.js index 70b5d4ef9..af6589840 100644 --- a/public/home/search.js +++ b/public/home/search.js @@ -124,29 +124,7 @@ function search(){ $('#searchForm').addClass("hiddenSearch"); initPageInfo(); if(!isEmpty(currentSearchKeyword)){ - document.getElementById("find_id").innerHTML=getLabel(isZh,"search_finded"); - currentSearchSortBy = sortBy[10]; - currentSearchAscending = "false"; - OnlySearchLabel =false; - page(currentPage); - if(currentSearchTableName != "repository"){ - doSearch("repository",currentSearchKeyword,1,pageSize,true,"",false); - } - if(currentSearchTableName != "issue"){ - doSearch("issue",currentSearchKeyword,1,pageSize,true,"",false); - } - if(currentSearchTableName != "user"){ - doSearch("user",currentSearchKeyword,1,pageSize,true,"",false); - } - if(currentSearchTableName != "org"){ - doSearch("org",currentSearchKeyword,1,pageSize,true,"",false); - } - if(currentSearchTableName != "dataset"){ - doSearch("dataset",currentSearchKeyword,1,pageSize,true,"",false); - } - if(currentSearchTableName != "pr"){ - doSearch("pr",currentSearchKeyword,1,pageSize,true,"",false); - } + doSpcifySearch("repository",currentSearchKeyword,sortBy[10],"false") }else{ initDiv(false); document.getElementById("find_id").innerHTML=getLabel(isZh,"search_empty"); @@ -187,6 +165,38 @@ function initDiv(isSearchLabel=false){ } } +function doSpcifySearch(tableName,keyword,sortBy="",ascending="false"){ + initDiv(true); + document.getElementById("find_id").innerHTML=getLabel(isZh,"search_finded"); + currentSearchKeyword = keyword; + initPageInfo(); + currentSearchTableName = tableName; + currentSearchSortBy = sortBy; + currentSearchAscending = ascending; + OnlySearchLabel =false; + + page(currentPage); + + if(currentSearchTableName != "repository"){ + doSearch("repository",currentSearchKeyword,1,pageSize,true,"",false); + } + if(currentSearchTableName != "issue"){ + doSearch("issue",currentSearchKeyword,1,pageSize,true,"",false); + } + if(currentSearchTableName != "user"){ + doSearch("user",currentSearchKeyword,1,pageSize,true,"",false); + } + if(currentSearchTableName != "org"){ + doSearch("org",currentSearchKeyword,1,pageSize,true,"",false); + } + if(currentSearchTableName != "dataset"){ + doSearch("dataset",currentSearchKeyword,1,pageSize,true,"",false); + } + if(currentSearchTableName != "pr"){ + doSearch("pr",currentSearchKeyword,1,pageSize,true,"",false); + } +} + function doSearchLabel(tableName,keyword,sortBy="",ascending="false"){ initDiv(true); //document.getElementById("search_div").style.display="none"; @@ -1272,8 +1282,15 @@ var zhCN={ sessionStorage.removeItem("searchLabel"); doSearchLabel(sessionStorage.getItem("tableName"),sessionStorage.getItem("keyword"),sessionStorage.getItem("sortBy"),sessionStorage.getItem("ascending")); }else{ - console.log("normal search...."); - search(); + var specifySearch = sessionStorage.getItem("specifySearch"); + if(specifySearch){ + sessionStorage.removeItem("specifySearch"); + doSpcifySearch(sessionStorage.getItem("tableName"),sessionStorage.getItem("keyword"),sessionStorage.getItem("sortBy"),sessionStorage.getItem("ascending")); + }else{ + console.log("normal search...."); + search(); + } + } } } From 90231a34369d4ac6b7560c8aa4e0ce9b6cee3b04 Mon Sep 17 00:00:00 2001 From: zouap Date: Fri, 1 Apr 2022 10:14:24 +0800 Subject: [PATCH 12/18] =?UTF-8?q?=E6=8F=90=E4=BA=A4=E4=BB=A3=E7=A0=81?= =?UTF-8?q?=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: zouap --- public/home/search.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/public/home/search.js b/public/home/search.js index af6589840..8468e42ac 100644 --- a/public/home/search.js +++ b/public/home/search.js @@ -166,7 +166,7 @@ function initDiv(isSearchLabel=false){ } function doSpcifySearch(tableName,keyword,sortBy="",ascending="false"){ - initDiv(true); + initDiv(false); document.getElementById("find_id").innerHTML=getLabel(isZh,"search_finded"); currentSearchKeyword = keyword; initPageInfo(); From b4deb062076e80b67a68f243f119a3c9d3217f18 Mon Sep 17 00:00:00 2001 From: zouap Date: Fri, 1 Apr 2022 10:19:20 +0800 Subject: [PATCH 13/18] =?UTF-8?q?=E6=8F=90=E4=BA=A4=E4=BB=A3=E7=A0=81?= =?UTF-8?q?=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: zouap --- public/home/search.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/public/home/search.js b/public/home/search.js index 8468e42ac..71af07bc3 100644 --- a/public/home/search.js +++ b/public/home/search.js @@ -124,7 +124,7 @@ function search(){ $('#searchForm').addClass("hiddenSearch"); initPageInfo(); if(!isEmpty(currentSearchKeyword)){ - doSpcifySearch("repository",currentSearchKeyword,sortBy[10],"false") + doSpcifySearch(currentSearchTableName,currentSearchKeyword,sortBy[10],"false"); }else{ initDiv(false); document.getElementById("find_id").innerHTML=getLabel(isZh,"search_empty"); From 3f8470708e94f2dc80a6206da7afc41b71ca2db6 Mon Sep 17 00:00:00 2001 From: zouap Date: Fri, 1 Apr 2022 14:37:05 +0800 Subject: [PATCH 14/18] =?UTF-8?q?=E6=8F=90=E4=BA=A4=E4=BB=A3=E7=A0=81?= =?UTF-8?q?=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: zouap --- public/home/search.js | 35 +++++++++++++++++++++-------------- 1 file changed, 21 insertions(+), 14 deletions(-) diff --git a/public/home/search.js b/public/home/search.js index 71af07bc3..33c2279f4 100644 --- a/public/home/search.js +++ b/public/home/search.js @@ -108,8 +108,9 @@ function searchItem(type,sortType){ currentSearchSortBy = sortBy[sortType]; currentSearchAscending = sortAscending[sortType]; OnlySearchLabel =false; - page(currentPage); + }else{ + emptySearch(); } } @@ -126,22 +127,26 @@ function search(){ if(!isEmpty(currentSearchKeyword)){ doSpcifySearch(currentSearchTableName,currentSearchKeyword,sortBy[10],"false"); }else{ - initDiv(false); - document.getElementById("find_id").innerHTML=getLabel(isZh,"search_empty"); - $('#find_title').html(""); - document.getElementById("sort_type").innerHTML=""; - document.getElementById("child_search_item").innerHTML=""; - document.getElementById("page_menu").innerHTML=""; - $('#repo_total').text(""); - $('#pr_total').text(""); - $('#issue_total').text(""); - $('#dataset_total').text(""); - $('#user_total').text(""); - $('#org_total').text(""); - setActivate(null); + emptySearch(); } } +function emptySearch(){ + initDiv(false); + document.getElementById("find_id").innerHTML=getLabel(isZh,"search_empty"); + $('#find_title').html(""); + document.getElementById("sort_type").innerHTML=""; + document.getElementById("child_search_item").innerHTML=""; + document.getElementById("page_menu").innerHTML=""; + $('#repo_total').text(""); + $('#pr_total').text(""); + $('#issue_total').text(""); + $('#dataset_total').text(""); + $('#user_total').text(""); + $('#org_total').text(""); + setActivate(null); +} + function initDiv(isSearchLabel=false){ if(isSearchLabel){ document.getElementById("search_div").style.display="none"; @@ -1285,6 +1290,8 @@ var zhCN={ var specifySearch = sessionStorage.getItem("specifySearch"); if(specifySearch){ sessionStorage.removeItem("specifySearch"); + console.log("search sepcial keyword=...." + sessionStorage.getItem("keyword")); + document.getElementById("keyword_input").value = sessionStorage.getItem("keyword"); doSpcifySearch(sessionStorage.getItem("tableName"),sessionStorage.getItem("keyword"),sessionStorage.getItem("sortBy"),sessionStorage.getItem("ascending")); }else{ console.log("normal search...."); From aa05fbe13a02ca2b1568559d413e402adef96c51 Mon Sep 17 00:00:00 2001 From: wangjr Date: Fri, 1 Apr 2022 15:02:49 +0800 Subject: [PATCH 15/18] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=90=9C=E7=B4=A2?= =?UTF-8?q?=E8=B7=B3=E8=BD=AC=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- templates/explore/organizations.tmpl | 23 ++++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-) diff --git a/templates/explore/organizations.tmpl b/templates/explore/organizations.tmpl index 757e80556..58615a8e5 100644 --- a/templates/explore/organizations.tmpl +++ b/templates/explore/organizations.tmpl @@ -10,13 +10,13 @@
-
-
- +
+
+ - +
- +
@@ -208,6 +208,19 @@