diff --git a/models/project/project.go b/models/project/project.go index 679d695881c..44609e60b2e 100644 --- a/models/project/project.go +++ b/models/project/project.go @@ -144,10 +144,21 @@ func (p *Project) Link() string { return "" } +func (p *Project) IconName() string { + 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)) } diff --git a/templates/projects/list.tmpl b/templates/projects/list.tmpl index 89c52dee680..5062109161e 100644 --- a/templates/projects/list.tmpl +++ b/templates/projects/list.tmpl @@ -38,7 +38,7 @@
{{range .Projects}}
  • - {{svg "octicon-project-symlink"}} {{.Title}} + {{svg .IconName}} {{.Title}}
    {{$closedDate:= TimeSinceUnix .ClosedDateUnix $.locale}} {{if .IsClosed}} diff --git a/templates/repo/issue/list.tmpl b/templates/repo/issue/list.tmpl index 975d6594709..726ef25cfe8 100644 --- a/templates/repo/issue/list.tmpl +++ b/templates/repo/issue/list.tmpl @@ -100,8 +100,7 @@
    {{range .OpenProjects}} - {{if .IsOrganizationProject}}{{svg "octicon-project-symlink" 18 "gt-mr-3"}}{{else}}{{svg "octicon-project" 18 "gt-mr-3"}}{{end}} - {{.Title}} + {{svg .IconName 18 "gt-mr-3"}}{{.Title}} {{end}} {{end}} @@ -112,8 +111,7 @@
  • {{range .ClosedProjects}} - {{if .IsOrganizationProject}}{{svg "octicon-project-symlink" 18 "gt-mr-3"}}{{else}}{{svg "octicon-project" 18 "gt-mr-3"}}{{end}} - {{.Title}} + {{svg .IconName 18 "gt-mr-3"}}{{.Title}} {{end}} {{end}} @@ -273,8 +271,7 @@ {{range .OpenProjects}}
    - {{if .IsOrganizationProject}}{{svg "octicon-project-symlink" 18 "gt-mr-3"}}{{else}}{{svg "octicon-project" 18 "gt-mr-3"}}{{end}} - {{.Title}} + {{svg .IconName 18 "gt-mr-3"}}{{.Title}}
    {{end}} {{end}} @@ -285,8 +282,7 @@ {{range .ClosedProjects}}
    - {{if .IsOrganizationProject}}{{svg "octicon-project-symlink" 18 "gt-mr-3"}}{{else}}{{svg "octicon-project" 18 "gt-mr-3"}}{{end}} - {{.Title}} + {{svg .IconName 18 "gt-mr-3"}}{{.Title}}
    {{end}} {{end}} diff --git a/templates/repo/issue/new_form.tmpl b/templates/repo/issue/new_form.tmpl index b45a00f7814..4945203ca53 100644 --- a/templates/repo/issue/new_form.tmpl +++ b/templates/repo/issue/new_form.tmpl @@ -134,8 +134,7 @@ {{range .OpenProjects}} - {{if .IsOrganizationProject}}{{svg "octicon-project-symlink" 18 "gt-mr-3"}}{{else}}{{svg "octicon-project" 18 "gt-mr-3"}}{{end}} - {{.Title}} + {{svg .IconName 18 "gt-mr-3"}}{{.Title}} {{end}} {{end}} @@ -146,8 +145,7 @@ {{range .ClosedProjects}} - {{if .IsOrganizationProject}}{{svg "octicon-project-symlink" 18 "gt-mr-3"}}{{else}}{{svg "octicon-project" 18 "gt-mr-3"}}{{end}} - {{.Title}} + {{svg .IconName 18 "gt-mr-3"}}{{.Title}} {{end}} {{end}} @@ -159,8 +157,7 @@
    {{if .Project}} - {{if .IsOrganizationProject}}{{svg "octicon-project-symlink" 18 "gt-mr-3"}}{{else}}{{svg "octicon-project" 18 "gt-mr-3"}}{{end}} - {{.Project.Title}} + {{svg .Project.IconName 18 "gt-mr-3"}}{{.Project.Title}} {{end}}
    diff --git a/templates/repo/issue/view_content/sidebar.tmpl b/templates/repo/issue/view_content/sidebar.tmpl index 40d87b41785..cef1e3a02ec 100644 --- a/templates/repo/issue/view_content/sidebar.tmpl +++ b/templates/repo/issue/view_content/sidebar.tmpl @@ -196,8 +196,7 @@ {{range .OpenProjects}} - {{if .IsOrganizationProject}}{{svg "octicon-project-symlink" 18 "gt-mr-3"}}{{else}}{{svg "octicon-project" 18 "gt-mr-3"}}{{end}} - {{.Title}} + {{svg .IconName 18 "gt-mr-3"}}{{.Title}} {{end}} {{end}} @@ -208,8 +207,7 @@ {{range .ClosedProjects}} - {{if .IsOrganizationProject}}{{svg "octicon-project-symlink" 18 "gt-mr-3"}}{{else}}{{svg "octicon-project" 18 "gt-mr-3"}}{{end}} - {{.Title}} + {{svg .IconName 18 "gt-mr-3"}}{{.Title}} {{end}} {{end}} @@ -220,8 +218,7 @@
    {{if .Issue.ProjectID}} - {{if .IsOrganizationProject}}{{svg "octicon-project-symlink" 18 "gt-mr-3"}}{{else}}{{svg "octicon-project" 18 "gt-mr-3"}}{{end}} - {{.Issue.Project.Title}} + {{svg .Issue.Project.IconName 18 "gt-mr-3"}}{{.Issue.Project.Title}} {{end}}
    diff --git a/templates/repo/projects/list.tmpl b/templates/repo/projects/list.tmpl index 6833b7d785a..2350a3af546 100644 --- a/templates/repo/projects/list.tmpl +++ b/templates/repo/projects/list.tmpl @@ -40,7 +40,7 @@
    {{range .Projects}}
  • - {{svg "octicon-project"}} {{.Title}} + {{svg .IconName}} {{.Title}}
    {{$closedDate:= TimeSinceUnix .ClosedDateUnix $.locale}} {{if .IsClosed}} diff --git a/templates/shared/issuelist.tmpl b/templates/shared/issuelist.tmpl index ae9cb55d44d..40ddb4dab03 100644 --- a/templates/shared/issuelist.tmpl +++ b/templates/shared/issuelist.tmpl @@ -88,7 +88,7 @@ {{end}} {{if .Project}} - {{if .Project.IsOrganizationProject}}{{svg "octicon-project-symlink" 14 "gt-mr-2"}}{{else}}{{svg "octicon-project" 14 "gt-mr-2"}}{{end}}{{.Project.Title}} + {{svg .Project.IconName 14 "gt-mr-2"}}{{.Project.Title}} {{end}} {{if .Ref}}