Skip to content

Commit c2c9a1e

Browse files
committed
improve
1 parent 69ab709 commit c2c9a1e

File tree

3 files changed

+78
-62
lines changed

3 files changed

+78
-62
lines changed

templates/repo/home.tmpl

Lines changed: 16 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,20 @@
1616
{{end}}
1717
</div>
1818
{{end}}
19-
{{template "repo/sub_menu" .}}
2019
{{$n := len .TreeNames}}
2120
{{$l := Eval $n "-" 1}}
2221
{{$isHomepage := (eq $n 0)}}
22+
23+
{{if $isHomepage}}
24+
<div class="mobile">
25+
{{template "repo/home_search_code" .}}
26+
</div>
27+
<div class="flex-list mobile">
28+
{{template "repo/home_share_sidebar" .}}
29+
</div>
30+
{{end}}
31+
{{template "repo/sub_menu" .}}
32+
2333
<div class="repo-button-row" data-is-homepage="{{$isHomepage}}">
2434
<div class="repo-button-row-left">
2535
{{template "repo/branch_dropdown" dict "root" . "ContainerClasses" "tw-mr-1"}}
@@ -119,69 +129,13 @@
119129

120130
{{if $isHomepage}}
121131
<div class="flex-container-repo">
122-
<form class="ignore-dirty tw-flex tw-flex-1 tw-mt-1" action="{{.RepoLink}}/search" method="get">
123-
<div class="ui small action input tw-flex-1">
124-
<input name="q" size="10" placeholder="{{ctx.Locale.Tr "search.code_kind"}}">
125-
{{template "shared/search/button"}}
126-
</div>
127-
</form>
132+
<div class="not-mobile">
133+
{{template "repo/home_search_code" .}}
134+
</div>
128135

129136
<div class="flex-list">
130-
<div class="flex-item">
131-
<div class="flex-item-main">
132-
<div class="flex-item-title">
133-
{{ctx.Locale.Tr "repo.repo_desc"}}
134-
</div>
135-
{{if and (not .HideRepoInfo) (not .IsBlame)}}
136-
<div class="flex-item-body repo-description tw-break-anywhere tw-gap-2 tw-mt-2">
137-
{{- $description := .Repository.DescriptionHTML ctx -}}
138-
{{if $description}}{{$description | RenderCodeBlock}}{{else}}{{ctx.Locale.Tr "repo.repo_no_desc"}}{{end}}
139-
{{if .Repository.Website}}{{svg "octicon-link"}}<a href="{{.Repository.Website}}">{{.Repository.Website}}</a>{{end}}
140-
</div>
141-
<div class="tw-flex tw-items-center tw-flex-wrap tw-gap-2 tw-my-2" id="repo-topics">
142-
{{/* it should match the code in issue-home.js */}}
143-
{{range .Topics}}<a class="repo-topic ui large label" href="{{AppSubUrl}}/explore/repos?q={{.Name}}&topic=1">{{.Name}}</a>{{end}}
144-
</div>
145-
{{if and .Permission.IsAdmin (not .Repository.IsArchived)}}<button id="manage_topic" class="btn interact-fg tw-text-12">{{ctx.Locale.Tr "repo.topic.manage_topics"}}</button>{{end}}
146-
{{end}}
147-
{{if and .Permission.IsAdmin (not .Repository.IsArchived)}}
148-
<div class="ui form tw-hidden flex-item-body tw-gap-2 tw-my-2" id="topic_edit">
149-
<div class="ui fluid multiple search selection dropdown tw-flex-wrap tw-flex-1">
150-
<input type="hidden" name="topics" value="{{range $i, $v := .Topics}}{{.Name}}{{if Eval $i "+" 1 "<" (len $.Topics)}},{{end}}{{end}}">
151-
{{range .Topics}}
152-
{{/* keep the same layout as Fomantic UI generated labels */}}
153-
<a class="ui label transition visible tw-cursor-default tw-inline-block repo-topic" data-value="{{.Name}}">{{.Name}}{{svg "octicon-x" 16 "delete icon"}}</a>
154-
{{end}}
155-
<div class="text"></div>
156-
</div>
157-
<div>
158-
<button class="ui primary button" id="save_topic" data-link="{{.RepoLink}}/topics">{{ctx.Locale.Tr "save"}}</button>
159-
<button class="ui basic button" id="cancel_topic_edit">{{ctx.Locale.Tr "cancel"}}</button>
160-
</div>
161-
</div>
162-
{{end}}
163-
{{if .ReadmeExist}}
164-
<div class="flex-item-body tw-mt-2">
165-
<a class="tw-flex tw-items-center tw-gap-2 muted" href="{{.TreeLink}}/{{.FileName}}">
166-
{{svg "octicon-book"}}{{ctx.Locale.Tr "readme"}}
167-
</a>
168-
</div>
169-
{{end}}
170-
{{if .DetectedRepoLicenses}}
171-
<div class="flex-item-body">
172-
<a class="tw-flex tw-items-center tw-gap-2 muted" href="{{.RepoLink}}/src/{{.Repository.DefaultBranch}}/{{PathEscapeSegments .LicenseFileName}}" data-tooltip-placement="top" data-tooltip-content="{{StringUtils.Join .DetectedRepoLicenses ", "}}">
173-
{{svg "octicon-law"}}{{if eq (len .DetectedRepoLicenses) 1}}{{index .DetectedRepoLicenses 0}}{{else}}{{ctx.Locale.Tr "repo.multiple_licenses"}}{{end}}
174-
</a>
175-
</div>
176-
{{end}}
177-
{{if .CitiationExist}}
178-
<div class="flex-item-body">
179-
<a class="tw-flex tw-items-center tw-gap-2 muted" id="cite-repo-button">
180-
{{svg "octicon-cross-reference"}}{{ctx.Locale.Tr "repo.cite_this_repo"}}
181-
</a>
182-
</div>
183-
{{end}}
184-
</div>
137+
<div class="flex-item not-mobile">
138+
{{template "repo/home_share_sidebar" .}}
185139
</div>
186140

187141
{{if .LatestRelease}}
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
<form class="ignore-dirty tw-flex tw-flex-1 tw-mt-1" action="{{.RepoLink}}/search" method="get">
2+
<div class="ui small action input tw-flex-1">
3+
<input name="q" size="10" placeholder="{{ctx.Locale.Tr "search.code_kind"}}">
4+
{{template "shared/search/button"}}
5+
</div>
6+
</form>
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
<div class="flex-item">
2+
<div class="flex-item-main">
3+
<div class="flex-item-title">
4+
{{ctx.Locale.Tr "repo.repo_desc"}}
5+
</div>
6+
{{if and (not .HideRepoInfo) (not .IsBlame)}}
7+
<div class="flex-item-body repo-description tw-break-anywhere tw-gap-2 tw-mt-2">
8+
{{- $description := .Repository.DescriptionHTML ctx -}}
9+
{{if $description}}{{$description | RenderCodeBlock}}{{else}}{{ctx.Locale.Tr "repo.repo_no_desc"}}{{end}}
10+
{{if .Repository.Website}}{{svg "octicon-link"}}<a href="{{.Repository.Website}}">{{.Repository.Website}}</a>{{end}}
11+
</div>
12+
<div class="tw-flex tw-items-center tw-flex-wrap tw-gap-2 tw-my-2" id="repo-topics">
13+
{{/* it should match the code in issue-home.js */}}
14+
{{range .Topics}}<a class="repo-topic ui large label" href="{{AppSubUrl}}/explore/repos?q={{.Name}}&topic=1">{{.Name}}</a>{{end}}
15+
</div>
16+
{{if and .Permission.IsAdmin (not .Repository.IsArchived)}}<button id="manage_topic" class="btn interact-fg tw-text-12">{{ctx.Locale.Tr "repo.topic.manage_topics"}}</button>{{end}}
17+
{{end}}
18+
{{if and .Permission.IsAdmin (not .Repository.IsArchived)}}
19+
<div class="ui form tw-hidden flex-item-body tw-gap-2 tw-my-2" id="topic_edit">
20+
<div class="ui fluid multiple search selection dropdown tw-flex-wrap tw-flex-1">
21+
<input type="hidden" name="topics" value="{{range $i, $v := .Topics}}{{.Name}}{{if Eval $i "+" 1 "<" (len $.Topics)}},{{end}}{{end}}">
22+
{{range .Topics}}
23+
{{/* keep the same layout as Fomantic UI generated labels */}}
24+
<a class="ui label transition visible tw-cursor-default tw-inline-block repo-topic" data-value="{{.Name}}">{{.Name}}{{svg "octicon-x" 16 "delete icon"}}</a>
25+
{{end}}
26+
<div class="text"></div>
27+
</div>
28+
<div>
29+
<button class="ui primary button" id="save_topic" data-link="{{.RepoLink}}/topics">{{ctx.Locale.Tr "save"}}</button>
30+
<button class="ui basic button" id="cancel_topic_edit">{{ctx.Locale.Tr "cancel"}}</button>
31+
</div>
32+
</div>
33+
{{end}}
34+
{{if .ReadmeExist}}
35+
<div class="flex-item-body tw-mt-2">
36+
<a class="tw-flex tw-items-center tw-gap-2 muted" href="{{.TreeLink}}/{{.FileName}}">
37+
{{svg "octicon-book"}}{{ctx.Locale.Tr "readme"}}
38+
</a>
39+
</div>
40+
{{end}}
41+
{{if .DetectedRepoLicenses}}
42+
<div class="flex-item-body">
43+
<a class="tw-flex tw-items-center tw-gap-2 muted" href="{{.RepoLink}}/src/{{.Repository.DefaultBranch}}/{{PathEscapeSegments .LicenseFileName}}" data-tooltip-placement="top" data-tooltip-content="{{StringUtils.Join .DetectedRepoLicenses ", "}}">
44+
{{svg "octicon-law"}}{{if eq (len .DetectedRepoLicenses) 1}}{{index .DetectedRepoLicenses 0}}{{else}}{{ctx.Locale.Tr "repo.multiple_licenses"}}{{end}}
45+
</a>
46+
</div>
47+
{{end}}
48+
{{if .CitiationExist}}
49+
<div class="flex-item-body">
50+
<a class="tw-flex tw-items-center tw-gap-2 muted" id="cite-repo-button">
51+
{{svg "octicon-cross-reference"}}{{ctx.Locale.Tr "repo.cite_this_repo"}}
52+
</a>
53+
</div>
54+
{{end}}
55+
</div>
56+
</div>

0 commit comments

Comments
 (0)