updates; fixes; progresses #5

pull/144/head
Henrique Dias 2016-07-01 10:46:09 +01:00
parent d294d1b116
commit 375a2647ea
19 changed files with 1227 additions and 1251 deletions

View File

@ -1,62 +0,0 @@
{
// The plugin looks for a .jsbeautifyrc file in the same directory as the
// source file you're prettifying (or any directory above if it doesn't exist,
// or in your home folder if everything else fails) and uses those options
// along the default ones.
// Details: https://github.com/victorporof/Sublime-HTMLPrettify#using-your-own-jsbeautifyrc-options
// Documentation: https://github.com/einars/js-beautify/
"html": {
"allowed_file_extensions": ["htm", "html", "xhtml", "shtml", "xml", "svg"],
"brace_style": "collapse", // [collapse|expand|end-expand|none] Put braces on the same line as control statements (default), or put braces on own line (Allman / ANSI style), or just put end braces on own line, or attempt to keep them where they are
"end_with_newline": false, // End output with newline
"indent_char": " ", // Indentation character
"indent_handlebars": false, // e.g. {{#foo}}, {{/foo}}
"indent_inner_html": false, // Indent <head> and <body> sections
"indent_scripts": "keep", // [keep|separate|normal]
"indent_size": 4, // Indentation size
"max_preserve_newlines": 0, // Maximum number of line breaks to be preserved in one chunk (0 disables)
"preserve_newlines": true, // Whether existing line breaks before elements should be preserved (only works before elements, not inside tags or for text)
"unformatted": ["a", "span", "img", "code", "pre", "sub", "sup", "em", "strong", "b", "i", "u", "strike", "big", "small", "pre", "h1", "h2", "h3", "h4", "h5", "h6"], // List of tags that should not be reformatted
"wrap_line_length": 0 // Lines should wrap at next opportunity after this number of characters (0 disables)
},
"css": {
"allowed_file_extensions": ["css", "scss", "sass", "less"],
"end_with_newline": false, // End output with newline
"indent_char": " ", // Indentation character
"indent_size": 4, // Indentation size
"newline_between_rules": true, // Add a new line after every css rule
"selector_separator": " ",
"selector_separator_newline": true // Separate selectors with newline or not (e.g. "a,\nbr" or "a, br")
},
"js": {
"allowed_file_extensions": ["js", "json", "jshintrc", "jsbeautifyrc"],
// Set brace_style
// collapse: (old default) Put braces on the same line as control statements
// collapse-preserve-inline: (new default) Same as collapse but better support for ES6 destructuring and other features. https://github.com/victorporof/Sublime-HTMLPrettify/issues/231
// expand: Put braces on own line (Allman / ANSI style)
// end-expand: Put end braces on own line
// none: Keep them where they are
"brace_style": "collapse-preserve-inline",
"break_chained_methods": false, // Break chained method calls across subsequent lines
"e4x": false, // Pass E4X xml literals through untouched
"end_with_newline": false, // End output with newline
"indent_char": " ", // Indentation character
"indent_level": 0, // Initial indentation level
"indent_size": 4, // Indentation size
"indent_with_tabs": false, // Indent with tabs, overrides `indent_size` and `indent_char`
"jslint_happy": false, // If true, then jslint-stricter mode is enforced
"keep_array_indentation": false, // Preserve array indentation
"keep_function_indentation": false, // Preserve function indentation
"max_preserve_newlines": 0, // Maximum number of line breaks to be preserved in one chunk (0 disables)
"preserve_newlines": true, // Whether existing line breaks should be preserved
"space_after_anon_function": false, // Should the space before an anonymous function's parens be added, "function()" vs "function ()"
"space_before_conditional": true, // Should the space before conditional statement be added, "if(true)" vs "if (true)"
"space_in_empty_paren": false, // Add padding spaces within empty paren, "f()" vs "f( )"
"space_in_paren": false, // Add padding spaces within paren, ie. f( a, b )
"unescape_strings": false, // Should printable characters in strings encoded in \xNN notation be unescaped, "example" vs "\x65\x78\x61\x6d\x70\x6c\x65"
"wrap_line_length": 0 // Lines should wrap at next opportunity after this number of characters (0 disables)
}
}

View File

@ -1,19 +1,15 @@
// Code generated by go-bindata.
// sources:
// assets/.jsbeautifyrc
// assets/assets.go
// assets/binary.go
// assets/public/css/styles.css
// assets/public/js/application.js
// assets/public/js/form2js.js
// assets/templates/actions.tmpl
// assets/templates/base.tmpl
// assets/templates/buttons.tmpl
// assets/templates/editor.tmpl
// assets/templates/frontmatter.tmpl
// assets/templates/listing.tmpl
// assets/templates/minimal.tmpl
// assets/templates/single.tmpl
// assets/embed/public/css/styles.css
// assets/embed/public/js/application.js
// assets/embed/public/js/form2js.js
// assets/embed/templates/actions.tmpl
// assets/embed/templates/base.tmpl
// assets/embed/templates/editor.tmpl
// assets/embed/templates/frontmatter.tmpl
// assets/embed/templates/listing.tmpl
// assets/embed/templates/minimal.tmpl
// assets/embed/templates/single.tmpl
// DO NOT EDIT!
package assets
@ -40,63 +36,9 @@ type asset struct {
info os.FileInfo
}
// Jsbeautifyrc reads file data from disk. It returns an error on failure.
func Jsbeautifyrc() (*asset, error) {
path := "D:\\Code\\Go\\src\\github.com\\hacdias\\caddy-filemanager\\assets\\.jsbeautifyrc"
name := ".jsbeautifyrc"
bytes, err := bindataRead(path, name)
if err != nil {
return nil, err
}
fi, err := os.Stat(path)
if err != nil {
err = fmt.Errorf("Error reading asset info %s at %s: %v", name, path, err)
}
a := &asset{bytes: bytes, info: fi}
return a, err
}
// assetsGo reads file data from disk. It returns an error on failure.
func assetsGo() (*asset, error) {
path := "D:\\Code\\Go\\src\\github.com\\hacdias\\caddy-filemanager\\assets\\assets.go"
name := "assets.go"
bytes, err := bindataRead(path, name)
if err != nil {
return nil, err
}
fi, err := os.Stat(path)
if err != nil {
err = fmt.Errorf("Error reading asset info %s at %s: %v", name, path, err)
}
a := &asset{bytes: bytes, info: fi}
return a, err
}
// binaryGo reads file data from disk. It returns an error on failure.
func binaryGo() (*asset, error) {
path := "D:\\Code\\Go\\src\\github.com\\hacdias\\caddy-filemanager\\assets\\binary.go"
name := "binary.go"
bytes, err := bindataRead(path, name)
if err != nil {
return nil, err
}
fi, err := os.Stat(path)
if err != nil {
err = fmt.Errorf("Error reading asset info %s at %s: %v", name, path, err)
}
a := &asset{bytes: bytes, info: fi}
return a, err
}
// publicCssStylesCss reads file data from disk. It returns an error on failure.
func publicCssStylesCss() (*asset, error) {
path := "D:\\Code\\Go\\src\\github.com\\hacdias\\caddy-filemanager\\assets\\public\\css\\styles.css"
path := "D:\\Code\\Go\\src\\github.com\\hacdias\\caddy-filemanager\\assets\\embed\\public\\css\\styles.css"
name := "public/css/styles.css"
bytes, err := bindataRead(path, name)
if err != nil {
@ -114,7 +56,7 @@ func publicCssStylesCss() (*asset, error) {
// publicJsApplicationJs reads file data from disk. It returns an error on failure.
func publicJsApplicationJs() (*asset, error) {
path := "D:\\Code\\Go\\src\\github.com\\hacdias\\caddy-filemanager\\assets\\public\\js\\application.js"
path := "D:\\Code\\Go\\src\\github.com\\hacdias\\caddy-filemanager\\assets\\embed\\public\\js\\application.js"
name := "public/js/application.js"
bytes, err := bindataRead(path, name)
if err != nil {
@ -132,7 +74,7 @@ func publicJsApplicationJs() (*asset, error) {
// publicJsForm2jsJs reads file data from disk. It returns an error on failure.
func publicJsForm2jsJs() (*asset, error) {
path := "D:\\Code\\Go\\src\\github.com\\hacdias\\caddy-filemanager\\assets\\public\\js\\form2js.js"
path := "D:\\Code\\Go\\src\\github.com\\hacdias\\caddy-filemanager\\assets\\embed\\public\\js\\form2js.js"
name := "public/js/form2js.js"
bytes, err := bindataRead(path, name)
if err != nil {
@ -150,7 +92,7 @@ func publicJsForm2jsJs() (*asset, error) {
// templatesActionsTmpl reads file data from disk. It returns an error on failure.
func templatesActionsTmpl() (*asset, error) {
path := "D:\\Code\\Go\\src\\github.com\\hacdias\\caddy-filemanager\\assets\\templates\\actions.tmpl"
path := "D:\\Code\\Go\\src\\github.com\\hacdias\\caddy-filemanager\\assets\\embed\\templates\\actions.tmpl"
name := "templates/actions.tmpl"
bytes, err := bindataRead(path, name)
if err != nil {
@ -168,7 +110,7 @@ func templatesActionsTmpl() (*asset, error) {
// templatesBaseTmpl reads file data from disk. It returns an error on failure.
func templatesBaseTmpl() (*asset, error) {
path := "D:\\Code\\Go\\src\\github.com\\hacdias\\caddy-filemanager\\assets\\templates\\base.tmpl"
path := "D:\\Code\\Go\\src\\github.com\\hacdias\\caddy-filemanager\\assets\\embed\\templates\\base.tmpl"
name := "templates/base.tmpl"
bytes, err := bindataRead(path, name)
if err != nil {
@ -184,27 +126,9 @@ func templatesBaseTmpl() (*asset, error) {
return a, err
}
// templatesButtonsTmpl reads file data from disk. It returns an error on failure.
func templatesButtonsTmpl() (*asset, error) {
path := "D:\\Code\\Go\\src\\github.com\\hacdias\\caddy-filemanager\\assets\\templates\\buttons.tmpl"
name := "templates/buttons.tmpl"
bytes, err := bindataRead(path, name)
if err != nil {
return nil, err
}
fi, err := os.Stat(path)
if err != nil {
err = fmt.Errorf("Error reading asset info %s at %s: %v", name, path, err)
}
a := &asset{bytes: bytes, info: fi}
return a, err
}
// templatesEditorTmpl reads file data from disk. It returns an error on failure.
func templatesEditorTmpl() (*asset, error) {
path := "D:\\Code\\Go\\src\\github.com\\hacdias\\caddy-filemanager\\assets\\templates\\editor.tmpl"
path := "D:\\Code\\Go\\src\\github.com\\hacdias\\caddy-filemanager\\assets\\embed\\templates\\editor.tmpl"
name := "templates/editor.tmpl"
bytes, err := bindataRead(path, name)
if err != nil {
@ -222,7 +146,7 @@ func templatesEditorTmpl() (*asset, error) {
// templatesFrontmatterTmpl reads file data from disk. It returns an error on failure.
func templatesFrontmatterTmpl() (*asset, error) {
path := "D:\\Code\\Go\\src\\github.com\\hacdias\\caddy-filemanager\\assets\\templates\\frontmatter.tmpl"
path := "D:\\Code\\Go\\src\\github.com\\hacdias\\caddy-filemanager\\assets\\embed\\templates\\frontmatter.tmpl"
name := "templates/frontmatter.tmpl"
bytes, err := bindataRead(path, name)
if err != nil {
@ -240,7 +164,7 @@ func templatesFrontmatterTmpl() (*asset, error) {
// templatesListingTmpl reads file data from disk. It returns an error on failure.
func templatesListingTmpl() (*asset, error) {
path := "D:\\Code\\Go\\src\\github.com\\hacdias\\caddy-filemanager\\assets\\templates\\listing.tmpl"
path := "D:\\Code\\Go\\src\\github.com\\hacdias\\caddy-filemanager\\assets\\embed\\templates\\listing.tmpl"
name := "templates/listing.tmpl"
bytes, err := bindataRead(path, name)
if err != nil {
@ -258,7 +182,7 @@ func templatesListingTmpl() (*asset, error) {
// templatesMinimalTmpl reads file data from disk. It returns an error on failure.
func templatesMinimalTmpl() (*asset, error) {
path := "D:\\Code\\Go\\src\\github.com\\hacdias\\caddy-filemanager\\assets\\templates\\minimal.tmpl"
path := "D:\\Code\\Go\\src\\github.com\\hacdias\\caddy-filemanager\\assets\\embed\\templates\\minimal.tmpl"
name := "templates/minimal.tmpl"
bytes, err := bindataRead(path, name)
if err != nil {
@ -276,7 +200,7 @@ func templatesMinimalTmpl() (*asset, error) {
// templatesSingleTmpl reads file data from disk. It returns an error on failure.
func templatesSingleTmpl() (*asset, error) {
path := "D:\\Code\\Go\\src\\github.com\\hacdias\\caddy-filemanager\\assets\\templates\\single.tmpl"
path := "D:\\Code\\Go\\src\\github.com\\hacdias\\caddy-filemanager\\assets\\embed\\templates\\single.tmpl"
name := "templates/single.tmpl"
bytes, err := bindataRead(path, name)
if err != nil {
@ -344,15 +268,11 @@ func AssetNames() []string {
// _bindata is a table, holding each asset generator, mapped to its name.
var _bindata = map[string]func() (*asset, error){
".jsbeautifyrc": Jsbeautifyrc,
"assets.go": assetsGo,
"binary.go": binaryGo,
"public/css/styles.css": publicCssStylesCss,
"public/js/application.js": publicJsApplicationJs,
"public/js/form2js.js": publicJsForm2jsJs,
"templates/actions.tmpl": templatesActionsTmpl,
"templates/base.tmpl": templatesBaseTmpl,
"templates/buttons.tmpl": templatesButtonsTmpl,
"templates/editor.tmpl": templatesEditorTmpl,
"templates/frontmatter.tmpl": templatesFrontmatterTmpl,
"templates/listing.tmpl": templatesListingTmpl,
@ -400,9 +320,6 @@ type bintree struct {
Children map[string]*bintree
}
var _bintree = &bintree{nil, map[string]*bintree{
".jsbeautifyrc": &bintree{Jsbeautifyrc, map[string]*bintree{}},
"assets.go": &bintree{assetsGo, map[string]*bintree{}},
"binary.go": &bintree{binaryGo, map[string]*bintree{}},
"public": &bintree{nil, map[string]*bintree{
"css": &bintree{nil, map[string]*bintree{
"styles.css": &bintree{publicCssStylesCss, map[string]*bintree{}},
@ -415,7 +332,6 @@ var _bintree = &bintree{nil, map[string]*bintree{
"templates": &bintree{nil, map[string]*bintree{
"actions.tmpl": &bintree{templatesActionsTmpl, map[string]*bintree{}},
"base.tmpl": &bintree{templatesBaseTmpl, map[string]*bintree{}},
"buttons.tmpl": &bintree{templatesButtonsTmpl, map[string]*bintree{}},
"editor.tmpl": &bintree{templatesEditorTmpl, map[string]*bintree{}},
"frontmatter.tmpl": &bintree{templatesFrontmatterTmpl, map[string]*bintree{}},
"listing.tmpl": &bintree{templatesListingTmpl, map[string]*bintree{}},

View File

@ -0,0 +1,11 @@
{
"css": {
"allowed_file_extensions": ["css", "scss", "sass", "less"],
"end_with_newline": false, // End output with newline
"indent_char": " ", // Indentation character
"indent_size": 4, // Indentation size
"newline_between_rules": true, // Add a new line after every css rule
"selector_separator": " ",
"selector_separator_newline": true // Separate selectors with newline or not (e.g. "a,\nbr" or "a, br")
}
}

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,32 @@
{
"js": {
"allowed_file_extensions": ["js", "json", "jshintrc", "jsbeautifyrc"],
// Set brace_style
// collapse: (old default) Put braces on the same line as control statements
// collapse-preserve-inline: (new default) Same as collapse but better support for ES6 destructuring and other features. https://github.com/victorporof/Sublime-HTMLPrettify/issues/231
// expand: Put braces on own line (Allman / ANSI style)
// end-expand: Put end braces on own line
// none: Keep them where they are
"brace_style": "collapse-preserve-inline",
"break_chained_methods": false, // Break chained method calls across subsequent lines
"e4x": false, // Pass E4X xml literals through untouched
"end_with_newline": false, // End output with newline
"indent_char": " ", // Indentation character
"indent_level": 0, // Initial indentation level
"indent_size": 4, // Indentation size
"indent_with_tabs": false, // Indent with tabs, overrides `indent_size` and `indent_char`
"jslint_happy": false, // If true, then jslint-stricter mode is enforced
"keep_array_indentation": false, // Preserve array indentation
"keep_function_indentation": false, // Preserve function indentation
"max_preserve_newlines": 0, // Maximum number of line breaks to be preserved in one chunk (0 disables)
"preserve_newlines": true, // Whether existing line breaks should be preserved
"space_after_anon_function": false, // Should the space before an anonymous function's parens be added, "function()" vs "function ()"
"space_before_conditional": true, // Should the space before conditional statement be added, "if(true)" vs "if (true)"
"space_in_empty_paren": false, // Add padding spaces within empty paren, "f()" vs "f( )"
"space_in_paren": false, // Add padding spaces within paren, ie. f( a, b )
"unescape_strings": false, // Should printable characters in strings encoded in \xNN notation be unescaped, "example" vs "\x65\x78\x61\x6d\x70\x6c\x65"
"wrap_line_length": 0 // Lines should wrap at next opportunity after this number of characters (0 disables)
}
}

View File

@ -785,7 +785,10 @@ document.addEventListener("DOMContentLoaded", function(event) {
document.getElementById("delete").addEventListener("click", deleteEvent);
document.getElementById("download").addEventListener("click", downloadEvent);
document.getElementById("open-nav").addEventListener("click", event => {
let sidebar = document.querySelector("header > div:nth-child(2)").classList.toggle("active");
document.querySelector("header > div:nth-child(2)").classList.toggle("active");
});
document.getElementById("overlay").addEventListener("click", event => {
document.querySelector("header > div:nth-child(2)").classList.toggle("active");
});
if (document.getElementById('listing')) {

View File

@ -0,0 +1,16 @@
{
"html": {
"allowed_file_extensions": ["htm", "html", "xhtml", "shtml", "xml", "svg"],
"brace_style": "collapse", // [collapse|expand|end-expand|none] Put braces on the same line as control statements (default), or put braces on own line (Allman / ANSI style), or just put end braces on own line, or attempt to keep them where they are
"end_with_newline": false, // End output with newline
"indent_char": " ", // Indentation character
"indent_handlebars": false, // e.g. {{#foo}}, {{/foo}}
"indent_inner_html": false, // Indent <head> and <body> sections
"indent_scripts": "keep", // [keep|separate|normal]
"indent_size": 4, // Indentation size
"max_preserve_newlines": 0, // Maximum number of line breaks to be preserved in one chunk (0 disables)
"preserve_newlines": true, // Whether existing line breaks before elements should be preserved (only works before elements, not inside tags or for text)
"unformatted": ["a", "span", "img", "code", "pre", "sub", "sup", "em", "strong", "b", "i", "u", "strike", "big", "small", "pre", "h1", "h2", "h3", "h4", "h5", "h6"], // List of tags that should not be reformatted
"wrap_line_length": 0 // Lines should wrap at next opportunity after this number of characters (0 disables)
}
}

View File

@ -1,6 +1,6 @@
{{ define "actions" }}
<div class="action" id="open">
<i class="material-icons">open_in_new</i>
<i class="material-icons">open_in_new</i> <span>See raw</span>
</div>
{{ if .IsDir }}
<div class="action" id="rename">
@ -8,9 +8,9 @@
</div>
{{ end }}
<div class="action" id="download">
<i class="material-icons">file_download</i>
<i class="material-icons">file_download</i> <span>Download</span>
</div>
<div class="action" id="delete">
<i class="material-icons">delete</i>
<i class="material-icons">delete</i> <span>Delete</span>
</div>
{{ end }}

View File

@ -42,8 +42,48 @@
</div>
<div>
{{ template "buttons" . }}
<div class="only-side">
{{ $lnk := .PreviousLink }}
{{ if ne $lnk ""}}
<a href="{{ $lnk }}">
{{ end }}
<div class="action{{ if eq $lnk ""}} disabled{{ end }}" id="prev">
<i class="material-icons">subdirectory_arrow_left</i>
</div>
{{ if ne $lnk ""}}
</a>
{{ end }}
<p>
<a href="{{ if eq .Config.BaseURL "" }}/{{ else }}{{ .Config.BaseURL }}{{ end }}">
{{ if .Config.HugoEnabled }}Hugo{{ else }}File Manager{{ end }}
</a>
</p>
</div>
{{ if .IsDir}}
<div id="search">
<i class="material-icons">storage</i>
<input type="text" placeholder="Execute a command...">
<div>Write your git, mercurial or svn command and press enter.</div>
</div>
<div class="action" id="view">
<i class="material-icons">view_headline</i> <span>Switch view</span>
</div>
<div class="action" id="upload">
<i class="material-icons">file_upload</i> <span>Upload</span>
</div>
{{ else }}
{{ template "actions" . }}
{{ end }}
<div class="action" id="logout">
<i class="material-icons">exit_to_app</i> <span>Logout</span>
</div>
</div>
<div id="overlay"></div>
</header>
{{ if .IsDir }}

View File

@ -20,7 +20,7 @@
{{- else}}
<p data-order="{{.Size}}">{{.HumanSize}}</p>
{{- end}}
<p class="hideable">
<p>
<time datetime="{{.HumanModTime " 2006-01-02T15:04:05Z"}}">{{.HumanModTime "01/02/2006 03:04:05 PM -07:00"}}</time>
</p>
</a>

File diff suppressed because it is too large Load Diff

View File

@ -1,23 +0,0 @@
{{ define "buttons" }}
{{ if .IsDir}}
<div id="search">
<i class="material-icons">storage</i>
<input type="text" placeholder="Execute a command...">
<div>Write your git, mercurial or svn command and press enter.</div>
</div>
<div class="action" id="view">
<i class="material-icons">view_headline</i> <span>Switch view</span>
</div>
<div class="action" id="upload">
<i class="material-icons">file_upload</i> <span>Upload</span>
</div>
{{ else }}
{{ template "actions" . }}
{{ end }}
<div class="action" id="logout">
<i class="material-icons">exit_to_app</i> <span>Logout</span>
</div>
{{ end }}

View File

@ -1,6 +1,6 @@
//go:generate go get github.com/jteeuwen/go-bindata
//go:generate go install github.com/jteeuwen/go-bindata/go-bindata
//go:generate go-bindata -debug -pkg assets -prefix "assets" -o assets/binary.go assets/...
//go:generate go-bindata -debug -pkg assets -ignore .jsbeautifyrc -prefix "assets/embed" -o assets/binary.go assets/embed/...
// Package filemanager provides middleware for managing files in a directory
// when directory path is requested instead of a specific file. Based on browse

View File

@ -82,7 +82,7 @@ func (p Page) PrintAsHTML(w http.ResponseWriter, templates ...string) (int, erro
if p.Minimal {
templates = append(templates, "actions", "minimal")
} else {
templates = append(templates, "buttons", "actions", "base")
templates = append(templates, "actions", "base")
}
var tpl *template.Template