Browse Source

Пользователь может редактировать информацию о компетенциях, ресурсах и интересах #9

pull/100/head
Artur Galyamov 3 years ago
parent
commit
42d952e180
  1. 3
      options/locale/locale_ru-RU.ini
  2. 3
      routers/web/user/setting/profile.go
  3. 3
      services/forms/user_form.go
  4. 12
      templates/user/settings/profile.tmpl

3
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' зарезервировано.

3
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 {

3
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
}

12
templates/user/settings/profile.tmpl

@ -38,6 +38,18 @@
<label for="description">{{$.i18n.Tr "user.user_bio"}}</label>
<textarea id="description" name="description" rows="2" placeholder="{{.i18n.Tr "settings.biography_placeholder"}}">{{.SignedUser.Description}}</textarea>
</div>
<div class="field {{if .Err_Competences}}error{{end}}">
<label for="competences">{{$.i18n.Tr "user.user_competences"}}</label>
<textarea id="competences" name="competences" rows="2">{{.SignedUser.Competences}}</textarea>
</div>
<div class="field {{if .Err_Resources}}error{{end}}">
<label for="resources">{{$.i18n.Tr "user.user_resources"}}</label>
<textarea id="resources" name="resources" rows="2">{{.SignedUser.Resources}}</textarea>
</div>
<div class="field {{if .Err_Interests}}error{{end}}">
<label for="interests">{{$.i18n.Tr "user.user_interests"}}</label>
<textarea id="interests" name="interests" rows="2">{{.SignedUser.Interests}}</textarea>
</div>
<div class="field {{if .Err_Website}}error{{end}}">
<label for="website">{{.i18n.Tr "settings.website"}}</label>
<input id="website" name="website" type="url" value="{{.SignedUser.Website}}">

Loading…
Cancel
Save