bootstrapper

package module
v0.5.4 Latest Latest
Warning

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

Go to latest
Published: Apr 7, 2024 License: MIT Imports: 9 Imported by: 1

README

Bootstrapper

Build Status Go Report Card Docs License

This is a library to generate various Bootstrap examples boilerplate for Quicktemplate:

Supported Components:

Documentation

Index

Constants

View Source
const (
	ColSizeXs   = "xs" // for phones - screens less than 768px wide
	ColSizeSm   = "sm" // for tablets - screens equal to or greater than 768px wide
	ColSizeMd   = "md" // for small laptops - screens equal to or greater than 992px wide
	ColSizeLg   = "lg" // for laptops and desktops - screens equal to or greater than 1200px wide
	ColMaxWidth = 12
)
View Source
const (
	ClassActive = "active"

	ClassButton         = "btn"
	ClassButtonGroup    = "btn-group"
	ClassButtonSuccess  = "btn-success"
	ClassDropdown       = "dropdown"
	ClassDropdownMenu   = "dropdown-menu"
	ClassDropdownToggle = "dropdown-toggle"

	ClassListGroup         = "list-group"
	ClassListGroupItem     = "list-group-item"
	ClassListGroupItemText = "list-group-item-text"

	ClassPanel        = "panel"
	ClassPanelHeading = "panel-heading"
	ClassPanelTitle   = "panel-title"
	ClassPanelBody    = "panel-body"

	ColorBlack  = "inverse"
	ColorBlue   = "primary"
	ColorCyan   = "info"
	ColorGreen  = "success"
	ColorOrange = "warning"
	ColorRed    = "danger"
)

Variables

View Source
var (
	ErrWidthTooLarge   = errors.New("max width of 12 exceeded")
	ErrWidthIsNegative = errors.New("width cannot be negative")
)
View Source
var ErrColorUnknown = errors.New("color unknown")

Functions

func ColWidthToClass added in v0.4.0

func ColWidthToClass(size string, width int) (string, error)

ColWidthToClass creates a class string where `size` must be in `[xs,sm,md,lg]` and size must be `[1,12]`.

func Colors added in v0.5.0

func Colors() []string

func IsColor added in v0.5.0

func IsColor(c string) bool
func NavbarHtml(navData Navbar) string

func StreamNavbarHtml

func StreamNavbarHtml(qw422016 *qt422016.Writer, navData Navbar)

func StreamWebpageHTML added in v0.4.0

func StreamWebpageHTML(qw422016 *qt422016.Writer, pageData Webpage)

func WebpageHTML added in v0.4.0

func WebpageHTML(pageData Webpage) string

func WriteNavbarHtml

func WriteNavbarHtml(qq422016 qtio422016.Writer, navData Navbar)

func WriteWebpageHTML added in v0.4.0

func WriteWebpageHTML(qq422016 qtio422016.Writer, pageData Webpage)

Types

type AlbumCell

type AlbumCell struct {
	ImageSrc string
	Text     string
	Button1  string
	Button2  string
	Footnote string
}

type Alert

type Alert int
const (
	Primary Alert = iota
	Secondary
	Success
	Danger
	Warning
	Info
	Light
	Dark
)

func NewAlert

func NewAlert(idx int) Alert

func (Alert) Class

func (a Alert) Class() string

Class returns the class name of the alert ("Primary", "Secondary", ...).

func (Alert) String

func (a Alert) String() string

Class returns the class name of the alert ("Primary", "Secondary", ...).

type AlertColored

type AlertColored int
const (
	PrimaryC AlertColored = iota
	SecondaryC
	SuccessC
	DangerC
	WarningC
	InfoC
)

func NewAlertColored

func NewAlertColored(idx int) AlertColored

func (AlertColored) Class

func (a AlertColored) Class() string

Class returns the class name of the alert ("Primary", "Secondary", ...).

func (AlertColored) DivHTML added in v0.4.0

func (a AlertColored) DivHTML(innerHTML string) string

Class returns the class name of the alert ("Primary", "Secondary", ...).

func (AlertColored) String

func (a AlertColored) String() string

Class returns the class name of the alert ("Primary", "Secondary", ...).

type Button added in v0.5.0

type Button struct {
	htmlutil.Element
}

Button return ssomething like `<button type="button" class="btn btn-success" style="width:100%" onclick="this.blur()">MyText</button>`

func NewButton added in v0.5.0

func NewButton() *Button

func (*Button) SetColor added in v0.5.0

func (but *Button) SetColor(c string) error

type Column added in v0.4.0

type Column struct {
	htmlutil.Element
	//ElementBase
	SizeDefaultWidth int
	SizeAllHidden    bool
	XsWidth          int
	XsHidden         bool
	SmWidth          int
	SmHidden         bool
	MdWidth          int
	MdHidden         bool
	LgWidth          int
	LgHidden         bool
}

func (*Column) Classes added in v0.5.0

func (col *Column) Classes() ([]string, error)

Classes returns a list of column-related Bootstrap classes.

func (*Column) String added in v0.5.0

func (col *Column) String() (string, error)

type Generic added in v0.4.0

type Generic htmlutil.Element
type Link struct {
	Href      string
	InnerHTML string
	Current   bool
	SubLinks  []Link
}

type ListGroup added in v0.5.0

type ListGroup struct {
	htmlutil.Element
}

func NewListGroup added in v0.5.0

func NewListGroup() *ListGroup

func (*ListGroup) AddItemText added in v0.5.0

func (grp *ListGroup) AddItemText(text string, escaped, active bool)
type Navbar struct {
	Title     Link
	MenuLinks []Link
	Search    Search
}

type Panel added in v0.5.0

type Panel struct {
	htmlutil.Element
}

func NewPanel added in v0.5.0

func NewPanel() *Panel

func (*Panel) AddBody added in v0.5.0

func (p *Panel) AddBody(text string, escaped bool)

func (*Panel) AddTitle added in v0.5.0

func (p *Panel) AddTitle(text string, escaped bool, tagName string)

func (*Panel) Color added in v0.5.0

func (p *Panel) Color(c string) error
type Search struct {
	Action      string
	Method      string
	Onclick     string
	Placeholder string
	Text        string
}

type Webpage

type Webpage struct {
	Title    string
	Navbar   Navbar
	MainHTML string
}

func (*Webpage) FooterString

func (pg *Webpage) FooterString() string

func (*Webpage) MainString

func (pg *Webpage) MainString() string

func (*Webpage) NavbarString

func (pg *Webpage) NavbarString() string

Directories

Path Synopsis
nav

Jump to

Keyboard shortcuts

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