Documentation ¶
Index ¶
- Constants
- Variables
- func IsDerivativePath(path string) bool
- func IsValidFileKind(kind string) bool
- func MongoDBSessionForURI(uri string) *mgo.Session
- func NewMongoDBSession() *mgo.Session
- type ActivitiesList
- type Activity
- type DBSession
- func (session *DBSession) ActivitiesCol() *mgo.Collection
- func (session *DBSession) Close()
- func (session *DBSession) Copy() *DBSession
- func (session *DBSession) CreateActivity(activity *Activity) error
- func (session *DBSession) CreateEvent(event *Event) error
- func (session *DBSession) CreateFile(f *File) error
- func (session *DBSession) CreateImage(img *Image) error
- func (session *DBSession) CreateMember(member *Member) error
- func (session *DBSession) CreatePage(page *Page) error
- func (session *DBSession) CreatePost(post *Post) error
- func (session *DBSession) CreateSite(site *Site) error
- func (session *DBSession) CreateUser(user *User) error
- func (session *DBSession) DB() *mgo.Database
- func (session *DBSession) DBName() string
- func (session *DBSession) EnsureActivitiesIndexes()
- func (session *DBSession) EnsureEventsIndexes()
- func (session *DBSession) EnsureFilesIndexes()
- func (session *DBSession) EnsureImagesIndexes()
- func (session *DBSession) EnsureIndexes()
- func (session *DBSession) EnsureMembersIndexes()
- func (session *DBSession) EnsurePagesIndexes()
- func (session *DBSession) EnsurePostsIndexes()
- func (session *DBSession) EnsureSitesIndexes()
- func (session *DBSession) EnsureUsersIndexes()
- func (session *DBSession) EventsCol() *mgo.Collection
- func (session *DBSession) FilesCol() *mgo.Collection
- func (session *DBSession) FindActivity(activityID bson.ObjectId) *Activity
- func (session *DBSession) FindEvent(eventID bson.ObjectId) *Event
- func (session *DBSession) FindFile(fileID bson.ObjectId) *File
- func (session *DBSession) FindImage(imageID bson.ObjectId) *Image
- func (session *DBSession) FindMember(memberID bson.ObjectId) *Member
- func (session *DBSession) FindPage(pageID bson.ObjectId) *Page
- func (session *DBSession) FindPost(postID bson.ObjectId) *Post
- func (session *DBSession) FindSite(siteID string) *Site
- func (session *DBSession) FindUser(userID string) *User
- func (session *DBSession) FindUserByEmail(email string) *User
- func (session *DBSession) ImagesCol() *mgo.Collection
- func (session *DBSession) MembersCol() *mgo.Collection
- func (session *DBSession) PagesCol() *mgo.Collection
- func (session *DBSession) PostsCol() *mgo.Collection
- func (session *DBSession) RemoveImageReferencesFromActivities(image *Image) error
- func (session *DBSession) RemoveImageReferencesFromEvents(image *Image) error
- func (session *DBSession) RemoveImageReferencesFromMembers(image *Image) error
- func (session *DBSession) RemoveImageReferencesFromPages(image *Image) error
- func (session *DBSession) RemoveImageReferencesFromPosts(image *Image) error
- func (session *DBSession) RemoveImageReferencesFromSitePageSettings(image *Image) error
- func (session *DBSession) SetDBName(name string)
- func (session *DBSession) SitesCol() *mgo.Collection
- func (session *DBSession) UsersCol() *mgo.Collection
- type Derivative
- type Event
- type EventsList
- type File
- type FileJSON
- type FilesList
- type Image
- func (img *Image) Delete() error
- func (img *Image) DerivativeFilePath(derivative *Derivative) string
- func (img *Image) DerivativePath(derivative *Derivative) string
- func (img *Image) DerivativeURL(derivative *Derivative) string
- func (img *Image) FindSite() *Site
- func (img *Image) GenerateDerivatives(force bool) error
- func (img *Image) LargePath() string
- func (img *Image) LargeURL() string
- func (img *Image) MarshalJSON() ([]byte, error)
- func (img *Image) Original() *image.Image
- func (img *Image) OriginalFilePath() string
- func (img *Image) PortraitFillPath() string
- func (img *Image) PortraitFillURL() string
- func (img *Image) SmallFillPath() string
- func (img *Image) SmallFillURL() string
- func (img *Image) SmallPath() string
- func (img *Image) SmallURL() string
- func (img *Image) SquarePath() string
- func (img *Image) SquareURL() string
- func (img *Image) ThumbPath() string
- func (img *Image) ThumbURL() string
- func (img *Image) URL() string
- type ImageJSON
- type ImagesList
- type Member
- type MembersList
- type Page
- type PagesList
- type Post
- type PostsList
- type Site
- func (site *Site) ActivitiesNb() int
- func (site *Site) BaseUrl() string
- func (site *Site) BuildDir() string
- func (site *Site) Delete() error
- func (site *Site) DeleteFields(fields []string) error
- func (site *Site) EventsNb() int
- func (site *Site) FilesNb() int
- func (site *Site) FindActivities(skip int, limit int) *ActivitiesList
- func (site *Site) FindAllActivities() *ActivitiesList
- func (site *Site) FindAllEvents() *EventsList
- func (site *Site) FindAllFiles() *FilesList
- func (site *Site) FindAllImages() *ImagesList
- func (site *Site) FindAllMembers() *MembersList
- func (site *Site) FindAllPages() *PagesList
- func (site *Site) FindAllPosts() *PostsList
- func (site *Site) FindCover() *Image
- func (site *Site) FindEvents(skip int, limit int) *EventsList
- func (site *Site) FindFavicon() *Image
- func (site *Site) FindFiles(skip int, limit int) *FilesList
- func (site *Site) FindImages(skip int, limit int) *ImagesList
- func (site *Site) FindLogo() *Image
- func (site *Site) FindMembers(skip int, limit int) *MembersList
- func (site *Site) FindMembership() *File
- func (site *Site) FindPageSettingsCover(settingKind string) *Image
- func (site *Site) FindPages(skip int, limit int) *PagesList
- func (site *Site) FindPosts(skip int, limit int, onlyPub bool) *PostsList
- func (site *Site) FindPublishedPosts() *PostsList
- func (site *Site) ImagesNb() int
- func (site *Site) MarshalJSON() ([]byte, error)
- func (site *Site) MembersNb() int
- func (site *Site) PagesNb() int
- func (site *Site) PostsNb() int
- func (site *Site) RemoveFileReferences(file *File) error
- func (site *Site) RemoveImageReferences(image *Image) error
- func (site *Site) SetBuiltAt(value time.Time) error
- func (site *Site) SetChangedAt(value time.Time) error
- func (site *Site) SetMembership(value bson.ObjectId) error
- func (site *Site) SetPageSettings(settings *SitePageSettings) error
- func (site *Site) SetThemeSettings(settings *SiteThemeSettings) error
- func (site *Site) SetValues(values bson.M) error
- func (site *Site) TZLocation() *time.Location
- func (site *Site) Update(newSite *Site) (bool, error)
- func (site *Site) UpdateMemberOrder(id bson.ObjectId, order int)
- type SiteJSON
- type SitePageSettings
- type SiteThemeSettings
- type SiteThemeSettingsJSON
- type SitesList
- type User
- func (user *User) AccountValidated() bool
- func (user *User) Active() bool
- func (user *User) DisplayName() string
- func (user *User) FindSites() *SitesList
- func (user *User) FullName() string
- func (user *User) MailAddress() string
- func (user *User) MarshalJSON() ([]byte, error)
- func (user *User) SetAccountValidated() error
- func (user *User) SetValues(values bson.M) error
- func (user *User) Update(newUser *User) (bool, error)
- type UserJSON
- type UsersList
Constants ¶
const ( // FormatHTML represents the HTML content format FormatHTML = "html" // FormatMarkdown represents the Markdown content format FormatMarkdown = "md" // DefaultFormat is the default content format DefaultFormat = FormatHTML )
const ( // PageKindContact represents the contact page PageKindContact = "contact" // PageKindActivities represents the activities page PageKindActivities = "activities" // PageKindMembers represents the members page PageKindMembers = "members" // PageKindPosts represents the contact page PageKindPosts = "posts" // PageKindEvents represents the contact page PageKindEvents = "events" )
const ( // UserStatusPending represents a user that signed up but did not confirmed UserStatusPending = "pending" // UserStatusActive represents a user that signed up and did confirmed UserStatusActive = "active" )
const (
// FileMembership represents a membership file kind
FileMembership = "membership"
)
Variables ¶
var Derivatives []*Derivative
Derivatives represents a list of image derivatives
var FileKinds = []string{FileMembership}
FileKinds all possible file kinds
var SitePagesSettingsKinds map[string]bool
SitePagesSettingsKinds holds all possible page settings kinds
Functions ¶
func IsDerivativePath ¶
IsDerivativePath returns true if given path is an image derivative
func IsValidFileKind ¶
IsValidFileKind returns true if argument is a file kind
func MongoDBSessionForURI ¶
func MongoDBSessionForURI(uri string) *mgo.Session
MongoDBSessionForURI returns a new mongodb session with given uri
func NewMongoDBSession ¶
func NewMongoDBSession() *mgo.Session
NewMongoDBSession returns a new mongodb session
Types ¶
type Activity ¶
type Activity struct { ID bson.ObjectId `bson:"_id,omitempty" json:"id"` CreatedAt time.Time `bson:"created_at" json:"createdAt"` UpdatedAt time.Time `bson:"updated_at" json:"updatedAt"` SiteID string `bson:"site_id" json:"site"` Title string `bson:"title" json:"title"` Summary string `bson:"summary" json:"summary"` Body string `bson:"body" json:"body"` Cover bson.ObjectId `bson:"cover,omitempty" json:"cover,omitempty"` // contains filtered or unexported fields }
Activity represents an activity
type DBSession ¶
type DBSession struct {
// contains filtered or unexported fields
}
DBSession represents a database session
func (*DBSession) ActivitiesCol ¶
func (session *DBSession) ActivitiesCol() *mgo.Collection
ActivitiesCol returns the activities collection
func (*DBSession) CreateActivity ¶
CreateActivity persists a new activity in database Side effect: 'Id', 'CreatedAt' and 'UpdatedAt' fields are set on activity record
func (*DBSession) CreateEvent ¶
CreateEvent creates a new event in database Side effect: 'Id', 'CreatedAt' and 'UpdatedAt' fields are set on event record
func (*DBSession) CreateFile ¶
CreateFile creates a new file in database
func (*DBSession) CreateImage ¶
CreateImage creates a new image in database
func (*DBSession) CreateMember ¶
CreateMember creates a new member in database Side effect: 'Id', 'CreatedAt' and 'UpdatedAt' fields are set on member record
func (*DBSession) CreatePage ¶
CreatePage creates a new page in database Side effect: 'Id', 'CreatedAt' and 'UpdatedAt' fields are set on page record
func (*DBSession) CreatePost ¶
CreatePost creates a new post in database Side effect: 'Id', 'CreatedAt' and 'UpdatedAt' fields are set on post record
func (*DBSession) CreateSite ¶
CreateSite creates a new site in database Side effect: 'CreatedAt' and 'UpdatedAt' fields are set on site record
func (*DBSession) CreateUser ¶
CreateUser creates a new user in database Side effect: 'CreatedAt' and 'UpdatedAt' fields are set on user record
func (*DBSession) EnsureActivitiesIndexes ¶
func (session *DBSession) EnsureActivitiesIndexes()
EnsureActivitiesIndexes ensures indexes on activities collection
func (*DBSession) EnsureEventsIndexes ¶
func (session *DBSession) EnsureEventsIndexes()
EnsureEventsIndexes ensures indexes on events collection
func (*DBSession) EnsureFilesIndexes ¶
func (session *DBSession) EnsureFilesIndexes()
EnsureFilesIndexes ensure indexes on files collection
func (*DBSession) EnsureImagesIndexes ¶
func (session *DBSession) EnsureImagesIndexes()
EnsureImagesIndexes ensures indexes on images collection
func (*DBSession) EnsureIndexes ¶
func (session *DBSession) EnsureIndexes()
EnsureIndexes ensures indexes on all collections
func (*DBSession) EnsureMembersIndexes ¶
func (session *DBSession) EnsureMembersIndexes()
EnsureMembersIndexes ensure indexes on members collection
func (*DBSession) EnsurePagesIndexes ¶
func (session *DBSession) EnsurePagesIndexes()
EnsurePagesIndexes ensure indexes on pages collection
func (*DBSession) EnsurePostsIndexes ¶
func (session *DBSession) EnsurePostsIndexes()
EnsurePostsIndexes ensures indexes on posts collection
func (*DBSession) EnsureSitesIndexes ¶
func (session *DBSession) EnsureSitesIndexes()
EnsureSitesIndexes ensures indexes on sites collection
func (*DBSession) EnsureUsersIndexes ¶
func (session *DBSession) EnsureUsersIndexes()
EnsureUsersIndexes ensures indexes on users collection
func (*DBSession) EventsCol ¶
func (session *DBSession) EventsCol() *mgo.Collection
EventsCol returns the events collection
func (*DBSession) FilesCol ¶
func (session *DBSession) FilesCol() *mgo.Collection
FilesCol returns files collection
func (*DBSession) FindActivity ¶
FindActivity finds an activity by id
func (*DBSession) FindMember ¶
FindMember finds member by id
func (*DBSession) FindUserByEmail ¶
FindUserByEmail finds a user by email
func (*DBSession) ImagesCol ¶
func (session *DBSession) ImagesCol() *mgo.Collection
ImagesCol returns images collection
func (*DBSession) MembersCol ¶
func (session *DBSession) MembersCol() *mgo.Collection
MembersCol returns members collection
func (*DBSession) PagesCol ¶
func (session *DBSession) PagesCol() *mgo.Collection
PagesCol returns pages collection
func (*DBSession) PostsCol ¶
func (session *DBSession) PostsCol() *mgo.Collection
PostsCol returns posts collection
func (*DBSession) RemoveImageReferencesFromActivities ¶
RemoveImageReferencesFromActivities removes all references to given image from all activities
func (*DBSession) RemoveImageReferencesFromEvents ¶
RemoveImageReferencesFromEvents remove all references to given image from all events
func (*DBSession) RemoveImageReferencesFromMembers ¶
RemoveImageReferencesFromMembers removes all references to given image from all members
func (*DBSession) RemoveImageReferencesFromPages ¶
RemoveImageReferencesFromPages removes all references to given image from all pages
func (*DBSession) RemoveImageReferencesFromPosts ¶
RemoveImageReferencesFromPosts removes all references to given image from all posts
func (*DBSession) RemoveImageReferencesFromSitePageSettings ¶
RemoveImageReferencesFromSitePageSettings removes all references to given image from site page settings
type Derivative ¶
type Derivative struct {
// contains filtered or unexported fields
}
Derivative represents an image derivative
func DerivativeForKind ¶
func DerivativeForKind(kind string) *Derivative
DerivativeForKind returns a derivative definition
type Event ¶
type Event struct { ID bson.ObjectId `bson:"_id,omitempty" json:"id"` CreatedAt time.Time `bson:"created_at" json:"createdAt"` UpdatedAt time.Time `bson:"updated_at" json:"updatedAt"` SiteID string `bson:"site_id" json:"site"` StartDate time.Time `bson:"start_date" json:"startDate,omitempty"` EndDate time.Time `bson:"end_date" json:"endDate,omitempty"` Title string `bson:"title" json:"title"` Body string `bson:"body" json:"body"` Format string `bson:"format" json:"format"` Place string `bson:"place" json:"place"` Cover bson.ObjectId `bson:"cover,omitempty" json:"cover,omitempty"` // contains filtered or unexported fields }
Event represents an event
type File ¶
type File struct { ID bson.ObjectId `bson:"_id,omitempty" json:"id"` CreatedAt time.Time `bson:"created_at" json:"createdAt"` UpdatedAt time.Time `bson:"updated_at" json:"updatedAt"` SiteID string `bson:"site_id" json:"site"` Kind string `bson:"kind" json:"kind"` Path string `bson:"path" json:"-"` // this is the effective file path Name string `bson:"name" json:"name"` // this is the uploaded file name (may be different from Path) Size int64 `bson:"size" json:"size"` Type string `bson:"type" json:"type"` // content type // contains filtered or unexported fields }
File represents a file
func (*File) MarshalJSON ¶
MarshalJSON implements the json.Marshaler interface
type Image ¶
type Image struct { ID bson.ObjectId `bson:"_id,omitempty" json:"id"` CreatedAt time.Time `bson:"created_at" json:"createdAt"` UpdatedAt time.Time `bson:"updated_at" json:"updatedAt"` SiteID string `bson:"site_id" json:"site"` Path string `bson:"path" json:"-"` // this is the effective image path Name string `bson:"name" json:"name"` // this is the uploaded file name (may be different from Path) Size int64 `bson:"size" json:"size"` Type string `bson:"type" json:"type"` // jpeg | png // contains filtered or unexported fields }
Image represents an image
func (*Image) DerivativeFilePath ¶
func (img *Image) DerivativeFilePath(derivative *Derivative) string
DerivativeFilePath returns given derivative file path
func (*Image) DerivativePath ¶
func (img *Image) DerivativePath(derivative *Derivative) string
DerivativePath returns given derivative path
func (*Image) DerivativeURL ¶
func (img *Image) DerivativeURL(derivative *Derivative) string
DerivativeURL returns given derivative URL
func (*Image) GenerateDerivatives ¶
GenerateDerivatives generates all derivatives that were not generated yet
func (*Image) MarshalJSON ¶
MarshalJSON implements the json.Marshaler interface
func (*Image) OriginalFilePath ¶
OriginalFilePath returns file path to original image
func (*Image) PortraitFillPath ¶
PortraitFillPath returns PortraitFill derivative path
func (*Image) PortraitFillURL ¶
PortraitFillURL returns Portrait Fill derivative URL
func (*Image) SmallFillPath ¶
SmallFillPath returns SmallFill derivative path
func (*Image) SmallFillURL ¶
SmallFillURL returns Small Fill derivative URL
func (*Image) SquarePath ¶
SquarePath returns Square derivative path
type ImageJSON ¶
type ImageJSON struct { Image URL string `json:"url"` ThumbURL string `json:"thumbUrl"` SquareURL string `json:"squareUrl"` SmallURL string `json:"smallUrl"` SmallFillURL string `json:"smallFillUrl"` PortraitFillURL string `json:"portraitFillUrl"` LargeURL string `json:"largeUrl"` }
ImageJSON represents the json version of an image
type Member ¶
type Member struct { ID bson.ObjectId `bson:"_id,omitempty" json:"id"` CreatedAt time.Time `bson:"created_at" json:"createdAt"` UpdatedAt time.Time `bson:"updated_at" json:"updatedAt"` SiteID string `bson:"site_id" json:"site"` Fullname string `bson:"fullname" json:"fullname"` Role string `bson:"role" json:"role"` Description string `bson:"description" json:"description"` Photo bson.ObjectId `bson:"photo,omitempty" json:"photo,omitempty"` Order int `bson:"order" json:"order"` // contains filtered or unexported fields }
Member represents a member
type Page ¶
type Page struct { ID bson.ObjectId `bson:"_id,omitempty" json:"id"` CreatedAt time.Time `bson:"created_at" json:"createdAt"` UpdatedAt time.Time `bson:"updated_at" json:"updatedAt"` SiteID string `bson:"site_id" json:"site"` Title string `bson:"title" json:"title"` Tagline string `bson:"tagline" json:"tagline"` Body string `bson:"body" json:"body"` Format string `bson:"format" json:"format"` Cover bson.ObjectId `bson:"cover,omitempty" json:"cover,omitempty"` // contains filtered or unexported fields }
Page represents a page
type Post ¶
type Post struct { ID bson.ObjectId `bson:"_id,omitempty" json:"id,omitempty"` CreatedAt time.Time `bson:"created_at" json:"createdAt"` UpdatedAt time.Time `bson:"updated_at" json:"updatedAt"` SiteID string `bson:"site_id" json:"site"` Published bool `bson:"published" json:"published"` PublishedAt time.Time `bson:"published_at" json:"publishedAt,omitempty"` Title string `bson:"title" json:"title"` Body string `bson:"body" json:"body"` Format string `bson:"format" json:"format"` Cover bson.ObjectId `bson:"cover,omitempty" json:"cover,omitempty"` // contains filtered or unexported fields }
Post represents a post
type Site ¶
type Site struct { ID string `bson:"_id,omitempty" json:"id"` CreatedAt time.Time `bson:"created_at" json:"createdAt"` UpdatedAt time.Time `bson:"updated_at" json:"updatedAt"` ChangedAt time.Time `bson:"changed_at,omitempty" json:"changedAt,omitempty"` BuiltAt time.Time `bson:"built_at,omitempty" json:"builtAt,omitempty"` UserID string `bson:"user_id" json:"user"` Lang string `bson:"lang" json:"lang"` TZ string `bson:"tz" json:"tz"` Name string `bson:"name" json:"name"` Tagline string `bson:"tagline" json:"tagline"` Description string `bson:"description" json:"description"` MoreDesc string `bson:"more_desc" json:"moreDesc"` JoinText string `bson:"join_text" json:"joinText"` Email string `bson:"email" json:"email"` Address string `bson:"address" json:"address"` Facebook string `bson:"facebook" json:"facebook"` Twitter string `bson:"twitter" json:"twitter"` GooglePlus string `bson:"google_plus" json:"googlePlus"` GoogleAnalytics string `bson:"google_analytics" json:"googleAnalytics"` // images Logo bson.ObjectId `bson:"logo,omitempty" json:"logo,omitempty"` Cover bson.ObjectId `bson:"cover,omitempty" json:"cover,omitempty"` Favicon bson.ObjectId `bson:"favicon,omitempty" json:"favicon,omitempty"` // files Membership bson.ObjectId `bson:"membership,omitempty" json:"membership,omitempty"` PageSettings map[string]*SitePageSettings `bson:"page_settings" json:"-"` ThemeSettings map[string]*SiteThemeSettings `bson:"theme_settings" json:"-"` // build settings Theme string `bson:"theme" json:"theme"` Domain string `bson:"domain" json:"domain"` CustomDomain string `bson:"custom_domain" json:"customDomain"` CustomURL string `bson:"custom_url" json:"customUrl"` UglyURL bool `bson:"ugly_url" json:"uglyUrl"` NameInNavBar bool `bson:"name_in_navbar" json:"nameInNavBar"` // contains filtered or unexported fields }
Site represents a site
func (*Site) ActivitiesNb ¶
ActivitiesNb returns the total number of activities
func (*Site) DeleteFields ¶
DeleteFields delete given site fields from database
func (*Site) FindActivities ¶
func (site *Site) FindActivities(skip int, limit int) *ActivitiesList
FindActivities fetches activities belonging to site
func (*Site) FindAllActivities ¶
func (site *Site) FindAllActivities() *ActivitiesList
FindAllActivities fetches all activities belonging to site
func (*Site) FindAllEvents ¶
func (site *Site) FindAllEvents() *EventsList
FindAllEvents fetches all events belonging to site
func (*Site) FindAllFiles ¶
FindAllFiles fetches all files belonging to site
func (*Site) FindAllImages ¶
func (site *Site) FindAllImages() *ImagesList
FindAllImages fetches all images belonging to site
func (*Site) FindAllMembers ¶
func (site *Site) FindAllMembers() *MembersList
FindAllMembers fetches all members belonging to site
func (*Site) FindAllPages ¶
FindAllPages fetches all pages belonging to site
func (*Site) FindAllPosts ¶
FindAllPosts fetches all posts belonging to site
func (*Site) FindEvents ¶
func (site *Site) FindEvents(skip int, limit int) *EventsList
FindEvents fetches events belonging to site
func (*Site) FindFavicon ¶
FindFavicon fetches favicon from database
func (*Site) FindImages ¶
func (site *Site) FindImages(skip int, limit int) *ImagesList
FindImages fetches images belonging to site
func (*Site) FindMembers ¶
func (site *Site) FindMembers(skip int, limit int) *MembersList
FindMembers fetches members belonging to site
func (*Site) FindMembership ¶
FindMembership fetches membership from database
func (*Site) FindPageSettingsCover ¶
FindPageSettingsCover fetches page settings cover from database
func (*Site) FindPublishedPosts ¶
FindPublishedPosts fetches all published posts belonging to site
func (*Site) MarshalJSON ¶
MarshalJSON implements json.MarshalJSON
func (*Site) RemoveFileReferences ¶
RemoveFileReferences removes all references to given file from database
func (*Site) RemoveImageReferences ¶
RemoveImageReferences removes all references to given image from database
func (*Site) SetBuiltAt ¶
SetBuiltAt sets the BuiltAt value
func (*Site) SetChangedAt ¶
SetChangedAt sets the ChangedAt value
func (*Site) SetMembership ¶
SetMembership sets the Membership value
func (*Site) SetPageSettings ¶
func (site *Site) SetPageSettings(settings *SitePageSettings) error
SetPageSettings inserts (or updates) page settings to database Side effect: 'Id' field is set on record if not already present, and string fields are trimed
func (*Site) SetThemeSettings ¶
func (site *Site) SetThemeSettings(settings *SiteThemeSettings) error
SetThemeSettings inserts (or updates) theme settings to database Side effect: 'Id' field is set on record if not already present, and string fields are trimed
func (*Site) TZLocation ¶
TZLocation returns timezone Location
type SiteJSON ¶
type SiteJSON struct { Site Links map[string]interface{} `json:"links"` // overrides the PageSettings and ThemeSettings fields to provide an array // of ids (as needed by Ember Data) instead of a hash of embedded documents PageSettings []string `json:"pageSettings,omitempty"` ThemeSettings []string `json:"themeSettings,omitempty"` }
SiteJSON represents the json version of a site
type SitePageSettings ¶
type SitePageSettings struct { ID bson.ObjectId `bson:"_id,omitempty" json:"id"` Kind string `bson:"kind" json:"kind"` // cf. SitePagesSettingsKinds Title string `bson:"title" json:"title"` Tagline string `bson:"tagline" json:"tagline"` Cover bson.ObjectId `bson:"cover,omitempty" json:"cover,omitempty"` Disabled bool `bson:"disabled" json:"disabled"` }
SitePageSettings represents all the settings for a built-in page
type SiteThemeSettings ¶
type SiteThemeSettings struct { ID bson.ObjectId `bson:"_id,omitempty" json:"id"` Palette string `bson:"palette,omitempty" json:"palette"` Custom map[string]string `bson:"custom,omitempty" json:"-"` Theme string `bson:"-" json:"theme"` }
SiteThemeSettings represents settings for given theme
func (*SiteThemeSettings) MarshalJSON ¶
func (settings *SiteThemeSettings) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaler interface
type SiteThemeSettingsJSON ¶
type SiteThemeSettingsJSON struct { SiteThemeSettings // overrides the Custom field to provide a JSON string instead of an array of embedded documents Custom string `json:"custom,omitempty"` }
SiteThemeSettingsJSON is the JSON representation of SiteThemeSettings
type User ¶
type User struct { ID string `bson:"_id,omitempty" json:"id"` CreatedAt time.Time `bson:"created_at" json:"createdAt"` UpdatedAt time.Time `bson:"updated_at" json:"updatedAt"` ValidatedAt time.Time `bson:"validated_at" json:"validatedAt"` Admin bool `bson:"admin" json:"admin"` Status string `bson:"status" json:"status"` Email string `bson:"email" json:"email"` FirstName string `bson:"first_name" json:"firstName"` LastName string `bson:"last_name" json:"lastName"` Lang string `bson:"lang" json:"lang"` TZ string `bson:"tz" json:"tz"` Password string `bson:"password" json:"-"` // contains filtered or unexported fields }
User represents a user
func (*User) AccountValidated ¶
AccountValidated returns true if user account has been validated
func (*User) DisplayName ¶
DisplayName returns user display name, usefull if fullname is empty
func (*User) MailAddress ¶
MailAddress returns user mail address with format: User Name <email@addre.ss>
func (*User) MarshalJSON ¶
MarshalJSON implements the json.Marshaler interface
func (*User) SetAccountValidated ¶
SetAccountValidated sets user account as validated