|
| 1 | +<script type="module"> |
| 2 | +const data = { |
| 3 | + ...window.config.pageData.dashboardRepoList, // it only contains searchLimit and uid |
| 4 | + |
| 5 | + isMirrorsEnabled: {{.IsMirrorsEnabled}}, |
| 6 | + isStarsEnabled: {{not .IsDisableStars}}, |
| 7 | + |
| 8 | + textRepository: {{.locale.Tr "repository"}}, |
| 9 | + textOrganization: {{.locale.Tr "organization"}}, |
| 10 | + textMyRepos: {{.locale.Tr "home.my_repos"}}, |
| 11 | + textNewRepo: {{.locale.Tr "new_repo"}}, |
| 12 | + textSearchRepos: {{.locale.Tr "home.search_repos"}}, |
| 13 | + textFilter: {{.locale.Tr "home.filter"}}, |
| 14 | + textShowArchived: {{.locale.Tr "home.show_archived"}}, |
| 15 | + textShowPrivate: {{.locale.Tr "home.show_private"}}, |
| 16 | + |
| 17 | + textShowBothArchivedUnarchived: {{.locale.Tr "home.show_both_archived_unarchived"}}, |
| 18 | + textShowOnlyUnarchived: {{.locale.Tr "home.show_only_unarchived"}}, |
| 19 | + textShowOnlyArchived: {{.locale.Tr "home.show_only_archived"}}, |
| 20 | + |
| 21 | + textShowBothPrivatePublic: {{.locale.Tr "home.show_both_private_public"}}, |
| 22 | + textShowOnlyPublic: {{.locale.Tr "home.show_only_public"}}, |
| 23 | + textShowOnlyPrivate: {{.locale.Tr "home.show_only_private"}}, |
| 24 | + |
| 25 | + textAll: {{.locale.Tr "all"}}, |
| 26 | + textSources: {{.locale.Tr "sources"}}, |
| 27 | + textForks: {{.locale.Tr "forks"}}, |
| 28 | + textMirrors: {{.locale.Tr "mirrors"}}, |
| 29 | + textCollaborative: {{.locale.Tr "collaborative"}}, |
| 30 | + |
| 31 | + textFirstPage: {{.locale.Tr "admin.first_page"}}, |
| 32 | + textPreviousPage: {{.locale.Tr "repo.issues.previous"}}, |
| 33 | + textNextPage: {{.locale.Tr "repo.issues.next"}}, |
| 34 | + textLastPage: {{.locale.Tr "admin.last_page"}}, |
| 35 | + |
| 36 | + textMyOrgs: {{.locale.Tr "home.my_orgs"}}, |
| 37 | + textNewOrg: {{.locale.Tr "new_org"}}, |
| 38 | +}; |
| 39 | + |
| 40 | +{{if .Team}} |
| 41 | +data.teamId = {{.Team.ID}}; |
| 42 | +{{end}} |
| 43 | + |
| 44 | +{{if not .ContextUser.IsOrganization}} |
| 45 | +data.organizations = [{{range .Orgs}}{'name': {{.Name}}, 'num_repos': {{.NumRepos}}},{{end}}]; |
| 46 | +data.isOrganization = false; |
| 47 | +data.organizationsTotalCount = {{.UserOrgsCount}} |
| 48 | +data.canCreateOrganization = {{.SignedUser.CanCreateOrganization}} |
| 49 | +{{end}} |
| 50 | + |
| 51 | +window.config.pageData.dashboardRepoList = data; |
| 52 | +</script> |
| 53 | + |
1 | 54 | <div id="dashboard-repo-list" class="six wide column"> |
2 | | - <repo-search |
3 | | - :search-limit="searchLimit" |
4 | | - :sub-url="subUrl" |
5 | | - :uid="uid" |
6 | | - {{if .Team}} |
7 | | - :team-id="{{.Team.ID}}" |
8 | | - {{end}} |
9 | | - :more-repos-link="'{{.ContextUser.HomeLink}}'" |
10 | | - {{if not .ContextUser.IsOrganization}} |
11 | | - :organizations="[ |
12 | | - {{range .Orgs}} |
13 | | - {name: '{{.Name}}', num_repos: '{{.NumRepos}}'}, |
14 | | - {{end}} |
15 | | - ]" |
16 | | - :is-organization="false" |
17 | | - :organizations-total-count="{{.UserOrgsCount}}" |
18 | | - :can-create-organization="{{.SignedUser.CanCreateOrganization}}" |
19 | | - {{end}} |
20 | | - inline-template |
21 | | - v-cloak |
22 | | - ></repo-search> |
| 55 | + <repo-search></repo-search> |
23 | 56 | </div> |
24 | 57 |
|
25 | 58 | <template id="dashboard-repo-list-template"> |
26 | 59 | <div> |
27 | 60 | <div v-if="!isOrganization" class="ui two item tabable menu"> |
28 | | - <a :class="{item: true, active: tab === 'repos'}" @click="changeTab('repos')">{{.locale.Tr "repository"}}</a> |
29 | | - <a :class="{item: true, active: tab === 'organizations'}" @click="changeTab('organizations')">{{.locale.Tr "organization"}}</a> |
| 61 | + <a :class="{item: true, active: tab === 'repos'}" @click="changeTab('repos')">${textRepository}</a> |
| 62 | + <a :class="{item: true, active: tab === 'organizations'}" @click="changeTab('organizations')">${textOrganization}</a> |
30 | 63 | </div> |
31 | 64 | <div v-show="tab === 'repos'" class="ui tab active list dashboard-repos"> |
32 | 65 | <h4 class="ui top attached header gt-df gt-ac"> |
33 | 66 | <div class="gt-f1 gt-df gt-ac"> |
34 | | - {{.locale.Tr "home.my_repos"}} |
| 67 | + ${textMyRepos} |
35 | 68 | <span class="ui grey label gt-ml-3">${reposTotalCount}</span> |
36 | 69 | </div> |
37 | | - <a class="tooltip" :href="subUrl + '/repo/create'" data-content="{{.locale.Tr "new_repo"}}" data-position="left center"> |
38 | | - {{svg "octicon-plus"}} |
39 | | - <span class="sr-only">{{.locale.Tr "new_repo"}}</span> |
| 70 | + <a class="tooltip" :href="subUrl + '/repo/create'" :data-content="textNewRepo" data-position="left center"> |
| 71 | + <svg-icon name="octicon-plus"></svg-icon> |
| 72 | + <span class="sr-only">${textNewRepo}</span> |
40 | 73 | </a> |
41 | 74 | </h4> |
42 | 75 | <div class="ui attached segment repos-search"> |
43 | 76 | <div class="ui fluid right action left icon input" :class="{loading: isLoading}"> |
44 | | - <input @input="changeReposFilter(reposFilter)" v-model="searchQuery" ref="search" placeholder="{{.locale.Tr "home.search_repos"}}"> |
45 | | - <i class="icon gt-df gt-ac gt-jc">{{svg "octicon-search" 16}}</i> |
46 | | - <div class="ui dropdown icon button" title="{{.locale.Tr "home.filter"}}"> |
47 | | - <i class="icon gt-df gt-ac gt-jc gt-m-0">{{svg "octicon-filter" 16}}</i> |
| 77 | + <input @input="changeReposFilter(reposFilter)" v-model="searchQuery" ref="search" :placeholder="textSearchRepos"> |
| 78 | + <i class="icon gt-df gt-ac gt-jc"><svg-icon name="octicon-search" :size="16"></svg-icon></i> |
| 79 | + <div class="ui dropdown icon button" :title="textFilter"> |
| 80 | + <i class="icon gt-df gt-ac gt-jc gt-m-0"><svg-icon name="octicon-filter" :size="16"></svg-icon></i> |
48 | 81 | <div class="menu"> |
49 | 82 | <a class="item" @click="toggleArchivedFilter()"> |
50 | | - <div class="ui checkbox" |
51 | | - ref="checkboxArchivedFilter" |
52 | | - data-title-both="{{.locale.Tr "home.show_both_archived_unarchived"}}" |
53 | | - data-title-unarchived="{{.locale.Tr "home.show_only_unarchived"}}" |
54 | | - data-title-archived="{{.locale.Tr "home.show_only_archived"}}" |
55 | | - :title="checkboxArchivedFilterTitle" |
56 | | - > |
| 83 | + <div class="ui checkbox" ref="checkboxArchivedFilter" :title="checkboxArchivedFilterTitle"> |
57 | 84 | <!--the "hidden" is necessary to make the checkbox work without Fomantic UI js, |
58 | 85 | otherwise if the "input" handles click event for intermediate status, it breaks the internal state--> |
59 | 86 | <input type="checkbox" class="hidden" v-bind.prop="checkboxArchivedFilterProps"> |
60 | 87 | <label> |
61 | | - {{svg "octicon-archive" 16 "gt-mr-2"}} |
62 | | - {{.locale.Tr "home.show_archived"}} |
| 88 | + <svg-icon name="octicon-archive" :size="16" class-name="gt-mr-2"></svg-icon> |
| 89 | + ${textShowArchived} |
63 | 90 | </label> |
64 | 91 | </div> |
65 | 92 | </a> |
66 | 93 | <a class="item" @click="togglePrivateFilter()"> |
67 | | - <div class="ui checkbox" |
68 | | - ref="checkboxPrivateFilter" |
69 | | - data-title-both="{{.locale.Tr "home.show_both_private_public"}}" |
70 | | - data-title-public="{{.locale.Tr "home.show_only_public"}}" |
71 | | - data-title-private="{{.locale.Tr "home.show_only_private"}}" |
72 | | - :title="checkboxPrivateFilterTitle" |
73 | | - > |
| 94 | + <div class="ui checkbox" ref="checkboxPrivateFilter" :title="checkboxPrivateFilterTitle"> |
74 | 95 | <input type="checkbox" class="hidden" v-bind.prop="checkboxPrivateFilterProps"> |
75 | 96 | <label> |
76 | | - {{svg "octicon-lock" 16 "gt-mr-2"}} |
77 | | - {{.locale.Tr "home.show_private"}} |
| 97 | + <svg-icon name="octicon-lock" :size="16" class-name="gt-mr-2"></svg-icon> |
| 98 | + ${textShowPrivate} |
78 | 99 | </label> |
79 | 100 | </div> |
80 | 101 | </a> |
|
83 | 104 | </div> |
84 | 105 | <div class="ui secondary tiny pointing borderless menu center grid repos-filter"> |
85 | 106 | <a class="item" :class="{active: reposFilter === 'all'}" @click="changeReposFilter('all')"> |
86 | | - {{.locale.Tr "all"}} |
| 107 | + ${textAll} |
87 | 108 | <div v-show="reposFilter === 'all'" class="ui circular mini grey label">${repoTypeCount}</div> |
88 | 109 | </a> |
89 | 110 | <a class="item" :class="{active: reposFilter === 'sources'}" @click="changeReposFilter('sources')"> |
90 | | - {{.locale.Tr "sources"}} |
| 111 | + ${textSources} |
91 | 112 | <div v-show="reposFilter === 'sources'" class="ui circular mini grey label">${repoTypeCount}</div> |
92 | 113 | </a> |
93 | 114 | <a class="item" :class="{active: reposFilter === 'forks'}" @click="changeReposFilter('forks')"> |
94 | | - {{.locale.Tr "forks"}} |
| 115 | + ${textForks} |
95 | 116 | <div v-show="reposFilter === 'forks'" class="ui circular mini grey label">${repoTypeCount}</div> |
96 | 117 | </a> |
97 | | - {{if .MirrorsEnabled}} |
98 | | - <a class="item" :class="{active: reposFilter === 'mirrors'}" @click="changeReposFilter('mirrors')"> |
99 | | - {{.locale.Tr "mirrors"}} |
| 118 | + <a class="item" :class="{active: reposFilter === 'mirrors'}" @click="changeReposFilter('mirrors')" v-if="isMirrorsEnabled"> |
| 119 | + ${textMirrors} |
100 | 120 | <div v-show="reposFilter === 'mirrors'" class="ui circular mini grey label">${repoTypeCount}</div> |
101 | 121 | </a> |
102 | | - {{end}} |
103 | 122 | <a class="item" :class="{active: reposFilter === 'collaborative'}" @click="changeReposFilter('collaborative')"> |
104 | | - {{.locale.Tr "collaborative"}} |
| 123 | + ${textCollaborative} |
105 | 124 | <div v-show="reposFilter === 'collaborative'" class="ui circular mini grey label">${repoTypeCount}</div> |
106 | 125 | </a> |
107 | 126 | </div> |
|
114 | 133 | <component v-bind:is="repoIcon(repo)" size="16" class="gt-mr-2"></component> |
115 | 134 | <div class="text gt-bold truncate gt-ml-1">${repo.full_name}</div> |
116 | 135 | <span v-if="repo.archived"> |
117 | | - {{svg "octicon-archive" 16 "gt-ml-2"}} |
| 136 | + <svg-icon name="octicon-archive" :size="16" class-name="gt-ml-2"></svg-icon> |
118 | 137 | </span> |
119 | 138 | </div> |
120 | | - {{if not .DisableStars}} |
121 | | - <div class="text light grey gt-df gt-ac"> |
122 | | - ${repo.stars_count} |
123 | | - {{svg "octicon-star" 16 "gt-ml-2"}} |
124 | | - </div> |
125 | | - {{end}} |
| 139 | + <div class="text light grey gt-df gt-ac" v-if="isStarsEnabled"> |
| 140 | + ${repo.stars_count} |
| 141 | + <svg-icon name="octicon-star" :size="16" class-name="gt-ml-2"></svg-icon> |
| 142 | + </div> |
126 | 143 | </a> |
127 | 144 | </li> |
128 | 145 | </ul> |
129 | 146 | <div v-if="showMoreReposLink" class="center gt-py-3 gt-border-secondary-top"> |
130 | 147 | <div class="ui borderless pagination menu narrow"> |
131 | 148 | <a class="item navigation gt-py-2" :class="{'disabled': page === 1}" |
132 | | - @click="changePage(1)" title="{{$.locale.Tr "admin.first_page"}}"> |
133 | | - {{svg "gitea-double-chevron-left" 16 "gt-mr-2"}} |
| 149 | + @click="changePage(1)" :title="textFirstPage"> |
| 150 | + <svg-icon name="gitea-double-chevron-left" :size="16" class-name="gt-mr-2"></svg-icon> |
134 | 151 | </a> |
135 | 152 | <a class="item navigation gt-py-2" :class="{'disabled': page === 1}" |
136 | | - @click="changePage(page - 1)" title="{{$.locale.Tr "repo.issues.previous"}}"> |
137 | | - {{svg "octicon-chevron-left" 16 "gt-mr-2"}} |
| 153 | + @click="changePage(page - 1)" :title="textPreviousPage"> |
| 154 | + <svg-icon name="octicon-chevron-left" :size="16" clsas-name="gt-mr-2"></svg-icon> |
138 | 155 | </a> |
139 | 156 | <a class="active item gt-py-2">${page}</a> |
140 | 157 | <a class="item navigation" :class="{'disabled': page === finalPage}" |
141 | | - @click="changePage(page + 1)" title="{{$.locale.Tr "repo.issues.next"}}"> |
142 | | - {{svg "octicon-chevron-right" 16 "gt-ml-2"}} |
| 158 | + @click="changePage(page + 1)" :title="textNextPage"> |
| 159 | + <svg-icon name="octicon-chevron-right" :size="16" class-name="gt-ml-2"></svg-icon> |
143 | 160 | </a> |
144 | 161 | <a class="item navigation gt-py-2" :class="{'disabled': page === finalPage}" |
145 | | - @click="changePage(finalPage)" title="{{$.locale.Tr "admin.last_page"}}"> |
146 | | - {{svg "gitea-double-chevron-right" 16 "gt-ml-2"}} |
| 162 | + @click="changePage(finalPage)" :title="textLastPage"> |
| 163 | + <svg-icon name="gitea-double-chevron-right" :size="16" class-name="gt-ml-2"></svg-icon> |
147 | 164 | </a> |
148 | 165 | </div> |
149 | 166 | </div> |
|
152 | 169 | <div v-if="!isOrganization" v-show="tab === 'organizations'" class="ui tab active list dashboard-orgs"> |
153 | 170 | <h4 class="ui top attached header gt-df gt-ac"> |
154 | 171 | <div class="gt-f1 gt-df gt-ac"> |
155 | | - {{.locale.Tr "home.my_orgs"}} |
| 172 | + ${textMyOrgs} |
156 | 173 | <span class="ui grey label gt-ml-3">${organizationsTotalCount}</span> |
157 | 174 | </div> |
158 | | - <a v-if="canCreateOrganization" class="tooltip" :href="subUrl + '/org/create'" data-content="{{.locale.Tr "new_org"}}" data-position="left center"> |
159 | | - {{svg "octicon-plus"}} |
160 | | - <span class="sr-only">{{.locale.Tr "new_org"}}</span> |
| 175 | + <a v-if="canCreateOrganization" class="tooltip" :href="subUrl + '/org/create'" :data-content="textNewOrg" data-position="left center"> |
| 176 | + <svg-icon name="octicon-plus"></svg-icon> |
| 177 | + <span class="sr-only">${textNewOrg}</span> |
161 | 178 | </a> |
162 | 179 | </h4> |
163 | 180 | <div v-if="organizations.length" class="ui attached table segment gt-rounded-bottom"> |
164 | 181 | <ul class="repo-owner-name-list"> |
165 | 182 | <li v-for="org in organizations"> |
166 | 183 | <a class="repo-list-link gt-df gt-ac gt-sb" :href="subUrl + '/' + encodeURIComponent(org.name)"> |
167 | 184 | <div class="text truncate item-name gt-f1"> |
168 | | - {{svg "octicon-organization" 16 "gt-mr-2"}} |
| 185 | + <svg-icon name="octicon-organization" :size="16" class-name="gt-mr-2"></svg-icon> |
169 | 186 | <strong>${org.name}</strong> |
170 | 187 | </div> |
171 | 188 | <div class="text light grey gt-df gt-ac"> |
172 | 189 | ${org.num_repos} |
173 | | - {{svg "octicon-repo" 16 "gt-ml-2 gt-mt-1"}} |
| 190 | + <svg-icon name="octicon-repo" :size="16" class-name="gt-ml-2 gt-mt-1"></svg-icon> |
174 | 191 | </div> |
175 | 192 | </a> |
176 | 193 | </li> |
|
0 commit comments