tags: github.com/gobuffalo/tags Index | Files | Directories

package tags

import "github.com/gobuffalo/tags"


Package Files

misc.go options.go pagination.go tag.go version.go


const Version = "v2.1.0"

Version holds current source version number

type AfterTag Uses

type AfterTag interface{}

AfterTag is content placed right after the Tag

type BeforeTag Uses

type BeforeTag interface{}

BeforeTag is content placed right before the Tag

type Body Uses

type Body interface{}

Body is a Tag inner content.

type Options Uses

type Options map[string]interface{}

Options is a map used to configure tags

func (Options) String Uses

func (o Options) String() string

type Paginator Uses

type Paginator struct {
    // Current page you're on
    Page int `json:"page"`
    // Number of results you want per page
    PerPage int `json:"per_page"`
    // Page * PerPage (ex: 2 * 20, Offset == 40)
    Offset int `json:"offset"`
    // Total potential records matching the query
    TotalEntriesSize int `json:"total_entries_size"`
    // Total records returns, will be <= PerPage
    CurrentEntriesSize int `json:"current_entries_size"`
    // Total pages
    TotalPages int `json:"total_pages"`

Paginator describes a pagination meta data

func (Paginator) Tag Uses

func (p Paginator) Tag(opts Options) (*Tag, error)

Tag generates the pagination html Tag

func (Paginator) TagFromPagination Uses

func (p Paginator) TagFromPagination(pagination interface{}, opts Options) (*Tag, error)

TagFromPagination receives a pagination interface{} and attempts to get Paginator properties from it before generating the tag.

type Tag Uses

type Tag struct {
    Name      string
    Options   Options
    Selected  bool
    Checked   bool
    BeforeTag []BeforeTag
    Body      []Body
    AfterTag  []AfterTag

Tag describes a HTML tag meta data.

func JavascriptTag Uses

func JavascriptTag(opts Options) *Tag

JavascriptTag builds JS tags based in passed options

func New Uses

func New(name string, opts Options) *Tag

New creates a new Tag with given name and options.

func Pagination Uses

func Pagination(pagination interface{}, opts Options) (*Tag, error)

Pagination builds pagination Tag based on a passed pagintation interface

func StylesheetTag Uses

func StylesheetTag(opts Options) *Tag

StylesheetTag builds the <link> tag to load styles on the page.

func (*Tag) Append Uses

func (t *Tag) Append(b ...Body)

Append adds new Body part(s) after the current Tag inner contents.

func (Tag) HTML Uses

func (t Tag) HTML() template.HTML

HTML gets the Tag string representation as a HTML template.

func (*Tag) Prepend Uses

func (t *Tag) Prepend(b ...Body)

Prepend adds new Body part(s) before the current Tag inner contents.

func (Tag) String Uses

func (t Tag) String() string



Package tags imports 12 packages (graph) and is imported by 20 packages. Updated 2019-04-17. Refresh now. Tools for package owners.