summaryrefslogtreecommitdiffstats
path: root/templates
diff options
context:
space:
mode:
authorKyle D <kdumontnu@gmail.com>2021-04-15 10:53:57 -0600
committerGitHub <noreply@github.com>2021-04-15 18:53:57 +0200
commitf44543a1bb776fa8bdfd3b605d67197d1466eb20 (patch)
treeb9a014285b40c3eb45dd90bcafa7ccc17c1031d8 /templates
parentaf2adb4e35ea71ca5c7fbb1e51b9d25fe49af2e4 (diff)
downloadgitea-f44543a1bb776fa8bdfd3b605d67197d1466eb20.tar.gz
gitea-f44543a1bb776fa8bdfd3b605d67197d1466eb20.zip
Disable Stars config option (#14653)
* Add config option to disable stars * Replace "stars" with watched in user profile * Add documentation
Diffstat (limited to 'templates')
-rw-r--r--templates/base/head_navbar.tmpl10
-rw-r--r--templates/explore/repo_list.tmpl4
-rw-r--r--templates/explore/repo_search.tmpl6
-rw-r--r--templates/repo/header.tmpl24
-rw-r--r--templates/swagger/v1_json.tmpl4
-rw-r--r--templates/user/dashboard/repolist.tmpl10
-rw-r--r--templates/user/profile.tmpl16
7 files changed, 47 insertions, 27 deletions
diff --git a/templates/base/head_navbar.tmpl b/templates/base/head_navbar.tmpl
index ec5c17b6b4..7e476fa4a4 100644
--- a/templates/base/head_navbar.tmpl
+++ b/templates/base/head_navbar.tmpl
@@ -157,10 +157,12 @@
{{svg "octicon-person"}}
{{.i18n.Tr "your_profile"}}<!-- Your profile -->
</a>
- <a class="item" href="{{AppSubUrl}}/{{.SignedUser.Name}}?tab=stars">
- {{svg "octicon-star"}}
- {{.i18n.Tr "your_starred"}}
- </a>
+ {{if not .DisableStars}}
+ <a class="item" href="{{AppSubUrl}}/{{.SignedUser.Name}}?tab=stars">
+ {{svg "octicon-star"}}
+ {{.i18n.Tr "your_starred"}}
+ </a>
+ {{end}}
<a class="{{if .PageIsUserSettings}}active{{end}} item" href="{{AppSubUrl}}/user/settings">
{{svg "octicon-tools"}}
{{.i18n.Tr "your_settings"}}<!-- Your settings -->
diff --git a/templates/explore/repo_list.tmpl b/templates/explore/repo_list.tmpl
index 91dc3d8bf4..4ff48b6076 100644
--- a/templates/explore/repo_list.tmpl
+++ b/templates/explore/repo_list.tmpl
@@ -42,7 +42,9 @@
{{if .PrimaryLanguage }}
<span class="text grey df ac mr-3"><i class="color-icon mr-3" style="background-color: {{.PrimaryLanguage.Color}}"></i>{{ .PrimaryLanguage.Language }}</span>
{{end}}
- <span class="text grey df ac mr-3">{{svg "octicon-star" 16 "mr-3"}}{{.NumStars}}</span>
+ {{if not $.DisableStars}}
+ <span class="text grey df ac mr-3">{{svg "octicon-star" 16 "mr-3"}}{{.NumStars}}</span>
+ {{end}}
<span class="text grey df ac mr-3">{{svg "octicon-git-branch" 16 "mr-3"}}{{.NumForks}}</span>
</div>
</div>
diff --git a/templates/explore/repo_search.tmpl b/templates/explore/repo_search.tmpl
index 5e7bed8b31..c1745525a9 100644
--- a/templates/explore/repo_search.tmpl
+++ b/templates/explore/repo_search.tmpl
@@ -12,8 +12,10 @@
<a class="{{if eq .SortType "reversealphabetically"}}active{{end}} item" href="{{$.Link}}?sort=reversealphabetically&q={{$.Keyword}}&tab={{$.TabName}}">{{.i18n.Tr "repo.issues.label.filter_sort.reverse_alphabetically"}}</a>
<a class="{{if eq .SortType "recentupdate"}}active{{end}} item" href="{{$.Link}}?sort=recentupdate&q={{$.Keyword}}&tab={{$.TabName}}">{{.i18n.Tr "repo.issues.filter_sort.recentupdate"}}</a>
<a class="{{if eq .SortType "leastupdate"}}active{{end}} item" href="{{$.Link}}?sort=leastupdate&q={{$.Keyword}}&tab={{$.TabName}}">{{.i18n.Tr "repo.issues.filter_sort.leastupdate"}}</a>
- <a class="{{if eq .SortType "moststars"}}active{{end}} item" href="{{$.Link}}?sort=moststars&q={{$.Keyword}}&tab={{$.TabName}}">{{.i18n.Tr "repo.issues.filter_sort.moststars"}}</a>
- <a class="{{if eq .SortType "feweststars"}}active{{end}} item" href="{{$.Link}}?sort=feweststars&q={{$.Keyword}}&tab={{$.TabName}}">{{.i18n.Tr "repo.issues.filter_sort.feweststars"}}</a>
+ {{if not .DisableStars}}
+ <a class="{{if eq .SortType "moststars"}}active{{end}} item" href="{{$.Link}}?sort=moststars&q={{$.Keyword}}&tab={{$.TabName}}">{{.i18n.Tr "repo.issues.filter_sort.moststars"}}</a>
+ <a class="{{if eq .SortType "feweststars"}}active{{end}} item" href="{{$.Link}}?sort=feweststars&q={{$.Keyword}}&tab={{$.TabName}}">{{.i18n.Tr "repo.issues.filter_sort.feweststars"}}</a>
+ {{end}}
<a class="{{if eq .SortType "mostforks"}}active{{end}} item" href="{{$.Link}}?sort=mostforks&q={{$.Keyword}}&tab={{$.TabName}}">{{.i18n.Tr "repo.issues.filter_sort.mostforks"}}</a>
<a class="{{if eq .SortType "fewestforks"}}active{{end}} item" href="{{$.Link}}?sort=fewestforks&q={{$.Keyword}}&tab={{$.TabName}}">{{.i18n.Tr "repo.issues.filter_sort.fewestforks"}}</a>
</div>
diff --git a/templates/repo/header.tmpl b/templates/repo/header.tmpl
index 188fc87b6a..ebd0333e8c 100644
--- a/templates/repo/header.tmpl
+++ b/templates/repo/header.tmpl
@@ -71,17 +71,19 @@
</a>
</div>
</form>
- <form method="post" action="{{$.RepoLink}}/action/{{if $.IsStaringRepo}}un{{end}}star?redirect_to={{$.Link}}">
- {{$.CsrfTokenHtml}}
- <div class="ui labeled button{{if not $.IsSigned}} poping up{{end}}" tabindex="0"{{if not $.IsSigned}} data-content="{{$.i18n.Tr "repo.star_guest_user" }}" data-position="top center" data-variation="tiny"{{end}}>
- <button type="submit" class="ui compact small basic button"{{if not $.IsSigned}} disabled{{end}}>
- {{if $.IsStaringRepo}}{{svg "octicon-star-fill"}}{{$.i18n.Tr "repo.unstar"}}{{else}}{{svg "octicon-star"}}{{$.i18n.Tr "repo.star"}}{{end}}
- </button>
- <a class="ui basic label" href="{{.Link}}/stars">
- {{CountFmt .NumStars}}
- </a>
- </div>
- </form>
+ {{if not $.DisableStars}}
+ <form method="post" action="{{$.RepoLink}}/action/{{if $.IsStaringRepo}}un{{end}}star?redirect_to={{$.Link}}">
+ {{$.CsrfTokenHtml}}
+ <div class="ui labeled button{{if not $.IsSigned}} poping up{{end}}" tabindex="0"{{if not $.IsSigned}} data-content="{{$.i18n.Tr "repo.star_guest_user" }}" data-position="top center" data-variation="tiny"{{end}}>
+ <button type="submit" class="ui compact small basic button"{{if not $.IsSigned}} disabled{{end}}>
+ {{if $.IsStaringRepo}}{{svg "octicon-star-fill"}}{{$.i18n.Tr "repo.unstar"}}{{else}}{{svg "octicon-star"}}{{$.i18n.Tr "repo.star"}}{{end}}
+ </button>
+ <a class="ui basic label" href="{{.Link}}/stars">
+ {{CountFmt .NumStars}}
+ </a>
+ </div>
+ </form>
+ {{end}}
{{if and (not .IsEmpty) ($.Permission.CanRead $.UnitTypeCode)}}
<div class="ui labeled button{{if not $.CanSignedUserFork}} poping up disabled{{end}}"{{if and (not $.CanSignedUserFork) $.IsSigned}} data-content="{{$.i18n.Tr "repo.fork_from_self"}}" {{else if not $.IsSigned}} data-content="{{$.i18n.Tr "repo.fork_guest_user"}}"{{end}} data-position="top center" data-variation="tiny" tabindex="0">
<a class="ui compact small basic button"{{if $.CanSignedUserFork}} href="{{AppSubUrl}}/repo/fork/{{.ID}}"{{end}}>
diff --git a/templates/swagger/v1_json.tmpl b/templates/swagger/v1_json.tmpl
index b548f25f4f..5aeed4a30f 100644
--- a/templates/swagger/v1_json.tmpl
+++ b/templates/swagger/v1_json.tmpl
@@ -14151,6 +14151,10 @@
"type": "boolean",
"x-go-name": "MirrorsDisabled"
},
+ "stars_disabled": {
+ "type": "boolean",
+ "x-go-name": "StarsDisabled"
+ },
"time_tracking_disabled": {
"type": "boolean",
"x-go-name": "TimeTrackingDisabled"
diff --git a/templates/user/dashboard/repolist.tmpl b/templates/user/dashboard/repolist.tmpl
index 9dfda9d84e..8ac07e1df6 100644
--- a/templates/user/dashboard/repolist.tmpl
+++ b/templates/user/dashboard/repolist.tmpl
@@ -130,10 +130,12 @@
{{svg "octicon-archive" 16 "ml-2"}}
</span>
</div>
- <div class="text light grey df ac">
- ${repo.stars_count}
- {{svg "octicon-star" 16 "ml-2"}}
- </div>
+ {{if not .DisableStars}}
+ <div class="text light grey df ac">
+ ${repo.stars_count}
+ {{svg "octicon-star" 16 "ml-2"}}
+ </div>
+ {{end}}
</a>
</li>
</ul>
diff --git a/templates/user/profile.tmpl b/templates/user/profile.tmpl
index ddad4c46c3..18f3c9f6dd 100644
--- a/templates/user/profile.tmpl
+++ b/templates/user/profile.tmpl
@@ -84,16 +84,22 @@
</div>
<div class="ui eleven wide column">
<div class="ui secondary stackable pointing tight menu">
- <a class='{{if and (ne .TabName "activity") (ne .TabName "following") (ne .TabName "followers") (ne .TabName "stars") (ne .TabName "projects")}}active{{end}} item' href="{{.Owner.HomeLink}}">
+ <a class='{{if and (ne .TabName "activity") (ne .TabName "following") (ne .TabName "followers") (ne .TabName "stars") (ne .TabName "watching") (ne .TabName "projects")}}active{{end}} item' href="{{.Owner.HomeLink}}">
{{svg "octicon-repo"}} {{.i18n.Tr "user.repositories"}}
</a>
<a class='{{if eq .TabName "activity"}}active{{end}} item' href="{{.Owner.HomeLink}}?tab=activity">
{{svg "octicon-rss"}} {{.i18n.Tr "user.activity"}}
</a>
- <a class='{{if eq .TabName "stars"}}active{{end}} item' href="{{.Owner.HomeLink}}?tab=stars">
- {{svg "octicon-star"}} {{.i18n.Tr "user.starred"}}
- <div class="ui label">{{.Owner.NumStars}}</div>
- </a>
+ {{if not .DisableStars}}
+ <a class='{{if eq .TabName "stars"}}active{{end}} item' href="{{.Owner.HomeLink}}?tab=stars">
+ {{svg "octicon-star"}} {{.i18n.Tr "user.starred"}}
+ <div class="ui label">{{.Owner.NumStars}}</div>
+ </a>
+ {{else}}
+ <a class='{{if eq .TabName "watching"}}active{{end}} item' href="{{.Owner.HomeLink}}?tab=watching">
+ {{svg "octicon-eye"}} {{.i18n.Tr "user.watched"}}
+ </a>
+ {{end}}
<a class='{{if eq .TabName "following"}}active{{end}} item' href="{{.Owner.HomeLink}}?tab=following">
{{svg "octicon-person"}} {{.i18n.Tr "user.following"}}
<div class="ui label">{{.Owner.NumFollowing}}</div>