Documentation
¶
Index ¶
- func Conn() (*gorm.DB, error)
- func RunMigrations()
- func SanitizeTestHelper(s string) template.HTML
- type Account
- type Image
- type LoginForm
- type Lora
- type Page
- type Param
- type Profile
- type Project
- func (p *Project) Build() error
- func (p *Project) Clean() error
- func (p *Project) GenContent() error
- func (p *Project) GenLorem()
- func (p *Project) GenScaffold() error
- func (p *Project) InitDir() error
- func (p *Project) Initialize(base string, name string, template string, theme string) error
- func (p *Project) InstallTemplate(name, theme string) error
- func (p *Project) InstallTheme(theme string) error
- func (p *Project) LoadConfigFile() error
- func (p *Project) SaveConfigFile() error
- func (p *Project) SaveDataFiles() error
- func (p *Project) SetBaseUrl()
- type Resource
- type Section
- type SubSection
- type Upload
- type UserProfileForm
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func RunMigrations ¶
func RunMigrations()
func SanitizeTestHelper ¶
Types ¶
type Account ¶
type Account struct { Id int64 `form:"-"` UserName string `toml:"-" sql:"not null;unique" form:"userName" valid:"Required"` Company string `toml:"company_name" sql:"unique" form:"company" valid:"Required"` Email string `toml:"email" sql:"unique" form:"email" valid:"Email"` Projects []Project `toml:"-" form:"-"` Password string `toml:"-" form:"password" valid:"Required"` ConfirmPassword string `toml:"-" sql:"-" form:"password2" valid:"Required"` Uploads []Upload `toml:"-" form:"-"` Profile Profile `toml:"-" form:"-"` ProfileId int64 `toml:"-" form:"-"` ClearanceLevel int `toml:"-" form:"-"` CreatedAt time.Time `toml:"-" form:"-"` UpdatedAt time.Time `toml:"-" form:"-"` DeletedAt time.Time `toml:"-" form:"-"` }
Account stores user information
type LoginForm ¶
type LoginForm struct { Email string `form:"email" valid:"Required;Email"` Password string `form:"password" valid:"Required;MinSize(6)"` }
RegistrationForm has info strings for verification during registration process
type Lora ¶
type Lora struct { Page Page Project Project Account Account Section Section SubSection SubSection Profile Profile Pages []Page Projects []Project Accounts []Account Sections []Section SubSections []SubSection Profiles []Profile HasPage bool HasProject bool HasAccount bool HasSection bool HasSubSection bool HasProfile bool HasPages bool HasProjects bool HasAccounts bool HasSections bool HasSubSections bool HasProfiles bool IsAdmin bool }
func NewLoraObject ¶
func NewLoraObject() *Lora
type Page ¶
type Page struct { Id int64 Title string `toml:"title"` ProjectId int64 `toml:"-" ` Content string `toml:"content" sql:"null;type:text"` ContentHtml template.HTML `toml:"-" sql:"-"` Slug string `toml:"slug" sql:"null"` Draft bool `toml:"draft" sql:"null"` Sections []Section `toml:"sections"` ContentPath string `toml:"-" sql:"-"` CreatedAt time.Time `toml:"-"` UpdatedAt time.Time `toml:"-"` }
Page representation of web page
func (*Page) LastUpdate ¶
func (*Page) Sanitize ¶
func (p *Page) Sanitize()
Sanitize This prepares the ContentHtml field for rendering safe html
func (*Page) SaveDataFile ¶
type Profile ¶
type Profile struct { Id int64 Phone string Photo string `sql:"null"` Thumbnail string UpdatedAt time.Time CreatedAT time.Time }
func (*Profile) GenerateIdenticon ¶
type Project ¶
type Project struct { Id int64 Title string `toml:"title"` Name string `toml:"projectName" sql:"unique""` BaseDir string `toml:"-" sql:"-"` Template string `toml:"templateName"` Theme string `toml:"theme"` PublishDir string `toml:"publishDir"` ProjectPath string `toml:"projectPath"` TemplatePath string `toml:"-"` BaseUrl string `toml:"baseurl"` HomeUrl string `toml:"-" sql:"-"` LanguageCode string `toml:"languageCode" sql:"-"` Pages []Page `toml:"pages"` AccountId int64 `toml:"-" sql:"null"` Param Param `toml:"params"` ParamId int64 `toml:"-"` Copyright string `toml:"copyright"` CreatedAt time.Time `toml:"-"` UpdatedAt time.Time `toml:"-"` }
Project provide an abstract representation of a hugo project with other extra important details about a website project
func NewLoraProject ¶
func (*Project) Build ¶
Build run hugo on the root of project path to generate static files in public folder of the project path.
func (*Project) GenContent ¶
GenContent generates frontmatter and contents of the pages in Markdown files, the fuction can only be called after the project configurations have been loaded
func (*Project) GenLorem ¶
func (p *Project) GenLorem()
GenLorem populates pages with lorem ipsum for the page's content
func (*Project) GenScaffold ¶
GenScaffold copies a directory from the templates folder into the projects folder. The template name should be provided by the user, if not default template is used
func (*Project) Initialize ¶
func (*Project) InstallTemplate ¶
func (*Project) InstallTheme ¶
func (*Project) LoadConfigFile ¶
LoadConfig reads the configuration file found in a project path. The file is expected to be of toml format, it unamrshall the values into the current project object.
func (*Project) SaveConfigFile ¶
SaveConfigFile saves the current object to a configuration file in Toml format
func (*Project) SaveDataFiles ¶
func (*Project) SetBaseUrl ¶
func (p *Project) SetBaseUrl()
type Section ¶
type Section struct { Id int64 PageId int64 Name string `toml:"name"` Title string `toml:"title"` Phone string `toml:"phone"` Photo string `toml:"photo"` Email string `toml:"email"` Address string `toml:"address"` Body string `toml:"body" sql:"null;type:text"` BodyHtml template.HTML `sql:"-"` SubSections []SubSection `toml:"subsections"` LastUpdate string `sql:"-" toml:"last_update"` CreatedAt time.Time UpdatedAt time.Time }
Section divides a page into small pieces
type SubSection ¶
type SubSection struct { Id int64 Name string `toml:"name"` Photo string `toml:"photo"` SectionId int64 Body string `toml:"body"` BodyHtml template.HTML `sql:"-"` LastUpdate string `sql:"-" toml:"last_update"` CreatedAt time.Time UpdatedAt time.Time }
func (*SubSection) Sanitize ¶
func (s *SubSection) Sanitize()