package wde import ( "path" "personalwebsite/webfilesystem" "github.com/gin-gonic/gin" ) type WDE struct { fs *webfilesystem.WebFileSystem FilesWidget FilesWidget } func NewWDE(webFs *webfilesystem.WebFileSystem) *WDE { return &WDE{ fs: webFs, } } type FilesWidget struct { } func (w *WDE) Render(path string) (gin.H, error) { list, err := w.fs.NewList(path) if err != nil { return nil, err } return gin.H{ "Name": "Greg Brzezinski", "Files": list, }, nil } func (w *WDE) RenderContextMenu() (gin.H, error) { // list, err := w.fs.List(path) // if err != nil { // return nil, err // } return gin.H{ "Name": "Greg Brzezinski", // "Files": list, }, nil } func (w *WDE) RenderFileTileView(directory string, host string) (gin.H, error) { list, err := w.fs.NewList(directory) if err != nil { return nil, err } for _, file := range list { switch file.Type { case "directory": file.Icon = host + "/system/libs/img/get?path=/wde/icons/macos9/folder.png" //FIXME case "jpeg": fallthrough case "png": fallthrough case "jpg": file.Icon = host + "/system/libs/img/get?path=" + path.Join(directory, file.Name) //FIXME default: file.Icon = host + "/system/libs/img/get?path=/wde/icons/macos9/about-me.png" //FIXME } } return gin.H{ "Files": list, }, nil }