mirror of
				https://gitee.com/gitea/gitea
				synced 2025-11-04 16:40:24 +08:00 
			
		
		
		
	cmd: CMD option for port number of gogs web to prevent first time run conflict
				
					
				
			- routers: use new binding convention to simplify code - templates: able to set HTTP port number in install page
This commit is contained in:
		@@ -9,6 +9,7 @@ import (
 | 
			
		||||
	"reflect"
 | 
			
		||||
	"strings"
 | 
			
		||||
 | 
			
		||||
	"github.com/Unknwon/com"
 | 
			
		||||
	"github.com/Unknwon/macaron"
 | 
			
		||||
	"github.com/macaron-contrib/binding"
 | 
			
		||||
	"github.com/macaron-contrib/session"
 | 
			
		||||
@@ -135,6 +136,10 @@ type Form interface {
 | 
			
		||||
	binding.Validator
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func init() {
 | 
			
		||||
	binding.SetNameMapper(com.ToSnakeCase)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// AssignForm assign form values back to the template data.
 | 
			
		||||
func AssignForm(form interface{}, data map[string]interface{}) {
 | 
			
		||||
	typ := reflect.TypeOf(form)
 | 
			
		||||
@@ -152,6 +157,8 @@ func AssignForm(form interface{}, data map[string]interface{}) {
 | 
			
		||||
		// Allow ignored fields in the struct
 | 
			
		||||
		if fieldName == "-" {
 | 
			
		||||
			continue
 | 
			
		||||
		} else if len(fieldName) == 0 {
 | 
			
		||||
			fieldName = com.ToSnakeCase(field.Name)
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		data[fieldName] = val.Field(i).Interface()
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user