changeset 149:e5ec33c4a8a8

forum/overview.html: classes modification + better global design
author Goffi <goffi@goffi.org>
date Sun, 03 Jun 2018 18:01:32 +0200
parents a4b6b8b6fc58
children 1b214b168948
files sat_templates/default/components/common.html sat_templates/default/forum/overview.html sat_templates/default/static/forum.css
diffstat 3 files changed, 19 insertions(+), 13 deletions(-) [+]
line wrap: on
line diff
--- a/sat_templates/default/components/common.html	Sun Jun 03 09:00:04 2018 +0200
+++ b/sat_templates/default/components/common.html	Sun Jun 03 18:01:32 2018 +0200
@@ -18,7 +18,7 @@
     <nav class="menu {{class}}">
         <ul>
         {% for name,url in menus %}
-            <li><a class="menu_item {{name}}" {{ {'href': url}|xmlattr }}>{{ml[name]}}</a></li>
+            <li><a class="menu_item menu_item--{{name}}" {{ {'href': url}|xmlattr }}>{{ml[name]}}</a></li>
         {% endfor %}
         </ul>
     </nav>
--- a/sat_templates/default/forum/overview.html	Sun Jun 03 09:00:04 2018 +0200
+++ b/sat_templates/default/forum/overview.html	Sun Jun 03 18:01:32 2018 +0200
@@ -1,11 +1,12 @@
 {% extends 'base/base.html' %}
 
-{% macro generate_forums(forums_data) %}
-    <ul class="forum">
+{% macro generate_forums(forums_data, level=0) %}
+    {% set panel_type = "main" if level==0 else "sub" %}
+    <ul class="forum forum__panel_{{panel_type}}">
     {% for forum in forums_data %}
-        <li>
+        <li class="forum forum__cat_{{panel_type}} forum__level_{{level}}">
             {% if 'http_url' in forum %}
-                <a href="{{forum['http_url']}}" class="forum_actif">
+                <a href="{{forum['http_url']}}" class="forum_active">
             {% else %}
                 <a>
             {% endif %}
@@ -16,7 +17,7 @@
             </a>
 
             {% if 'sub-forums' in forum %}
-                {{ generate_forums(forum['sub-forums']) }}
+                {{ generate_forums(forum['sub-forums'], level=level+1) }}
             {% endif %}
         </li>
     {% endfor %}
@@ -27,7 +28,7 @@
 {% if not forums %}
     <p class="message--info">{% trans %}No forums found on this server!{% endtrans %}</p>
 {% else %}
-    <div id="forums">
+    <div class="forums">
         {{ generate_forums(forums) }}
     </div>
 {% endif %}
--- a/sat_templates/default/static/forum.css	Sun Jun 03 09:00:04 2018 +0200
+++ b/sat_templates/default/static/forum.css	Sun Jun 03 18:01:32 2018 +0200
@@ -1,22 +1,27 @@
 @import 'blog.css'; /* needed as blog/articles.html is included */
 
-#forums {
+.forums {
     margin: 2em auto 0 auto;
     width: 90%;
 }
 
 ul.forum {
+    list-style: none;
+}
+
+ul.forum__panel_sub {
     box-sizing: border-box;
-    list-style: none;
     display: flex;
+    flex-flow: row wrap;
     margin: 0 auto;
 }
 
-ul.forum>li {
-    width: 100%;
+.forum__cat_sub {
+    margin: 0.5em 1em;
+    width: 25em;
 }
 
-ul.forum>li>a {
+.forum__cat_sub>a {
     border: 0.7rem solid #ddd;
     border-radius: 0.5em;
     display: block;
@@ -26,7 +31,7 @@
     color: inherit;
 }
 
-a.forum_actif:hover {
+a.forum_active:hover {
     background-color: #43d2f6;
 }