Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
AlekSIS-Core
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Terraform modules
Monitor
Service Desk
Analyze
Contributor analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
AlekSIS®
Official
AlekSIS-Core
Commits
aad284e2
Verified
Commit
aad284e2
authored
4 years ago
by
magicfelix
Browse files
Options
Downloads
Patches
Plain Diff
Remove authentication check from index template
parent
d579eec2
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!506
Resolve "Support default dashboard for anonymous users"
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
aleksis/core/rules.py
+3
-0
3 additions, 0 deletions
aleksis/core/rules.py
aleksis/core/templates/core/index.html
+83
-82
83 additions, 82 deletions
aleksis/core/templates/core/index.html
aleksis/core/views.py
+10
-5
10 additions, 5 deletions
aleksis/core/views.py
with
96 additions
and
87 deletions
aleksis/core/rules.py
+
3
−
0
View file @
aad284e2
...
...
@@ -310,6 +310,9 @@ rules.add_perm("core.edit_dashboardwidget", edit_dashboard_widget_predicate)
delete_dashboard_widget_predicate
=
has_person
&
has_global_perm
(
"
core.delete_dashboardwidget
"
)
rules
.
add_perm
(
"
core.delete_dashboardwidget
"
,
delete_dashboard_widget_predicate
)
edit_dashboard_predicate
=
has_person
rules
.
add_perm
(
"
core.edit_dashboard
"
,
edit_dashboard_predicate
)
edit_default_dashboard_predicate
=
has_person
&
has_global_perm
(
"
core.edit_default_dashboard
"
)
rules
.
add_perm
(
"
core.edit_default_dashboard
"
,
edit_default_dashboard_predicate
)
...
...
This diff is collapsed.
Click to expand it.
aleksis/core/templates/core/index.html
+
83
−
82
View file @
aad284e2
{% extends 'core/base.html' %}
{% load i18n static dashboard %}
{% load i18n static dashboard
rules
%}
{% block browser_title %}{% blocktrans %}Home{% endblocktrans %}{% endblock %}
{% block no_page_title %}{% endblock %}
...
...
@@ -9,104 +9,105 @@
{% endblock %}
{% block content %}
<a
class=
"btn-flat waves-effect waves-light right"
href=
"{% url "
edit_dashboard
"
%}"
>
<i
class=
"material-icons left"
>
edit
</i>
{% trans "Edit dashboard" %}
</a>
{% has_perm "core.edit_dashboard" user as can_edit_dashboard %}
{% if can_edit_dashboard %}
<a
class=
"btn-flat waves-effect waves-light right"
href=
"{% url "
edit_dashboard
"
%}"
>
<i
class=
"material-icons left"
>
edit
</i>
{% trans "Edit dashboard" %}
</a>
{% endif %}
<h4>
{{ request.site.preferences.general__title }}
</h4>
{% if user.is_authenticated %}
{% for notification in unread_notifications %}
<div
class=
"alert primary scale-transition"
>
<div>
<i
class=
"material-icons left"
>
info
</i>
<div
class=
"right"
>
<a
class=
"btn-flat waves-effect"
href=
"{% url "
notification_mark_read
"
notification.id
%}"
>
<i
class=
"material-icons center"
>
close
</i>
</a>
</div>
{% for notification in unread_notifications %}
<div
class=
"alert primary scale-transition"
>
<div>
<i
class=
"material-icons left"
>
info
</i>
<strong>
{{ notification.title }}
</strong>
<p>
{{ notification.description }}
</p>
<div
class=
"right"
>
<a
class=
"btn-flat waves-effect"
href=
"{% url "
notification_mark_read
"
notification.id
%}"
>
<i
class=
"material-icons center"
>
close
</i>
</a>
</div>
</div>
{% endfor %}
{% include "core/partials/announcements.html" with announcements=announcements %}
<div
class=
"row"
id=
"live_load"
>
{% for widget in widgets %}
<div
class=
"col s{{ widget.size_s }} m{{ widget.size_m }} l{{ widget.size_l }} xl{{ widget.size_xl }}"
>
{% include_widget widget %}
</div>
{% endfor %}
<strong>
{{ notification.title }}
</strong>
<p>
{{ notification.description }}
</p>
</div>
</div>
{% endfor %}
{% include "core/partials/announcements.html" with announcements=announcements %}
{% if default_dashboard and widgets %}
<div
class=
"grey-text right"
>
{% blocktrans %}
You didn't customise your dashboard so that you see the system default. Please click on "Edit dashboard" to
customise your personal dashboard.
{% endblocktrans %}
<div
class=
"row"
id=
"live_load"
>
{% for widget in widgets %}
<div
class=
"col s{{ widget.size_s }} m{{ widget.size_m }} l{{ widget.size_l }} xl{{ widget.size_xl }}"
>
{% include_widget widget %}
</div>
{% endif %}
{% endfor %}
</div>
{% if default_dashboard and widgets and can_edit_dashboard %}
<div
class=
"grey-text right"
>
{% blocktrans %}
You didn't customise your dashboard so that you see the system default. Please click on "Edit dashboard" to
customise your personal dashboard.
{% endblocktrans %}
</div>
{% endif %}
<div
class=
"row"
>
<div
class=
"col s12 m6"
>
<h5>
{% blocktrans %}Last activities{% endblocktrans %}
</h5>
<div
class=
"row"
>
<div
class=
"col s12 m6"
>
<h5>
{% blocktrans %}Last activities{% endblocktrans %}
</h5>
{% if activities %}
<ul
class=
"collection"
>
{% for activity in activities %}
<li
class=
"collection-item"
>
<span
class=
"badge new primary-color"
>
{{ activity.app }}
</span>
<span
class=
"title"
>
{{ activity.title }}
</span>
<p>
<i
class=
"material-icons left"
>
access_time
</i>
{{ activity.created }}
</p>
<p>
{{ activity.description }}
</p>
</li>
{% endfor %}
</ul>
{% else %}
<p>
{% blocktrans %}No activities available yet.{% endblocktrans %}
</p>
{% endif %}
</div>
{% if activities %}
<ul
class=
"collection"
>
{% for activity in activities %}
<li
class=
"collection-item"
>
<span
class=
"badge new primary-color"
>
{{ activity.app }}
</span>
<span
class=
"title"
>
{{ activity.title }}
</span>
<p>
<i
class=
"material-icons left"
>
access_time
</i>
{{ activity.created }}
</p>
<p>
{{ activity.description }}
</p>
</li>
{% endfor %}
</ul>
{% else %}
<p>
{% blocktrans %}No activities available yet.{% endblocktrans %}
</p>
{% endif %}
</div>
<div
class=
"col s12 m6"
>
<h5>
{% blocktrans %}Recent notifications{% endblocktrans %}
</h5>
<div
class=
"col s12 m6"
>
<h5>
{% blocktrans %}Recent notifications{% endblocktrans %}
</h5>
{% if notifications %}
<ul
class=
"collection"
>
{% for notification in notifications %}
<li
class=
"collection-item"
>
<span
class=
"badge new primary-color"
>
{{ notification.app }}
</span>
<span
class=
"title"
>
{{ notification.title }}
</span>
<p>
<i
class=
"material-icons left"
>
access_time
</i>
{{ notification.created }}
</p>
{% if notifications %}
<ul
class=
"collection"
>
{% for notification in notifications %}
<li
class=
"collection-item"
>
<span
class=
"badge new primary-color"
>
{{ notification.app }}
</span>
<span
class=
"title"
>
{{ notification.title }}
</span>
<p>
<i
class=
"material-icons left"
>
access_time
</i>
{{ notification.created }}
</p>
<p>
{{ notification.description }}
</p>
{% if notification.link %}
<p>
{{ notification.
description }}
<a
href=
"
{{ notification.
link }}"
>
{% blocktrans %}More information →{% endblocktrans %}
</a>
</p>
{% if notification.link %}
<p>
<a
href=
"{{ notification.link }}"
>
{% blocktrans %}More information →{% endblocktrans %}
</a>
</p>
{% endif %}
</li>
{% endfor %}
</ul>
{% else %}
<p>
{% blocktrans %}No notifications available yet.{% endblocktrans %}
</p>
{% endif %}
</div>
{% endif %}
</li>
{% endfor %}
</ul>
{% else %}
<p>
{% blocktrans %}No notifications available yet.{% endblocktrans %}
</p>
{% endif %}
</div>
{% endif %}
</div>
<script
type=
"text/javascript"
src=
"{% static "
js
/
include_ajax_live.js
"
%}"
></script>
{% endblock %}
This diff is collapsed.
Click to expand it.
aleksis/core/views.py
+
10
−
5
View file @
aad284e2
...
...
@@ -84,9 +84,16 @@ def index(request: HttpRequest) -> HttpResponse:
"""
View for dashboard.
"""
context
=
{}
activities
=
request
.
user
.
person
.
activities
.
all
()[:
5
]
notifications
=
request
.
user
.
person
.
notifications
.
all
()[:
5
]
unread_notifications
=
request
.
user
.
person
.
notifications
.
all
().
filter
(
read
=
False
)
if
has_person
(
request
.
user
):
person
=
request
.
user
.
person
widgets
=
person
.
dashboard_widgets
else
:
person
=
DummyPerson
()
widgets
=
[]
activities
=
person
.
activities
.
all
()[:
5
]
notifications
=
person
.
notifications
.
all
()[:
5
]
unread_notifications
=
person
.
notifications
.
all
().
filter
(
read
=
False
)
context
[
"
activities
"
]
=
activities
context
[
"
notifications
"
]
=
notifications
...
...
@@ -95,8 +102,6 @@ def index(request: HttpRequest) -> HttpResponse:
announcements
=
Announcement
.
objects
.
at_time
().
for_person
(
request
.
user
.
person
)
context
[
"
announcements
"
]
=
announcements
widgets
=
request
.
user
.
person
.
dashboard_widgets
if
len
(
widgets
)
==
0
:
# Use default dashboard if there are no widgets
widgets
=
DashboardWidgetOrder
.
default_dashboard_widgets
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment