Browse Source

Merge remote-tracking branch 'origin/V20220415' into zouap_static

tags/v1.22.4.1^2
zouap 3 years ago
parent
commit
00f1376c33
17 changed files with 633 additions and 109 deletions
  1. +13
    -0
      models/dbsql/dataset_foreigntable_for_es.sql
  2. +11
    -0
      models/dbsql/issue_foreigntable_for_es.sql
  3. +13
    -0
      models/dbsql/repo_foreigntable_for_es.sql
  4. +9
    -0
      models/dbsql/user_foreigntable_for_es.sql
  5. +1
    -0
      models/models.go
  6. +99
    -0
      models/org.go
  7. +10
    -0
      models/repo_statistic.go
  8. +6
    -0
      models/user.go
  9. +12
    -0
      modules/cron/tasks_basic.go
  10. +10
    -0
      options/locale/locale_en-US.ini
  11. +10
    -0
      options/locale/locale_zh-CN.ini
  12. +66
    -42
      public/home/search.js
  13. +47
    -13
      routers/home.go
  14. +2
    -0
      routers/private/internal.go
  15. +4
    -0
      routers/private/tool.go
  16. +237
    -54
      templates/explore/organizations.tmpl
  17. +83
    -0
      web_src/less/openi.less

+ 13
- 0
models/dbsql/dataset_foreigntable_for_es.sql View File

@@ -1,4 +1,17 @@
DELETE FROM public.dataset_es;
DROP FOREIGN TABLE public.dataset_es;
DROP TRIGGER IF EXISTS es_insert_dataset on public.dataset;
DROP FUNCTION public.insert_dataset_data();
DROP TRIGGER IF EXISTS es_udpate_dataset_file_name on public.attachment;
DROP FUNCTION public.udpate_dataset_file_name;

DROP TRIGGER IF EXISTS es_update_dataset on public.dataset;
DROP FUNCTION public.update_dataset;

DROP TRIGGER IF EXISTS es_delete_dataset on public.dataset;
DROP FUNCTION public.delete_dataset;


CREATE FOREIGN TABLE public.dataset_es
(
id bigint NOT NULL,


+ 11
- 0
models/dbsql/issue_foreigntable_for_es.sql View File

@@ -1,4 +1,15 @@
delete from public.issue_es;
DROP FOREIGN TABLE public.issue_es;
DROP TRIGGER IF EXISTS es_insert_issue on public.issue;
DROP FUNCTION public.insert_issue_data;
DROP TRIGGER IF EXISTS es_udpate_issue_comment on public.comment;
DROP FUNCTION udpate_issue_comment;
DROP TRIGGER IF EXISTS es_update_issue on public.issue;
DROP FUNCTION public.update_issue;
DROP TRIGGER IF EXISTS es_delete_issue on public.issue;
DROP FUNCTION public.delete_issue;


CREATE FOREIGN TABLE public.issue_es
(
id bigint NOT NULL,


+ 13
- 0
models/dbsql/repo_foreigntable_for_es.sql View File

@@ -1,5 +1,18 @@
-- 要处理项目从私有变为公有,并且从公有变成私有的情况
DELETE FROM public.repository_es;
DROP FOREIGN table if exists public.repository_es;
DROP TRIGGER IF EXISTS es_insert_repository on public.repository;
DROP FUNCTION public.insert_repository_data;
DROP TRIGGER IF EXISTS es_update_repository on public.repository;
DROP FUNCTION public.update_repository;

DROP TRIGGER IF EXISTS es_delete_repository on public.repository;
DROP FUNCTION public.delete_repository;

DROP TRIGGER IF EXISTS es_udpate_repository_lang on public.language_stat;
DROP FUNCTION public.udpate_repository_lang;


CREATE FOREIGN TABLE public.repository_es (
id bigint NOT NULL,
owner_id bigint,


+ 9
- 0
models/dbsql/user_foreigntable_for_es.sql View File

@@ -1,4 +1,13 @@
DELETE FROM public.user_es;
DROP FOREIGN table if exists public.user_es;
DROP TRIGGER IF EXISTS es_insert_user on public.user;
DROP FUNCTION public.insert_user_data;
DROP TRIGGER IF EXISTS es_update_user on public.user;
DROP FUNCTION public.update_user;

DROP TRIGGER IF EXISTS es_delete_user on public.user;
DROP FUNCTION public.delete_user;

CREATE FOREIGN TABLE public.user_es
(
id bigint NOT NULL ,


+ 1
- 0
models/models.go View File

@@ -138,6 +138,7 @@ func init() {
new(OfficialTag),
new(OfficialTagRepos),
new(WechatBindLog),
new(OrgStatistic),
new(SearchRecord),
)



+ 99
- 0
models/org.go View File

@@ -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() {


+ 10
- 0
models/repo_statistic.go View File

@@ -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()


+ 6
- 0
models/user.go View File

@@ -2104,6 +2104,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 = ''").


+ 12
- 0
modules/cron/tasks_basic.go View File

@@ -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()
}

+ 10
- 0
options/locale/locale_en-US.ini View File

@@ -2198,6 +2198,16 @@ 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

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.


+ 10
- 0
options/locale/locale_zh-CN.ini View File

@@ -2203,6 +2203,16 @@ customize = 自定义
selected_project=精选项目
fold = 收起
unfold = 展开
org_member = 成员
org_members = 成员
org_team = 团队
org_teams = 团队
org_repository = 项目
org_repositories = 项目

star = 点赞榜
member = 成员榜
active = 活跃榜

form.name_reserved=组织名称 '%s' 是被保留的。
form.name_pattern_not_allowed=组织名称中不允许使用 "%s"。


+ 66
- 42
public/home/search.js View File

@@ -108,8 +108,9 @@ function searchItem(type,sortType){
currentSearchSortBy = sortBy[sortType];
currentSearchAscending = sortAscending[sortType];
OnlySearchLabel =false;
page(currentPage);
}else{
emptySearch();
}
}

@@ -121,49 +122,31 @@ function search(){
if(!isEmpty(currentSearchKeyword)){
currentSearchKeyword = currentSearchKeyword.trim();
}
$('#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(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);
initPageInfo();
$('#searchForm').addClass("hiddenSearch");
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";
@@ -174,7 +157,6 @@ function initDiv(isSearchLabel=false){
document.getElementById("user_item").style.display="none";
document.getElementById("org_item").style.display="none";
document.getElementById("find_id").innerHTML="";
}else{
document.getElementById("search_div").style.display="block";
document.getElementById("search_label_div").style.display="none";
@@ -187,6 +169,39 @@ function initDiv(isSearchLabel=false){
}
}

function doSpcifySearch(tableName,keyword,sortBy="",ascending="false"){
initDiv(false);
$('#searchForm').addClass("hiddenSearch");
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 +1287,17 @@ 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");
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....");
search();
}
}
}
}


+ 47
- 13
routers/home.go View File

@@ -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")
@@ -441,17 +444,39 @@ 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 := GetRecommendOrg()
if err != nil {
log.Error("GetRecommendOrgInfos failed:%v", err.Error(), ctx.Data["MsgID"])
ctx.ServerError("GetRecommendOrgInfos", err)
return
}
setRecommendURLOnly(ctx)
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
@@ -583,12 +608,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 {
@@ -598,6 +623,7 @@ func RecommendOrgFromPromote(ctx *context.Context) {
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
@@ -608,7 +634,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)
}



+ 2
- 0
routers/private/internal.go View File

@@ -45,6 +45,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)
m.Post("/task/history_handle/duration", repo.HandleTaskWithNoDuration)



+ 4
- 0
routers/private/tool.go View File

@@ -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)


+ 237
- 54
templates/explore/organizations.tmpl View File

@@ -1,68 +1,251 @@

<link rel="stylesheet" href="/swiper/swiper-bundle.min.css">
<link rel="stylesheet" href="/css/git.openi.css">
<script src="/swiper/swiper-bundle.min.js"></script>
<script src="/self/js/jquery.min.js" type="text/javascript"></script>

{{template "base/head" .}}
<div class="explore users">
{{template "explore/search" .}}

<div class="ui container">
<div class="ui grid">
{{template "explore/navbar" .}}
<div class="sixteen wide mobile ten wide tablet ten wide computer column">
<h2 class="ui left floated medium header">
{{.i18n.Tr "explore.organizations"}}
</h2>
<div class="ui right floated secondary filter menu">
<!-- Sort -->
<div class="ui right dropdown type jump item">
<span class="text">
{{.i18n.Tr "repo.issues.filter_sort"}}
<i class="dropdown icon"></i>
</span>
<div class="menu">
<a class="{{if eq .SortType "newest"}}active{{end}} item" href="{{$.Link}}?sort=newest&q={{$.Keyword}}&tab={{$.TabName}}">{{.i18n.Tr "repo.issues.filter_sort.latest"}}</a>
<a class="{{if eq .SortType "oldest"}}active{{end}} item" href="{{$.Link}}?sort=oldest&q={{$.Keyword}}&tab={{$.TabName}}">{{.i18n.Tr "repo.issues.filter_sort.oldest"}}</a>
<a class="{{if eq .SortType "alphabetically"}}active{{end}} item" href="{{$.Link}}?sort=alphabetically&q={{$.Keyword}}&tab={{$.TabName}}">{{.i18n.Tr "repo.issues.label.filter_sort.alphabetically"}}</a>
<a class="{{if eq .SortType "reversealphabetically"}}active{{end}} item" href="{{$.Link}}?sort=reversealphabetically&q={{$.Keyword}}&tab={{$.TabName}}">{{.i18n.Tr "repo.issues.label.filter_sort.reverse_alphabetically"}}</a>
<a class="{{if eq .SortType "recentupdate"}}active{{end}} item" href="{{$.Link}}?sort=recentupdate&q={{$.Keyword}}&tab={{$.TabName}}">{{.i18n.Tr "repo.issues.filter_sort.recentupdate"}}</a>
<a class="{{if eq .SortType "leastupdate"}}active{{end}} item" href="{{$.Link}}?sort=leastupdate&q={{$.Keyword}}&tab={{$.TabName}}">{{.i18n.Tr "repo.issues.filter_sort.leastupdate"}}</a>
</div>
<!-- {{template "explore/search" .}} -->
<div class="repos--seach">
<div class="ui container">
<div class="ui two column centered grid">
<div class="fourteen wide mobile ten wide tablet ten wide computer column ui form ignore-dirty" >
<div class="ui fluid action input" id="search_all">
<input id = 'value_s' name="q" value="{{.Keyword}}" placeholder="{{.i18n.Tr "explore.search"}}..." onkeydown="if(event.keyCode==13){all_search();}" autofocus>
<input type="hidden" name="tab" value="{{$.TabName}}">
<button class="ui green button" onclick="all_search()">{{.i18n.Tr "explore.search"}}</button>
</div>
</div>
</div>
</div>
</div>

<div class="ui clearing divider"></div>

<div class="ui user list">
{{range .Users}}
<div class="item">
<img class="ui avatar image" src="{{.RelAvatarLink}}">
<div class="content">
<span class="header">
<a href="{{.HomeLink}}">{{.Name}}</a> {{.FullName}}
{{if .Visibility.IsPrivate}}
<span class="text gold">{{svg "octicon-lock" 16}}</span>
{{end}}
</span>
<div class="description">
{{if .Location}}
{{svg "octicon-location" 16}} {{.Location}}
{{end}}
{{if and .Website}}
{{svg "octicon-link" 16}}
<a href="{{.Website}}" rel="nofollow">{{.Website}}</a>
{{end}}
{{svg "octicon-clock" 16}} {{$.i18n.Tr "user.join_on"}} {{.CreatedUnix.FormatShort}}
</div>
</div>
<div class="ui container homeorg">
<div class="ui center aligned header">
<h1 class="title_re">
{{$.i18n.Tr "home.page_recommend_org"}}
</h1>
<p class="re_con"> {{$.i18n.Tr "home.page_recommend_org_desc"}}<a href="{{.RecommendURL}}"> {{$.i18n.Tr "home.page_recommend_org_commit"}}</a></p>
</div>

<div class="sixteen wide tablet sixteen wide computer column">
<div class="homeorg-list" >
<div class="swiper-wrapper" id="recommendorg" style="height:auto">
{{range .RecommendOrgs}}
<div class="swiper-slide">
<a href="{{.HomeLink}}" class= "ui fluid card">
<div class="content">
<div class= "ui small header">
<img class="ui image" src="{{.Avatar}}" >
<div class="content nowrap">
<span class="ui blue"> {{.Name}} </span> {{.FullName}}
<div class="sub header">
<span>
{{.NumRepos}}
{{if le .NumRepos 1}}
{{$.i18n.Tr "org.org_repository"}}
{{else}}
{{$.i18n.Tr "org.org_repositories"}}
{{end}}
</span>
. <span>
{{.NumMembers}}
{{if le .NumRepos 1}}
{{$.i18n.Tr "org.org_member"}}
{{else}}
{{$.i18n.Tr "org.org_members"}}
{{end}}
</span>
.<span>
{{.NumTeams}}
{{if le .NumRepos 1}}
{{$.i18n.Tr "org.org_team"}}
{{else}}
{{$.i18n.Tr "org.org_teams"}}
{{end}}
</span>
</div>
</div>
</div>
</div>
</a>
</div>
{{else}}
<div>{{$.i18n.Tr "explore.org_no_results"}}</div>
{{end}}
</div>

{{template "base/paginate" .}}
<div class="swiper-pagination"></div>
</div>
<div class="sixteen wide mobile six wide tablet three wide computer column">
{{template "explore/repo_right" .}}
</div>
</div>
<div class="ui container homeorg">
<div class="content_top10">
<div class="ui three doubling cards">
<div class="card_list" >
<div class="list_title star_title">
<p class="p_text"> <i class="ri-star-line"> </i>{{$.i18n.Tr "org.star"}}</p>
</div>
<li style="list-style:none">
{{ range $i,$user :=.StarOrgs}}
<ul class="orgs" style="display: flex;">
{{if eq $i 0}}
<div class="org_icon">
<svg width="1em" height="1em" viewBox="0 0 32 32" class="contribution-item-img__2-fih"><defs><path id="rank1_svg__a" d="M13.69 20V9.616h-1.598l-3.139 2.61 1.027 1.218 1.95-1.804V20z"></path></defs><g fill="none" fill-rule="evenodd"><path d="M0 0h32v32H0z"></path><g transform="translate(4 2.667)"><path fill="#D16C11" d="M0 0h6.976l5.49 7.642L17.063 0H24L12 16z"></path><circle fill="#F7C049" cx="12" cy="14.667" r="12"></circle><circle fill="#FEE6AD" cx="12" cy="14.667" r="9.333"></circle><g fill-rule="nonzero"><use fill="#FFF" xlink:href="#rank1_svg__a"></use><use fill="#D74D03" xlink:href="#rank1_svg__a"></use></g></g></g></svg>
</div>
{{else if eq $i 1}}
<div class="org_icon">
<svg width="1em" height="1em" viewBox="0 0 32 32" class="contribution-item-img__2-fih"><g transform="translate(4 2.667)" fill="none" fill-rule="evenodd"><path fill="#305269" d="M0 0h6.976l5.49 7.642L17.063 0H24L12 16z"></path><circle fill="#BDD8F0" cx="12" cy="14.667" r="12"></circle><circle fill="#E1E9FC" cx="12" cy="14.667" r="9.333"></circle><path d="M15.817 20v-1.584h-4.81l3.212-2.977c.469-.43.853-.883 1.151-1.357.298-.474.447-1.039.447-1.694 0-.499-.088-.934-.264-1.305a2.525 2.525 0 00-.718-.917 3.169 3.169 0 00-1.064-.543 4.531 4.531 0 00-1.312-.183c-.47 0-.905.064-1.306.19-.4.128-.753.314-1.056.558-.303.244-.55.55-.74.917-.191.366-.306.79-.345 1.268l1.848.147c.059-.43.23-.772.513-1.027.284-.254.646-.381 1.086-.381.205 0 .398.032.579.095.18.064.34.154.477.272a1.262 1.262 0 01.455.997c0 .176-.035.345-.103.506a2.52 2.52 0 01-.257.462 3.476 3.476 0 01-.345.418c-.127.132-.249.257-.366.374l-4.034 3.901V20h6.952z" fill="#305269" fill-rule="nonzero"></path></g></svg>
</div>
{{else if eq $i 2}}
<div class="org_icon">
<svg width="1em" height="1em" viewBox="0 0 32 32" class="contribution-item-img__2-fih"><g transform="translate(4 2.667)" fill="none" fill-rule="evenodd"><path fill="#865B45" d="M0 0h6.976l5.49 7.642L17.063 0H24L12 16z"></path><circle fill="#E7C5AC" cx="12" cy="14.667" r="12"></circle><circle fill="#FEDDC7" cx="12" cy="14.667" r="9.333"></circle><path d="M12.239 20.176c.46 0 .902-.066 1.327-.198.425-.132.8-.328 1.122-.587.323-.259.58-.579.77-.96.19-.382.286-.822.286-1.32 0-.646-.171-1.203-.513-1.672-.343-.47-.846-.753-1.511-.851v-.03c.557-.136.992-.422 1.305-.857.313-.435.47-.932.47-1.489 0-.46-.09-.863-.272-1.21a2.547 2.547 0 00-.726-.865 3.232 3.232 0 00-1.056-.521 4.521 4.521 0 00-1.276-.176 4.52 4.52 0 00-1.1.132 3.404 3.404 0 00-.968.403 2.79 2.79 0 00-.762.697 3.181 3.181 0 00-.499.997l1.863.499c.127-.362.33-.643.608-.843.279-.2.594-.301.946-.301.44 0 .797.127 1.071.381.274.255.41.582.41.983 0 .313-.058.562-.175.748a1.17 1.17 0 01-.462.425 1.903 1.903 0 01-.646.191 6.09 6.09 0 01-.74.044h-.455v1.584h.425c.264 0 .533.02.807.059.274.039.52.115.74.227.22.112.402.274.543.484.142.21.213.482.213.814a1.533 1.533 0 01-.52 1.18 1.772 1.772 0 01-.558.33 1.88 1.88 0 01-.667.118c-.47 0-.841-.117-1.115-.352s-.464-.567-.572-.997l-1.877.498c.117.43.288.8.513 1.108.225.308.491.56.8.755.307.196.652.34 1.033.433a5.13 5.13 0 001.218.139z" fill="#865B45" fill-rule="nonzero"></path></g></svg>
</div>
{{else }}
<div class="org_icon org_icon_num" >
{{Add $i 1}}
</div>
{{end}}
<li class="li_avatar">
<img class="ui avatar image" src="{{$user.RelAvatarLink}}" >
</li>
<li class="li_name">
<p class="org_line_hight">{{$user.Name}}</p>
</li>
<ul>
<li class="li_score" >
<i class="ri-star-line org_line_hight org_icon_color"></i> &nbsp;<p class="p_score">{{$user.Score}}</p>
</li>
</ul>

</ul>
{{end}}
</li>
</div>
<div class="card_list" >
<div class="list_title star_title">
<p class="p_text"> <i class="ri-user-2-line"> </i>{{$.i18n.Tr "org.member"}}</p>
</div>
<li style="list-style:none">
{{ range $i,$user :=.StarOrgs}}
<ul class="orgs" style="display: flex;">
{{if eq $i 0}}
<div class="org_icon">
<svg width="1em" height="1em" viewBox="0 0 32 32" class="contribution-item-img__2-fih"><defs><path id="rank1_svg__a" d="M13.69 20V9.616h-1.598l-3.139 2.61 1.027 1.218 1.95-1.804V20z"></path></defs><g fill="none" fill-rule="evenodd"><path d="M0 0h32v32H0z"></path><g transform="translate(4 2.667)"><path fill="#D16C11" d="M0 0h6.976l5.49 7.642L17.063 0H24L12 16z"></path><circle fill="#F7C049" cx="12" cy="14.667" r="12"></circle><circle fill="#FEE6AD" cx="12" cy="14.667" r="9.333"></circle><g fill-rule="nonzero"><use fill="#FFF" xlink:href="#rank1_svg__a"></use><use fill="#D74D03" xlink:href="#rank1_svg__a"></use></g></g></g></svg>
</div>
{{else if eq $i 1}}
<div class="org_icon">
<svg width="1em" height="1em" viewBox="0 0 32 32" class="contribution-item-img__2-fih"><g transform="translate(4 2.667)" fill="none" fill-rule="evenodd"><path fill="#305269" d="M0 0h6.976l5.49 7.642L17.063 0H24L12 16z"></path><circle fill="#BDD8F0" cx="12" cy="14.667" r="12"></circle><circle fill="#E1E9FC" cx="12" cy="14.667" r="9.333"></circle><path d="M15.817 20v-1.584h-4.81l3.212-2.977c.469-.43.853-.883 1.151-1.357.298-.474.447-1.039.447-1.694 0-.499-.088-.934-.264-1.305a2.525 2.525 0 00-.718-.917 3.169 3.169 0 00-1.064-.543 4.531 4.531 0 00-1.312-.183c-.47 0-.905.064-1.306.19-.4.128-.753.314-1.056.558-.303.244-.55.55-.74.917-.191.366-.306.79-.345 1.268l1.848.147c.059-.43.23-.772.513-1.027.284-.254.646-.381 1.086-.381.205 0 .398.032.579.095.18.064.34.154.477.272a1.262 1.262 0 01.455.997c0 .176-.035.345-.103.506a2.52 2.52 0 01-.257.462 3.476 3.476 0 01-.345.418c-.127.132-.249.257-.366.374l-4.034 3.901V20h6.952z" fill="#305269" fill-rule="nonzero"></path></g></svg>
</div>
{{else if eq $i 2}}
<div class="org_icon">
<svg width="1em" height="1em" viewBox="0 0 32 32" class="contribution-item-img__2-fih"><g transform="translate(4 2.667)" fill="none" fill-rule="evenodd"><path fill="#865B45" d="M0 0h6.976l5.49 7.642L17.063 0H24L12 16z"></path><circle fill="#E7C5AC" cx="12" cy="14.667" r="12"></circle><circle fill="#FEDDC7" cx="12" cy="14.667" r="9.333"></circle><path d="M12.239 20.176c.46 0 .902-.066 1.327-.198.425-.132.8-.328 1.122-.587.323-.259.58-.579.77-.96.19-.382.286-.822.286-1.32 0-.646-.171-1.203-.513-1.672-.343-.47-.846-.753-1.511-.851v-.03c.557-.136.992-.422 1.305-.857.313-.435.47-.932.47-1.489 0-.46-.09-.863-.272-1.21a2.547 2.547 0 00-.726-.865 3.232 3.232 0 00-1.056-.521 4.521 4.521 0 00-1.276-.176 4.52 4.52 0 00-1.1.132 3.404 3.404 0 00-.968.403 2.79 2.79 0 00-.762.697 3.181 3.181 0 00-.499.997l1.863.499c.127-.362.33-.643.608-.843.279-.2.594-.301.946-.301.44 0 .797.127 1.071.381.274.255.41.582.41.983 0 .313-.058.562-.175.748a1.17 1.17 0 01-.462.425 1.903 1.903 0 01-.646.191 6.09 6.09 0 01-.74.044h-.455v1.584h.425c.264 0 .533.02.807.059.274.039.52.115.74.227.22.112.402.274.543.484.142.21.213.482.213.814a1.533 1.533 0 01-.52 1.18 1.772 1.772 0 01-.558.33 1.88 1.88 0 01-.667.118c-.47 0-.841-.117-1.115-.352s-.464-.567-.572-.997l-1.877.498c.117.43.288.8.513 1.108.225.308.491.56.8.755.307.196.652.34 1.033.433a5.13 5.13 0 001.218.139z" fill="#865B45" fill-rule="nonzero"></path></g></svg>
</div>
{{else }}
<div class="org_icon org_icon_num" >
{{Add $i 1}}
</div>
{{end}}
<li class="li_avatar">
<img class="ui avatar image" src="{{$user.RelAvatarLink}}" >
</li>
<li class="li_name">
<p class="org_line_hight">{{$user.Name}}</p>
</li>
<ul>
<li class="li_score">
<i class="ri-user-2-line org_line_hight org_icon_color"></i> &nbsp;<p class="p_score">{{$user.Score}}</p>
</li>
</ul>

</ul>
{{end}}
</li>
</div>
<div class="card_list" >
<div class="list_title star_title">
<p class="p_text"> <i class="ri-blaze-fill"> </i>{{$.i18n.Tr "org.active"}}</p>
</div>
<li style="list-style:none">
{{ range $i,$user :=.StarOrgs}}
<ul class="orgs" style="display: flex;">
{{if eq $i 0}}
<div class="org_icon">
<svg width="1em" height="1em" viewBox="0 0 32 32" class="contribution-item-img__2-fih"><defs><path id="rank1_svg__a" d="M13.69 20V9.616h-1.598l-3.139 2.61 1.027 1.218 1.95-1.804V20z"></path></defs><g fill="none" fill-rule="evenodd"><path d="M0 0h32v32H0z"></path><g transform="translate(4 2.667)"><path fill="#D16C11" d="M0 0h6.976l5.49 7.642L17.063 0H24L12 16z"></path><circle fill="#F7C049" cx="12" cy="14.667" r="12"></circle><circle fill="#FEE6AD" cx="12" cy="14.667" r="9.333"></circle><g fill-rule="nonzero"><use fill="#FFF" xlink:href="#rank1_svg__a"></use><use fill="#D74D03" xlink:href="#rank1_svg__a"></use></g></g></g></svg>
</div>
{{else if eq $i 1}}
<div class="org_icon">
<svg width="1em" height="1em" viewBox="0 0 32 32" class="contribution-item-img__2-fih"><g transform="translate(4 2.667)" fill="none" fill-rule="evenodd"><path fill="#305269" d="M0 0h6.976l5.49 7.642L17.063 0H24L12 16z"></path><circle fill="#BDD8F0" cx="12" cy="14.667" r="12"></circle><circle fill="#E1E9FC" cx="12" cy="14.667" r="9.333"></circle><path d="M15.817 20v-1.584h-4.81l3.212-2.977c.469-.43.853-.883 1.151-1.357.298-.474.447-1.039.447-1.694 0-.499-.088-.934-.264-1.305a2.525 2.525 0 00-.718-.917 3.169 3.169 0 00-1.064-.543 4.531 4.531 0 00-1.312-.183c-.47 0-.905.064-1.306.19-.4.128-.753.314-1.056.558-.303.244-.55.55-.74.917-.191.366-.306.79-.345 1.268l1.848.147c.059-.43.23-.772.513-1.027.284-.254.646-.381 1.086-.381.205 0 .398.032.579.095.18.064.34.154.477.272a1.262 1.262 0 01.455.997c0 .176-.035.345-.103.506a2.52 2.52 0 01-.257.462 3.476 3.476 0 01-.345.418c-.127.132-.249.257-.366.374l-4.034 3.901V20h6.952z" fill="#305269" fill-rule="nonzero"></path></g></svg>
</div>
{{else if eq $i 2}}
<div class="org_icon">
<svg width="1em" height="1em" viewBox="0 0 32 32" class="contribution-item-img__2-fih"><g transform="translate(4 2.667)" fill="none" fill-rule="evenodd"><path fill="#865B45" d="M0 0h6.976l5.49 7.642L17.063 0H24L12 16z"></path><circle fill="#E7C5AC" cx="12" cy="14.667" r="12"></circle><circle fill="#FEDDC7" cx="12" cy="14.667" r="9.333"></circle><path d="M12.239 20.176c.46 0 .902-.066 1.327-.198.425-.132.8-.328 1.122-.587.323-.259.58-.579.77-.96.19-.382.286-.822.286-1.32 0-.646-.171-1.203-.513-1.672-.343-.47-.846-.753-1.511-.851v-.03c.557-.136.992-.422 1.305-.857.313-.435.47-.932.47-1.489 0-.46-.09-.863-.272-1.21a2.547 2.547 0 00-.726-.865 3.232 3.232 0 00-1.056-.521 4.521 4.521 0 00-1.276-.176 4.52 4.52 0 00-1.1.132 3.404 3.404 0 00-.968.403 2.79 2.79 0 00-.762.697 3.181 3.181 0 00-.499.997l1.863.499c.127-.362.33-.643.608-.843.279-.2.594-.301.946-.301.44 0 .797.127 1.071.381.274.255.41.582.41.983 0 .313-.058.562-.175.748a1.17 1.17 0 01-.462.425 1.903 1.903 0 01-.646.191 6.09 6.09 0 01-.74.044h-.455v1.584h.425c.264 0 .533.02.807.059.274.039.52.115.74.227.22.112.402.274.543.484.142.21.213.482.213.814a1.533 1.533 0 01-.52 1.18 1.772 1.772 0 01-.558.33 1.88 1.88 0 01-.667.118c-.47 0-.841-.117-1.115-.352s-.464-.567-.572-.997l-1.877.498c.117.43.288.8.513 1.108.225.308.491.56.8.755.307.196.652.34 1.033.433a5.13 5.13 0 001.218.139z" fill="#865B45" fill-rule="nonzero"></path></g></svg>
</div>
{{else }}
<div class="org_icon org_icon_num" >
{{Add $i 1}}
</div>
{{end}}
<li class="li_avatar">
<img class="ui avatar image" src="{{$user.RelAvatarLink}}" >
</li>
<li class="li_name">
<p class="org_line_hight">{{$user.Name}}</p>
</li>

</ul>
{{end}}
</li>
</div>
</div>
</div>
</div>



</div>

{{template "base/footer" .}}

<script>


function all_search(){
var inputValue = document.getElementById("value_s").value;
console.log("Keyword",inputValue)
sessionStorage.setItem("keyword",inputValue);
sessionStorage.setItem("tableName","org");
sessionStorage.setItem("specifySearch",true);
sessionStorage.setItem("sortBy","default");
sessionStorage.setItem("ascending","false");
window.open("/all/search/");

}

window.onload = function() {
var swiperOrg = new Swiper(".homeorg-list", {
slidesPerView: 1,
slidesPerColumn: 3,
slidesPerColumnFill:'row',
spaceBetween: 15,
pagination: {
el: ".swiper-pagination",
clickable: true,
},
autoplay: {
delay: 4500,
disableOnInteraction: false,
},
breakpoints: {
768: {
slidesPerView: 3,
},
1024: {
slidesPerView: 4,
},
},

});

}

</script>

+ 83
- 0
web_src/less/openi.less View File

@@ -811,6 +811,89 @@ display: block;
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: 13px;
}
.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;
}
/**seach**/
/**搜索导航条适配窄屏**/
.seachnav{


Loading…
Cancel
Save