From dad801abf0bc155c173f8a24503ce8f1d5e831c3 Mon Sep 17 00:00:00 2001 From: Artur Galyamov Date: Mon, 22 Aug 2022 16:04:11 +0500 Subject: [PATCH 01/10] =?UTF-8?q?=D0=94=D0=BE=D0=B1=D0=B0=D0=B2=D0=BB?= =?UTF-8?q?=D0=B5=D0=BD=D1=8B=20=D0=BF=D0=BE=D0=BB=D1=8F=20=D0=BA=D0=BE?= =?UTF-8?q?=D0=BC=D0=BF=D0=B5=D1=82=D0=B5=D0=BD=D1=86=D0=B8=D0=B9,=20?= =?UTF-8?q?=D1=80=D0=B5=D1=81=D1=83=D1=80=D1=81=D0=BE=D0=B2=20=D0=B8=20?= =?UTF-8?q?=D0=B8=D0=BD=D1=82=D0=B5=D1=80=D0=B5=D1=81=D0=BE=D0=B2=20=D0=BA?= =?UTF-8?q?=20=D0=BF=D0=BE=D0=BB=D1=8C=D0=B7=D0=BE=D0=B2=D0=B0=D1=82=D0=B5?= =?UTF-8?q?=D0=BB=D1=8E=20#9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit добавление реализовано через механизм миграций. --- models/migrations/migrations.go | 2 ++ models/migrations/v211.go | 28 ++++++++++++++++++++++++++++ models/user/user.go | 3 +++ 3 files changed, 33 insertions(+) create mode 100644 models/migrations/v211.go diff --git a/models/migrations/migrations.go b/models/migrations/migrations.go index 6dff3e055b..4e27af4d73 100644 --- a/models/migrations/migrations.go +++ b/models/migrations/migrations.go @@ -373,6 +373,8 @@ var migrations = []Migration{ NewMigration("Increase WebAuthentication CredentialID size to 410 - NO-OPED", increaseCredentialIDTo410), // v210 -> v211 NewMigration("v208 was completely broken - remigrate", remigrateU2FCredentials), + // v211 -> v212 + NewMigration("add competences, resources, interests to user tbl", addTrustedPropsToUser), } // GetCurrentDBVersion returns the current db version diff --git a/models/migrations/v211.go b/models/migrations/v211.go new file mode 100644 index 0000000000..7a72b4b20a --- /dev/null +++ b/models/migrations/v211.go @@ -0,0 +1,28 @@ +package migrations + +import ( + "fmt" + "xorm.io/xorm" + "xorm.io/xorm/schemas" +) + +func addTrustedPropsToUser(engine *xorm.Engine) error { + var err error + tableName := "user" + switch engine.Dialect().URI().DBType { + case schemas.POSTGRES: + addColsQuery := fmt.Sprintf("ALTER TABLE \"%s\" ADD COLUMN competences TEXT, ADD COLUMN resources TEXT, ADD COLUMN interests TEXT;", tableName) + _, err = engine.Exec(addColsQuery) + case schemas.SQLITE: + addColsQuery := fmt.Sprintf("ALTER TABLE \"%s\" ADD COLUMN competences TEXT;\nALTER TABLE \"%s\" ADD COLUMN resources TEXT;\nALTER TABLE \"%s\" ADD COLUMN interests TEXT;", tableName, tableName, tableName) + _, err = engine.Exec(addColsQuery) + case schemas.MYSQL: + addColsQuery := fmt.Sprintf("ALTER TABLE `%s` ADD COLUMN competences TEXT, ADD COLUMN resources TEXT, ADD COLUMN interests TEXT;", tableName) + _, err = engine.Exec(addColsQuery) + } + if err != nil { + return fmt.Errorf("Ошибка добавление колонок компетенций и тд: %v", err) + } else { + return nil + } +} diff --git a/models/user/user.go b/models/user/user.go index ac70c242b5..5ce5d3cbd5 100644 --- a/models/user/user.go +++ b/models/user/user.go @@ -100,6 +100,9 @@ type User struct { Salt string `xorm:"VARCHAR(32)"` Language string `xorm:"VARCHAR(5)"` Description string `xorm:"TEXT"` + Competences string `xorm:"TEXT"` + Resources string `xorm:"TEXT"` + Interests string `xorm:"TEXT"` CreatedUnix timeutil.TimeStamp `xorm:"INDEX created"` UpdatedUnix timeutil.TimeStamp `xorm:"INDEX updated"` From c79bea9808139bc66ef52cf90dc9619581ce9f81 Mon Sep 17 00:00:00 2001 From: Artur Galyamov Date: Mon, 22 Aug 2022 16:51:54 +0500 Subject: [PATCH 02/10] =?UTF-8?q?=D0=92=D1=8B=D0=B2=D0=BE=D0=B4=D1=8F?= =?UTF-8?q?=D1=82=D1=81=D1=8F=20=D0=BF=D0=BE=D0=BB=D1=8F=20=D0=BA=D0=BE?= =?UTF-8?q?=D0=BC=D0=BF=D0=B5=D1=82=D0=B5=D0=BD=D1=86=D0=B8=D0=B8,=20?= =?UTF-8?q?=D1=80=D0=B5=D1=81=D1=83=D1=80=D1=81=D1=8B=20=D0=B8=20=D0=B8?= =?UTF-8?q?=D0=BD=D1=82=D0=B5=D1=80=D0=B5=D1=81=D1=8B=20=D0=B2=20=D0=BF?= =?UTF-8?q?=D1=80=D0=BE=D1=84=D0=B8=D0=BB=D0=B5=20=D0=BF=D0=BE=D0=BB=D1=8C?= =?UTF-8?q?=D0=B7=D0=BE=D0=B2=D0=B0=D1=82=D0=B5=D0=BB=D1=8F=20#9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit решено использовать рефлексию, для того, чтобы код был более читабельным. Хотя для MVP это избыточно. --- routers/web/user/profile.go | 62 ++++++++++++++++++++++++++++++++++++--------- templates/user/profile.tmpl | 15 +++++++++++ 2 files changed, 65 insertions(+), 12 deletions(-) diff --git a/routers/web/user/profile.go b/routers/web/user/profile.go index 40fc44ed14..2ad333a6af 100644 --- a/routers/web/user/profile.go +++ b/routers/web/user/profile.go @@ -9,6 +9,7 @@ import ( "fmt" "net/http" "path" + "reflect" "strings" "code.gitea.io/gitea/models" @@ -158,18 +159,30 @@ func Profile(ctx *context.Context) { ctx.Data["HeatmapData"] = data } - if len(ctxUser.Description) != 0 { - content, err := markdown.RenderString(&markup.RenderContext{ - URLPrefix: ctx.Repo.RepoLink, - Metas: map[string]string{"mode": "document"}, - GitRepo: ctx.Repo.GitRepo, - Ctx: ctx, - }, ctxUser.Description) - if err != nil { - ctx.ServerError("RenderString", err) - return - } - ctx.Data["RenderedDescription"] = content + var renderErr error + + renderErr = getRenderedTextField(ctx, ctxUser, "Description") + if renderErr != nil { + ctx.ServerError("RenderString", renderErr) + return + } + + renderErr = getRenderedTextField(ctx, ctxUser, "Competences") + if renderErr != nil { + ctx.ServerError("RenderString", renderErr) + return + } + + renderErr = getRenderedTextField(ctx, ctxUser, "Resources") + if renderErr != nil { + ctx.ServerError("RenderString", renderErr) + return + } + + renderErr = getRenderedTextField(ctx, ctxUser, "Interests") + if renderErr != nil { + ctx.ServerError("RenderString", renderErr) + return } showPrivate := ctx.IsSigned && (ctx.User.IsAdmin || ctx.User.ID == ctxUser.ID) @@ -377,3 +390,28 @@ func Action(ctx *context.Context) { // FIXME: We should check this URL and make sure that it's a valid Gitea URL ctx.RedirectToFirst(ctx.FormString("redirect_to"), u.HomeLink()) } + +func getTextField(user *user_model.User, fieldName string) string { + reflectedObj := reflect.ValueOf(user) + dynamicField := reflect.Indirect(reflectedObj).FieldByName(fieldName) + return dynamicField.String() +} + +func getRenderedTextField(ctx *context.Context, ctxUser *user_model.User, fieldName string) error { + var err error = nil + var content string + fieldVal := getTextField(ctxUser, fieldName) + if len(fieldVal) != 0 { + content, err = markdown.RenderString(&markup.RenderContext{ + URLPrefix: ctx.Repo.RepoLink, + Metas: map[string]string{"mode": "document"}, + GitRepo: ctx.Repo.GitRepo, + Ctx: ctx, + }, fieldVal) + if err == nil { + renderedFieldName := fmt.Sprintf("Rendered%s", fieldName) + ctx.Data[renderedFieldName] = content + } + } + return err +} diff --git a/templates/user/profile.tmpl b/templates/user/profile.tmpl index d14a86fd17..0ce7c9af40 100644 --- a/templates/user/profile.tmpl +++ b/templates/user/profile.tmpl @@ -39,6 +39,21 @@
{{$.RenderedDescription|Str2html}}
{{end}} + {{if $.RenderedCompetences}} +
  • +
    {{$.RenderedCompetences|Str2html}}
    +
  • + {{end}} + {{if $.RenderedResources}} +
  • +
    {{$.RenderedResources|Str2html}}
    +
  • + {{end}} + {{if $.RenderedInterests}} +
  • +
    {{$.RenderedInterests|Str2html}}
    +
  • + {{end}} {{range .OpenIDs}} {{if .Show}}
  • From 42d952e180ac8696b18ecdc66cd46bf1ef5c5ab0 Mon Sep 17 00:00:00 2001 From: Artur Galyamov Date: Mon, 22 Aug 2022 17:58:51 +0500 Subject: [PATCH 03/10] =?UTF-8?q?=D0=9F=D0=BE=D0=BB=D1=8C=D0=B7=D0=BE?= =?UTF-8?q?=D0=B2=D0=B0=D1=82=D0=B5=D0=BB=D1=8C=20=D0=BC=D0=BE=D0=B6=D0=B5?= =?UTF-8?q?=D1=82=20=D1=80=D0=B5=D0=B4=D0=B0=D0=BA=D1=82=D0=B8=D1=80=D0=BE?= =?UTF-8?q?=D0=B2=D0=B0=D1=82=D1=8C=20=D0=B8=D0=BD=D1=84=D0=BE=D1=80=D0=BC?= =?UTF-8?q?=D0=B0=D1=86=D0=B8=D1=8E=20=D0=BE=20=D0=BA=D0=BE=D0=BC=D0=BF?= =?UTF-8?q?=D0=B5=D1=82=D0=B5=D0=BD=D1=86=D0=B8=D1=8F=D1=85,=20=D1=80?= =?UTF-8?q?=D0=B5=D1=81=D1=83=D1=80=D1=81=D0=B0=D1=85=20=D0=B8=20=D0=B8?= =?UTF-8?q?=D0=BD=D1=82=D0=B5=D1=80=D0=B5=D1=81=D0=B0=D1=85=20#9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- options/locale/locale_ru-RU.ini | 3 +++ routers/web/user/setting/profile.go | 3 +++ services/forms/user_form.go | 3 +++ templates/user/settings/profile.tmpl | 12 ++++++++++++ 4 files changed, 21 insertions(+) diff --git a/options/locale/locale_ru-RU.ini b/options/locale/locale_ru-RU.ini index 7a3a9bb10d..b056d84c5e 100644 --- a/options/locale/locale_ru-RU.ini +++ b/options/locale/locale_ru-RU.ini @@ -494,6 +494,9 @@ follow=Подписаться unfollow=Отписаться heatmap.loading=Загрузка тепловой карты… user_bio=О себе +user_competences=Компетенции +user_resources=Ресурсы +user_interests=Интересы disabled_public_activity=Этот пользователь отключил публичную видимость активности. form.name_reserved=Имя пользователя '%s' зарезервировано. diff --git a/routers/web/user/setting/profile.go b/routers/web/user/setting/profile.go index ddc5a7c47d..255318a8c9 100644 --- a/routers/web/user/setting/profile.go +++ b/routers/web/user/setting/profile.go @@ -121,6 +121,9 @@ func ProfilePost(ctx *context.Context) { ctx.User.Location = form.Location ctx.User.LocationCoordinate = form.LocationCoordinate ctx.User.Description = form.Description + ctx.User.Competences = form.Competences + ctx.User.Resources = form.Resources + ctx.User.Interests = form.Interests ctx.User.KeepActivityPrivate = form.KeepActivityPrivate ctx.User.Visibility = form.Visibility if err := user_model.UpdateUserSetting(ctx.User); err != nil { diff --git a/services/forms/user_form.go b/services/forms/user_form.go index 1ea967ca1b..00d9cba093 100644 --- a/services/forms/user_form.go +++ b/services/forms/user_form.go @@ -247,6 +247,9 @@ type UpdateProfileForm struct { Location string `binding:"MaxSize(50)"` LocationCoordinate string `binding:"MaxSize(255)"` Description string `binding:"MaxSize(1024)"` + Competences string `binding:"MaxSize(1024)"` + Resources string `binding:"MaxSize(1024)"` + Interests string `binding:"MaxSize(1024)"` Visibility structs.VisibleType KeepActivityPrivate bool } diff --git a/templates/user/settings/profile.tmpl b/templates/user/settings/profile.tmpl index 18f5ed4b5c..8123c8670a 100644 --- a/templates/user/settings/profile.tmpl +++ b/templates/user/settings/profile.tmpl @@ -38,6 +38,18 @@ +
    + + +
    +
    + + +
    +
    + + +
    From 911317c4becf8d0c85ed287c5340944ba39a6a08 Mon Sep 17 00:00:00 2001 From: Artur Galyamov Date: Tue, 23 Aug 2022 12:26:48 +0500 Subject: [PATCH 04/10] =?UTF-8?q?=D0=92=D1=8B=D0=B2=D0=BE=D0=B4=D1=8F?= =?UTF-8?q?=D1=82=D1=81=D1=8F=20=D0=BA=D0=BE=D0=BC=D0=BF=D0=B5=D1=82=D0=B5?= =?UTF-8?q?=D0=BD=D1=86=D0=B8=D0=B8=20=D0=B8=20=D1=80=D0=B5=D1=81=D1=83?= =?UTF-8?q?=D1=80=D1=81=D1=8B=20=D0=B4=D0=BB=D1=8F=20=D1=81=D0=BE=D0=BE?= =?UTF-8?q?=D0=B1=D1=89=D0=B5=D1=81=D1=82=D0=B2=D0=B0=20#9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit лучше было бы вынести getRenderedTextField в services. Но так не получилось сделать, см. комментарий в org/home.go:182. --- routers/web/org/home.go | 64 ++++++++++++++++++++++++++++++++++++--------- routers/web/user/profile.go | 4 +-- templates/org/home.tmpl | 2 ++ 3 files changed, 55 insertions(+), 15 deletions(-) diff --git a/routers/web/org/home.go b/routers/web/org/home.go index 4967ce0e99..3e9dc97932 100644 --- a/routers/web/org/home.go +++ b/routers/web/org/home.go @@ -5,7 +5,11 @@ package org import ( + "code.gitea.io/gitea/modules/markup" + "code.gitea.io/gitea/modules/markup/markdown" + "fmt" "net/http" + "reflect" "strings" "code.gitea.io/gitea/models" @@ -13,8 +17,6 @@ import ( repo_model "code.gitea.io/gitea/models/repo" "code.gitea.io/gitea/modules/base" "code.gitea.io/gitea/modules/context" - "code.gitea.io/gitea/modules/markup" - "code.gitea.io/gitea/modules/markup/markdown" "code.gitea.io/gitea/modules/setting" ) @@ -46,17 +48,24 @@ func Home(ctx *context.Context) { ctx.Data["PageIsUserProfile"] = true ctx.Data["Title"] = org.DisplayName() - if len(org.Description) != 0 { - desc, err := markdown.RenderString(&markup.RenderContext{ - URLPrefix: ctx.Repo.RepoLink, - Metas: map[string]string{"mode": "document"}, - GitRepo: ctx.Repo.GitRepo, - }, org.Description) - if err != nil { - ctx.ServerError("RenderString", err) - return - } - ctx.Data["RenderedDescription"] = desc + + var renderErr error + renderErr = getRenderedTextField(ctx, org, "Description") + if renderErr != nil { + ctx.ServerError("RenderString", renderErr) + return + } + + renderErr = getRenderedTextField(ctx, org, "Competences") + if renderErr != nil { + ctx.ServerError("RenderString", renderErr) + return + } + + renderErr = getRenderedTextField(ctx, org, "Resources") + if renderErr != nil { + ctx.ServerError("RenderString", renderErr) + return } var orderBy db.SearchOrderBy @@ -159,3 +168,32 @@ func Home(ctx *context.Context) { ctx.HTML(http.StatusOK, tplOrgHome) } + +func getTextField(user *models.Organization, fieldName string) string { + reflectedObj := reflect.ValueOf(user) + dynamicField := reflect.Indirect(reflectedObj).FieldByName(fieldName) + return dynamicField.String() +} + +/** +Приходится дублировать код, т.к. не получилось вынести эту функцию и функцию getTextField в services, +т.к. modules/context/context.go зависит от models/user. +*/ +func getRenderedTextField(ctx *context.Context, ctxUser *models.Organization, fieldName string) error { + var err error = nil + var content string + fieldVal := getTextField(ctxUser, fieldName) + if len(fieldVal) != 0 { + content, err = markdown.RenderString(&markup.RenderContext{ + URLPrefix: ctx.Repo.RepoLink, + Metas: map[string]string{"mode": "document"}, + GitRepo: ctx.Repo.GitRepo, + Ctx: ctx, + }, fieldVal) + if err == nil { + renderedFieldName := fmt.Sprintf("Rendered%s", fieldName) + ctx.Data[renderedFieldName] = content + } + } + return err +} diff --git a/routers/web/user/profile.go b/routers/web/user/profile.go index 2ad333a6af..d36a68501b 100644 --- a/routers/web/user/profile.go +++ b/routers/web/user/profile.go @@ -6,6 +6,8 @@ package user import ( + "code.gitea.io/gitea/modules/markup" + "code.gitea.io/gitea/modules/markup/markdown" "fmt" "net/http" "path" @@ -17,8 +19,6 @@ import ( repo_model "code.gitea.io/gitea/models/repo" user_model "code.gitea.io/gitea/models/user" "code.gitea.io/gitea/modules/context" - "code.gitea.io/gitea/modules/markup" - "code.gitea.io/gitea/modules/markup/markdown" "code.gitea.io/gitea/modules/setting" "code.gitea.io/gitea/modules/util" "code.gitea.io/gitea/routers/web/feed" diff --git a/templates/org/home.tmpl b/templates/org/home.tmpl index 7ba5f95b46..8e1afb08a5 100644 --- a/templates/org/home.tmpl +++ b/templates/org/home.tmpl @@ -11,6 +11,8 @@
    {{if $.RenderedDescription}}

    {{$.RenderedDescription|Str2html}}

    {{end}} + {{if $.RenderedCompetences}}

    {{$.RenderedCompetences|Str2html}}

    {{end}} + {{if $.RenderedResources}}

    {{$.RenderedResources|Str2html}}

    {{end}}
    {{if .Org.Location}}
    {{svg "octicon-location"}} {{.Org.Location}} ({{.Org.LocationCoordinate}})
    {{end}} {{if .Org.Website}}
    {{svg "octicon-link"}} {{.Org.Website}}
    {{end}} From 265e8e633726149b4ab4d832c8f5ce02ff2150f7 Mon Sep 17 00:00:00 2001 From: Artur Galyamov Date: Tue, 23 Aug 2022 12:49:35 +0500 Subject: [PATCH 05/10] =?UTF-8?q?=D0=94=D0=BE=D0=B1=D0=B0=D0=B2=D0=BB?= =?UTF-8?q?=D0=B5=D0=BD=D0=B0=20=D0=B2=D0=BE=D0=B7=D0=BC=D0=BE=D0=B6=D0=BD?= =?UTF-8?q?=D0=BE=D1=81=D1=82=D1=8C=20=D1=80=D0=B5=D0=B4=D0=B0=D0=BA=D1=82?= =?UTF-8?q?=D0=B8=D1=80=D0=BE=D0=B2=D0=B0=D0=BD=D0=B8=D1=8F=20=D0=BA=D0=BE?= =?UTF-8?q?=D0=BC=D0=BF=D0=B5=D1=82=D0=B5=D0=BD=D1=86=D0=B8=D0=B9=20=D0=B8?= =?UTF-8?q?=20=D1=80=D0=B5=D1=81=D1=83=D1=80=D1=81=D0=BE=D0=B2=20=D1=81?= =?UTF-8?q?=D0=BE=D0=BE=D0=B1=D1=89=D0=B5=D1=81=D1=82=D0=B2=D0=B0=20#9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- options/locale/locale_ru-RU.ini | 2 ++ routers/web/org/setting.go | 2 ++ services/forms/org.go | 2 ++ templates/org/settings/options.tmpl | 8 ++++++++ 4 files changed, 14 insertions(+) diff --git a/options/locale/locale_ru-RU.ini b/options/locale/locale_ru-RU.ini index b056d84c5e..c7a318409c 100644 --- a/options/locale/locale_ru-RU.ini +++ b/options/locale/locale_ru-RU.ini @@ -2204,6 +2204,8 @@ lower_repositories=Проекты create_new_team=Создание команды create_team=Создать команду org_desc=Описание +org_competences=Компетенции +org_resources=Ресурсы team_name=Название команды team_desc=Описание team_name_helper=Названия команд должны быть короткими и запоминающимися. diff --git a/routers/web/org/setting.go b/routers/web/org/setting.go index 16f83f8b80..0f50eac54b 100644 --- a/routers/web/org/setting.go +++ b/routers/web/org/setting.go @@ -98,6 +98,8 @@ func SettingsPost(ctx *context.Context) { org.FullName = form.FullName org.Description = form.Description + org.Competences = form.Competences + org.Resources = form.Resources org.Website = form.Website org.Location = form.Location org.LocationCoordinate = form.LocationCoordinate diff --git a/services/forms/org.go b/services/forms/org.go index a5a0b06d7b..9d73f029a1 100644 --- a/services/forms/org.go +++ b/services/forms/org.go @@ -40,6 +40,8 @@ type UpdateOrgSettingForm struct { Name string `binding:"Required;AlphaDashDot;MaxSize(40)" locale:"org.org_name_holder"` FullName string `binding:"MaxSize(100)"` Description string `binding:"MaxSize(1024)"` + Competences string `binding:"MaxSize(1024)"` + Resources string `binding:"MaxSize(1024)"` Website string `binding:"ValidUrl;MaxSize(255)"` Location string `binding:"MaxSize(50)"` LocationCoordinate string `binding:"MaxSize(255)"` diff --git a/templates/org/settings/options.tmpl b/templates/org/settings/options.tmpl index a6d30dae48..3244e50144 100644 --- a/templates/org/settings/options.tmpl +++ b/templates/org/settings/options.tmpl @@ -27,6 +27,14 @@
    +
    + + +
    +
    + + +
    From f894ff93054b284da9a816968e848e7d37cc4196 Mon Sep 17 00:00:00 2001 From: Artur Galyamov Date: Tue, 23 Aug 2022 12:59:16 +0500 Subject: [PATCH 06/10] =?UTF-8?q?=D0=90=D0=B4=D0=BC=D0=B8=D0=BD=D0=B8?= =?UTF-8?q?=D1=81=D1=82=D1=80=D0=B0=D1=82=D0=BE=D1=80=20=D0=BC=D0=BE=D0=B6?= =?UTF-8?q?=D0=B5=D1=82=20=D1=80=D0=B5=D0=B4=D0=B0=D0=BA=D1=82=D0=B8=D1=80?= =?UTF-8?q?=D0=BE=D0=B2=D0=B0=D1=82=D1=8C=20=D0=B4=D0=BE=D0=B2=D0=B5=D1=80?= =?UTF-8?q?=D0=B8=D1=82=D0=B5=D0=BB=D1=8C=D0=BD=D1=8B=D0=B5=20=D1=81=D0=B2?= =?UTF-8?q?=D0=BE=D0=B9=D1=81=D1=82=D0=B2=D0=B0=20=D0=B8=20=D0=B8=D0=BD?= =?UTF-8?q?=D1=82=D0=B5=D1=80=D0=B5=D1=81=D1=8B=20=D0=BB=D0=B8=D1=87=D0=BD?= =?UTF-8?q?=D0=BE=D1=81=D1=82=D0=B8=20#9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- routers/web/admin/users.go | 3 +++ services/forms/admin.go | 3 +++ templates/admin/user/edit.tmpl | 12 ++++++++++++ 3 files changed, 18 insertions(+) diff --git a/routers/web/admin/users.go b/routers/web/admin/users.go index 4b94fe9e10..7cb7e9c8d9 100644 --- a/routers/web/admin/users.go +++ b/routers/web/admin/users.go @@ -372,6 +372,9 @@ func EditUserPost(ctx *context.Context) { u.Email = form.Email u.Website = form.Website u.Description = form.Description + u.Competences = form.Competences + u.Resources = form.Resources + u.Interests = form.Interests u.Location = form.Location u.LocationCoordinate = form.LocationCoordinate u.MaxRepoCreation = form.MaxRepoCreation diff --git a/services/forms/admin.go b/services/forms/admin.go index 8a4aaaed50..94e487ee0d 100644 --- a/services/forms/admin.go +++ b/services/forms/admin.go @@ -42,6 +42,9 @@ type AdminEditUserForm struct { Password string `binding:"MaxSize(255)"` Website string `binding:"ValidUrl;MaxSize(255)"` Description string `binding:"MaxSize(1024)"` + Competences string `binding:"MaxSize(1024)"` + Resources string `binding:"MaxSize(1024)"` + Interests string `binding:"MaxSize(1024)"` Location string `binding:"MaxSize(50)"` LocationCoordinate string `binding:"MaxSize(255)"` MaxRepoCreation int diff --git a/templates/admin/user/edit.tmpl b/templates/admin/user/edit.tmpl index 7487baf947..518fc1bda2 100644 --- a/templates/admin/user/edit.tmpl +++ b/templates/admin/user/edit.tmpl @@ -77,6 +77,18 @@
    +
    + + +
    +
    + + +
    +
    + + +
    From b0cfcd4b6d29888019227b885d71b4a493f92a11 Mon Sep 17 00:00:00 2001 From: Artur Galyamov Date: Tue, 23 Aug 2022 13:14:33 +0500 Subject: [PATCH 07/10] =?UTF-8?q?=D0=A3=D0=BB=D1=83=D1=87=D1=88=D0=B5?= =?UTF-8?q?=D0=BD=D0=BE=20=D1=83=D0=B4=D0=BE=D0=B1=D1=81=D1=82=D0=B2=D0=BE?= =?UTF-8?q?=20=D0=B8=D1=81=D0=BF=D0=BE=D0=BB=D1=8C=D0=B7=D0=BE=D0=B2=D0=B0?= =?UTF-8?q?=D0=BD=D0=B8=D1=8F=20=D0=BF=D1=80=D0=B8=20=D0=BF=D1=80=D0=BE?= =?UTF-8?q?=D1=81=D0=BC=D0=BE=D1=82=D1=80=D0=B5=20=D0=BF=D1=80=D0=BE=D1=84?= =?UTF-8?q?=D0=B8=D0=BB=D1=8F=20=D0=BF=D0=BE=D0=BB=D1=8C=D0=B7=D0=BE=D0=B2?= =?UTF-8?q?=D0=B0=D1=82=D0=B5=D0=BB=D1=8F=20#9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- templates/user/profile.tmpl | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/templates/user/profile.tmpl b/templates/user/profile.tmpl index 0ce7c9af40..bcf9ebc1ff 100644 --- a/templates/user/profile.tmpl +++ b/templates/user/profile.tmpl @@ -36,21 +36,25 @@ {{end}} {{if $.RenderedDescription}}
  • +

    {{.i18n.Tr "user.user_bio"}}

    {{$.RenderedDescription|Str2html}}
  • {{end}} {{if $.RenderedCompetences}}
  • +

    {{.i18n.Tr "user.user_competences"}}

    {{$.RenderedCompetences|Str2html}}
  • {{end}} {{if $.RenderedResources}}
  • +

    {{.i18n.Tr "user.user_resources"}}

    {{$.RenderedResources|Str2html}}
  • {{end}} {{if $.RenderedInterests}}
  • +

    {{.i18n.Tr "user.user_interests"}}

    {{$.RenderedInterests|Str2html}}
  • {{end}} From efdedf8314f3a58194ff61a98588bfd04bcfb9a4 Mon Sep 17 00:00:00 2001 From: Artur Galyamov Date: Tue, 23 Aug 2022 13:21:41 +0500 Subject: [PATCH 08/10] =?UTF-8?q?=D0=A3=D0=BB=D1=83=D1=87=D1=88=D0=B5?= =?UTF-8?q?=D0=BD=D0=BE=20=D1=83=D0=B4=D0=BE=D0=B1=D1=81=D1=82=D0=B2=D0=BE?= =?UTF-8?q?=20=D0=B8=D1=81=D0=BF=D0=BE=D0=BB=D1=8C=D0=B7=D0=BE=D0=B2=D0=B0?= =?UTF-8?q?=D0=BD=D0=B8=D1=8F=20=D0=BF=D1=80=D0=B8=20=D0=BF=D1=80=D0=BE?= =?UTF-8?q?=D1=81=D0=BC=D0=BE=D1=82=D1=80=D0=B5=20=D1=81=D0=BE=D0=BE=D0=B1?= =?UTF-8?q?=D1=89=D0=B5=D1=81=D1=82=D0=B2=20#9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- templates/org/home.tmpl | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/templates/org/home.tmpl b/templates/org/home.tmpl index 8e1afb08a5..6845b678d2 100644 --- a/templates/org/home.tmpl +++ b/templates/org/home.tmpl @@ -10,9 +10,18 @@ {{if .Org.Visibility.IsPrivate}}
    {{.i18n.Tr "org.settings.visibility.private_shortname"}}
    {{end}} - {{if $.RenderedDescription}}

    {{$.RenderedDescription|Str2html}}

    {{end}} - {{if $.RenderedCompetences}}

    {{$.RenderedCompetences|Str2html}}

    {{end}} - {{if $.RenderedResources}}

    {{$.RenderedResources|Str2html}}

    {{end}} + {{if $.RenderedDescription}} +

    {{.i18n.Tr "org.org_desc"}}

    +

    {{$.RenderedDescription|Str2html}}

    + {{end}} + {{if $.RenderedCompetences}} +

    {{.i18n.Tr "org.org_competences"}}

    +

    {{$.RenderedCompetences|Str2html}}

    + {{end}} + {{if $.RenderedResources}} +

    {{.i18n.Tr "org.org_resources"}}

    +

    {{$.RenderedResources|Str2html}}

    + {{end}}
    {{if .Org.Location}}
    {{svg "octicon-location"}} {{.Org.Location}} ({{.Org.LocationCoordinate}})
    {{end}} {{if .Org.Website}}
    {{svg "octicon-link"}} {{.Org.Website}}
    {{end}} From 0bcf3bdc65d87c6000ca176905ae95eb8239e2d5 Mon Sep 17 00:00:00 2001 From: Artur Galyamov Date: Tue, 23 Aug 2022 19:58:46 +0500 Subject: [PATCH 09/10] =?UTF-8?q?=D0=98=D0=B7=D0=BC=D0=B5=D0=BD=D0=B8?= =?UTF-8?q?=D0=BB=D0=B8=20=D0=BF=D0=BE=D1=80=D1=8F=D0=B4=D0=BE=D0=BA=20?= =?UTF-8?q?=D0=B8=D0=BC=D0=BF=D0=BE=D1=80=D1=82=D0=BE=D0=B2=20=D0=B4=D0=BB?= =?UTF-8?q?=D1=8F=20=D1=83=D0=BC=D0=B5=D0=BD=D1=8C=D1=88=D0=B5=D0=BD=D0=B8?= =?UTF-8?q?=D1=8F=20=D1=87=D0=B8=D1=81=D0=BB=D0=B0=20=D0=BA=D0=BE=D0=BD?= =?UTF-8?q?=D1=84=D0=BB=D0=B8=D0=BA=D1=82=D0=BE=D0=B2=20=D1=81=D0=BB=D0=B8?= =?UTF-8?q?=D1=8F=D0=BD=D0=B8=D1=8F=20#9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- routers/web/org/home.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/routers/web/org/home.go b/routers/web/org/home.go index 3e9dc97932..13c4b1c73d 100644 --- a/routers/web/org/home.go +++ b/routers/web/org/home.go @@ -5,8 +5,6 @@ package org import ( - "code.gitea.io/gitea/modules/markup" - "code.gitea.io/gitea/modules/markup/markdown" "fmt" "net/http" "reflect" @@ -17,6 +15,8 @@ import ( repo_model "code.gitea.io/gitea/models/repo" "code.gitea.io/gitea/modules/base" "code.gitea.io/gitea/modules/context" + "code.gitea.io/gitea/modules/markup" + "code.gitea.io/gitea/modules/markup/markdown" "code.gitea.io/gitea/modules/setting" ) From 136bddbd9fe152213d6c0f5d35a8f2057b2699de Mon Sep 17 00:00:00 2001 From: Artur Galyamov Date: Tue, 23 Aug 2022 20:18:11 +0500 Subject: [PATCH 10/10] =?UTF-8?q?=D0=A3=D0=BC=D0=B5=D0=BD=D1=8C=D1=88?= =?UTF-8?q?=D0=B5=D0=BD=D0=B0=20=D0=B2=D0=B5=D1=80=D0=BE=D1=8F=D1=82=D0=BD?= =?UTF-8?q?=D0=BE=D1=81=D1=82=D1=8C=20=D0=BA=D0=BE=D0=BD=D1=84=D0=BB=D0=B8?= =?UTF-8?q?=D0=BA=D1=82=D0=BE=D0=B2=20=D1=81=D0=BB=D0=B8=D1=8F=D0=BD=D0=B8?= =?UTF-8?q?=D1=8F=20#9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- routers/web/user/profile.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/routers/web/user/profile.go b/routers/web/user/profile.go index d36a68501b..2ad333a6af 100644 --- a/routers/web/user/profile.go +++ b/routers/web/user/profile.go @@ -6,8 +6,6 @@ package user import ( - "code.gitea.io/gitea/modules/markup" - "code.gitea.io/gitea/modules/markup/markdown" "fmt" "net/http" "path" @@ -19,6 +17,8 @@ import ( repo_model "code.gitea.io/gitea/models/repo" user_model "code.gitea.io/gitea/models/user" "code.gitea.io/gitea/modules/context" + "code.gitea.io/gitea/modules/markup" + "code.gitea.io/gitea/modules/markup/markdown" "code.gitea.io/gitea/modules/setting" "code.gitea.io/gitea/modules/util" "code.gitea.io/gitea/routers/web/feed"