Skip to content

Commit

Permalink
wip admin dashboad
Browse files Browse the repository at this point in the history
  • Loading branch information
dpausp committed Nov 26, 2023
1 parent b7dd618 commit 2911915
Show file tree
Hide file tree
Showing 4 changed files with 123 additions and 3 deletions.
30 changes: 30 additions & 0 deletions src/ekklesia_portal/concepts/ekklesia_portal/cell/admin_area.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,33 @@ class AdminAreaCell(LayoutCell):
def admin_box(self):
return AdminBox()

def is_global_admin(self):
return self._request.current_user and self._request.identity.has_global_admin_permissions

def managed_departments(self):
return self.current_user.managed_departments

def queued_messages(self):
return [
dict(author="testuser", subject="Bitte Antrag XY löschen", body="War ne blöde Idee, sorry"),
dict(author="testadmin", subject="Schau dir mal user testuser an", body="Macht komische Dinge"),
dict(author="testuser", subject="Bitte Antrag XY löschen", body="War ne blöde Idee, sorry"),
dict(),
dict(),
dict(),
dict(),
dict(),
]

def queued_propositions(self):
return [
dict(author="testuser", title="Antrag XY", content="Der Vorstand wird verpflichtet..."),
dict(author="testuser", title="Antrag 1", content="..."),
dict(author="testuser", title="Antrag 2", content="..."),
dict(),
dict(),
dict(),
dict(),
dict(),
dict(),
]
9 changes: 8 additions & 1 deletion src/ekklesia_portal/concepts/ekklesia_portal/cell/layout.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,14 @@ def admin_area_url(self):
return self.link(AdminArea())

def show_admin_area(self):
return self.current_user and self._request.identity.has_global_admin_permissions
if self.current_user is None:
return False

if self._request.identity.has_global_admin_permissions:
return True

if self.current_user.managed_departments:
return True

def show_login_button(self):
return self._s.app.login_visible
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,95 @@
- block content

h2 Admin

if is_global_admin
p
strong Du bist globaler Admin

.row
.col-sm-6
.card
.card-body
h2.card-title
a(href="#") Wartende Anträge
| 
span.badge.badge-primary= queued_propositions|length

.card-text
for proposition in queued_propositions[:3]
.card
.card-body
h5.card-title
p= proposition.title
small Von:
= proposition.author
.card-text
.message_actions
.btn.btn-secondary.btn-sm Veröffentlichen
.btn.btn-danger.btn-sm Löschen
.btn.btn-danger.btn-sm Ignorieren
hr
p= proposition.content

a(href="#")
small Es werden nur 3 von 9 Anträgen angezeigt, alle anzeigen...


.col-sm-6
.card
.card-body
h2.card-title
a(href="#") Nachrichten
| 
span.badge.badge-primary= queued_messages|length
.card-text
for message in queued_messages[:3]
.card
.card-body
h5.card-title
p= message.subject
small Von: {{ message.author }}
.card-text
.message_actions
.btn.btn-secondary.btn-sm Antworten
.btn.btn-secondary.btn-sm Als Abgeschlossen markieren
.btn.btn-danger.btn-sm Ignorieren
hr
p= message.body

a(href="#")
small Es werden nur 3 von 8 Nachrichten angezeigt, alle anzeigen...

hr

.row
.col-sm-6
.card
.card-body
h2.card-title
a(href="#") Meine Gliederungen
| 
span.badge.badge-primary= managed_departments|length
.card-text
= render_cell(admin_box)
for department in managed_departments[:3]
.card
.card-body
h5.card-title= department.name
.card-text
.message_actions
.btn.btn-secondary.btn-sm Neuer Antrag
.btn.btn-secondary.btn-sm Neue Abstimmungsphase
.btn.btn-secondary.btn-sm Alle Anträge

if is_global_admin
.col-sm-6
.card
.card-body
h2.card-title Admin-Aktionen
.card-text
= render_cell(admin_box)




// generated from jade
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

@App.permission_rule(model=AdminArea, permission=ViewPermission)
def admin_area_view_permission(identity, model, permission):
return identity.has_global_admin_permissions
return identity.has_global_admin_permissions or identity.user.managed_departments


@App.path(model=AdminArea, path='/admin')
Expand Down

0 comments on commit 2911915

Please sign in to comment.