mirror of
https://github.com/filebrowser/filebrowser.git
synced 2024-06-07 23:00:43 +00:00
add page
This commit is contained in:
parent
c5dc03ad8b
commit
da02deb3a4
@ -52,6 +52,12 @@ func GetFileInfo(url *url.URL, c *Config) (*FileInfo, int, error) {
|
|||||||
return file, 0, nil
|
return file, 0, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// GetExtendedFileInfo is used to get extra parameters for FileInfo struct
|
||||||
|
func (fi FileInfo) GetExtendedFileInfo() error {
|
||||||
|
// TODO: do this!
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
// HumanSize returns the size of the file as a human-readable string
|
// HumanSize returns the size of the file as a human-readable string
|
||||||
// in IEC format (i.e. power of 2 or base 1024).
|
// in IEC format (i.e. power of 2 or base 1024).
|
||||||
func (fi FileInfo) HumanSize() string {
|
func (fi FileInfo) HumanSize() string {
|
||||||
|
1
listing.go
Normal file
1
listing.go
Normal file
@ -0,0 +1 @@
|
|||||||
|
package filemanager
|
@ -2,16 +2,22 @@ package filemanager
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
|
"html/template"
|
||||||
"log"
|
"log"
|
||||||
"net/http"
|
"net/http"
|
||||||
"strings"
|
"strings"
|
||||||
"text/template"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// Page contains the informations and functions needed to show the page
|
||||||
|
type Page struct {
|
||||||
|
Info *PageInfo
|
||||||
|
}
|
||||||
|
|
||||||
// PageInfo contains the information of a page
|
// PageInfo contains the information of a page
|
||||||
type PageInfo struct {
|
type PageInfo struct {
|
||||||
Name string
|
Name string
|
||||||
Path string
|
Path string
|
||||||
|
Config *Config
|
||||||
Data interface{}
|
Data interface{}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -43,11 +49,6 @@ func (p PageInfo) BreadcrumbMap() map[string]string {
|
|||||||
return result
|
return result
|
||||||
}
|
}
|
||||||
|
|
||||||
// Page contains the informations and functions needed to show the page
|
|
||||||
type Page struct {
|
|
||||||
Info *PageInfo
|
|
||||||
}
|
|
||||||
|
|
||||||
// PrintAsHTML formats the page in HTML and executes the template
|
// PrintAsHTML formats the page in HTML and executes the template
|
||||||
func (p Page) PrintAsHTML(w http.ResponseWriter, templates ...string) (int, error) {
|
func (p Page) PrintAsHTML(w http.ResponseWriter, templates ...string) (int, error) {
|
||||||
templates = append(templates, "base")
|
templates = append(templates, "base")
|
Loading…
Reference in New Issue
Block a user