Browse Source

Координаты проекта могут содержать множество значений #65 #120

pull/120/head
Artur Galyamov 2 years ago
parent
commit
e7f050e1c8
  1. 6
      models/migrations/v213.go
  2. 2
      models/repo/repo.go
  3. 2
      options/locale/locale_ru-RU.ini
  4. 2
      routers/web/repo/setting.go
  5. 40
      services/forms/repo_form.go
  6. 6
      templates/repo/settings/options.tmpl

6
models/migrations/v213.go

@ -11,13 +11,13 @@ func addLocationCoordinateToRepo(engine *xorm.Engine) error {
tableName := "repository" tableName := "repository"
switch engine.Dialect().URI().DBType { switch engine.Dialect().URI().DBType {
case schemas.POSTGRES: case schemas.POSTGRES:
addColsQuery := fmt.Sprintf("ALTER TABLE \"%s\" ADD COLUMN location_coordinate VARCHAR(20);", tableName) addColsQuery := fmt.Sprintf("ALTER TABLE \"%s\" ADD COLUMN location_coordinates VARCHAR(1024);", tableName)
_, err = engine.Exec(addColsQuery) _, err = engine.Exec(addColsQuery)
case schemas.SQLITE: case schemas.SQLITE:
addColsQuery := fmt.Sprintf("ALTER TABLE \"%s\" ADD COLUMN location_coordinate TEXT;", tableName) addColsQuery := fmt.Sprintf("ALTER TABLE \"%s\" ADD COLUMN location_coordinates TEXT;", tableName)
_, err = engine.Exec(addColsQuery) _, err = engine.Exec(addColsQuery)
case schemas.MYSQL: case schemas.MYSQL:
addColsQuery := fmt.Sprintf("ALTER TABLE `%s` ADD COLUMN location_coordinate VARCHAR(20);", tableName) addColsQuery := fmt.Sprintf("ALTER TABLE `%s` ADD COLUMN location_coordinates VARCHAR(1024);", tableName)
_, err = engine.Exec(addColsQuery) _, err = engine.Exec(addColsQuery)
} }
if err != nil { if err != nil {

2
models/repo/repo.go

@ -103,7 +103,7 @@ type Repository struct {
Resources string `xorm:"TEXT"` Resources string `xorm:"TEXT"`
Competences string `xorm:"TEXT"` Competences string `xorm:"TEXT"`
Website string `xorm:"VARCHAR(2048)"` Website string `xorm:"VARCHAR(2048)"`
LocationCoordinate string `xorm:"VARCHAR(20)"` LocationCoordinates string `xorm:"VARCHAR(1024)"`
OriginalServiceType api.GitServiceType `xorm:"index"` OriginalServiceType api.GitServiceType `xorm:"index"`
OriginalURL string `xorm:"VARCHAR(2048)"` OriginalURL string `xorm:"VARCHAR(2048)"`
DefaultBranch string DefaultBranch string

2
options/locale/locale_ru-RU.ini

@ -1719,7 +1719,7 @@ settings.email_notifications.onmention=Посылать письмо на эл.
settings.email_notifications.disable=Отключить почтовые уведомления settings.email_notifications.disable=Отключить почтовые уведомления
settings.email_notifications.submit=Установить настройки электронной почты settings.email_notifications.submit=Установить настройки электронной почты
settings.site=Сайт settings.site=Сайт
settings.location_coordinate=Координаты settings.location_coordinates=Координаты
settings.update_settings=Обновить настройки settings.update_settings=Обновить настройки
settings.branches.update_default_branch=Обновить ветку по умолчанию settings.branches.update_default_branch=Обновить ветку по умолчанию
settings.advanced_settings=Расширенные настройки settings.advanced_settings=Расширенные настройки

2
routers/web/repo/setting.go

@ -154,7 +154,7 @@ func SettingsPost(ctx *context.Context) {
repo.Resources = form.Resources repo.Resources = form.Resources
repo.Competences = form.Competences repo.Competences = form.Competences
repo.Website = form.Website repo.Website = form.Website
repo.LocationCoordinate = form.LocationCoordinate repo.LocationCoordinates = form.LocationCoordinates
repo.IsTemplate = form.Template repo.IsTemplate = form.Template
// Visibility of forked repository is forced sync with base repository. // Visibility of forked repository is forced sync with base repository.

40
services/forms/repo_form.go

@ -113,26 +113,26 @@ func ParseRemoteAddr(remoteAddr, authUsername, authPassword string) (string, err
// RepoSettingForm form for changing repository settings // RepoSettingForm form for changing repository settings
type RepoSettingForm struct { type RepoSettingForm struct {
RepoName string `binding:"Required;AlphaDashDot;MaxSize(100)"` RepoName string `binding:"Required;AlphaDashDot;MaxSize(100)"`
Description string `binding:"MaxSize(255)"` Description string `binding:"MaxSize(255)"`
Resources string `binding:"MaxSize(1024)"` Resources string `binding:"MaxSize(1024)"`
Competences string `binding:"MaxSize(1024)"` Competences string `binding:"MaxSize(1024)"`
Website string `binding:"ValidUrl;MaxSize(255)"` Website string `binding:"ValidUrl;MaxSize(255)"`
LocationCoordinate string LocationCoordinates string `binding:"MaxSize(1024)"`
Interval string Interval string
MirrorAddress string MirrorAddress string
MirrorUsername string MirrorUsername string
MirrorPassword string MirrorPassword string
LFS bool `form:"mirror_lfs"` LFS bool `form:"mirror_lfs"`
LFSEndpoint string `form:"mirror_lfs_endpoint"` LFSEndpoint string `form:"mirror_lfs_endpoint"`
PushMirrorID string PushMirrorID string
PushMirrorAddress string PushMirrorAddress string
PushMirrorUsername string PushMirrorUsername string
PushMirrorPassword string PushMirrorPassword string
PushMirrorInterval string PushMirrorInterval string
Private bool Private bool
Template bool Template bool
EnablePrune bool EnablePrune bool
// Advanced settings // Advanced settings
EnableWiki bool EnableWiki bool

6
templates/repo/settings/options.tmpl

@ -56,9 +56,9 @@
<label for="website">{{.i18n.Tr "repo.settings.site"}}</label> <label for="website">{{.i18n.Tr "repo.settings.site"}}</label>
<input id="website" name="website" type="url" value="{{.Repository.Website}}"> <input id="website" name="website" type="url" value="{{.Repository.Website}}">
</div> </div>
<div class="field {{if .Err_LocationCoordinate}}error{{end}}"> <div class="field {{if .Err_LocationCoordinates}}error{{end}}">
<label for="location_coordinate">{{.i18n.Tr "repo.settings.location_coordinate"}}</label> <label for="location_coordinates">{{.i18n.Tr "repo.settings.location_coordinates"}}</label>
<input id="location_coordinate" name="location_coordinate" value="{{.Repository.LocationCoordinate}}" placeholder="55.4, 37.3"> <input id="location_coordinates" name="location_coordinates" value="{{.Repository.LocationCoordinates}}" placeholder="55.4, 37.3">
</div> </div>
<div class="field"> <div class="field">

Loading…
Cancel
Save