summaryrefslogtreecommitdiffstats
path: root/templates
diff options
context:
space:
mode:
authorUnknwon <u@gogs.io>2015-12-21 04:24:11 -0800
committerUnknwon <u@gogs.io>2015-12-21 04:24:11 -0800
commita49af93fafe824cdd375318d15de420b3ed61e79 (patch)
tree1508c0bbd9f9caf2c3af8163e4e9abe326093558 /templates
parentc62a6b7a1238524225ec9c214dc5eac7da017663 (diff)
downloadgitea-a49af93fafe824cdd375318d15de420b3ed61e79.tar.gz
gitea-a49af93fafe824cdd375318d15de420b3ed61e79.zip
#1692 APIs: Users Followers
- User profile un/follow - List user's followers/following
Diffstat (limited to 'templates')
-rw-r--r--templates/.VERSION2
-rw-r--r--templates/repo/user_cards.tmpl47
-rw-r--r--templates/repo/watchers.tmpl52
-rw-r--r--templates/user/meta/followers.tmpl6
-rw-r--r--templates/user/meta/header.tmpl25
-rw-r--r--templates/user/meta/stars.tmpl0
-rw-r--r--templates/user/profile.tmpl27
7 files changed, 107 insertions, 52 deletions
diff --git a/templates/.VERSION b/templates/.VERSION
index 3d67a16bda..5a139812a3 100644
--- a/templates/.VERSION
+++ b/templates/.VERSION
@@ -1 +1 @@
-0.8.12.1219 \ No newline at end of file
+0.8.13.1221 \ No newline at end of file
diff --git a/templates/repo/user_cards.tmpl b/templates/repo/user_cards.tmpl
new file mode 100644
index 0000000000..98b811d50e
--- /dev/null
+++ b/templates/repo/user_cards.tmpl
@@ -0,0 +1,47 @@
+<div class="ui container user-cards">
+ <h2 class="ui dividing header">
+ {{.CardsTitle}}
+ </h2>
+ <ul class="list">
+ {{range .Cards}}
+ <li class="item ui segment">
+ <a href="{{.HomeLink}}">
+ <img class="avatar" src="{{.AvatarLink}}"/>
+ </a>
+ <h3 class="name"><a href="{{.HomeLink}}">{{.DisplayName}}</a></h3>
+
+ <div class="meta">
+ {{if .Website}}
+ <span class="icon octicon octicon-link"></span> <a href="{{.Website}}" target="_blank">{{.Website}}</a>
+ {{else if .Location}}
+ <span class="icon octicon octicon-location"></span> {{.Location}}
+ {{else}}
+ <span class="icon octicon octicon-clock"></span> {{$.i18n.Tr "user.join_on"}} {{DateFmtShort .Created}}
+ {{end}}
+ </div>
+ </li>
+ {{end}}
+ </ul>
+
+ {{with .Page}}
+ {{if gt .TotalPages 1}}
+ <div class="center page buttons">
+ <div class="ui borderless pagination menu">
+ <a class="{{if not .HasPrevious}}disabled{{end}} item" {{if .HasPrevious}}href="{{$.Link}}?page={{.Previous}}"{{end}}>
+ <i class="left arrow icon"></i> {{$.i18n.Tr "repo.issues.previous"}}
+ </a>
+ {{range .Pages}}
+ {{if eq .Num -1}}
+ <a class="disabled item">...</a>
+ {{else}}
+ <a class="{{if .IsCurrent}}active{{end}} item" {{if not .IsCurrent}}href="{{$.Link}}?page={{.Num}}"{{end}}>{{.Num}}</a>
+ {{end}}
+ {{end}}
+ <a class="{{if not .HasNext}}disabled{{end}} item" {{if .HasNext}}href="{{$.Link}}?page={{.Next}}"{{end}}>
+ {{$.i18n.Tr "repo.issues.next"}}&nbsp;<i class="icon right arrow"></i>
+ </a>
+ </div>
+ </div>
+ {{end}}
+ {{end}}
+</div> \ No newline at end of file
diff --git a/templates/repo/watchers.tmpl b/templates/repo/watchers.tmpl
index d87d9b7a3c..235ebf23b6 100644
--- a/templates/repo/watchers.tmpl
+++ b/templates/repo/watchers.tmpl
@@ -1,56 +1,6 @@
{{template "base/head" .}}
<div class="repository watchers">
{{template "repo/header" .}}
- <div class="ui container">
- <h2 class="ui dividing header">
- {{if .PageIsWatchers}}
- {{.i18n.Tr "repo.watchers"}}
- {{else}}
- {{.i18n.Tr "repo.stargazers"}}
- {{end}}
- </h2>
- <ul class="list">
- {{range .Watchers}}
- <li class="item ui segment">
- <a href="{{.HomeLink}}">
- <img class="avatar" src="{{.AvatarLink}}"/>
- </a>
- <h3 class="name"><a href="{{.HomeLink}}">{{.DisplayName}}</a></h3>
-
- <div class="meta">
- {{if .Website}}
- <span class="icon octicon octicon-link"></span> <a href="{{.Website}}" target="_blank">{{.Website}}</a>
- {{else if .Location}}
- <span class="icon octicon octicon-location"></span> {{.Location}}
- {{else}}
- <span class="icon octicon octicon-clock"></span> {{$.i18n.Tr "user.join_on"}} {{DateFmtShort .Created}}
- {{end}}
- </div>
- </li>
- {{end}}
- </ul>
-
- {{with .Page}}
- {{if gt .TotalPages 1}}
- <div class="center page buttons">
- <div class="ui borderless pagination menu">
- <a class="{{if not .HasPrevious}}disabled{{end}} item" {{if .HasPrevious}}href="{{$.Link}}?page={{.Previous}}"{{end}}>
- <i class="left arrow icon"></i> {{$.i18n.Tr "repo.issues.previous"}}
- </a>
- {{range .Pages}}
- {{if eq .Num -1}}
- <a class="disabled item">...</a>
- {{else}}
- <a class="{{if .IsCurrent}}active{{end}} item" {{if not .IsCurrent}}href="{{$.Link}}?page={{.Num}}"{{end}}>{{.Num}}</a>
- {{end}}
- {{end}}
- <a class="{{if not .HasNext}}disabled{{end}} item" {{if .HasNext}}href="{{$.Link}}?page={{.Next}}"{{end}}>
- {{$.i18n.Tr "repo.issues.next"}}&nbsp;<i class="icon right arrow"></i>
- </a>
- </div>
- </div>
- {{end}}
- {{end}}
- </div>
+ {{template "repo/user_cards" .}}
</div>
{{template "base/footer" .}}
diff --git a/templates/user/meta/followers.tmpl b/templates/user/meta/followers.tmpl
new file mode 100644
index 0000000000..403a4e8a2b
--- /dev/null
+++ b/templates/user/meta/followers.tmpl
@@ -0,0 +1,6 @@
+{{template "base/head" .}}
+<div class="user followers">
+ {{template "user/meta/header" .}}
+ {{template "repo/user_cards" .}}
+</div>
+{{template "base/footer" .}} \ No newline at end of file
diff --git a/templates/user/meta/header.tmpl b/templates/user/meta/header.tmpl
new file mode 100644
index 0000000000..366d1e0b5a
--- /dev/null
+++ b/templates/user/meta/header.tmpl
@@ -0,0 +1,25 @@
+{{with .Owner}}
+<div class="ui container">
+ <img class="ui avatar image" src="{{.AvatarLink}}">
+ <span class="header name">
+ <a href="{{.HomeLink}}">{{.Name}}</a>
+ {{with .FullName}}({{.}}){{end}}
+ </span>
+
+ <div class="ui right">
+
+ {{if or $.PageIsFollowers $.PageIsFollowing}}
+ {{if and $.IsSigned (ne $.SignedUserName .Name)}}
+ <div class="follow">
+ {{if $.SignedUser.IsFollowing .Id}}
+ <a class="ui small basic red button" href="{{.HomeLink}}/action/unfollow?redirect_to={{$.Link}}"><i class="octicon octicon-person"></i> {{$.i18n.Tr "user.unfollow"}}</a>
+ {{else}}
+ <a class="ui small basic green button" href="{{.HomeLink}}/action/follow?redirect_to={{$.Link}}"><i class="octicon octicon-person"></i> {{$.i18n.Tr "user.follow"}}</a>
+ {{end}}
+ </div>
+ {{end}}
+ {{end}}
+ </div>
+</div>
+{{end}}
+<div class="ui divider"></div> \ No newline at end of file
diff --git a/templates/user/meta/stars.tmpl b/templates/user/meta/stars.tmpl
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/templates/user/meta/stars.tmpl
diff --git a/templates/user/profile.tmpl b/templates/user/profile.tmpl
index 476b45dd5e..cceaa0de57 100644
--- a/templates/user/profile.tmpl
+++ b/templates/user/profile.tmpl
@@ -39,6 +39,33 @@
</li>
{{end}}
<li><i class="icon octicon octicon-clock"></i> {{.i18n.Tr "user.join_on"}} {{DateFmtShort .Owner.Created}}</li>
+ <li>
+ <i class="user icon"></i>
+ <a href="{{.Owner.HomeLink}}/followers">
+ {{.Owner.NumFollowers}} {{.i18n.Tr "user.followers"}}
+ </a>
+ -
+ <a href="{{.Owner.HomeLink}}/following">
+ {{.Owner.NumFollowing}} {{.i18n.Tr "user.following"}}
+ </a>
+ </li>
+ {{/*
+ <li>
+ <i class="octicon octicon-star"></i>
+ <a href="{{.Owner.HomeLink}}/stars">
+ {{.Owner.NumStars}} {{.i18n.Tr "user.starred"}}
+ </a>
+ </li>
+ */}}
+ {{if and .IsSigned (ne .SignedUserName .Owner.Name)}}
+ <li class="follow">
+ {{if .SignedUser.IsFollowing .Owner.Id}}
+ <a class="ui basic red button" href="{{.Link}}/action/unfollow?redirect_to={{$.Link}}"><i class="octicon octicon-person"></i> {{.i18n.Tr "user.unfollow"}}</a>
+ {{else}}
+ <a class="ui basic green button" href="{{.Link}}/action/follow?redirect_to={{$.Link}}"><i class="octicon octicon-person"></i> {{.i18n.Tr "user.follow"}}</a>
+ {{end}}
+ </li>
+ {{end}}
</ul>
</div>
</div>