editor

package
v0.5.12 Latest Latest
Warning

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

Go to latest
Published: Feb 18, 2024 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ViewActionKey         = "view"
	PreviewDraftActionKey = "preview-draft"
	ViewErrorActionKey    = "preview-error"
	EditActionKey         = "edit"
	UnlockActionKey       = "unlock"
	RetakeActionKey       = "retake"
	DeleteActionKey       = "delete"
	DeleteDraftActionKey  = "delete-draft"
	DeletePathActionKey   = "delete-path"
	CommitActionKey       = "commit"
	PublishActionKey      = "publish"
	IndexPageActionKey    = "index-page"
	DeIndexPageActionKey  = "de-index-page"
	CancelActionKey       = "cancel"
	MoveActionKey         = "move"
	CopyActionKey         = "copy"
	CreatePageActionKey   = "create-page"
	CreateMenuActionKey   = "create-menu"
	TranslateActionKey    = "translate"
	ChangeActionKey       = "change"
	SearchActionKey       = "search"

	CreateUserActionKey      = "create-user"
	DeleteUserActionKey      = "delete-user"
	ReactivateUserActionKey  = "reactivate-user"
	DeactivateUserActionKey  = "deactivate-user"
	AdminLockUserActionKey   = "admin-lock-user"
	AdminUnlockUserActionKey = "admin-unlock-user"
	ResetUserOtpActionKey    = "reset-user-otp"
)

Variables

View Source
var (
	EditorWorkFiles = WorkFiles{
		LockFile,
		DraftFile,
	}
)

Functions

func MakeLangCodePath

func MakeLangCodePath(code, dirs string) (dirsPath string)

func MakeScrollToKey

func MakeScrollToKey(changeID string) (key string)

Types

type Action

type Action struct {
	// Key is the kebab-cased verb used for machine purposes
	Key string `json:"key"`
	// Name is the label displayed for this action
	Name string `json:"name"`
	// Icon is the icon class to display
	Icon string `json:"icon"`
	// Button is the button class to render with (ie: "primary", "secondary", "caution", "danger", etc)
	Class string `json:"class"`
	// Active indicates whether this action is clickable or simply an indicator
	Active bool `json:"active"`
	// Prompt is the text to use in a prompt for confirmation of this action, leave empty to act without confirmation
	Prompt string `json:"prompt,omitempty"`
	// Method is the form method for submitting this action
	Method FormMethod `json:"method,omitempty"`
	// Tilde is a WorkFile extension to include in the URL of action links
	Tilde string `json:"tilde,omitempty"`
	// Dialog specifies the editor dialog template to use (default is "yesno")
	Dialog string `json:"dialog,omitempty"`
	// Order specifies the weighted position of this action in the menu UX, actions with an Order less than 10 are to
	// be displayed beside the menu dropdown for quick-access
	Order int `json:"order"`
}

func MakeAdminLockUser

func MakeAdminLockUser(printer *message.Printer, eid string) (action *Action)

func MakeAdminUnlockUser

func MakeAdminUnlockUser(printer *message.Printer, eid string) (action *Action)

func MakeCancelFileAction

func MakeCancelFileAction(printer *message.Printer) (action *Action)

func MakeCommitFileAction

func MakeCommitFileAction(printer *message.Printer) (action *Action)

func MakeCopyFileAction

func MakeCopyFileAction(printer *message.Printer, filename string) (action *Action)

func MakeCreateMenuAction

func MakeCreateMenuAction(printer *message.Printer) (action *Action)

func MakeCreatePageAction

func MakeCreatePageAction(printer *message.Printer) (action *Action)

func MakeCreateUser

func MakeCreateUser(printer *message.Printer) (action *Action)

func MakeDeIndexPageAction

func MakeDeIndexPageAction(printer *message.Printer, filename string) (action *Action)

func MakeDeactivateUser

func MakeDeactivateUser(printer *message.Printer, eid string) (action *Action)

func MakeDeleteDraftFileAction

func MakeDeleteDraftFileAction(printer *message.Printer, filename string) (action *Action)

func MakeDeleteFileAction

func MakeDeleteFileAction(printer *message.Printer, filename string) (action *Action)

func MakeDeletePathAction

func MakeDeletePathAction(printer *message.Printer, dirPath string) (action *Action)

func MakeDeleteUser

func MakeDeleteUser(printer *message.Printer, eid string) (action *Action)

func MakeEditFileAction

func MakeEditFileAction(printer *message.Printer) (action *Action)

func MakeIndexPageAction

func MakeIndexPageAction(printer *message.Printer, filename string) (action *Action)

func MakeMoveFileAction

func MakeMoveFileAction(printer *message.Printer, filename string) (action *Action)

func MakePreviewDraftAction

func MakePreviewDraftAction(printer *message.Printer) (action *Action)

func MakePublishFileAction

func MakePublishFileAction(printer *message.Printer, filename string) (action *Action)

func MakeReactivateUser

func MakeReactivateUser(printer *message.Printer, eid string) (action *Action)

func MakeResetUserOtp

func MakeResetUserOtp(printer *message.Printer, eid string) (action *Action)

func MakeRetakeFileAction

func MakeRetakeFileAction(printer *message.Printer, filename string) (action *Action)

func MakeTranslateAction

func MakeTranslateAction(printer *message.Printer, filename string) (action *Action)

func MakeUnlockFileAction

func MakeUnlockFileAction(printer *message.Printer, filename string) (action *Action)

func MakeViewErrorAction

func MakeViewErrorAction(printer *message.Printer) (action *Action)

func MakeViewFileAction

func MakeViewFileAction(printer *message.Printer) (action *Action)

type Actions

type Actions []*Action

func (Actions) Has

func (list Actions) Has(key string) (present bool)

func (Actions) Len

func (list Actions) Len() (size int)

func (Actions) Prune

func (list Actions) Prune(keys ...string) (pruned Actions)

func (Actions) Sort

func (list Actions) Sort() (sorted Actions)

type Dialog

type Dialog struct {
	Key      string `json:"key"`
	Tag      string `json:"tag"`
	Name     string `json:"name"`
	Icon     string `json:"icon"`
	Class    string `json:"class"`
	Title    string `json:"title"`
	Message  string `json:"message"`
	Template string `json:"template"`
}

type File

type File struct {
	FSBT   string        `json:"fsbt"`
	FSID   string        `json:"fsid"`
	Code   string        `json:"code"`
	Path   string        `json:"path"`
	File   string        `json:"file"`
	Locale *language.Tag `json:"lang"`

	MountPoint interface{} `json:"-"`
	Tilde      string      `json:"-"`

	Name     string `json:"name"`
	Shasum   string `json:"shasum"`
	MimeType string `json:"mimeType"`

	HasDraft bool   `json:"hasDraft"`
	Locked   bool   `json:"locked"`
	LockedBy string `json:"lockedBy"`
	ReadOnly bool   `json:"readOnly"`
	Binary   bool   `json:"binary"`

	Created time.Time `json:"created"`
	Updated time.Time `json:"updated"`

	Actions    Actions    `json:"actions"`
	Indicators Indicators `json:"indicators,omitempty"`

	Context beContext.Context `json:"-"`
}

func ParseDirectory

func ParseDirectory(fsid, filePath string) *File

func ParseFile

func ParseFile(fsid, filePath string) *File

func (*File) BaseName

func (f *File) BaseName() (fileName string)

func (*File) BaseNamePath

func (f *File) BaseNamePath() (filePath string)

func (*File) Clone

func (f *File) Clone() (file *File)

func (*File) CodeFilePath

func (f *File) CodeFilePath() (filePath string)

func (*File) DirectoryPath

func (f *File) DirectoryPath() (dirPath string)

func (*File) EditCodeDirectoryPath

func (f *File) EditCodeDirectoryPath() (directory string)

func (*File) EditCodeFilePath

func (f *File) EditCodeFilePath() (filePath string)

func (*File) EditCodeParentDirectoryPath

func (f *File) EditCodeParentDirectoryPath() (directory string)

func (*File) EditDirectoryPath

func (f *File) EditDirectoryPath() (directory string)

func (*File) EditFilePath

func (f *File) EditFilePath() (filePath string)

func (*File) EditParentDirectoryPath

func (f *File) EditParentDirectoryPath() (directory string)

func (*File) EditPath

func (f *File) EditPath() (filePath string)

func (*File) FileName

func (f *File) FileName() (name string)

func (*File) FilePath

func (f *File) FilePath() (filePath string)

func (*File) Url

func (f *File) Url() (path string)

type Files

type Files []*File

func (Files) Find

func (l Files) Find(fsid, filePath string) (f *File)

func (Files) Sort

func (l Files) Sort() (sorted Files)

type FormMethod

type FormMethod string
const (
	NilFormMethod  FormMethod = ""
	GetFormMethod  FormMethod = "get"
	PostFormMethod FormMethod = "post"
)

type Indicator

type Indicator struct {
	Icon    string `json:"icon"`
	Message string `json:"message"`
	Link    string `json:"link,omitempty"`
}

type Indicators

type Indicators []*Indicator

type WorkFile

type WorkFile string
const (
	NilFile   WorkFile = ""
	LockFile  WorkFile = "lock"
	DraftFile WorkFile = "draft"
)

func ParseEditorWorkFile

func ParseEditorWorkFile(filename string) (modified string, wf WorkFile, ok bool)

func (WorkFile) Is

func (wf WorkFile) Is(name string) (is bool)

func (WorkFile) String

func (wf WorkFile) String() (name string)

type WorkFiles

type WorkFiles []WorkFile

func (WorkFiles) Lookup

func (wf WorkFiles) Lookup(key string) (found WorkFile)

Jump to

Keyboard shortcuts

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