modal

package
v5.3.3-pre30 Latest Latest
Warning

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

Go to latest
Published: Sep 10, 2024 License: AGPL-3.0 Imports: 9 Imported by: 1

Documentation

Overview

Nging is a toolbox for webmasters Copyright (C) 2018-present Wenhui Shen <swh@admpub.com>

This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details.

You should have received a copy of the GNU Affero General Public License along with this program. If not, see <https://www.gnu.org/licenses/>.

Index

Constants

This section is empty.

Variables

View Source
var (
	DefaultModal = Modal{
		ExtButtons: []Button{},
	}
	PathFixer = func(ctx echo.Context, conf string) string {
		return conf
	}
	ReadConfigFile = func(file string) ([]byte, error) {
		return os.ReadFile(file)
	}
	WriteConfigFile = func(file string, b []byte) error {
		err := com.MkdirAll(filepath.Dir(file), os.ModePerm)
		if err != nil {
			return err
		}
		return os.WriteFile(file, b, os.ModePerm)
	}
)

Functions

func Clear

func Clear() error

func Remove

func Remove(confPath string) error

func Render

func Render(ctx echo.Context, param interface{}) template.HTML

Types

type Button

type Button struct {
	Attributes []HTMLAttr //按钮属性
	Text       string     //按钮文本
}

type ButtonDefault

type ButtonDefault struct {
	DisableClose bool
	Disabled     bool
	Button
}

type HTMLAttr

type HTMLAttr struct {
	Attr  string      //属性名
	Value interface{} //属性值
}
type Modal struct {
	Id           string   //元素id
	Custom       bool     //是否自定义整个内容区域
	Full         bool     // 是否铺满整个页面
	HeadTitle    string   //头部标题
	Title        string   //内容标题
	Content      string   //内容
	HelpText     string   //帮助提示
	Animate      string   //动画样式class名
	Type         string   //类型:warning/primary/success/danger
	ContentType  string   //内容类型:form/blackform/""
	ExtButtons   []Button //附加按钮 [{Text:"🔃重载",Attributes:[{Attr:"class",Value:"btn btn-warning btn-reload"}]}]
	ButtonCancel ButtonDefault
	ButtonSubmit ButtonDefault
}

func UnmarshalFile

func UnmarshalFile(ctx echo.Context, confile string) (Modal, error)

Jump to

Keyboard shortcuts

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