ui

package module
v0.0.0-...-ed2f94b Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 10, 2021 License: GPL-3.0 Imports: 32 Imported by: 1

Documentation

Index

Constants

View Source
const (
	POST = "POST"
	GET  = "GET"
)

Form methods: POST or GET.

Variables

This section is empty.

Functions

func DecodeJSONBody

func DecodeJSONBody(w http.ResponseWriter, r *http.Request, dst interface{}) error

Types

type ArButtons

type ArButtons []InfoButton

type ArProperties

type ArProperties []InfoProperty

type ArTabs

type ArTabs []InfoTab

type ColumnInfo

type ColumnInfo struct {
	Title    string `json:"title"                yaml:"title"`
	Type     string `json:"type"                 yaml:"type"`
	Field    string `json:"field"                yaml:"field"`
	Align    string `json:"align"                yaml:"align"`
	Sortable bool   `json:"sortable"             yaml:"sortable"`
	Filter   string `json:"filter"               yaml:"filter"`
	// contains filtered or unexported fields
}

type FormInfo

type FormInfo struct {
	Code        string       `json:"code"         yaml:"code"`
	EncType     string       `json:"enctype"      yaml:"enctype"`
	Method      string       `json:"method"       yaml:"method"`
	Action      string       `json:"action"       yaml:"action"`
	Version     int32        `json:"version"      yaml:"version"`
	Date        string       `json:"date"         yaml:"date"`
	Date_start  string       `json:"date_start"   yaml:"date_start"`
	Date_finish string       `json:"date_finish"  yaml:"date_finish"`
	Title       string       `json:"title"        yaml:"title"`
	Type        string       `json:"type"         yaml:"type"`
	Description string       `json:"description"  yaml:"description"`
	Tabs        ArTabs       `json:"tabs"         yaml:"tabs,flow"`
	Properties  ArProperties `json:"properties"   yaml:"properties,flow"`
	Buttons     ArButtons    `json:"buttons"      yaml:"buttons,flow"`
}

func (*FormInfo) Copy

func (info *FormInfo) Copy(in *FormInfo)

func (*FormInfo) Tr

func (info *FormInfo) Tr(t *tr.Tr, lang string)

func (*FormInfo) TrDef

func (info *FormInfo) TrDef(t *tr.Tr)

type Forms

type Forms struct {
	// contains filtered or unexported fields
}

func NewForms

func NewForms(cfg *cache.CacheConfig, t *tr.Tr, ts *Templates) *Forms

func (*Forms) Count

func (f *Forms) Count() int64

func (*Forms) ExpandProperties

func (f *Forms) ExpandProperties(info *FormInfo)

func (*Forms) Filter

func (f *Forms) Filter(lang string, forms []string) map[string]FormInfo

func (*Forms) Get

func (f *Forms) Get(code string) *FormInfo

func (*Forms) GetParameters

func (f *Forms) GetParameters(r *http.Request, storagePath string, subPath string) (map[string]interface{}, bool)

func (*Forms) Load

func (f *Forms) Load(configPath string)

func (*Forms) New

func (f *Forms) New(info FormInfo) string

func (*Forms) Render

func (f *Forms) Render(form_code string, lang string, style string, isModal bool, data *map[string]interface{}) string

type Functions

type Functions struct {
	// contains filtered or unexported fields
}

func NewFunctions

func NewFunctions(t *tr.Tr, forms *Forms, views *Views) *Functions

func (*Functions) AppendFuncMap

func (f *Functions) AppendFuncMap(funcmap *template.FuncMap)

func (*Functions) FuncMap

func (f *Functions) FuncMap(name string, path string, style string, lang string) template.FuncMap

type InfoAction

type InfoAction struct {
	Title  string `json:"title"    yaml:"title"`
	Url    string `json:"url"      yaml:"url"`
	Target string `json:"target"   yaml:"target"`
}

type InfoButton

type InfoButton struct {
	CODE  string `json:"code"          yaml:"code"`
	Order int    `json:"order"         yaml:"order"`
	Title string `json:"title"         yaml:"title"`
	Type  string `json:"type"          yaml:"type"`
}

type InfoItem

type InfoItem struct {
	Description string   `json:"description"   yaml:"description"`
	Enum        []string `json:"enum"          yaml:"enum"`
}

type InfoProperty

type InfoProperty struct {
	CODE        string     `json:"code"          yaml:"code"`
	Order       int        `json:"order"         yaml:"order"`
	Title       string     `json:"title"         yaml:"title"`
	Description string     `json:"description"   yaml:"description"`
	DataType    string     `json:"data_type"     yaml:"data_type"`
	WidgetType  string     `json:"widget"        yaml:"widget"`
	Required    string     `json:"required"      yaml:"required"`
	Format      string     `json:"format"        yaml:"format"`
	Table       string     `json:"table"         yaml:"table"`
	Default     string     `json:"default"       yaml:"default"`
	OneOf       []InfoItem `json:"oneOf"         yaml:"oneOf"`
	OneOfConst  string     `json:"oneOfConst"    yaml:"oneOfConst"`
}

type InfoTab

type InfoTab struct {
	CODE        string   `json:"code"         yaml:"code"`
	Order       int      `json:"order"        yaml:"order"`
	Title       string   `json:"title"        yaml:"title"`
	Description string   `json:"description"  yaml:"description"`
	Fields      []string `json:"fields"       yaml:"fields"`
}

type MapInfo

type MapInfo struct {
	Name        string  `json:"name"           yaml:"name"`
	Latitude    float64 `json:"latitude"       yaml:"latitude"`
	Longitude   float64 `json:"longitude"      yaml:"longitude"`
	DefaultZoom float64 `json:"default_zoom"   yaml:"default_zoom"`
	MinZoom     float64 `json:"min_zoom"       yaml:"min_zoom"`
	MaxZoom     float64 `json:"max_zoom"       yaml:"max_zoom"`
	LayersUrl   string  `json:"layers_url"     yaml:"layers_url"`
}

type PageInfo

type PageInfo struct {
	CODE          string `json:"code"              yaml:"code"`
	Title         string `json:"title"             yaml:"title"`
	Keywords      string `json:"keywords"          yaml:"keywords"`    // MAX 250
	Description   string `json:"description"       yaml:"description"` // MAX 140
	Template      string `json:"template"          yaml:"template"`
	Cache         bool   `json:"cache"             yaml:"cache"`
	MultiLanguage bool   `json:"multi_language"    yaml:"multi_language"`
}

func (*PageInfo) Copy

func (info *PageInfo) Copy(in *PageInfo)

func (*PageInfo) Tr

func (info *PageInfo) Tr(t *tr.Tr, lang string)

func (*PageInfo) TrDef

func (info *PageInfo) TrDef(t *tr.Tr)

type Pages

type Pages struct {
	// contains filtered or unexported fields
}

func NewPages

func NewPages(cfg *cache.CacheConfig, t *tr.Tr, ts *Templates) *Pages

func (*Pages) Count

func (p *Pages) Count() int64

func (*Pages) Filter

func (p *Pages) Filter(lang string, pages []string) map[string]PageInfo

func (*Pages) Get

func (p *Pages) Get(code string) *PageInfo

func (*Pages) Load

func (p *Pages) Load(configPath string)

func (*Pages) New

func (p *Pages) New(info PageInfo) string

func (*Pages) Render

func (p *Pages) Render(page_code string, lang string, style string, private bool, data *map[string]interface{}) (string, bool)

type TableInfo

type TableInfo struct {
	Name    string       `json:"name"     yaml:"name"`
	DataUrl string       `json:"url"      yaml:"url"`
	Columns []ColumnInfo `json:"columns"  yaml:"columns"`
}

type Templates

type Templates struct {
	// contains filtered or unexported fields
}

func NewTemplates

func NewTemplates(t *tr.Tr, p string) *Templates

func (*Templates) FuncMap

func (t *Templates) FuncMap(name string, path string, style string, lang string) template.FuncMap

func (*Templates) Get

func (ts *Templates) Get(name string, path string, style string, lang string) *template.Template

func (*Templates) SetFunc

func (t *Templates) SetFunc(f *Functions)

type UI

type UI struct {
	Forms *Forms
	Views *Views
	Pages *Pages
	// contains filtered or unexported fields
}

func NewUI

func NewUI(templPath string, cfgForms *cache.CacheConfig, cfgViews *cache.CacheConfig, cfgPages *cache.CacheConfig, cfgRenders *cache.CacheConfig) *UI

func (*UI) GetLangList

func (u *UI) GetLangList() *map[string]map[string]string

func (*UI) GetStat

func (u *UI) GetStat() *UIStat

func (*UI) Init

func (u *UI) Init(configPath string, enableWatcher bool, enableMinify bool)

func (*UI) RenderForm

func (u *UI) RenderForm(form_code string, lang string, style string, isModal bool, data *map[string]interface{}) string

func (*UI) RenderPage

func (u *UI) RenderPage(page_code string, lang string, style string, private bool, data *map[string]interface{}) string

func (*UI) ToJSON

func (u *UI) ToJSON(role_name string, lang string, menus []string, forms []string, views []string) []byte

type UIInfo

type UIInfo struct {
	Form map[string]FormInfo `json:"forms"   yaml:"forms"`
	View map[string]ViewInfo `json:"views"   yaml:"views"`
}

type UIStat

type UIStat struct {
	CntPage int64 `json:"cnt_page"`
	CntForm int64 `json:"cnt_form"`
	CntView int64 `json:"cnt_view"`
	CntTr   int   `json:"cnt_tr"`
	CntLang int   `json:"cnt_lang"`
}

type ViewInfo

type ViewInfo struct {
	CODE         string                `json:"code"          yaml:"code"`
	Title        string                `json:"title"         yaml:"title"`
	Description  string                `json:"description"   yaml:"description"`
	MainModel    string                `json:"main_model"    yaml:"main_model"`
	EditForm     string                `json:"edit_form"     yaml:"edit_form"`
	ReadItemUrl  string                `json:"read_item_url"   yaml:"read_item_url"`
	WriteItemUrl string                `json:"write_item_url"  yaml:"write_item_url"`
	ViewItemUrl  string                `json:"view_item_url"   yaml:"view_item_url"`
	Table        TableInfo             `json:"table"         yaml:"table,flow"`
	Map          MapInfo               `json:"map"           yaml:"map,flow"`
	Function     string                `json:"function"      yaml:"function"`
	Template     string                `json:"template"      yaml:"template"`
	Actions      map[string]InfoAction `json:"actions"       yaml:"actions,flow"`
}

func (*ViewInfo) Copy

func (info *ViewInfo) Copy(in *ViewInfo)

func (*ViewInfo) Tr

func (info *ViewInfo) Tr(t *tr.Tr, lang string)

func (*ViewInfo) TrDef

func (info *ViewInfo) TrDef(t *tr.Tr)

type Views

type Views struct {
	// contains filtered or unexported fields
}

func NewViews

func NewViews(cfg *cache.CacheConfig, t *tr.Tr, ts *Templates) *Views

func (*Views) Count

func (v *Views) Count() int64

func (*Views) Filter

func (v *Views) Filter(lang string, views []string) map[string]ViewInfo

func (*Views) Get

func (v *Views) Get(code string) *ViewInfo

func (*Views) Load

func (v *Views) Load(configPath string)

func (*Views) New

func (v *Views) New(info ViewInfo) string

func (*Views) Render

func (v *Views) Render(view_code string, lang string, style string, data *map[string]interface{}) (string, bool)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL