changeset 122:9d95b58200df

file: files handling first draft: file/overview.html generate a simple files/directories listing
author Goffi <goffi@goffi.org>
date Sun, 11 Mar 2018 19:21:46 +0100
parents ab2dd835e597
children 44b838bcc0d6
files default/file/overview.html default/static/file.css default/static/styles.css
diffstat 3 files changed, 77 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/default/file/overview.html	Sun Mar 11 19:21:46 2018 +0100
@@ -0,0 +1,33 @@
+{% extends 'base/base.html' %}
+
+{% block body %}
+{{ icon_defs('level-up', 'doc','folder-open-empty') }}
+<ul id="files">
+    {% if parent_url is defined  %}
+        <li class="file">
+            <a href="{{ parent_url }}">
+                {{ icon('level-up', cls='file__icon') }}
+                {% trans %}parent dir{% endtrans %}
+            </a>
+        </li>
+    {% endif %}
+
+    {% for file in files_data %}
+        {% if file.type == C.FILE_TYPE_DIRECTORY %}
+            <li class="file file_{{file.type}}">
+                <a href="{{file.url}}">
+                    {{ icon('folder-open-empty', cls='file__icon') }}
+                    {{ file.name }}
+                </a>
+            </li>
+        {% else %}
+            <li class="file file_{{file.type}}">
+                <a href="{{file.url}}">
+                    {{ icon('doc', cls='file__icon icon--soft') }}
+                    {{ file.name }}
+                </a>
+            </li>
+        {% endif %}
+    {% endfor %}
+</ul>
+{% endblock body %}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/default/static/file.css	Sun Mar 11 19:21:46 2018 +0100
@@ -0,0 +1,40 @@
+#files {
+    list-style: none;
+    display: flex;
+    flex-wrap: wrap;
+}
+
+.file {
+    padding: 0 0 0.5em;
+    width: 100px;
+    text-overflow: ellipsis;
+    overflow: hidden;
+    text-align: center;
+    overflow-wrap: break-word;
+}
+
+.file:hover {
+    background: #ddd;
+    overflow: visible;
+}
+
+.file a {
+    text-decoration: none;
+}
+
+.file__icon {
+    height: 3em;
+    display: block;
+    margin: 0 auto;
+}
+
+.icon--soft {
+    fill: #777;
+}
+
+@media (min-width: 500px) {
+    .file {
+        padding: 1em;
+        width: 170px;
+    }
+}
--- a/default/static/styles.css	Fri Mar 02 19:01:57 2018 +0100
+++ b/default/static/styles.css	Sun Mar 11 19:21:46 2018 +0100
@@ -11,6 +11,10 @@
     box-sizing: border-box;
 }
 
+ul {
+    padding: 0;
+}
+
 #main_side_bar {
 
 }