Compare commits
No commits in common. "10cfc151e1aeff0e49faca9606dee50708329378" and "aef53b18283f881c27546d2fba287f123a107f65" have entirely different histories.
10cfc151e1
...
aef53b1828
@ -33,15 +33,8 @@ class DashboardFragment:
|
|||||||
|
|
||||||
class LinksCardDashboardFragment(DashboardFragment):
|
class LinksCardDashboardFragment(DashboardFragment):
|
||||||
template = "dashboard/links_card.dj.html"
|
template = "dashboard/links_card.dj.html"
|
||||||
links: list[Link] = []
|
links: [Link] = []
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def context(self):
|
def context(self):
|
||||||
return {"links": self.links}
|
return {"links": self.links}
|
||||||
|
|
||||||
@property
|
|
||||||
def visible(self) -> bool:
|
|
||||||
return any(
|
|
||||||
link.permission is None or self.request.user.has_perm(link.permission)
|
|
||||||
for link in self.links
|
|
||||||
)
|
|
||||||
|
@ -1,42 +0,0 @@
|
|||||||
import dashboard
|
|
||||||
from dashboard import Link
|
|
||||||
from membershipworks.models import Member
|
|
||||||
from paperwork.models import Department
|
|
||||||
|
|
||||||
|
|
||||||
@dashboard.register
|
|
||||||
class ExternalAppsDashboardFragment(dashboard.LinksCardDashboardFragment):
|
|
||||||
name = "External Applications"
|
|
||||||
|
|
||||||
@property
|
|
||||||
def links(self):
|
|
||||||
links = [
|
|
||||||
Link(
|
|
||||||
"Wiki",
|
|
||||||
"https://wiki.claremontmakerspace.org",
|
|
||||||
tooltip="Uses CMS Network Computing account",
|
|
||||||
permission=None,
|
|
||||||
),
|
|
||||||
Link(
|
|
||||||
"Mailman",
|
|
||||||
"http://mailman.claremontmakerspace.org",
|
|
||||||
tooltip="Mailing list management. Uses its own authentication, for now",
|
|
||||||
permission=None,
|
|
||||||
),
|
|
||||||
]
|
|
||||||
|
|
||||||
member = Member.from_user(self.request.user)
|
|
||||||
if (
|
|
||||||
member is not None
|
|
||||||
and Department.objects.filter(shop_lead_flag__members=member).exists()
|
|
||||||
):
|
|
||||||
links.append(
|
|
||||||
Link(
|
|
||||||
"Ticketing System",
|
|
||||||
"https://tickets.claremontmakerspace.org/scp/",
|
|
||||||
tooltip="Uses CMS Network Computing account",
|
|
||||||
permission=None,
|
|
||||||
)
|
|
||||||
)
|
|
||||||
|
|
||||||
return links
|
|
@ -31,3 +31,7 @@ class MembershipworksDashboardFragment(dashboard.LinksCardDashboardFragment):
|
|||||||
permission="membershipworks.view_member",
|
permission="membershipworks.view_member",
|
||||||
),
|
),
|
||||||
]
|
]
|
||||||
|
|
||||||
|
@property
|
||||||
|
def visible(self) -> bool:
|
||||||
|
return self.request.user.has_perm("doorcontrol.view_hidevent")
|
||||||
|
Loading…
Reference in New Issue
Block a user