瀏覽代碼

group privacy implemented

cube 1 天之前
父節點
當前提交
7ddf77b1ba
共有 3 個文件被更改,包括 10 次插入1 次删除
  1. 2
    1
      myriad/manage.py
  2. 3
    0
      myriad/templates/groups.html
  3. 5
    0
      myriad/templates/manage/groups.html

+ 2
- 1
myriad/manage.py 查看文件

@@ -267,7 +267,8 @@ def group_edit(gid):
267 267
     if request.method == "POST":
268 268
         name = request.form["name"]
269 269
         desc = request.form["desc"]
270
-        db.execute("UPDATE groups SET group_name=(?), group_description=(?) WHERE id=(?)",(name, desc, gid))
270
+        privacy = request.form["privacy"]
271
+        db.execute("UPDATE groups SET group_name=(?), group_description=(?), public=(?) WHERE id=(?)",(name, desc, privacy, gid))
271 272
         db.commit()
272 273
 
273 274
     return redirect(url_for("manage.groups"))

+ 3
- 0
myriad/templates/groups.html 查看文件

@@ -4,6 +4,8 @@
4 4
 {% block content %}
5 5
 
6 6
   {% for group in groups %}
7
+  {% if not g.user and group[3]==0 %}
8
+  {% else %}
7 9
     <div class="heading big">{{group[1]}}</div>
8 10
     <div class="maintext">
9 11
       {{group[2]}}<br><br>
@@ -13,6 +15,7 @@
13 15
         {% endfor %}
14 16
       {% endif %}
15 17
     </div>
18
+    {% endif %}
16 19
   {% endfor %}
17 20
 
18 21
 {% endblock %}

+ 5
- 0
myriad/templates/manage/groups.html 查看文件

@@ -22,8 +22,13 @@
22 22
       <input name="name" id="name" value="{{group[1]}}" required><br>
23 23
       <label for="desc">Description</label>
24 24
       <textarea name="desc" id="desc">{{group[2]}}</textarea><br>
25
+      <input type="radio" id="public" name="privacy" value=1 {% if group[3]==1 %}checked{% endif %}>
26
+      <label for="public">Public</label><br>
27
+      <input type="radio" id="private" name="privacy" value=0 {% if group[3]==0 %}checked{% endif %}>
28
+      <label for="private">Private</label><br>
25 29
       <input type="submit" value="Submit">
26 30
     </form>
31
+    <a class="danger">Delete group</a> - WARNING: this action is permanent and irreversible. this will not delete any members contained within the group.
27 32
     <hr>
28 33
   {% endfor %}
29 34