File tree Expand file tree Collapse file tree 3 files changed +23
-19
lines changed Expand file tree Collapse file tree 3 files changed +23
-19
lines changed Original file line number Diff line number Diff line change @@ -16,6 +16,7 @@ import (
16
16
"code.gitea.io/gitea/modules/cache"
17
17
"code.gitea.io/gitea/modules/git"
18
18
"code.gitea.io/gitea/modules/log"
19
+ "code.gitea.io/gitea/modules/markup"
19
20
"code.gitea.io/gitea/modules/markup/markdown"
20
21
"code.gitea.io/gitea/modules/setting"
21
22
api "code.gitea.io/gitea/modules/structs"
@@ -378,9 +379,16 @@ func repoAssignment(ctx *Context, repo *models.Repository) {
378
379
}
379
380
380
381
for index , btn := range repo .CustomRepoButtons {
381
- if ! btn .IsLink () {
382
- repo .CustomRepoButtons [index ].RenderedContent = string (markdown .Render ([]byte (btn .Content ), ctx .Repo .RepoLink ,
383
- ctx .Repo .Repository .ComposeMetas ()))
382
+ if btn .IsLink () {
383
+ continue
384
+ }
385
+
386
+ if repo .CustomRepoButtons [index ].RenderedContent , err = markdown .RenderString (& markup.RenderContext {
387
+ URLPrefix : ctx .Repo .Repository .Link (),
388
+ Metas : ctx .Repo .Repository .ComposeMetas (),
389
+ }, btn .Content ); err != nil {
390
+ ctx .ServerError ("LoadCustomRepoButton" , err )
391
+ return
384
392
}
385
393
}
386
394
}
Original file line number Diff line number Diff line change 42
42
</div>
43
43
{{if not .IsBeingCreated}}
44
44
<div class="repo-buttons">
45
+ {{ $index := 0}}
45
46
{{range .CustomRepoButtons}}
46
47
<div class="ui labeled button">
47
48
{{if .IsLink}}
50
51
</a>
51
52
{{else}}
52
53
<a class="ui basic label show-repo-button-content"
53
- data-title="{{.Title}}"
54
- data-content="{{.RenderedContent}}">
54
+ data-index="{{$index}}">
55
55
{{.Title}}
56
56
</a>
57
+ <div class="ui modal custom-repo-buttons" id="detail-modal-{{$index}}">
58
+ {{svg "octicon-x" 16 "close inside"}}
59
+ <div class="content">
60
+ <div class="sub header">{{.Title}}</div>
61
+ <div class="ui divider"></div>
62
+ <div class="render-content markdown">{{.RenderedContent|Str2html}}</div>
63
+ </div>
64
+ </div>
57
65
{{end}}
58
66
</div>
67
+ {{ $index = Add $index 1}}
59
68
{{end}}
60
69
{{if $.RepoTransfer}}
61
70
<form method="post" action="{{$.RepoLink}}/action/accept_transfer?redirect_to={{$.RepoLink}}">
114
123
</div><!-- end grid -->
115
124
</div><!-- end container -->
116
125
117
- <div class="ui modal custom-repo-buttons" id="detail-modal">
118
- {{svg "octicon-x" 16 "close inside"}}
119
- <div class="content">
120
- <div class="sub header"></div>
121
- <div class="ui divider"></div>
122
- <div class="render-content markdown"></div>
123
- </div>
124
- </div>
125
-
126
126
{{end}}
127
127
<div class="ui tabs container">
128
128
{{if not .Repository.IsBeingCreated}}
Original file line number Diff line number Diff line change @@ -1286,12 +1286,8 @@ async function initRepository() {
1286
1286
return ;
1287
1287
}
1288
1288
1289
- const $detailModal = $ ( '#detail-modal' ) ;
1290
-
1291
1289
$ ( '.show-repo-button-content' ) . on ( 'click' , function ( ) {
1292
- $detailModal . find ( '.content .render-content' ) . html ( $ ( this ) . data ( 'content' ) ) ;
1293
- $detailModal . find ( '.sub.header' ) . text ( $ ( this ) . data ( 'title' ) ) ;
1294
- $detailModal . modal ( 'show' ) ;
1290
+ $ ( `#detail-modal-${ $ ( this ) . data ( 'index' ) } ` ) . modal ( 'show' ) ;
1295
1291
return false ;
1296
1292
} ) ;
1297
1293
} ) ( ) ;
You can’t perform that action at this time.
0 commit comments