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"
switch engine.Dialect().URI().DBType {
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)
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)
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)
}
if err != nil {

2
models/repo/repo.go

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

2
options/locale/locale_ru-RU.ini

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

2
routers/web/repo/setting.go

@ -154,7 +154,7 @@ func SettingsPost(ctx *context.Context) {
repo.Resources = form.Resources
repo.Competences = form.Competences
repo.Website = form.Website
repo.LocationCoordinate = form.LocationCoordinate
repo.LocationCoordinates = form.LocationCoordinates
repo.IsTemplate = form.Template
// 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
type RepoSettingForm struct {
RepoName string `binding:"Required;AlphaDashDot;MaxSize(100)"`
Description string `binding:"MaxSize(255)"`
Resources string `binding:"MaxSize(1024)"`
Competences string `binding:"MaxSize(1024)"`
Website string `binding:"ValidUrl;MaxSize(255)"`
LocationCoordinate string
Interval string
MirrorAddress string
MirrorUsername string
MirrorPassword string
LFS bool `form:"mirror_lfs"`
LFSEndpoint string `form:"mirror_lfs_endpoint"`
PushMirrorID string
PushMirrorAddress string
PushMirrorUsername string
PushMirrorPassword string
PushMirrorInterval string
Private bool
Template bool
EnablePrune bool
RepoName string `binding:"Required;AlphaDashDot;MaxSize(100)"`
Description string `binding:"MaxSize(255)"`
Resources string `binding:"MaxSize(1024)"`
Competences string `binding:"MaxSize(1024)"`
Website string `binding:"ValidUrl;MaxSize(255)"`
LocationCoordinates string `binding:"MaxSize(1024)"`
Interval string
MirrorAddress string
MirrorUsername string
MirrorPassword string
LFS bool `form:"mirror_lfs"`
LFSEndpoint string `form:"mirror_lfs_endpoint"`
PushMirrorID string
PushMirrorAddress string
PushMirrorUsername string
PushMirrorPassword string
PushMirrorInterval string
Private bool
Template bool
EnablePrune bool
// Advanced settings
EnableWiki bool

6
templates/repo/settings/options.tmpl

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

Loading…
Cancel
Save