Skip to content

Commit 9281a58

Browse files
committed
move language bar to sidebar
1 parent eb6c8d5 commit 9281a58

File tree

3 files changed

+55
-24
lines changed

3 files changed

+55
-24
lines changed

templates/repo/home.tmpl

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,39 @@
156156
</div>
157157
</div>
158158
{{end}}
159+
160+
{{if and (.Permission.CanRead $.UnitTypeCode) (not .IsEmptyRepo) .LanguageStats}}
161+
<div class="flex-item">
162+
<div class="flex-item-main">
163+
<div class="flex-item-title">
164+
{{ctx.Locale.Tr "repo.repo_lang"}}
165+
</div>
166+
167+
<div class="flex-item-body">
168+
<div class="language-stats">
169+
{{range .LanguageStats}}
170+
<div class="bar" style="width: {{.Percentage}}%; background-color: {{.Color}}" data-tooltip-placement="top" data-tooltip-content={{.Language}} data-tooltip-follow-cursor="horizontal"></div>
171+
{{end}}
172+
</div>
173+
<div class="language-stats-details">
174+
{{range .LanguageStats}}
175+
<div class="item">
176+
<i class="color-icon" style="background-color: {{.Color}}"></i>
177+
<span class="gt-font-semibold gt-dib">
178+
{{if eq .Language "other"}}
179+
{{ctx.Locale.Tr "repo.language_other"}}
180+
{{else}}
181+
{{.Language}}
182+
{{end}}
183+
</span>
184+
{{.Percentage}}%
185+
</div>
186+
{{end}}
187+
</div>
188+
</div>
189+
</div>
190+
</div>
191+
{{end}}
159192
</div>
160193
</div>
161194
</div>

templates/repo/sub_menu.tmpl

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -20,27 +20,5 @@
2020
</span>
2121
{{end}}
2222
</div>
23-
{{if and (.Permission.CanRead $.UnitTypeCode) (not .IsEmptyRepo) .LanguageStats}}
24-
<div class="ui segment sub-menu language-stats-details gt-hidden">
25-
{{range .LanguageStats}}
26-
<div class="item">
27-
<i class="color-icon" style="background-color: {{.Color}}"></i>
28-
<span class="gt-font-semibold">
29-
{{if eq .Language "other"}}
30-
{{ctx.Locale.Tr "repo.language_other"}}
31-
{{else}}
32-
{{.Language}}
33-
{{end}}
34-
</span>
35-
{{.Percentage}}%
36-
</div>
37-
{{end}}
38-
</div>
39-
<a class="ui segment language-stats show-panel toggle" data-panel=".repository-summary > .sub-menu">
40-
{{range .LanguageStats}}
41-
<div class="bar" style="width: {{.Percentage}}%; background-color: {{.Color}}" data-tooltip-placement="top" data-tooltip-content={{.Language}} data-tooltip-follow-cursor="horizontal"></div>
42-
{{end}}
43-
</a>
44-
{{end}}
4523
</div>
4624
{{end}}

web_src/css/repo.css

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -272,7 +272,8 @@
272272
justify-content: space-between;
273273
align-items: center;
274274
gap: 5px;
275-
margin-bottom: 5px;
275+
margin-top: 1rem;
276+
margin-bottom: 1rem;
276277
}
277278

278279
@media (max-width: 767.98px) {
@@ -2111,14 +2112,33 @@
21112112
background: var(--color-secondary);
21122113
}
21132114

2114-
.repository .repository-summary .segment.language-stats {
2115+
.language-stats {
21152116
display: flex;
21162117
gap: 2px;
21172118
padding: 0;
21182119
height: 10px;
21192120
white-space: nowrap;
21202121
border-radius: 0 0 3px 3px !important;
21212122
overflow: hidden;
2123+
width: 100%;
2124+
margin-top: 1rem;
2125+
margin-bottom: 5px;
2126+
}
2127+
2128+
.language-stats-details {
2129+
display: flex;
2130+
flex-wrap: wrap;
2131+
}
2132+
2133+
.language-stats-details .item {
2134+
height: 30px;
2135+
line-height: var(--line-height-default);
2136+
display: inline-block;
2137+
align-items: center;
2138+
justify-content: center;
2139+
gap: 0.25em;
2140+
padding: 0 0.5em; /* make the UI look better for narrow (mobile) view */
2141+
text-decoration: none;
21222142
}
21232143

21242144
#cite-repo-modal #citation-panel {

0 commit comments

Comments
 (0)