Skip to content

Commit

Permalink
Update
Browse files Browse the repository at this point in the history
  • Loading branch information
hiifong committed Feb 25, 2025
1 parent aa38a6e commit da0b2e6
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 23 deletions.
1 change: 1 addition & 0 deletions models/migrations/v1_24/v314.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ type StarList struct {
}

type StarListRepo struct {
ID int64 `xorm:"pk autoincr"`
UID int64 `xorm:"UNIQUE(s)"`
StarListID int64 `xorm:"UNIQUE(s)"`
RepoID int64 `xorm:"UNIQUE(s)"`
Expand Down
1 change: 1 addition & 0 deletions models/repo/star_list_repo.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (
)

type StarListRepo struct {
ID int64 `xorm:"pk autoincr"`
UID int64 `xorm:"UNIQUE(s)"`
StarListID int64 `xorm:"UNIQUE(s)"`
RepoID int64 `xorm:"UNIQUE(s)"`
Expand Down
6 changes: 6 additions & 0 deletions routers/web/user/profile.go
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,12 @@ func prepareUserProfileTabData(ctx *context.Context, showPrivate bool, profileDb
total = int(count)
case "stars":
ctx.Data["PageIsProfileStarList"] = true
starList, err := repo_model.GetStarListsForUser(ctx, ctx.ContextUser.ID)
if err != nil {
ctx.ServerError("SearchStarList", err)
return
}
ctx.Data["StarList"] = starList
repos, count, err = repo_model.SearchRepository(ctx, &repo_model.SearchRepoOptions{
ListOptions: db.ListOptions{
PageSize: pagingNum,
Expand Down
45 changes: 22 additions & 23 deletions templates/shared/star_list.tmpl
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{{if true }}
{{if .PageIsProfileStarList }}
<div class="star-list">
<!-- Header -->
<div class="top">
<div class="top tw-mb-3">
<div>
<span>Lists(26)</span>
</div>
Expand All @@ -28,49 +28,48 @@
</div>
<!-- Create List-->
<div>
<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>
<button class="ui primary button muted show-modal" data-modal="#create-star-list" data-modal-modal-form.action="{{AppSubUrl}}/stars/lists">Create list</button>
</div>
</div>
</div>

<!-- List -->
<div id="profile-lists-container">
{{if gt (len .StarList) 0}}
<div class="list-box">
{{range .StarList}}
<a href="https://ilo.nz" class="box-row">
<h3 class="name">Vim</h3>
<h3 class="name">{{.Name}}</h3>
<div class="repositories">
88 repositories
</div>
</a>
<a href="https://ilo.nz" class="box-row">
<h3 class="name">Gitea</h3>
<div class="repositories">
123 repositories
</div>
</a>
<a href="https://ilo.nz" class="box-row">
<h3 class="name">Git</h3>
<div class="repositories">
12 repositories
</div>
</a>
<a href="https://ilo.nz" class="box-row">
<h3 class="name">NeoVim</h3>
<div class="repositories">
6 repositories
{{end}}
</div>
{{else}}
<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">
<div class="content">
<div class="">{{svg "octicon-star"}}</div>
<div class="tw-mt-5 tw-text-20 tw-font-bold">Create your first list</div>
<div class="tw-mt-5">
Lists make it easier to organize and curate repositories that you have starred.
<a class="ui show-modal" href="#" data-modal="#create-star-list" data-modal-modal-form.action="{{AppSubUrl}}/stars/lists">Create your first list</a>
</div>
</a>
</div>
</div>
{{end}}
</div>
</div>
{{else if false }}
{{else }}
<div class="star-list-repos">
<div class="top">
<h2>Test</h2>
<a class="muted show-modal" href="#" data-modal="#edit-star-list" data-modal-modal-form.action="{{AppSubUrl}}/stars/lists">Edit list</a>
</div>
<div class="description">Test</div>
<div class="repositories">1 repositories</div>
<div class="repositories">
{{svg "octicon-repo"}} 12 {{ctx.Locale.Tr "user.repositories"}}
</div>
</div>
{{end}}

Expand Down

0 comments on commit da0b2e6

Please sign in to comment.