0
0
mirror of https://github.com/go-gitea/gitea.git synced 2024-12-11 14:54:52 +01:00
gitea/templates/user/dashboard/repolist.tmpl
wxiaoguang e82f1b15c7
Refactor dashboard repo list to Vue SFC (#23405)
Similar to #23394

The dashboard repo list mixes jQuery/Fomantic UI/Vue together, it's very
diffcult to maintain and causes unfixable a11y problems.

This PR uses two steps to refactor the repo list:

1. move `data-` attributes to JS object and use Vue data as much as
possible
d3adc0dcac
2. move the code into a Vue SFC
7ebe55df6e

Total: +516 −585

Screenshots:

<details>

![image](https://user-images.githubusercontent.com/2114189/224271457-a23e05be-d7d3-4247-a803-f0ee30c36f44.png)

![image](https://user-images.githubusercontent.com/2114189/224271504-76fbd3da-4d7a-4725-b0d1-fbff83caac63.png)

![image](https://user-images.githubusercontent.com/2114189/224271845-f007cadf-6c49-46bd-a65c-a3fc75bdba3b.png)

</details>

---------

Co-authored-by: John Olheiser <john.olheiser@gmail.com>
2023-03-14 12:09:06 +08:00

55 lines
1.9 KiB
Handlebars

<script type="module">
const data = {
...window.config.pageData.dashboardRepoList, // it only contains searchLimit and uid
isMirrorsEnabled: {{.IsMirrorsEnabled}},
isStarsEnabled: {{not .IsDisableStars}},
textRepository: {{.locale.Tr "repository"}},
textOrganization: {{.locale.Tr "organization"}},
textMyRepos: {{.locale.Tr "home.my_repos"}},
textNewRepo: {{.locale.Tr "new_repo"}},
textSearchRepos: {{.locale.Tr "home.search_repos"}},
textFilter: {{.locale.Tr "home.filter"}},
textShowArchived: {{.locale.Tr "home.show_archived"}},
textShowPrivate: {{.locale.Tr "home.show_private"}},
textShowBothArchivedUnarchived: {{.locale.Tr "home.show_both_archived_unarchived"}},
textShowOnlyUnarchived: {{.locale.Tr "home.show_only_unarchived"}},
textShowOnlyArchived: {{.locale.Tr "home.show_only_archived"}},
textShowBothPrivatePublic: {{.locale.Tr "home.show_both_private_public"}},
textShowOnlyPublic: {{.locale.Tr "home.show_only_public"}},
textShowOnlyPrivate: {{.locale.Tr "home.show_only_private"}},
textAll: {{.locale.Tr "all"}},
textSources: {{.locale.Tr "sources"}},
textForks: {{.locale.Tr "forks"}},
textMirrors: {{.locale.Tr "mirrors"}},
textCollaborative: {{.locale.Tr "collaborative"}},
textFirstPage: {{.locale.Tr "admin.first_page"}},
textPreviousPage: {{.locale.Tr "repo.issues.previous"}},
textNextPage: {{.locale.Tr "repo.issues.next"}},
textLastPage: {{.locale.Tr "admin.last_page"}},
textMyOrgs: {{.locale.Tr "home.my_orgs"}},
textNewOrg: {{.locale.Tr "new_org"}},
};
{{if .Team}}
data.teamId = {{.Team.ID}};
{{end}}
{{if not .ContextUser.IsOrganization}}
data.organizations = [{{range .Orgs}}{'name': {{.Name}}, 'num_repos': {{.NumRepos}}},{{end}}];
data.isOrganization = false;
data.organizationsTotalCount = {{.UserOrgsCount}}
data.canCreateOrganization = {{.SignedUser.CanCreateOrganization}}
{{end}}
window.config.pageData.dashboardRepoList = data;
</script>
<div id="dashboard-repo-list" class="six wide column"></div>