viewmodel

package
v0.10.0 Latest Latest
Warning

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

Go to latest
Published: Feb 11, 2017 License: BSD-3-Clause Imports: 2 Imported by: 12

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Alias added in v0.10.0

type Alias struct {
	Name        string
	Route       string
	TargetRoute string
}

Alias represents an alias-index entry with a name, route and target route.

type AliasIndex added in v0.10.0

type AliasIndex struct {
	Model

	Aliases []Alias
}

type Analytics

type Analytics struct {
	Enabled         bool            `json:"enabled"`
	GoogleAnalytics GoogleAnalytics `json:"googleAnalytics"`
}

type Author

type Author struct {
	Name  string `json:"name"`
	Email string `json:"email"`
	URL   string `json:"url"`

	GooglePlusHandle string `json:"googlePlusHandle"`
	TwitterHandle    string `json:"twitterHandle"`
	FacebookHandle   string `json:"facebookHandle"`
}

type Base

type Base struct {
	RepositoryName        string `json:"repositoryName"`
	RepositoryDescription string `json:"repositoryDescription"`

	Type    string  `json:"type"`
	Level   int     `json:"level"`
	Route   string  `json:"route"`
	Aliases []Alias `json:"aliases"`

	ParentRoute string `json:"parentRoute"`

	BaseURL     string `json:"baseURL"`
	PrintURL    string `json:"printURL"`
	JSONURL     string `json:"jsonURL"`
	MarkdownURL string `json:"markdownURL"`
	DOCXURL     string `json:"docxURL"`

	PageTitle   string `json:"pageTitle"`
	Title       string `json:"title"`
	Description string `json:"description"`

	LanguageTag      string `json:"languageTag"`
	CreationDate     string `json:"creationdate"`
	LastModifiedDate string `json:"lastmodifieddate"`

	LiveReloadEnabled bool
}

Base contains the minimum set of attributes for every view model.

type Breadcrumb struct {
	Level  int    `json:"level"`
	Title  string `json:"title"`
	Path   string `json:"path"`
	IsLast bool
}
type BreadcrumbNavigation struct {
	Entries []Breadcrumb `json:"entries"`
}
func (navigation BreadcrumbNavigation) IsAvailable() bool

type ConversionModel

type ConversionModel struct {
	Base

	Content string `json:"content"`

	Files []File `json:"files"`
}

type Feed added in v0.10.0

type Feed struct {
	FeedEntry
	Items []FeedEntry
}

type FeedEntry

type FeedEntry struct {
	Title       string `json:"title"`
	Description string `json:"description"`
	Link        string `json:"link"`
	PubDate     string `json:"pubDate"`
}

type File

type File struct {
	Parent string `json:"parent"`
	Path   string `json:"path"`
	Route  string `json:"route"`
	Name   string `json:"name"`

	Hash         string    `json:"hash"`
	LastModified time.Time `json:"lastModified"`
	MimeType     string    `json:"mimeType"`
}

type GeoLocation

type GeoLocation struct {
	PlaceName   string `json:"placename"`
	Address     string `json:"address"`
	Coordinates string `json:"coordinates"`

	Street    string `json:"street"`
	City      string `json:"city"`
	Postcode  string `json:"postcode"`
	Country   string `json:"country"`
	Latitude  string `json:"latitude"`
	Longitude string `json:"longitude"`
	MapType   string `json:"mapType"`
	Zoom      int    `json:"zoom"`
}

type GoogleAnalytics

type GoogleAnalytics struct {
	Enabled    bool   `json:"enabled"`
	TrackingID string `json:"trackingId"`
}

type Image

type Image struct {
	File
}

type ItemNavigation

type ItemNavigation struct {
	Parent   NavEntry `json:"parent"`
	Previous NavEntry `json:"previous"`
	Next     NavEntry `json:"next"`
}

func (ItemNavigation) IsAvailable added in v0.10.0

func (nav ItemNavigation) IsAvailable() bool

IsAvailable returns a flag indicating whether the item navigation model is initialized or not.

type Model

type Model struct {
	Base

	Content  string `json:"content"`
	Markdown string `json:"markdown"`

	Publisher Publisher `json:"publisher"`
	Author    Author    `json:"author"`

	Children []Base `json:"children"`

	ToplevelNavigation   ToplevelNavigation   `json:"toplevelNavigation"`
	BreadcrumbNavigation BreadcrumbNavigation `json:"breadcrumbNavigation"`
	ItemNavigation       ItemNavigation       `json:"itemNavigation"`

	Tags     []Tag    `json:"tags"`
	TagCloud TagCloud `json:"tagCloud"`

	Files  []File  `json:"files"`
	Images []Image `json:"images"`

	GeoLocation GeoLocation `json:"geoLocation"`

	Analytics Analytics `json:"-"`

	Hash string `json:"hash"`

	IsRepositoryItem bool
}

func Error

func Error(title, content, route string) Model
type NavEntry struct {
	Title       string `json:"title"`
	Description string `json:"description"`
	Path        string `json:"path"`
}

type OpenSearchDescription

type OpenSearchDescription struct {
	Title       string `json:"title"`
	Description string `json:"description"`
	FavIconURL  string `json:"favIconURL"`
	SearchURL   string `json:"searchURL"`
	Tags        string `json:"tags"`
}

type Publisher

type Publisher struct {
	Name  string `json:"name"`
	Email string `json:"email"`
	URL   string `json:"url"`

	GooglePlusHandle string `json:"googlePlusHandle"`
	TwitterHandle    string `json:"twitterHandle"`
	FacebookHandle   string `json:"facebookHandle"`
}

type RobotsTxt added in v0.10.0

type RobotsTxt struct {
	Disallows  []RobotsTxtDisallow
	SitemapURL string
}

RobotsTxt represents the content of a robots.txt file

type RobotsTxtDisallow added in v0.10.0

type RobotsTxtDisallow struct {
	UserAgent string
	Paths     []string
}

RobotsTxtDisallow is the definition of disallow-section of a robots.txt

type Search struct {
	Model
	Results SearchResults
}

type SearchResult

type SearchResult struct {
	Index int `json:"index"`

	Title       string `json:"title"`
	Description string `json:"description"`
	Route       string `json:"route"`
	Path        string `json:"path"`
}

type SearchResults added in v0.10.0

type SearchResults struct {
	Query   string         `json:"query"`
	Results []SearchResult `json:"results"`

	Page         int `json:"page"`
	ItemsPerPage int `json:"itemPerPage"`

	StartIndex       int `json:"startIndex"`
	ResultCount      int `json:"resultCount"`
	TotalResultCount int `json:"totalResultCount"`
}

type Sitemap

type Sitemap struct {
	Model
	Tree string
}

type SitemapEntry added in v0.10.0

type SitemapEntry struct {
	Path        string         `json:"path"`
	Title       string         `json:"title"`
	Description string         `json:"description"`
	Children    []SitemapEntry `json:"children"`
}

type SortAliasBy added in v0.10.0

type SortAliasBy func(alias1, alias2 Alias) bool

SortAliasBy can be used to sort two aliases.

func (SortAliasBy) Sort added in v0.10.0

func (by SortAliasBy) Sort(aliases []Alias)

Sort sorts the supplied list of aliases.

type SortBaseModelBy

type SortBaseModelBy func(model1, model2 Base) bool

func (SortBaseModelBy) Sort

func (by SortBaseModelBy) Sort(models []Base)

type SortModelBy

type SortModelBy func(model1, model2 Model) bool

func (SortModelBy) Sort

func (by SortModelBy) Sort(models []Model)

type SortTagBy

type SortTagBy func(tag1, tag2 Tag) bool

func (SortTagBy) Sort

func (by SortTagBy) Sort(tags []Tag)

type SortTagCloudBy

type SortTagCloudBy func(tagCloudEntry1, tagCloudEntry2 TagCloudEntry) bool

func (SortTagCloudBy) Sort

func (by SortTagCloudBy) Sort(tagCloud TagCloud)

type Tag

type Tag struct {
	Name     string  `json:"name"`
	Anchor   string  `json:"anchor"`
	Route    string  `json:"route"`
	Children []Model `json:"children"`
}

type TagCloud

type TagCloud []TagCloudEntry

type TagCloudEntry

type TagCloudEntry struct {
	Name             string `json:"name"`
	Anchor           string `json:"anchor"`
	Route            string `json:"route"`
	Level            int    `json:"level"`
	NumberOfChildren int    `json:"numberofchildren"`
}

type Tags added in v0.10.0

type Tags struct {
	Model
	Tags []Tag
}

type Title

type Title struct {
	Value  string   `json:"value"`
	Tokens []string `json:"tokens"`
	Route  string   `json:"route"`
}

type ToplevelEntry

type ToplevelEntry struct {
	Title string `json:"title"`
	Path  string `json:"path"`
}

type ToplevelNavigation

type ToplevelNavigation struct {
	Entries []ToplevelEntry `json:"entries"`
}

func (*ToplevelNavigation) IsAvailable

func (navigation *ToplevelNavigation) IsAvailable() bool

type TypeAhead

type TypeAhead struct {
	Index int `json:"index"`

	Title       string `json:"title"`
	Description string `json:"description"`
	Route       string `json:"route"`
	Path        string `json:"path"`

	Value  string   `json:"value"`
	Tokens []string `json:"tokens"`
}

type Update added in v0.10.0

type Update struct {
	Model

	Snippets map[string]string `json:"snippets"`
}

type XMLSitemap added in v0.10.0

type XMLSitemap struct {
	Entries []XmlSitemapEntry
}

type XmlSitemapEntry

type XmlSitemapEntry struct {
	Loc          string                 `json:"loc"`
	LastModified string                 `json:"lastModified"`
	Images       []XmlSitemapEntryImage `json:"image:image"`
}

type XmlSitemapEntryImage added in v0.10.0

type XmlSitemapEntryImage struct {
	Loc string `json:"image:loc"`
}

Jump to

Keyboard shortcuts

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