template_editor_model

package
v0.0.0-...-076d96f Latest Latest
Warning

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

Go to latest
Published: Sep 25, 2012 License: BSD-2-Clause-Views Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CanModifyTemplate

func CanModifyTemplate(opt map[string]interface{}) bool

func Contains

func Contains(fi []os.FileInfo, term string) []os.FileInfo

Filter

func DeleteFile

func DeleteFile(opt map[string]interface{}, inp map[string][]string, root, host string) error

Delete a file OR dir. See NewFile for controversy about filenames and extensions.

func DeletePrivate

func DeletePrivate(opt map[string]interface{}, inp map[string][]string, root, host string) error

Delete a whole private template.

func Exists

func Exists(path string) (bool, error)

Taken from http://stackoverflow.com/questions/10510691/how-to-check-whether-a-file-or-directory-denoted-by-a-path-exists-in-golang exists returns whether the given file or directory exists or not

func ForkPrivate

func ForkPrivate(db *mgo.Database, opt map[string]interface{}, inp map[string][]string, root, host string) error

Fork current private template into an other private one. Copies the whole directory from /templates/private/{host}/{current_template} to /templates/private/{host}/{inp:new_private_name}

func ForkPublic

func ForkPublic(db *mgo.Database, opt map[string]interface{}, root, host string) error

Forks a public template into a private one: creates a deep recursive copy of the whole directory tree, so the user can edit his own template files as he wishes.

func Install

func Install(db *mgo.Database, id bson.ObjectId) error

func IsDir

func IsDir(filep string) bool

Returns true if a given filepath (relative or absolute) identifies a directory.

func NewFile

func NewFile(opt map[string]interface{}, inp map[string][]string, root, host string) error

New file OR dir. Filenames without extensions became dirs. RETHINK: This way we lose the ability to create files without extensions. Only accessed member of opt will be "TplIsPrivate" in scut.GetTPath. TODO: this is ugly.

func PublishPrivate

func PublishPrivate(db *mgo.Database, opt map[string]interface{}, inp map[string][]string, root, host string) error

Publish a private template, so others can use it too. Copies the whole directory of /templates/private/{host}/{current_template} to /templates/public/{input:public_name} Fails if a public template with the chosen name already exists.

func SaveFile

func SaveFile(opt map[string]interface{}, inp map[string][]string, root, host string) error

Save an existing file.

func SwitchToTemplate

func SwitchToTemplate(db *mgo.Database, inp map[string][]string, root, host string) error

Switches from one template to another. Fails if the template we want to switch does not exist.

func Uninstall

func Uninstall(db *mgo.Database, id bson.ObjectId) error

Types

type Breadc

type Breadc struct {
	Name string
	Path string
}

func CreateBreadCrumb

func CreateBreadCrumb(fs []string) []Breadc

fs is strings.Split(filepath, "/") where filepath is "aboutus/joe.tpl"

type ReqLink struct {
	Typ      string
	Tempname string
	Filepath string
}
func ReqLinks(opt map[string]interface{}, file, root, host string) []ReqLink

Extracts all requires ( {{require example.t}} ) from a given file. Takes into account fallback files too. First it checks if the file exists in the current template. If yes, the link will point to that file. If not, then the link will point to the fallback module file. TODO: Case when the required file does not exists anywhere is not handled.

Jump to

Keyboard shortcuts

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