page

package
v1.68.1 Latest Latest
Warning

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

Go to latest
Published: Aug 1, 2018 License: AGPL-3.0 Imports: 5 Imported by: 35

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Levelize added in v1.56.0

func Levelize(pages []Page)

Levelize ensure page level increments are consistent after a page is inserted or removed.

Valid: 1, 2, 3, 4, 4, 4, 2, 1 Invalid: 1, 2, 4, 4, 2, 1 (note the jump from 2 --> 4)

Rules: 1. levels can increase by 1 only (e.g. from 1 to 2 to 3 to 4) 2. levels can decrease by any amount (e.g. drop from 4 to 1)

func Numberize added in v1.55.0

func Numberize(pages []Page)

Numberize calculates numbers for pages, e.g. 1, 1.1, 2.2.1 for the document's Table of Contents.

func Sequenize added in v1.56.0

func Sequenize(p []Page)

Sequenize will re-generate page sequence numbers for a document

Types

type BulkRequest added in v1.56.0

type BulkRequest struct {
	ID      string        `json:"id"`
	Page    Page          `json:"page"`
	Meta    Meta          `json:"meta"`
	Pending []PendingPage `json:"pending"`
}

BulkRequest details page, it's meta, pending page changes. Used to bulk load data by GUI so as to reduce network requests.

type LevelRequest added in v1.55.0

type LevelRequest struct {
	PageID string `json:"pageId"`
	Level  int    `json:"level"`
}

LevelRequest details a page ID and level.

type Meta

type Meta struct {
	ID             uint64    `json:"id"`
	Created        time.Time `json:"created"`
	Revised        time.Time `json:"revised"`
	OrgID          string    `json:"orgId"`
	UserID         string    `json:"userId"`
	DocumentID     string    `json:"documentId"`
	PageID         string    `json:"pageId"`
	RawBody        string    `json:"rawBody"`        // a blob of data
	Config         string    `json:"config"`         // JSON based custom config for this type
	ExternalSource bool      `json:"externalSource"` // true indicates data sourced externally
}

Meta holds raw page data that is used to render the actual page data.

func (*Meta) SetDefaults

func (p *Meta) SetDefaults()

SetDefaults ensures no blank values.

type NewPage

type NewPage struct {
	Page Page `json:"page"`
	Meta Meta `json:"meta"`
}

NewPage contains the page and associated meta.

type Page

type Page struct {
	model.BaseEntity
	OrgID       string                `json:"orgId"`
	DocumentID  string                `json:"documentId"`
	UserID      string                `json:"userId"`
	ContentType string                `json:"contentType"`
	PageType    string                `json:"pageType"`
	BlockID     string                `json:"blockId"`
	Level       uint64                `json:"level"`
	Sequence    float64               `json:"sequence"`
	Numbering   string                `json:"numbering"`
	Title       string                `json:"title"`
	Body        string                `json:"body"`
	Revisions   uint64                `json:"revisions"`
	Status      workflow.ChangeStatus `json:"status"`
	RelativeID  string                `json:"relativeId"` // links page to pending page edits
}

Page represents a section within a document.

func (*Page) IsSectionType

func (p *Page) IsSectionType() bool

IsSectionType tells us that page is "words"

func (*Page) IsTabType

func (p *Page) IsTabType() bool

IsTabType tells us that page is "SaaS data embed"

func (*Page) SetDefaults

func (p *Page) SetDefaults()

SetDefaults ensures no blank values.

type PendingPage added in v1.56.0

type PendingPage struct {
	Page  Page   `json:"page"`
	Meta  Meta   `json:"meta"`
	Owner string `json:"owner"`
}

PendingPage details page that is yet to be published

type Revision

type Revision struct {
	model.BaseEntity
	OrgID       string `json:"orgId"`
	DocumentID  string `json:"documentId"`
	PageID      string `json:"pageId"`
	OwnerID     string `json:"ownerId"`
	UserID      string `json:"userId"`
	ContentType string `json:"contentType"`
	PageType    string `json:"pageType"`
	Title       string `json:"title"`
	Body        string `json:"body"`
	RawBody     string `json:"rawBody"`
	Config      string `json:"config"`
	Email       string `json:"email"`
	Firstname   string `json:"firstname"`
	Lastname    string `json:"lastname"`
	Initials    string `json:"initials"`
	Revisions   int    `json:"revisions"`
}

Revision holds the previous version of a Page.

type SequenceRequest added in v1.55.0

type SequenceRequest struct {
	PageID   string  `json:"pageId"`
	Sequence float64 `json:"sequence"`
}

SequenceRequest details a page ID and its sequence within the document.

Jump to

Keyboard shortcuts

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