From ad0368b745298b32f76cb3c5db6ebc636349c993 Mon Sep 17 00:00:00 2001 From: Henrique Dias Date: Mon, 26 Jun 2017 20:38:40 +0100 Subject: [PATCH] Sidebar and such --- _assets/css/styles.css | 44 +++++++++++--- _assets/templates/actions.tmpl | 91 +++++++++++++++++++++++++++++ _assets/templates/base.tmpl | 101 ++++----------------------------- page.go | 1 + 4 files changed, 140 insertions(+), 97 deletions(-) create mode 100644 _assets/templates/actions.tmpl diff --git a/_assets/css/styles.css b/_assets/css/styles.css index eb1196a2..e921b8c2 100644 --- a/_assets/css/styles.css +++ b/_assets/css/styles.css @@ -242,12 +242,16 @@ fieldset h3, .action { display: inline-block; cursor: pointer; - -webkit-transition: 0.2s ease all; transition: 0.2s ease all; border: 0; margin: 0; color: #546E7A; border-radius: 50%; + background: transparent; + padding: 0; + box-shadow: 0 0 0 0; + vertical-align: middle; + text-align: left; } .action.disabled { @@ -262,7 +266,7 @@ fieldset h3, border-radius: 50%; } -.action:hover i { +.action:hover { background-color: rgba(0, 0, 0, .1); } @@ -395,6 +399,30 @@ header>div div { display: block; } +/* SIDEBAR */ + +#sidebar { + position: fixed; + left: 0; + width: 20%; +} +#sidebar .action { + width: 100%; + display: block; + border-radius: 0; + font-size: 1.1em; + padding: .5em; +} + +#sidebar .action > * { + vertical-align: middle; +} + +main { + width: 78%; + margin-left: 20%; +} + /* * * * * * * * * * * * * * * * * TOP BAR * @@ -791,9 +819,9 @@ header>div div { #listing.list .item { width: 100%; margin: 0; - border: 0; - border-bottom: 1px solid rgba(0, 0, 0, 0.1); + border: 1px solid rgba(0, 0, 0, 0.1); padding: 1em; + border-top: 0; } #listing.list h2 { @@ -840,13 +868,15 @@ header>div div { #listing.list .item.header { display: flex !important; - background: #fafafa; + background: #f8f8f8; position: fixed; - width: 100%; + width: 78%; top: 7.8em; - left: 0; + left: 20%; z-index: 999; padding: .85em; + border: 0; + border-bottom: 1px solid rgba(0, 0, 0, 0.1); } #listing.list .item.header>div:first-child { diff --git a/_assets/templates/actions.tmpl b/_assets/templates/actions.tmpl new file mode 100644 index 00000000..6bcecf1a --- /dev/null +++ b/_assets/templates/actions.tmpl @@ -0,0 +1,91 @@ +{{ define "right-side-actions" }} + {{- if .IsDir }} + + {{- if eq .Display "mosaic" }}view_list{{ else }}view_module{{ end }} + Switch view + + + + {{- end }} + + {{- if and (.User.AllowNew) (.IsDir) }} + + {{- end }} + + {{- if and .User.AllowEdit (not .IsDir) }} + + {{- end }} + + + + +{{ end }} + +{{ define "left-side-actions" }} + {{- if and (not .IsDir) (.User.AllowEdit) }} + {{- if .Editor}} + + {{- if eq .Data.Mode "markdown" }} + + {{- end }} + + {{- if eq .Data.Visual true }} + + {{- end }} + + {{/* end if editor */}} + {{- end }} + + + + {{/* end if not dir and AllowEdit */}} + {{- end }} + + {{- if and .IsDir .User.AllowEdit }} + + + + + + {{- end }} +{{ end }} \ No newline at end of file diff --git a/_assets/templates/base.tmpl b/_assets/templates/base.tmpl index daa9ef0d..fec41f43 100644 --- a/_assets/templates/base.tmpl +++ b/_assets/templates/base.tmpl @@ -62,101 +62,15 @@
- {{- if and (not .IsDir) (.User.AllowEdit) }} - {{- if .Editor}} - - {{- if eq .Data.Mode "markdown" }} -
- remove_red_eye -
- {{- end }} - - {{- if eq .Data.Visual true }} -
- code -
- {{- end }} - {{- end }} - -
- save -
- {{- end }} - - {{- if and (.User.AllowEdit) (.IsDir) }} -
- forward - Move file -
- {{- end }} - - {{- if and .IsDir .User.AllowEdit }} -
- mode_edit -
- {{- end }} - - {{- if and .User.AllowEdit .IsDir }} -
- deleteDelete -
- {{- end }} + {{- template "left-side-actions" . -}}
-
+
+
- {{- if .IsDir }} -
- {{- if eq .Display "mosaic" }} - - view_listSwitch view - - {{- else }} - - view_moduleSwitch view - - {{- end }} -
- -
- check_circleSelect -
- {{- end }} - - {{- if and (.User.AllowNew) (.IsDir) }} -
- file_uploadUpload -
- {{- end }} - - {{- if and .User.AllowEdit (not .IsDir) }} -
- deleteDelete -
- {{- end }} - -
- {{- if not .IsDir}}{{ end }} - file_downloadDownload - {{- if not .IsDir}}{{ end }} - - {{- if .IsDir }} - - {{- end }} -
- -
- infoInfo -
+ {{- template "right-side-actions" . -}}
@@ -170,6 +84,13 @@ + +
{{- template "content" . }}
diff --git a/page.go b/page.go index dec7a0a3..9324718d 100644 --- a/page.go +++ b/page.go @@ -103,6 +103,7 @@ func (p page) PreviousLink() string { // PrintAsHTML formats the page in HTML and executes the template func (p page) PrintAsHTML(w http.ResponseWriter, m *FileManager, templates ...string) (int, error) { + templates = append(templates, "actions") templates = append(templates, "templates") if p.minimal {