File tree Expand file tree Collapse file tree 4 files changed +40
-2
lines changed
hackdb/templates/groupadmin Expand file tree Collapse file tree 4 files changed +40
-2
lines changed Original file line number Diff line number Diff line change
1
+ # Generated by Django 4.0.4 on 2024-06-13 21:34
2
+
3
+ from django .db import migrations , models
4
+
5
+
6
+ class Migration (migrations .Migration ):
7
+
8
+ dependencies = [
9
+ ("groupadmin" , "0002_groupproperties_owners_manage_owners" ),
10
+ ]
11
+
12
+ operations = [
13
+ migrations .AddField (
14
+ model_name = "groupproperties" ,
15
+ name = "advertise_owners" ,
16
+ field = models .BooleanField (default = False ),
17
+ ),
18
+ ]
Original file line number Diff line number Diff line change @@ -26,6 +26,7 @@ class GroupProperties(models.Model):
26
26
)
27
27
description = models .CharField (max_length = 255 , blank = True , null = True )
28
28
self_service = models .BooleanField (default = False )
29
+ advertise_owners = models .BooleanField (default = False )
29
30
owners_manage_owners = models .BooleanField (default = False )
30
31
31
32
def __str__ (self ):
Original file line number Diff line number Diff line change @@ -34,6 +34,15 @@ def groupadmin_list(request):
34
34
if group .name not in groups :
35
35
groups [group .name ] = {"object" : group }
36
36
37
+ # groups that are configured to advertise owners
38
+ for group in Group .objects .filter (properties__advertise_owners = True ):
39
+ if group .name not in groups :
40
+ groups [group .name ] = {"object" : group }
41
+ if group .owners .count () > 0 :
42
+ groups [group .name ]["owners_text" ] = ", " .join (
43
+ sorted (owner .user .get_full_name () for owner in group .owners .all ())
44
+ )
45
+
37
46
context = {"groups" : [groups [name ] for name in sorted (groups .keys ())]}
38
47
return render (request , "groupadmin/groups.html" , context )
39
48
Original file line number Diff line number Diff line change @@ -19,11 +19,16 @@ <h1>Groups</h1>
19
19
{% for group in groups %}
20
20
< tr >
21
21
< td > {{ group.object.name }}</ td >
22
- < td > {{ group.object.properties.description }}</ td >
22
+ < td >
23
+ {{ group.object.properties.description }}
24
+ {% if group.owners_text %}
25
+ < i class ="bi bi-info-circle " style ="color:blue " data-bs-toggle ="tooltip " data-bs-title ="Managed by {{ group.owners_text }} "> </ i >
26
+ {% endif %}
27
+ </ td >
23
28
< td > {% if group.member %}< i class ="bi-check-lg " data-bs-toggle ="tooltip " title ="You are a member of this group. "> </ i > {% endif %}</ td >
24
29
< td >
25
30
{% if group.owner %}
26
- < a href ="{% url 'groupadmin_view' group.object.name %} " class ="btn btn-sm btn-light " data-bs-toggle ="tooltip " title ="You are an owner of this group. "> admin</ a >
31
+ < a href ="{% url 'groupadmin_view' group.object.name %} " class ="btn btn-sm btn-light " data-bs-toggle ="tooltip " title ="Manage this group. "> admin</ a >
27
32
{% endif %}
28
33
{% if group.object.properties.self_service %}
29
34
{% if group.member %}
@@ -45,4 +50,9 @@ <h1>Groups</h1>
45
50
</ table >
46
51
</ div >
47
52
53
+ < script type ="module ">
54
+ const tooltipTriggerList = document . querySelectorAll ( '[data-bs-toggle="tooltip"]' )
55
+ const tooltipList = [ ...tooltipTriggerList ] . map ( tooltipTriggerEl => new bootstrap . Tooltip ( tooltipTriggerEl ) )
56
+ </ script >
57
+
48
58
{% endblock %}
You can’t perform that action at this time.
0 commit comments