diff --git a/routers/web/org/teams.go b/routers/web/org/teams.go index 10803c9fbf..7312478299 100644 --- a/routers/web/org/teams.go +++ b/routers/web/org/teams.go @@ -609,6 +609,8 @@ func DeleteTeam(ctx *context.Context) { // TeamInvite renders the team invite page func TeamInvite(ctx *context.Context) { invite, org, team, inviter, err := getTeamInviteFromContext(ctx) + // TODO: to quickly debug the UI, can uncomment this (don't worry, it won't pass CI lint) + // invite, org, team, inviter, err = &org_model.TeamInvite{}, &org_model.Organization{}, &org_model.Team{}, ctx.Doer, nil if err != nil { if org_model.IsErrTeamInviteNotFound(err) { ctx.NotFound(err) diff --git a/services/context/context_template.go b/services/context/context_template.go index b63aaf4c3c..0f083d097e 100644 --- a/services/context/context_template.go +++ b/services/context/context_template.go @@ -5,13 +5,11 @@ package context import ( "context" - "fmt" "html" "html/template" "net/http" "strconv" "strings" - "sync" "time" "code.gitea.io/gitea/modules/httplib" @@ -91,31 +89,14 @@ func (c TemplateContext) AppFullLink(link ...string) template.URL { return template.URL(s + "/" + strings.TrimPrefix(link[0], "/")) } -var globalVars = sync.OnceValue(func() (ret struct { - scriptImportRemainingPart string -}, -) { - // add onerror handler to alert users when the script fails to load: - // * for end users: there were many users reporting that "UI doesn't work", actually they made mistakes in their config - // * for developers: help them to remember to run "make watch-frontend" to build frontend assets - // the message will be directly put in the onerror JS code's string - onScriptErrorPrompt := `Please make sure the asset files can be accessed.` - if !setting.IsProd { - onScriptErrorPrompt += `\n\nFor development, run: make watch-frontend.` - } - onScriptErrorJS := fmt.Sprintf(`alert('Failed to load asset file from ' + this.src + '. %s')`, onScriptErrorPrompt) - ret.scriptImportRemainingPart = `onerror="` + html.EscapeString(onScriptErrorJS) + `">` - return ret -}) - func (c TemplateContext) ScriptImport(path string, typ ...string) template.HTML { if len(typ) > 0 { if typ[0] == "module" { - return template.HTML(``) } panic("unsupported script type: " + typ[0]) } - return template.HTML(``) } func (c TemplateContext) CspScriptNonce() (ret string) { diff --git a/templates/base/footer.tmpl b/templates/base/footer.tmpl index 5a218bb62a..b7443345ad 100644 --- a/templates/base/footer.tmpl +++ b/templates/base/footer.tmpl @@ -11,5 +11,8 @@ {{template "base/footer_content" .}} {{ctx.ScriptImport "js/index.js" "module"}} {{template "custom/footer" .}} + diff --git a/templates/org/header.tmpl b/templates/org/header.tmpl index 83ae95a1ae..4f9e54b610 100644 --- a/templates/org/header.tmpl +++ b/templates/org/header.tmpl @@ -1,13 +1,13 @@ -
- {{ctx.AvatarUtils.Avatar .Org 100 "org-avatar"}} -
-
- {{.Org.DisplayName}} - +
+
{{ctx.AvatarUtils.Avatar .Org 100}}
+
+
+
+ {{.Org.DisplayName}} {{if .Org.Visibility.IsLimited}}{{ctx.Locale.Tr "org.settings.visibility.limited_shortname"}}{{end}} {{if .Org.Visibility.IsPrivate}}{{ctx.Locale.Tr "org.settings.visibility.private_shortname"}}{{end}} - - +
+
- {{if .RenderedDescription}}
{{.RenderedDescription}}
{{end}} -
- {{if .Org.Location}}
{{svg "octicon-location"}} {{.Org.Location}}
{{end}} - {{if .Org.Website}}
{{end}} - {{if .IsSigned}} - {{if .Org.Email}}
{{svg "octicon-mail"}} {{.Org.Email}}
{{end}} + {{if .RenderedDescription}} +
{{.RenderedDescription}}
+ {{end}} +
+ {{if .Org.Location}} +
{{svg "octicon-location"}} {{.Org.Location}}
+ {{end}} + {{if .Org.Website}} +
{{svg "octicon-link"}} {{.Org.Website}}
+ {{end}} + {{if and .IsSigned .Org.Email}} +
{{svg "octicon-mail"}} {{.Org.Email}}
{{end}}
diff --git a/templates/org/home.tmpl b/templates/org/home.tmpl index 7132743d0c..12b41c3e94 100644 --- a/templates/org/home.tmpl +++ b/templates/org/home.tmpl @@ -55,11 +55,12 @@ {{end}} {{if .NumMembers}} -

- {{ctx.Locale.Tr "org.members"}} +

+ {{ctx.Locale.Tr "org.members"}} {{.NumMembers}} {{svg "octicon-chevron-right"}}

-
+ {{/* gap 8px below is specifically chosen to make sure a full line of avatars can exactly fit the segment width */}} +
{{range $memberUser := .OrgOverviewMembers}} {{if or $.IsOrganizationMember (call $.IsPublicMember $memberUser.ID)}} {{template "shared/user/avatarlink" dict "user" $memberUser "size" 32 "tooltip" true}} @@ -68,20 +69,22 @@
{{end}} {{if .IsOrganizationMember}} -
- {{ctx.Locale.Tr "org.teams"}} +
+ {{ctx.Locale.Tr "org.teams"}} {{.Org.NumTeams}} {{svg "octicon-chevron-right"}}
-
+
+ {{if .IsOrganizationOwner}}
diff --git a/templates/org/team/invite.tmpl b/templates/org/team/invite.tmpl index 14a97ae659..d591414efc 100644 --- a/templates/org/team/invite.tmpl +++ b/templates/org/team/invite.tmpl @@ -1,18 +1,14 @@ {{template "base/head" .}} -
+
{{template "base/alert" .}} -
-
- {{ctx.AvatarUtils.Avatar .Organization 140}} -
-
-
{{ctx.Locale.Tr "org.teams.invite.title" .Team.Name .Organization.Name}}
-
{{ctx.Locale.Tr "org.teams.invite.by" .Inviter.Name}}
-
{{ctx.Locale.Tr "org.teams.invite.description"}}
-
-
-
+
+
+
{{ctx.AvatarUtils.Avatar .Organization 140}}
+
{{ctx.Locale.Tr "org.teams.invite.title" .Team.Name .Organization.Name}}
+
{{ctx.Locale.Tr "org.teams.invite.by" .Inviter.Name}}
+
{{ctx.Locale.Tr "org.teams.invite.description"}}
+
diff --git a/templates/org/team/sidebar.tmpl b/templates/org/team/sidebar.tmpl index 1487c280de..1036e886da 100644 --- a/templates/org/team/sidebar.tmpl +++ b/templates/org/team/sidebar.tmpl @@ -15,21 +15,21 @@ {{end}}
-
-
+ +
{{if .Team.Description}} {{.Team.Description}} {{else}} {{ctx.Locale.Tr "org.teams.no_desc"}} {{end}}
- {{if eq .Team.LowerName "owners"}} -
+ +
+ {{/* TODO: old indent is kept to make diff changes minimal, can be reformatted in the future */}} + {{if eq .Team.LowerName "owners"}}

{{ctx.Locale.Tr "org.teams.owners_permission_desc"}}

{{ctx.Locale.Tr "org.teams.owners_permission_suggestion"}}

-
- {{else}} -
+ {{else}}

{{ctx.Locale.Tr "org.team_access_desc"}}

    {{if .Team.IncludesAllRepositories}} @@ -75,9 +75,9 @@ {{end}} -
- {{end}} -
+ {{end}} +
+ {{if .IsOrganizationOwner}}
{{svg "octicon-gear"}} {{ctx.Locale.Tr "org.teams.settings"}} diff --git a/web_src/css/index.css b/web_src/css/index.css index c23e3e1c19..d7f57e324b 100644 --- a/web_src/css/index.css +++ b/web_src/css/index.css @@ -37,7 +37,6 @@ @import "./shared/flex-list.css"; @import "./shared/milestone.css"; -@import "./shared/repoorg.css"; @import "./shared/settings.css"; @import "./features/dropzone.css"; diff --git a/web_src/css/org.css b/web_src/css/org.css index b54a21ac6e..6de9ebd51e 100644 --- a/web_src/css/org.css +++ b/web_src/css/org.css @@ -1,23 +1,3 @@ -.organization .head .ui.header .ui.right { - margin-top: 5px; -} - -.page-content.organization .org-avatar { - margin-right: 15px; -} - -.page-content.organization #org-info .ui.header { - display: flex; - align-items: center; - font-size: 36px; - margin-bottom: 0; -} - -.page-content.organization #org-info .desc { - font-size: 16px; - margin-bottom: 10px; -} - .page-content.organization .team-item-box > .team-item-header { min-height: 50px; /* the header sometimes contains a mini button, sometimes not, so we set a min-height to make sure the layout is consistent */ } @@ -30,20 +10,3 @@ white-space: nowrap; color: var(--color-text-light-3); } - -.organization.invite .ui.avatar { - width: 100%; - height: 100%; -} - -.organization.teams .detail .item { - padding: 10px 15px; -} - -.organization.teams .detail .item:not(:last-child) { - border-bottom: 1px solid var(--color-secondary); -} - -.org-team-navbar .active.item { - background: var(--color-box-body) !important; -} diff --git a/web_src/css/shared/repoorg.css b/web_src/css/shared/repoorg.css deleted file mode 100644 index 5573ae47b8..0000000000 --- a/web_src/css/shared/repoorg.css +++ /dev/null @@ -1,18 +0,0 @@ -.repository .head .ui.header .text, -.organization .head .ui.header .text { - vertical-align: middle; - font-size: 1.6rem; - margin-left: 15px; -} - -.repository .ui.tabs.container, -.organization .ui.tabs.container { - margin-top: 14px; - margin-bottom: 0; -} - -.repository .head .ui.header .org-visibility .label, -.organization .head .ui.header .org-visibility .label { - margin-left: 5px; - margin-top: 5px; -} diff --git a/web_src/js/globals.d.ts b/web_src/js/globals.d.ts index bd9fd410b8..5398d407d1 100644 --- a/web_src/js/globals.d.ts +++ b/web_src/js/globals.d.ts @@ -53,6 +53,7 @@ interface Window { enableTimeTracking: boolean, mermaidMaxSourceCharacters: number, i18n: Record, + frontendInited: boolean, }, $: JQueryStatic, jQuery: JQueryStatic, diff --git a/web_src/js/index.ts b/web_src/js/index.ts index d6457a1326..cb2b56a5bd 100644 --- a/web_src/js/index.ts +++ b/web_src/js/index.ts @@ -171,3 +171,5 @@ const initDur = performance.now() - initStartTime; if (initDur > 500) { console.error(`slow init functions took ${initDur.toFixed(3)}ms`); } + +window.config.frontendInited = true; diff --git a/web_src/js/vitest.setup.ts b/web_src/js/vitest.setup.ts index 229c99cceb..190196cabd 100644 --- a/web_src/js/vitest.setup.ts +++ b/web_src/js/vitest.setup.ts @@ -12,6 +12,7 @@ window.config = { enableTimeTracking: true, mermaidMaxSourceCharacters: 5000, i18n: {}, + frontendInited: false, }; window.testModules = {};