controller

package
v1.7.2 Latest Latest
Warning

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

Go to latest
Published: Jan 16, 2023 License: BSD-3-Clause Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const HRManagerRoleKey = "HRManager"

Variables

This section is empty.

Functions

This section is empty.

Types

type BaseController added in v0.10.0

type BaseController struct {
	Echo           echo.Context
	OdooClient     *model.Odoo
	OdooSession    *odoo.Session
	SessionData    SessionData
	RequestContext context.Context
}

type BaseView added in v0.10.0

type BaseView struct {
}

BaseView contains some utility methods.

func (BaseView) FormatDailySummary added in v1.0.0

func (v BaseView) FormatDailySummary(daily *timesheet.DailySummary) Values

FormatDailySummary returns Values with sensible format.

func (BaseView) FormatDurationInHours added in v0.10.0

func (v BaseView) FormatDurationInHours(d time.Duration) string

FormatDurationInHours returns a human friendly "0:00"-formatted duration. Seconds within a minute are rounded up or down to the nearest full minute. A sign ("-") is prefixed if duration is negative.

func (BaseView) FormatFloat added in v0.10.0

func (v BaseView) FormatFloat(value float64, precision int) string

FormatFloat returns a string of the given float with desired digits after comma.

func (BaseView) GetNextMonth added in v0.10.0

func (v BaseView) GetNextMonth(year, month int) (int, int)

GetNextMonth returns the numerical next month of the given input (month 1-12) The year is increased if month is >= 12.

func (BaseView) GetPreviousMonth added in v0.10.0

func (v BaseView) GetPreviousMonth(year, month int) (int, int)

GetPreviousMonth returns the numerical previous month of the given input (month 1-12) The year is decreased if month is <= 1.

func (BaseView) OvertimeClassname added in v1.7.0

func (v BaseView) OvertimeClassname(duration time.Duration) string

func (BaseView) OvertimeClassnameThreshold added in v1.7.0

func (v BaseView) OvertimeClassnameThreshold(duration time.Duration, dailyMax time.Duration) string

type Renderer

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

Renderer is able to render HTML templates. Templates will be compiled the first time they are requested, and cached thereafter.

func NewRenderer

func NewRenderer() *Renderer

NewRenderer returns a new "Renderer" struct

func (*Renderer) Render

func (v *Renderer) Render(w io.Writer, name string, data interface{}, c echo.Context) error

Render renders the requested template with the given data into w. "template" is suffixed with ".html", and then rendered together with "layout.html".

type SessionData added in v0.9.0

type SessionData struct {
	Employee *model.Employee `json:"employee"`
	Roles    []string        `json:"roles"`
}

SessionData is an additional data struct. Its purpose is to store data in a session cookie in order to avoid repetitive Odoo API calls.

type Values

type Values map[string]interface{}

Values is an arbitrary tree of data to be passed to Template rendering.

func AsError

func AsError(err error) Values

Jump to

Keyboard shortcuts

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