Kaynağa Gözat

group privacy implemented

cube 1 gün önce
ebeveyn
işleme
7ddf77b1ba

+ 2
- 1
myriad/manage.py Dosyayı Görüntüle

267
     if request.method == "POST":
267
     if request.method == "POST":
268
         name = request.form["name"]
268
         name = request.form["name"]
269
         desc = request.form["desc"]
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
         db.commit()
272
         db.commit()
272
 
273
 
273
     return redirect(url_for("manage.groups"))
274
     return redirect(url_for("manage.groups"))

+ 3
- 0
myriad/templates/groups.html Dosyayı Görüntüle

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

+ 5
- 0
myriad/templates/manage/groups.html Dosyayı Görüntüle

22
       <input name="name" id="name" value="{{group[1]}}" required><br>
22
       <input name="name" id="name" value="{{group[1]}}" required><br>
23
       <label for="desc">Description</label>
23
       <label for="desc">Description</label>
24
       <textarea name="desc" id="desc">{{group[2]}}</textarea><br>
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
       <input type="submit" value="Submit">
29
       <input type="submit" value="Submit">
26
     </form>
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
     <hr>
32
     <hr>
28
   {% endfor %}
33
   {% endfor %}
29
 
34