controllers

package
v0.0.0-...-16d2632 Latest Latest
Warning

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

Go to latest
Published: Jul 26, 2020 License: BSD-3-Clause Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DetectUserAgent = func(ctx *context.Context) {
	deviceDetector := mobiledetect.NewMobileDetect(ctx.Request, nil)
	ctx.Request.ParseForm()
	device := ""
	if len(ctx.Request.Form["device_type"]) != 0 {
		device = ctx.Request.Form["device_type"][0]
	}
	if device == "" {
		device = ctx.Input.Cookie("Device-Type")
	}
	if device == "" {
		if deviceDetector.IsMobile() {
			device = "mobile"
		}
		if deviceDetector.IsTablet() {
			device = "tablet"
		}
		if device == "" {
			device = beego.AppConfig.String("DefaultDevice")
			if device == "" {
				device = "desktop"
			}
		}
	}
	ctx.Output.Cookie("Device-Type", device)
	ctx.Input.SetData("device_type", device)
}

DetectUserAgent detects device type and set it into a cookie

Functions

This section is empty.

Types

type AjaxController

type AjaxController struct {
	BaseController
}

func (*AjaxController) GetImageUploadStatus

func (CTRL *AjaxController) GetImageUploadStatus()

func (*AjaxController) PostImage

func (CTRL *AjaxController) PostImage()

generic Ajax

type BaseController

type BaseController struct {
	beego.Controller
	// contains filtered or unexported fields
}

BaseController Extendable

func (*BaseController) ConfigPage

func (CTRL *BaseController) ConfigPage(page string)

ConfigPage receives template name and makes basic config to render it

func (*BaseController) GetActiveAds

func (CTRL *BaseController) GetActiveAds() map[string]string

func (*BaseController) GetBlocks

func (CTRL *BaseController) GetBlocks() map[string]string

func (*BaseController) GetCache

func (CTRL *BaseController) GetCache()

GetCache set the cache connector into our controller

func (*BaseController) GetContent

func (CTRL *BaseController) GetContent() string

GetContent gets contents

func (*BaseController) GetDB

func (CTRL *BaseController) GetDB(db ...string) orm.Ormer

GetDB set the orm connector into our controller if repication activated we use slave to Slave

func (*BaseController) GetModuleMenu

func (CTRL *BaseController) GetModuleMenu() string

GetModuleMenu retrieves menu

type IndexController

type IndexController struct {
	BaseController
}

func (*IndexController) Category

func (CTRL *IndexController) Category()

Get main page

func (*IndexController) Get

func (CTRL *IndexController) Get()

Get main page

func (*IndexController) GetPage

func (CTRL *IndexController) GetPage()

type ViewController

type ViewController struct {
	BaseController
}

ArticleController ...

func (*ViewController) Get

func (CTRL *ViewController) Get()

Get Displays Article by id

func (*ViewController) Video

func (CTRL *ViewController) Video()

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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