File tree Expand file tree Collapse file tree 5 files changed +52
-61
lines changed Expand file tree Collapse file tree 5 files changed +52
-61
lines changed Original file line number Diff line number Diff line change @@ -41,11 +41,22 @@ func Home(ctx *context.Context) {
41
41
if ctx .Written () {
42
42
return
43
43
}
44
- shared_user . PrepareContextForOrgProfileBigAvatar ( ctx )
44
+
45
45
org := ctx .Org .Organization
46
46
47
47
ctx .Data ["PageIsUserProfile" ] = true
48
48
ctx .Data ["Title" ] = org .DisplayName ()
49
+ if len (org .Description ) != 0 {
50
+ desc , err := markdown .RenderString (& markup.RenderContext {
51
+ Ctx : ctx ,
52
+ Metas : map [string ]string {"mode" : "document" },
53
+ }, org .Description )
54
+ if err != nil {
55
+ ctx .ServerError ("RenderString" , err )
56
+ return
57
+ }
58
+ ctx .Data ["RenderedDescription" ] = desc
59
+ }
49
60
50
61
var orderBy db.SearchOrderBy
51
62
ctx .Data ["SortType" ] = ctx .FormString ("sort" )
Original file line number Diff line number Diff line change @@ -30,25 +30,6 @@ func prepareContextForCommonProfile(ctx *context.Context) {
30
30
ctx .Data ["FeedURL" ] = ctx .ContextUser .HomeLink ()
31
31
}
32
32
33
- // PrepareContextForProfileBigAvatar set the context for big avatar view on the org profile page
34
- func PrepareContextForOrgProfileBigAvatar (ctx * context.Context ) {
35
- prepareContextForCommonProfile (ctx )
36
-
37
- ctx .Data ["IsFollowing" ] = ctx .Doer != nil && user_model .IsFollowing (ctx , ctx .Doer .ID , ctx .ContextUser .ID )
38
-
39
- if len (ctx .ContextUser .Description ) != 0 {
40
- desc , err := markdown .RenderString (& markup.RenderContext {
41
- Ctx : ctx ,
42
- Metas : map [string ]string {"mode" : "document" },
43
- }, ctx .ContextUser .Description )
44
- if err != nil {
45
- ctx .ServerError ("RenderString" , err )
46
- return
47
- }
48
- ctx .Data ["RenderedDescription" ] = desc
49
- }
50
- }
51
-
52
33
// PrepareContextForProfileBigAvatar set the context for big avatar view on the profile page
53
34
func PrepareContextForProfileBigAvatar (ctx * context.Context ) {
54
35
prepareContextForCommonProfile (ctx )
Original file line number Diff line number Diff line change @@ -28,8 +28,8 @@ import (
28
28
)
29
29
30
30
const (
31
- tplProfileBigAvatar base.TplName = "shared/user/profile_big_avatar"
32
- tplOrgProfileBigAvatar base.TplName = "shared/user/org_profile_big_avatar "
31
+ tplProfileBigAvatar base.TplName = "shared/user/profile_big_avatar"
32
+ tplFollowUnfollow base.TplName = "shared/user/follow_unfollow "
33
33
)
34
34
35
35
// OwnerProfile render profile page for a user or a organization (aka, repo owner)
@@ -324,8 +324,8 @@ func Action(ctx *context.Context) {
324
324
ctx .HTML (http .StatusOK , tplProfileBigAvatar )
325
325
return
326
326
} else if ctx .ContextUser .IsOrganization () {
327
- shared_user . PrepareContextForOrgProfileBigAvatar (ctx )
328
- ctx .HTML (http .StatusOK , tplOrgProfileBigAvatar )
327
+ ctx . Data [ "IsFollowing" ] = ctx . Doer != nil && user_model . IsFollowing (ctx , ctx . Doer . ID , ctx . ContextUser . ID )
328
+ ctx .HTML (http .StatusOK , tplFollowUnfollow )
329
329
return
330
330
}
331
331
log .Error ("Failed to apply action %q: unsupport context user type: %s" , ctx .FormString ("action" ), ctx .ContextUser .Type )
Original file line number Diff line number Diff line change 1
1
{{template "base/head" .}}
2
2
<div role="main" aria-label="{{.Title}}" class="page-content organization profile">
3
- {{template "shared/user/org_profile_big_avatar" .}}
3
+ <div class="ui container gt-df">
4
+ {{ctx.AvatarUtils.Avatar .Org 140 "org-avatar"}}
5
+ <div id="org-info">
6
+ <div class="ui header">
7
+ {{.Org.DisplayName}}
8
+ <span class="org-visibility">
9
+ {{if .Org.Visibility.IsLimited}}<span class="ui large basic horizontal label">{{ctx.Locale.Tr "org.settings.visibility.limited_shortname"}}</span>{{end}}
10
+ {{if .Org.Visibility.IsPrivate}}<span class="ui large basic horizontal label">{{ctx.Locale.Tr "org.settings.visibility.private_shortname"}}</span>{{end}}
11
+ </span>
12
+ </div>
13
+ {{if $.RenderedDescription}}<div class="render-content markup">{{$.RenderedDescription|Str2html}}</div>{{end}}
14
+ <div class="text grey meta">
15
+ {{if .Org.Location}}<div class="flex-text-block">{{svg "octicon-location"}} <span>{{.Org.Location}}</span></div>{{end}}
16
+ {{if .Org.Website}}<div class="flex-text-block">{{svg "octicon-link"}} <a target="_blank" rel="noopener noreferrer me" href="{{.Org.Website}}">{{.Org.Website}}</a></div>{{end}}
17
+ {{if $.IsSigned}}
18
+ {{if .Org.Email}}<div class="flex-text-block">{{svg "octicon-mail"}} <a class="muted" href="mailto:{{.Org.Email}}">{{.Org.Email}}</a></div>{{end}}
19
+ {{end}}
20
+ </div>
21
+ </div>
22
+ <div class="right menu">
23
+ {{if .EnableFeed}}
24
+ <a class="ui basic label button gt-mr-0" href="{{$.Org.HomeLink}}.rss" data-tooltip-content="{{ctx.Locale.Tr "rss_feed"}}">
25
+ {{svg "octicon-rss" 24}}
26
+ </a>
27
+ {{end}}
28
+ {{if .IsSigned}}
29
+ <button class="ui basic button gt-mr-0" hx-post="{{.Org.HomeLink}}?action={{if $.IsFollowing}}unfollow{{else}}follow{{end}}">
30
+ {{if $.IsFollowing}}
31
+ {{ctx.Locale.Tr "user.unfollow"}}
32
+ {{else}}
33
+ {{ctx.Locale.Tr "user.follow"}}
34
+ {{end}}
35
+ </button>
36
+ {{end}}
37
+ </div>
38
+ </div>
4
39
5
40
{{template "org/menu" .}}
6
41
Load Diff This file was deleted.
You can’t perform that action at this time.
0 commit comments