Merge branch 'repo-description-tweak' into forgejo
	
		
			
	
		
	
	
		
	
		
			Some checks are pending
		
		
	
	
		
			
				
	
				/ release (push) Waiting to run
				
			
		
			
				
	
				testing / backend-checks (push) Waiting to run
				
			
		
			
				
	
				testing / frontend-checks (push) Waiting to run
				
			
		
			
				
	
				testing / test-unit (push) Blocked by required conditions
				
			
		
			
				
	
				testing / test-e2e (push) Blocked by required conditions
				
			
		
			
				
	
				testing / test-remote-cacher (redis) (push) Blocked by required conditions
				
			
		
			
				
	
				testing / test-remote-cacher (valkey) (push) Blocked by required conditions
				
			
		
			
				
	
				testing / test-remote-cacher (garnet) (push) Blocked by required conditions
				
			
		
			
				
	
				testing / test-remote-cacher (redict) (push) Blocked by required conditions
				
			
		
			
				
	
				testing / test-mysql (push) Blocked by required conditions
				
			
		
			
				
	
				testing / test-pgsql (push) Blocked by required conditions
				
			
		
			
				
	
				testing / test-sqlite (push) Blocked by required conditions
				
			
		
			
				
	
				testing / security-check (push) Blocked by required conditions
				
			
		
		
	
	
		
	
		
			Some checks are pending
		
		
	
	/ release (push) Waiting to run
				
			testing / backend-checks (push) Waiting to run
				
			testing / frontend-checks (push) Waiting to run
				
			testing / test-unit (push) Blocked by required conditions
				
			testing / test-e2e (push) Blocked by required conditions
				
			testing / test-remote-cacher (redis) (push) Blocked by required conditions
				
			testing / test-remote-cacher (valkey) (push) Blocked by required conditions
				
			testing / test-remote-cacher (garnet) (push) Blocked by required conditions
				
			testing / test-remote-cacher (redict) (push) Blocked by required conditions
				
			testing / test-mysql (push) Blocked by required conditions
				
			testing / test-pgsql (push) Blocked by required conditions
				
			testing / test-sqlite (push) Blocked by required conditions
				
			testing / security-check (push) Blocked by required conditions
				
			This commit is contained in:
		
				commit
				
					
						02ca38b523
					
				
			
		
					 5 changed files with 47 additions and 30 deletions
				
			
		| 
						 | 
					@ -973,6 +973,9 @@ func renderHomeCode(ctx *context.Context) {
 | 
				
			||||||
	ctx.Data["RepositoryUploadEnabled"] = setting.Repository.Upload.Enabled
 | 
						ctx.Data["RepositoryUploadEnabled"] = setting.Repository.Upload.Enabled
 | 
				
			||||||
	prepareOpenWithEditorApps(ctx)
 | 
						prepareOpenWithEditorApps(ctx)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						// Get Topics of this repo. Earlier, beacuse we show them even when the repo is empty.
 | 
				
			||||||
 | 
						renderRepoTopics(ctx)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if ctx.Repo.Commit == nil || ctx.Repo.Repository.IsEmpty || ctx.Repo.Repository.IsBroken() {
 | 
						if ctx.Repo.Commit == nil || ctx.Repo.Repository.IsEmpty || ctx.Repo.Repository.IsBroken() {
 | 
				
			||||||
		showEmpty := true
 | 
							showEmpty := true
 | 
				
			||||||
		var err error
 | 
							var err error
 | 
				
			||||||
| 
						 | 
					@ -1021,8 +1024,6 @@ func renderHomeCode(ctx *context.Context) {
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	ctx.Data["Title"] = title
 | 
						ctx.Data["Title"] = title
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	// Get Topics of this repo
 | 
					 | 
				
			||||||
	renderRepoTopics(ctx)
 | 
					 | 
				
			||||||
	if ctx.Written() {
 | 
						if ctx.Written() {
 | 
				
			||||||
		return
 | 
							return
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
							
								
								
									
										36
									
								
								templates/repo/description.tmpl
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										36
									
								
								templates/repo/description.tmpl
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
					@ -0,0 +1,36 @@
 | 
				
			||||||
 | 
					<div class="tw-mb-4"> {{/* Magic number warning */}}
 | 
				
			||||||
 | 
					    <div class="repo-description">
 | 
				
			||||||
 | 
					    	<div id="repo-desc" class="tw-break-anywhere tw-text-16">
 | 
				
			||||||
 | 
							    {{$description := .Repository.DescriptionHTML $.Context}}
 | 
				
			||||||
 | 
							    {{if $description}}<span class="description">{{$description | RenderCodeBlock}}</span>{{else}}<span class="no-description text-italic">{{ctx.Locale.Tr "repo.no_desc"}}</span>{{end}}
 | 
				
			||||||
 | 
							    {{if .Repository.Website}}
 | 
				
			||||||
 | 
					    			<a class="link tw-mt-1 tw-flex tw-items-center tw-gap-1" href="{{.Repository.Website}}">{{svg "octicon-globe"}} {{.Repository.Website}}</a>
 | 
				
			||||||
 | 
							    {{end}}
 | 
				
			||||||
 | 
						    </div>
 | 
				
			||||||
 | 
					    </div>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    <div class="tw-flex tw-items-center tw-flex-wrap tw-gap-2 tw-my-2" id="repo-topics">
 | 
				
			||||||
 | 
					    	{{/* it should match the code in issue-home.js */}}
 | 
				
			||||||
 | 
					    	{{range .Topics}}
 | 
				
			||||||
 | 
					            <a class="repo-topic ui large label" href="{{AppSubUrl}}/explore/repos?q={{.Name}}&topic=1">{{.Name}}</a>
 | 
				
			||||||
 | 
					        {{end}}
 | 
				
			||||||
 | 
						    {{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}}
 | 
				
			||||||
 | 
					    </div>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    {{if and .Permission.IsAdmin (not .Repository.IsArchived)}}
 | 
				
			||||||
 | 
					        <div class="ui form tw-hidden tw-flex tw-gap-2 tw-my-3" id="topic_edit">
 | 
				
			||||||
 | 
							    <div class="ui fluid multiple search selection dropdown tw-flex-wrap tw-flex-1">
 | 
				
			||||||
 | 
					    			<input type="hidden" name="topics" value="{{range $i, $v := .Topics}}{{.Name}}{{if Eval $i "+" 1 "<" (len $.Topics)}},{{end}}{{end}}">
 | 
				
			||||||
 | 
								    {{range .Topics}}
 | 
				
			||||||
 | 
					    				{{/* keep the same layout as Fomantic UI generated labels */}}
 | 
				
			||||||
 | 
									    <a class="ui label transition visible tw-cursor-default tw-inline-block" data-value="{{.Name}}">{{.Name}}{{svg "octicon-x" 16 "delete icon"}}</a>
 | 
				
			||||||
 | 
								    {{end}}
 | 
				
			||||||
 | 
								    <div class="text"></div>
 | 
				
			||||||
 | 
							    </div>
 | 
				
			||||||
 | 
							    <div>
 | 
				
			||||||
 | 
					    			<button class="ui basic button" id="cancel_topic_edit">{{ctx.Locale.Tr "cancel"}}</button>
 | 
				
			||||||
 | 
								    <button class="ui primary button" id="save_topic" data-link="{{.RepoLink}}/topics">{{ctx.Locale.Tr "save"}}</button>
 | 
				
			||||||
 | 
							    </div>
 | 
				
			||||||
 | 
						    </div>
 | 
				
			||||||
 | 
					    {{end}}
 | 
				
			||||||
 | 
					</div>
 | 
				
			||||||
| 
						 | 
					@ -14,6 +14,9 @@
 | 
				
			||||||
						{{end}}
 | 
											{{end}}
 | 
				
			||||||
					</div>
 | 
										</div>
 | 
				
			||||||
				{{end}}
 | 
									{{end}}
 | 
				
			||||||
 | 
									{{if not .HideRepoInfo}}
 | 
				
			||||||
 | 
										{{template "repo/description" .}}
 | 
				
			||||||
 | 
									{{end}}
 | 
				
			||||||
				{{if .Repository.IsBroken}}
 | 
									{{if .Repository.IsBroken}}
 | 
				
			||||||
						<div class="ui segment center">
 | 
											<div class="ui segment center">
 | 
				
			||||||
							{{ctx.Locale.Tr "repo.broken_message"}}
 | 
												{{ctx.Locale.Tr "repo.broken_message"}}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -4,34 +4,7 @@
 | 
				
			||||||
	<div class="ui container {{if .IsBlame}}fluid padded{{end}}">
 | 
						<div class="ui container {{if .IsBlame}}fluid padded{{end}}">
 | 
				
			||||||
		{{template "base/alert" .}}
 | 
							{{template "base/alert" .}}
 | 
				
			||||||
		{{if and (not .HideRepoInfo) (not .IsBlame)}}
 | 
							{{if and (not .HideRepoInfo) (not .IsBlame)}}
 | 
				
			||||||
		<div class="repo-description">
 | 
								{{template "repo/description" .}}
 | 
				
			||||||
			<div id="repo-desc" class="tw-break-anywhere tw-text-16">
 | 
					 | 
				
			||||||
				{{$description := .Repository.DescriptionHTML $.Context}}
 | 
					 | 
				
			||||||
				{{if $description}}<span class="description">{{$description | RenderCodeBlock}}</span>{{else}}<span class="no-description text-italic">{{ctx.Locale.Tr "repo.no_desc"}}</span>{{end}}
 | 
					 | 
				
			||||||
				{{if .Repository.Website}}<a class="link" href="{{.Repository.Website}}">{{.Repository.Website}}</a>{{end}}
 | 
					 | 
				
			||||||
			</div>
 | 
					 | 
				
			||||||
		</div>
 | 
					 | 
				
			||||||
		<div class="tw-flex tw-items-center tw-flex-wrap tw-gap-2 tw-my-2" id="repo-topics">
 | 
					 | 
				
			||||||
			{{/* it should match the code in issue-home.js */}}
 | 
					 | 
				
			||||||
			{{range .Topics}}<a class="repo-topic ui large label" href="{{AppSubUrl}}/explore/repos?q={{.Name}}&topic=1">{{.Name}}</a>{{end}}
 | 
					 | 
				
			||||||
			{{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}}
 | 
					 | 
				
			||||||
		</div>
 | 
					 | 
				
			||||||
		{{end}}
 | 
					 | 
				
			||||||
		{{if and .Permission.IsAdmin (not .Repository.IsArchived)}}
 | 
					 | 
				
			||||||
		<div class="ui form tw-hidden tw-flex tw-gap-2 tw-my-2" id="topic_edit">
 | 
					 | 
				
			||||||
			<div class="ui fluid multiple search selection dropdown tw-flex-wrap tw-flex-1">
 | 
					 | 
				
			||||||
				<input type="hidden" name="topics" value="{{range $i, $v := .Topics}}{{.Name}}{{if Eval $i "+" 1 "<" (len $.Topics)}},{{end}}{{end}}">
 | 
					 | 
				
			||||||
				{{range .Topics}}
 | 
					 | 
				
			||||||
					{{/* keep the same layout as Fomantic UI generated labels */}}
 | 
					 | 
				
			||||||
					<a class="ui label transition visible tw-cursor-default tw-inline-block" data-value="{{.Name}}">{{.Name}}{{svg "octicon-x" 16 "delete icon"}}</a>
 | 
					 | 
				
			||||||
				{{end}}
 | 
					 | 
				
			||||||
				<div class="text"></div>
 | 
					 | 
				
			||||||
			</div>
 | 
					 | 
				
			||||||
			<div>
 | 
					 | 
				
			||||||
				<button class="ui basic button" id="cancel_topic_edit">{{ctx.Locale.Tr "cancel"}}</button>
 | 
					 | 
				
			||||||
				<button class="ui primary button" id="save_topic" data-link="{{.RepoLink}}/topics">{{ctx.Locale.Tr "save"}}</button>
 | 
					 | 
				
			||||||
			</div>
 | 
					 | 
				
			||||||
		</div>
 | 
					 | 
				
			||||||
		{{end}}
 | 
							{{end}}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		{{if RepoFlagsEnabled}}
 | 
							{{if RepoFlagsEnabled}}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -2847,3 +2847,7 @@ tbody.commit-list {
 | 
				
			||||||
#repo-activity-top-authors-chart {
 | 
					#repo-activity-top-authors-chart {
 | 
				
			||||||
  height: 150px; /* Pre-allocate the height that will be taken up by the chart, to avoid the container 'jumping'. */
 | 
					  height: 150px; /* Pre-allocate the height that will be taken up by the chart, to avoid the container 'jumping'. */
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					.no-description {
 | 
				
			||||||
 | 
					  color: var(--color-text-light-3);
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue