Skip to content

Commit da0b2e6

Browse files
committed
Update
1 parent aa38a6e commit da0b2e6

File tree

4 files changed

+30
-23
lines changed

4 files changed

+30
-23
lines changed

models/migrations/v1_24/v314.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ type StarList struct {
2020
}
2121

2222
type StarListRepo struct {
23+
ID int64 `xorm:"pk autoincr"`
2324
UID int64 `xorm:"UNIQUE(s)"`
2425
StarListID int64 `xorm:"UNIQUE(s)"`
2526
RepoID int64 `xorm:"UNIQUE(s)"`

models/repo/star_list_repo.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import (
77
)
88

99
type StarListRepo struct {
10+
ID int64 `xorm:"pk autoincr"`
1011
UID int64 `xorm:"UNIQUE(s)"`
1112
StarListID int64 `xorm:"UNIQUE(s)"`
1213
RepoID int64 `xorm:"UNIQUE(s)"`

routers/web/user/profile.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -190,6 +190,12 @@ func prepareUserProfileTabData(ctx *context.Context, showPrivate bool, profileDb
190190
total = int(count)
191191
case "stars":
192192
ctx.Data["PageIsProfileStarList"] = true
193+
starList, err := repo_model.GetStarListsForUser(ctx, ctx.ContextUser.ID)
194+
if err != nil {
195+
ctx.ServerError("SearchStarList", err)
196+
return
197+
}
198+
ctx.Data["StarList"] = starList
193199
repos, count, err = repo_model.SearchRepository(ctx, &repo_model.SearchRepoOptions{
194200
ListOptions: db.ListOptions{
195201
PageSize: pagingNum,

templates/shared/star_list.tmpl

Lines changed: 22 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
{{if true }}
1+
{{if .PageIsProfileStarList }}
22
<div class="star-list">
33
<!-- Header -->
4-
<div class="top">
4+
<div class="top tw-mb-3">
55
<div>
66
<span>Lists(26)</span>
77
</div>
@@ -28,49 +28,48 @@
2828
</div>
2929
<!-- Create List-->
3030
<div>
31-
<button class="ui primary button muted show-modal" href="#" data-modal="#create-star-list" data-modal-modal-form.action="{{AppSubUrl}}/stars/lists">Create list</button>
31+
<button class="ui primary button muted show-modal" data-modal="#create-star-list" data-modal-modal-form.action="{{AppSubUrl}}/stars/lists">Create list</button>
3232
</div>
3333
</div>
3434
</div>
3535

3636
<!-- List -->
3737
<div id="profile-lists-container">
38+
{{if gt (len .StarList) 0}}
3839
<div class="list-box">
40+
{{range .StarList}}
3941
<a href="https://ilo.nz" class="box-row">
40-
<h3 class="name">Vim</h3>
42+
<h3 class="name">{{.Name}}</h3>
4143
<div class="repositories">
4244
88 repositories
4345
</div>
4446
</a>
45-
<a href="https://ilo.nz" class="box-row">
46-
<h3 class="name">Gitea</h3>
47-
<div class="repositories">
48-
123 repositories
49-
</div>
50-
</a>
51-
<a href="https://ilo.nz" class="box-row">
52-
<h3 class="name">Git</h3>
53-
<div class="repositories">
54-
12 repositories
55-
</div>
56-
</a>
57-
<a href="https://ilo.nz" class="box-row">
58-
<h3 class="name">NeoVim</h3>
59-
<div class="repositories">
60-
6 repositories
47+
{{end}}
48+
</div>
49+
{{else}}
50+
<div class="ui attached segment tw-text-center tw-flex tw-items-center tw-justify-center tw-h-64 tw-border tw-rounded-md tw-border-red-600">
51+
<div class="content">
52+
<div class="">{{svg "octicon-star"}}</div>
53+
<div class="tw-mt-5 tw-text-20 tw-font-bold">Create your first list</div>
54+
<div class="tw-mt-5">
55+
Lists make it easier to organize and curate repositories that you have starred.
56+
<a class="ui show-modal" href="#" data-modal="#create-star-list" data-modal-modal-form.action="{{AppSubUrl}}/stars/lists">Create your first list</a>
6157
</div>
62-
</a>
58+
</div>
6359
</div>
60+
{{end}}
6461
</div>
6562
</div>
66-
{{else if false }}
63+
{{else }}
6764
<div class="star-list-repos">
6865
<div class="top">
6966
<h2>Test</h2>
7067
<a class="muted show-modal" href="#" data-modal="#edit-star-list" data-modal-modal-form.action="{{AppSubUrl}}/stars/lists">Edit list</a>
7168
</div>
7269
<div class="description">Test</div>
73-
<div class="repositories">1 repositories</div>
70+
<div class="repositories">
71+
{{svg "octicon-repo"}} 12 {{ctx.Locale.Tr "user.repositories"}}
72+
</div>
7473
</div>
7574
{{end}}
7675

0 commit comments

Comments
 (0)