Bläddra i källkod

pages also display members icons

QUICK GIVE ME CUSTOM HTML INCLUDING IMAGES IDEAS RN (it might end up being that they use external sources or we manual edit html files in production. hmm)
cube 4 dagar sedan
förälder
incheckning
620f4be9fb
2 ändrade filer med 24 tillägg och 3 borttagningar
  1. 3
    1
      myriad/home.py
  2. 21
    2
      myriad/templates/page.html

+ 3
- 1
myriad/home.py Visa fil

@@ -48,5 +48,7 @@ def page(mid):
48 48
     db = get_db()
49 49
     member = db.execute("SELECT * FROM member WHERE id=(?)",(mid,)).fetchone()
50 50
     blog = db.execute("SELECT * FROM blog WHERE member_id=(?) ORDER BY created DESC",(mid,)).fetchall()
51
+    icon = db.execute("SELECT icon_location FROM icons WHERE id=(?)",(member[6],)).fetchone()
52
+    all_icons = db.execute("SELECT icon_location FROM icons WHERE member_id=(?)",(mid,)).fetchall()
51 53
 
52
-    return render_template('page.html', member=member, blog=blog)
54
+    return render_template('page.html', member=member, blog=blog, icon=icon, all_icons=all_icons)

+ 21
- 2
myriad/templates/page.html Visa fil

@@ -3,9 +3,20 @@
3 3
 
4 4
 {% block content %}
5 5
 
6
+    {% if icon %}
7
+    <img class="icon" src="{{ url_for('static', filename='icons/'+icon[0]) }}">
8
+    {% else %}
9
+    <img class="icon" src="{{ url_for('static', filename='any.jpg') }}">
10
+    {% endif %}
11
+        <div class="title">{{member[3]}}</div>
12
+        <div class="maintext">
13
+            {{member[5]}}
14
+        </div>
15
+        <br class="clear" />
16
+
17
+    {% if blog|length > 0 %}
6 18
     <div class="heading big">{{member[3]}}'s blog</div>
7 19
         <div id="blog">
8
-
9 20
             {% for post in blog %}
10 21
             <div class="post">
11 22
                 <div class="title">{{post[3]}}</div>
@@ -15,7 +26,15 @@
15 26
                 </div>
16 27
             </div>
17 28
             {% endfor %}
18
-
19 29
         </div>
30
+    {% endif %}
31
+
32
+    {% if all_icons|length > 0 %}
33
+    <div class="heading big">{{member[3]}}'s icons</div>
34
+    {% for i in all_icons %}
35
+    <img class="icon" src="{{ url_for('static', filename='icons/'+i[0]) }}">
36
+    {% endfor %}
37
+    {% endif %}
38
+
20 39
 
21 40
 {% endblock %}