Skip to content

Commit beab1dd

Browse files
Mohammad Hadi Hosseinpourtechknowlogickzeripath
authored
Added title and action buttons to Project view page (#13437)
* Added title and action buttons to Project view page * Changed octicon for project close action * Fix indentation in templates/repo/projects/view.tmpl Co-authored-by: zeripath <[email protected]> * Fix indentation templates/repo/projects/view.tmpl (2nd) Co-authored-by: techknowlogick <[email protected]> Co-authored-by: zeripath <[email protected]>
1 parent 182b5a0 commit beab1dd

File tree

3 files changed

+57
-2
lines changed

3 files changed

+57
-2
lines changed

routers/repo/projects.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -291,6 +291,8 @@ func ViewProject(ctx *context.Context) {
291291
return
292292
}
293293

294+
project.RenderedContent = string(markdown.Render([]byte(project.Description), ctx.Repo.RepoLink, ctx.Repo.Repository.ComposeMetas()))
295+
294296
ctx.Data["CanWriteProjects"] = ctx.Repo.Permission.CanWrite(models.UnitTypeProjects)
295297
ctx.Data["Project"] = project
296298
ctx.Data["Boards"] = allBoards

templates/repo/projects/list.tmpl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@
5757
{{if .IsClosed}}
5858
<a class="link-action" href data-url="{{$.Link}}/{{.ID}}/open">{{svg "octicon-check"}} {{$.i18n.Tr "repo.projects.open"}}</a>
5959
{{else}}
60-
<a class="link-action" href data-url="{{$.Link}}/{{.ID}}/close">{{svg "octicon-x"}} {{$.i18n.Tr "repo.projects.close"}}</a>
60+
<a class="link-action" href data-url="{{$.Link}}/{{.ID}}/close">{{svg "octicon-skip"}} {{$.i18n.Tr "repo.projects.close"}}</a>
6161
{{end}}
6262
<a class="delete-button" href="#" data-url="{{$.RepoLink}}/projects/{{.ID}}/delete" data-id="{{.ID}}">{{svg "octicon-trashcan"}} {{$.i18n.Tr "repo.issues.label_delete"}}</a>
6363
</div>

templates/repo/projects/view.tmpl

Lines changed: 54 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,39 @@
3434
</div>
3535
</div>
3636
<div class="ui divider"></div>
37+
<div class="ui two column stackable grid">
38+
<div class="column">
39+
<h2 class="project-title">{{$.Project.Title}}</h2>
40+
<div class="content project-description">{{$.Project.RenderedContent|Str2html}}</div>
41+
</div>
42+
{{if and (or $.CanWriteIssues $.CanWritePulls) (not $.Repository.IsArchived)}}
43+
<div class="column right aligned">
44+
<div class="ui compact right small menu">
45+
<a class="item" href="{{$.RepoLink}}/projects/{{.Project.ID}}/edit" data-id={{$.Project.ID}} data-title={{$.Project.Title}}>
46+
{{svg "octicon-pencil"}}
47+
<span class="mx-3">{{$.i18n.Tr "repo.issues.label_edit"}}</span>
48+
</a>
49+
{{if .Project.IsClosed}}
50+
<a class="item link-action" href data-url="{{$.RepoLink}}/projects/{{.Project.ID}}/open">
51+
{{svg "octicon-check"}}
52+
<span class="mx-3">{{$.i18n.Tr "repo.projects.open"}}</span>
53+
</a>
54+
{{else}}
55+
<a class="item link-action" href data-url="{{$.RepoLink}}/projects/{{.Project.ID}}/close">
56+
{{svg "octicon-skip"}}
57+
<span class="mx-3">{{$.i18n.Tr "repo.projects.close"}}</span>
58+
</a>
59+
{{end}}
60+
<a class="item delete-button" href="#" data-url="{{$.RepoLink}}/projects/{{.Project.ID}}/delete" data-id="{{.Project.ID}}">
61+
{{svg "octicon-trashcan"}}
62+
<span class="mx-3">{{$.i18n.Tr "repo.issues.label_delete"}}</span>
63+
</a>
64+
</div>
65+
</div>
66+
{{end}}
67+
</div>
68+
<div class="ui divider"></div>
3769
</div>
38-
3970
<div class="ui container fluid padded" id="project-board">
4071

4172
<div class="board">
@@ -146,4 +177,26 @@
146177

147178
</div>
148179

180+
{{if or .CanWriteIssues .CanWritePulls}}
181+
<div class="ui small basic delete modal">
182+
<div class="ui icon header">
183+
{{svg "octicon-trashcan"}}
184+
{{.i18n.Tr "repo.projects.deletion"}}
185+
</div>
186+
<div class="content">
187+
<p>{{.i18n.Tr "repo.projects.deletion_desc"}}</p>
188+
</div>
189+
<div class="actions">
190+
<div class="ui red basic inverted cancel button">
191+
<i class="remove icon"></i>
192+
{{.i18n.Tr "modal.no"}}
193+
</div>
194+
<div class="ui green basic inverted ok button">
195+
<i class="checkmark icon"></i>
196+
{{.i18n.Tr "modal.yes"}}
197+
</div>
198+
</div>
199+
</div>
200+
{{end}}
201+
149202
{{template "base/footer" .}}

0 commit comments

Comments
 (0)