Documentation
¶
Overview ¶
Package mediaadmin is the Media section of the admin: the media library, where editors upload files, write their titles and alternative texts per language and choose the focal point of images.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type AssetView ¶
type AssetView struct {
Card Card
Markdown string
Tabs []admin.LocaleTab
Form form.RenderModel
Errors form.FieldErrors
// ReadOnly is set for users who may view the file but not edit it: Form
// is then read-only (disabled, without its button).
ReadOnly bool
Delete *form.RenderModel
// Focus places the focal point of an image; nil for other files.
Focus *FocusView
}
AssetView is the data of the screen of one file, with its texts in one language. Markdown is the snippet that places the file in Markdown content.
type Card ¶
Card is one file in the library: its name, a thumbnail for images and Details such as "image/png · 12 KB · 800×600".
type CropPreview ¶
CropPreview shows the image cropped to Width:Height by the browser, with Class, the class of focal-points.css (media.FocalPoint.PositionClass) that shows about the part a crop variant of those proportions shows. The box's proportions are the class focal-crop-<Width>-<Height> of focalpoint.css, one of previewRatios.
type FocusView ¶
type FocusView struct {
URL string
// Width and Height are the image's size as shown.
Width int
Height int
// X and Y place the marker, in percent from the top left.
X string
Y string
Previews []CropPreview
Form form.RenderModel
Errors form.FieldErrors
}
FocusView shows an image with a marker on its focal point, previews of common crops and a form with the point in percent, which works without JavaScript; admin/assets/focalpoint.js lets editors click, drag or move the marker with the arrow keys instead. Nothing is placed with a style attribute, which a Content-Security-Policy blocks: the marker is placed by the script, the previews by classes until the script places them exactly.
type LibraryView ¶
type LibraryView struct {
Cards []Card
// Upload is the upload form, for users who may create media; nil for
// others.
Upload *form.RenderModel
UploadErrors form.FieldErrors
// MaxMB is the largest upload in megabytes.
MaxMB int64
// TrashURL shows the deleted files in the admin's trash.
TrashURL string
// Pager pages through a large library.
Pager admin.Pager
}
LibraryView is the data of the media library: a page of files as cards.
type PickerItem ¶
type PickerItem struct {
ID string `json:"id"`
Filename string `json:"filename"`
// URL is the original file.
URL string `json:"url"`
// Thumb is a small copy for the picker's grid.
Thumb string `json:"thumb"`
// Preview is the copy the editor shows in the text.
Preview string `json:"preview"`
}
PickerItem is an image as the editor's picker lists it.
type PickerPage ¶
type PickerPage struct {
Items []PickerItem `json:"items"`
// Next tells whether a next page exists.
Next bool `json:"next"`
}
PickerPage is a page of the picker.