Skip to content

Make language stats available without JavaScript #20948

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions templates/repo/sub_menu.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,12 @@
</div>
</div>
{{if and (.Permission.CanRead $.UnitTypeCode) (not .IsEmptyRepo) .LanguageStats }}
<div class="ui segment sub-menu language-stats-details" style="display: none">
<div class="ui segment language-stats">
{{range .LanguageStats}}
<div class="bar" style="width: {{ .Percentage }}%; background-color: {{ .Color }}">&nbsp;</div>
{{end}}
</div>
<div class="ui segment sub-menu language-stats-details">
<div class="ui horizontal center link list">
{{range .LanguageStats}}
<div class="item df ac jc">
Expand All @@ -37,10 +42,5 @@
{{end}}
</div>
</div>
<a class="ui segment language-stats">
{{range .LanguageStats}}
<div class="bar" style="width: {{ .Percentage }}%; background-color: {{ .Color }}">&nbsp;</div>
{{end}}
</a>
{{end}}
</div>
10 changes: 0 additions & 10 deletions web_src/js/features/repo-common.js
Original file line number Diff line number Diff line change
Expand Up @@ -96,13 +96,3 @@ export function initRepoCommonFilterSearchDropdown(selector) {
message: {noResults: $dropdown.attr('data-no-results')},
});
}

export function initRepoCommonLanguageStats() {
// Language stats
if ($('.language-stats').length > 0) {
$('.language-stats').on('click', (e) => {
e.preventDefault();
$('.language-stats-details, .repository-menu').slideToggle();
});
}
}
2 changes: 0 additions & 2 deletions web_src/js/features/repo-legacy.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ import {
initRepoCloneLink,
initRepoCommonBranchOrTagDropdown,
initRepoCommonFilterSearchDropdown,
initRepoCommonLanguageStats,
} from './repo-common.js';
import {initCompLabelEdit} from './comp/LabelEdit.js';
import {initRepoDiffConversationNav} from './repo-diff.js';
Expand Down Expand Up @@ -500,7 +499,6 @@ export function initRepository() {
}

initRepoCloneLink();
initRepoCommonLanguageStats();
initRepoSettingBranches();

// Issues
Expand Down
2 changes: 1 addition & 1 deletion web_src/less/_repository.less
Original file line number Diff line number Diff line change
Expand Up @@ -3164,7 +3164,7 @@ td.blob-excerpt {

/* prevent page shaking on language bar click */
.repository-summary-language-stats {
height: 48px;
height: 84px;
overflow: hidden;

@media @mediaSm {
Expand Down