Documentation ¶
Index ¶
- func BootStrap()
- func LoadFromEtree(element *etree.Element)
- type Collection
- func (vc *Collection) Add(v *View)
- func (vc *Collection) GetAll() []*View
- func (vc *Collection) GetAllViewsForModel(model string) []*View
- func (vc *Collection) GetByID(id string) *View
- func (vc *Collection) GetFirstViewForModel(model string, viewType ViewType) *View
- func (vc *Collection) LoadFromEtree(element *etree.Element)
- type SubViews
- type TranslatableAttribute
- type View
- type ViewRef
- func (vr ViewRef) ID() string
- func (vr ViewRef) IsNull() bool
- func (vr ViewRef) MarshalJSON() ([]byte, error)
- func (vr ViewRef) Name() string
- func (vr *ViewRef) Scan(src interface{}) error
- func (vr *ViewRef) UnmarshalJSON(data []byte) error
- func (vr *ViewRef) UnmarshalXMLAttr(attr xml.Attr) error
- func (vr ViewRef) Value() (driver.Value, error)
- type ViewTuple
- type ViewType
- type ViewXML
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BootStrap ¶
func BootStrap()
BootStrap makes the necessary updates to view definitions. In particular: - sets the type of the view from the arch root. - extracts embedded views - populates the fields map from the views arch.
func LoadFromEtree ¶
LoadFromEtree reads the view given etree.Element, creates or updates the view and adds it to the view registry if it not already.
Types ¶
type Collection ¶
A Collection is a view collection
var Registry *Collection
Registry is the views collection of the application
func NewCollection ¶
func NewCollection() *Collection
NewCollection returns a pointer to a new Collection instance
func (*Collection) Add ¶
func (vc *Collection) Add(v *View)
Add adds the given view to our Collection
func (*Collection) GetAll ¶
func (vc *Collection) GetAll() []*View
GetAll returns a list of all views of this Collection. Views are returned in an arbitrary order
func (*Collection) GetAllViewsForModel ¶
func (vc *Collection) GetAllViewsForModel(model string) []*View
GetAllViewsForModel returns a list with all views for the given model
func (*Collection) GetByID ¶
func (vc *Collection) GetByID(id string) *View
GetByID returns the View with the given id
func (*Collection) GetFirstViewForModel ¶
func (vc *Collection) GetFirstViewForModel(model string, viewType ViewType) *View
GetFirstViewForModel returns the first view of type viewType for the given model
func (*Collection) LoadFromEtree ¶
func (vc *Collection) LoadFromEtree(element *etree.Element)
LoadFromEtree loads the given view given as Element into this collection.
type TranslatableAttribute ¶
A TranslatableAttribute is a reference to an attribute in a XML view definition that can be translated.
type View ¶
type View struct { ID string Name string Model string Type ViewType Priority uint8 FieldParent string Fields []models.FieldNamer SubViews map[string]SubViews // contains filtered or unexported fields }
View is the internal definition of a view in the application
func (*View) AddOnchanges ¶
AddOnchanges adds onchange=1 for each field in the view which has an OnChange method defined
func (*View) Arch ¶
Arch returns the arch XML string of this view for the given language. Call with empty string to get the default language's arch
func (*View) SanitizeSearchView ¶
func (v *View) SanitizeSearchView()
SanitizeSearchView adds the missing domain attribute if it does not exist
func (*View) TranslatableStrings ¶
func (v *View) TranslatableStrings() []TranslatableAttribute
TranslatableStrings returns the list of all the strings in the view arch that must be translated.
type ViewRef ¶
type ViewRef [2]string
ViewRef is an array of two strings representing a view: - The first one is the ID of the view - The second one is the name of the view
func (ViewRef) MarshalJSON ¶
MarshalJSON is the JSON marshalling method of ViewRef. It marshals empty ViewRef into null instead of ["", ""].
func (*ViewRef) Scan ¶
Scan fetches the name of our view from the ID stored in the database to fill the ViewRef.
func (*ViewRef) UnmarshalJSON ¶
UnmarshalJSON is the JSON unmarshalling method of ViewRef. It unmarshals null into an empty ViewRef.
func (*ViewRef) UnmarshalXMLAttr ¶
UnmarshalXMLAttr is the XML unmarshalling method of ViewRef. It unmarshals null into an empty ViewRef.
type ViewTuple ¶
ViewTuple is an array of two strings representing a view: - The first one is the ID of the view - The second one is the view type corresponding to the view ID
func (ViewTuple) MarshalJSON ¶
MarshalJSON is the JSON marshalling method of ViewTuple. It marshals ViewTuple into a list [id, type].
func (*ViewTuple) UnmarshalJSON ¶
UnmarshalJSON method for ViewTuple
type ViewType ¶
type ViewType string
A ViewType defines the type of a view
const ( ViewTypeTree ViewType = "tree" ViewTypeList ViewType = "list" ViewTypeForm ViewType = "form" ViewTypeGraph ViewType = "graph" ViewTypeCalendar ViewType = "calendar" ViewTypeDiagram ViewType = "diagram" ViewTypeGantt ViewType = "gantt" ViewTypeKanban ViewType = "kanban" ViewTypeSearch ViewType = "search" ViewTypeQWeb ViewType = "qweb" )
View types
type ViewXML ¶
type ViewXML struct { ID string `xml:"id,attr"` Name string `xml:"name,attr"` Model string `xml:"model,attr"` Priority uint8 `xml:"priority,attr"` Arch string `xml:",innerxml"` InheritID string `xml:"inherit_id,attr"` FieldParent string `xml:"field_parent,attr"` }
ViewXML is used to unmarshal the XML definition of a View