Skip to content
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

Add project type descriptions in issue badge and improve project icons #23437

Merged
merged 15 commits into from
Apr 21, 2023
Merged
11 changes: 11 additions & 0 deletions models/project/project.go
Original file line number Diff line number Diff line change
Expand Up @@ -144,10 +144,21 @@ func (p *Project) Link() string {
return ""
}

func (p *Project) Icon() string {
yp05327 marked this conversation as resolved.
Show resolved Hide resolved
if p.IsRepositoryProject() {
return "octicon-project"
}
return "octicon-project-symlink"
}

func (p *Project) IsOrganizationProject() bool {
return p.Type == TypeOrganization
}

func (p *Project) IsRepositoryProject() bool {
return p.Type == TypeRepository
}

func init() {
db.RegisterModel(new(Project))
}
Expand Down
6 changes: 3 additions & 3 deletions options/locale/locale_en-US.ini
Original file line number Diff line number Diff line change
Expand Up @@ -1289,11 +1289,11 @@ issues.remove_label = removed the %s label %s
issues.remove_labels = removed the %s labels %s
issues.add_remove_labels = added %s and removed %s labels %s
issues.add_milestone_at = `added this to the <b>%s</b> milestone %s`
issues.add_project_at = `added this to the <b>%s</b> project %s`
issues.add_project_at = `added this to the %s<b>%s</b> project %s`
issues.change_milestone_at = `modified the milestone from <b>%s</b> to <b>%s</b> %s`
issues.change_project_at = `modified the project from <b>%s</b> to <b>%s</b> %s`
issues.change_project_at = `modified the project from %s<b>%s</b> to %s<b>%s</b> %s`
issues.remove_milestone_at = `removed this from the <b>%s</b> milestone %s`
issues.remove_project_at = `removed this from the <b>%s</b> project %s`
issues.remove_project_at = `removed this from the %s<b>%s</b> project %s`
issues.deleted_milestone = `(deleted)`
issues.deleted_project = `(deleted)`
issues.self_assign_at = `self-assigned this %s`
Expand Down
2 changes: 1 addition & 1 deletion templates/projects/list.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
<div class="milestone list">
{{range .Projects}}
<li class="item">
{{svg "octicon-project-symlink"}} <a href="{{.Link}}">{{.Title}}</a>
{{svg .Icon}} <a href="{{.Link}}">{{.Title}}</a>
<div class="meta">
{{$closedDate:= TimeSinceUnix .ClosedDateUnix $.locale}}
{{if .IsClosed}}
Expand Down
8 changes: 4 additions & 4 deletions templates/repo/issue/list.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@
</div>
{{range .OpenProjects}}
<a class="{{if $.ProjectID}}{{if eq $.ProjectID .ID}}active selected{{end}}{{end}} item" href="{{$.Link}}?type={{$.ViewType}}&sort={{$.SortType}}&state={{$.State}}&labels={{$.SelectLabels}}&milestone={{$.MilestoneID}}&project={{.ID}}&assignee={{$.AssigneeID}}&poster={{$.PosterID}}">
{{if .IsOrganizationProject}}{{svg "octicon-project-symlink" 18 "gt-mr-3"}}{{else}}{{svg "octicon-project" 18 "gt-mr-3"}}{{end}}
{{svg .Icon 18 "gt-mr-3"}}
{{.Title}}
</a>
{{end}}
Expand All @@ -112,7 +112,7 @@
</div>
{{range .ClosedProjects}}
<a class="{{if $.ProjectID}}{{if eq $.ProjectID .ID}}active selected{{end}}{{end}} item" href="{{$.Link}}?type={{$.ViewType}}&sort={{$.SortType}}&state={{$.State}}&labels={{$.SelectLabels}}&milestone={{$.MilestoneID}}&project={{.ID}}&assignee={{$.AssigneeID}}&poster={{$.PosterID}}">
{{if .IsOrganizationProject}}{{svg "octicon-project-symlink" 18 "gt-mr-3"}}{{else}}{{svg "octicon-project" 18 "gt-mr-3"}}{{end}}
{{svg .Icon 18 "gt-mr-3"}}
{{.Title}}
</a>
{{end}}
Expand Down Expand Up @@ -273,7 +273,7 @@
</div>
{{range .OpenProjects}}
<div class="item issue-action" data-element-id="{{.ID}}" data-url="{{$.RepoLink}}/issues/projects">
{{if .IsOrganizationProject}}{{svg "octicon-project-symlink" 18 "gt-mr-3"}}{{else}}{{svg "octicon-project" 18 "gt-mr-3"}}{{end}}
{{svg .Icon 18 "gt-mr-3"}}
{{.Title}}
</div>
{{end}}
Expand All @@ -285,7 +285,7 @@
</div>
{{range .ClosedProjects}}
<div class="item issue-action" data-element-id="{{.ID}}" data-url="{{$.RepoLink}}/issues/projects">
{{if .IsOrganizationProject}}{{svg "octicon-project-symlink" 18 "gt-mr-3"}}{{else}}{{svg "octicon-project" 18 "gt-mr-3"}}{{end}}
{{svg .Icon 18 "gt-mr-3"}}
{{.Title}}
</div>
{{end}}
Expand Down
6 changes: 3 additions & 3 deletions templates/repo/issue/new_form.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@
</div>
{{range .OpenProjects}}
<a class="item muted sidebar-item-link" data-id="{{.ID}}" data-href="{{.Link}}">
{{if .IsOrganizationProject}}{{svg "octicon-project-symlink" 18 "gt-mr-3"}}{{else}}{{svg "octicon-project" 18 "gt-mr-3"}}{{end}}
{{svg .Icon 18 "gt-mr-3"}}
{{.Title}}
</a>
{{end}}
Expand All @@ -189,7 +189,7 @@
</div>
{{range .ClosedProjects}}
<a class="item muted sidebar-item-link" data-id="{{.ID}}" data-href="{{.Link}}">
{{if .IsOrganizationProject}}{{svg "octicon-project-symlink" 18 "gt-mr-3"}}{{else}}{{svg "octicon-project" 18 "gt-mr-3"}}{{end}}
{{svg .Icon 18 "gt-mr-3"}}
{{.Title}}
</a>
{{end}}
Expand All @@ -202,7 +202,7 @@
<div class="selected">
{{if .Project}}
<a class="item muted sidebar-item-link" href="{{.Project.Link}}">
{{if .IsOrganizationProject}}{{svg "octicon-project-symlink" 18 "gt-mr-3"}}{{else}}{{svg "octicon-project" 18 "gt-mr-3"}}{{end}}
{{svg .Project.Icon 18 "gt-mr-3"}}
{{.Project.Title}}
</a>
{{end}}
Expand Down
6 changes: 3 additions & 3 deletions templates/repo/issue/view_content/comments.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -729,12 +729,12 @@
{{template "shared/user/authorlink" .Poster}}
{{if gt .OldProjectID 0}}
{{if gt .ProjectID 0}}
{{$.locale.Tr "repo.issues.change_project_at" (.OldProject.Title|Escape) (.Project.Title|Escape) $createdStr | Safe}}
{{$.locale.Tr "repo.issues.change_project_at" (svg .OldProject.Icon 16 "gt-mr-2") (.OldProject.Title|Escape) (svg .Project.Icon 16 "gt-mr-2") (.Project.Title|Escape) $createdStr | Safe}}
{{else}}
{{$.locale.Tr "repo.issues.remove_project_at" (.OldProject.Title|Escape) $createdStr | Safe}}
{{$.locale.Tr "repo.issues.remove_project_at" (svg .OldProject.Icon 16 "gt-mr-2") (.OldProject.Title|Escape) $createdStr | Safe}}
{{end}}
{{else if gt .ProjectID 0}}
{{$.locale.Tr "repo.issues.add_project_at" (.Project.Title|Escape) $createdStr | Safe}}
{{$.locale.Tr "repo.issues.add_project_at" (svg .Project.Icon 16 "gt-mr-2") (.Project.Title|Escape) $createdStr | Safe}}
{{end}}
</span>
</div>
Expand Down
6 changes: 3 additions & 3 deletions templates/repo/issue/view_content/sidebar.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@
</div>
{{range .OpenProjects}}
<a class="item muted sidebar-item-link" data-id="{{.ID}}" data-href="{{.Link}}">
{{if .IsOrganizationProject}}{{svg "octicon-project-symlink" 18 "gt-mr-3"}}{{else}}{{svg "octicon-project" 18 "gt-mr-3"}}{{end}}
{{svg .Icon 18 "gt-mr-3"}}
{{.Title}}
</a>
{{end}}
Expand All @@ -251,7 +251,7 @@
</div>
{{range .ClosedProjects}}
<a class="item muted sidebar-item-link" data-id="{{.ID}}" data-href="{{.Link}}">
{{if .IsOrganizationProject}}{{svg "octicon-project-symlink" 18 "gt-mr-3"}}{{else}}{{svg "octicon-project" 18 "gt-mr-3"}}{{end}}
{{svg .Icon 18 "gt-mr-3"}}
{{.Title}}
</a>
{{end}}
Expand All @@ -263,7 +263,7 @@
<div class="selected">
{{if .Issue.ProjectID}}
<a class="item muted sidebar-item-link" href="{{.Issue.Project.Link}}">
{{if .IsOrganizationProject}}{{svg "octicon-project-symlink" 18 "gt-mr-3"}}{{else}}{{svg "octicon-project" 18 "gt-mr-3"}}{{end}}
{{svg .Issue.Project.Icon 18 "gt-mr-3"}}
{{.Issue.Project.Title}}
</a>
{{end}}
Expand Down
2 changes: 1 addition & 1 deletion templates/shared/issuelist.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@
{{end}}
{{if .Project}}
<a class="project" href="{{.Project.Link}}">
{{if .Project.IsOrganizationProject}}{{svg "octicon-project-symlink" 14 "gt-mr-2"}}{{else}}{{svg "octicon-project" 14 "gt-mr-2"}}{{end}}{{.Project.Title}}
{{svg .Project.Icon 14 "gt-mr-2"}}{{.Project.Title}}
</a>
{{end}}
{{if .Ref}}
Expand Down