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
1c80eb1e
Commit
1c80eb1e
authored
5 years ago
by
Julian
Browse files
Options
Downloads
Patches
Plain Diff
work on dashboardfeeds
parent
b80b839b
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Pipeline
#734
failed
5 years ago
Stage: test
Stage: build
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
aleksis/core/templates/core/index.html
+8
-0
8 additions, 0 deletions
aleksis/core/templates/core/index.html
aleksis/core/util/network.py
+9
-7
9 additions, 7 deletions
aleksis/core/util/network.py
aleksis/core/views.py
+4
-0
4 additions, 0 deletions
aleksis/core/views.py
with
21 additions
and
7 deletions
aleksis/core/templates/core/index.html
+
8
−
0
View file @
1c80eb1e
...
...
@@ -24,6 +24,14 @@
</div>
{% endfor %}
<div
class=
"row"
>
{% for widget in widgets %}
<div
class=
"col s12 m12 l6 xl4"
>
{{ widget }}
</div>
{% endfor %}
</div>
<div
class=
"row"
>
<div
class=
"col s12 m6"
>
<h5>
{% blocktrans %}Last activities{% endblocktrans %}
</h5>
...
...
This diff is collapsed.
Click to expand it.
aleksis/core/util/network.py
+
9
−
7
View file @
1c80eb1e
...
...
@@ -5,8 +5,8 @@ from django.utils import timezone, formats
from
ics
import
Calendar
from
requests
import
RequestException
from
dashboard
import
settings
from
dashboard.caches
import
LATEST_ARTICLE_CACHE
,
CURRENT_EVENTS_CACHE
#
from dashboard import settings
#
from dashboard.caches import LATEST_ARTICLE_CACHE, CURRENT_EVENTS_CACHE
WP_DOMAIN
:
str
=
"
https://katharineum-zu-luebeck.de
"
...
...
@@ -18,7 +18,8 @@ def get_newest_articles(domain: str = WP_DOMAIN,
author_whitelist
:
list
=
None
,
author_blacklist
:
list
=
None
,
category_whitelist
:
list
=
None
,
category_blacklist
:
list
=
None
category_blacklist
:
list
=
None
,
filter_vs_composer
:
bool
=
False
,
):
"""
This function returns the newest articles/posts of a WordPress site.
...
...
@@ -29,6 +30,7 @@ def get_newest_articles(domain: str = WP_DOMAIN,
:param author_blacklist: If the author
'
s id (an integer) is in this list, the article won
'
t be shown
:param category_whitelist: If this list is filled, only articles which are in one of this categories will be shown
:param category_blacklist: If the category
'
s id (an integer) is in this list, the article won
'
t be shown
:param filter_vs_composer: Remove unnecessary Visual Composer Tags
:return: a list of the newest posts/articles
"""
# Make mutable default arguments unmutable
...
...
@@ -68,7 +70,7 @@ def get_newest_articles(domain: str = WP_DOMAIN,
image_url
:
str
=
""
# Replace VS composer tags if activated
if
settings
.
latest_article_settings
.
replace
_vs_composer
_stuff
:
if
filter
_vs_composer
:
excerpt
=
VS_COMPOSER_REGEX
.
sub
(
""
,
post
[
"
excerpt
"
][
"
rendered
"
])
else
:
excerpt
=
post
[
"
excerpt
"
][
"
rendered
"
]
...
...
@@ -81,13 +83,13 @@ def get_newest_articles(domain: str = WP_DOMAIN,
"
image_url
"
:
image_url
,
}
)
if
len
(
posts
)
>=
limit
and
limit
>=
0
:
if
len
(
posts
)
>=
limit
>=
0
:
break
return
posts
@LATEST_ARTICLE_CACHE.decorator
#
@LATEST_ARTICLE_CACHE.decorator
def
get_newest_article_from_news
(
domain
=
WP_DOMAIN
):
newest_articles
:
list
=
get_newest_articles
(
domain
=
domain
,
limit
=
1
,
category_whitelist
=
[
1
,
27
])
if
len
(
newest_articles
)
>
0
:
...
...
@@ -149,7 +151,7 @@ def get_current_events(calendar: Calendar, limit: int = 5) -> list:
return
events
@CURRENT_EVENTS_CACHE.decorator
#
@CURRENT_EVENTS_CACHE.decorator
def
get_current_events_with_cal
(
limit
:
int
=
5
)
->
list
:
# Get URL
calendar_url
:
str
=
settings
.
current_events_settings
.
calendar_url
...
...
This diff is collapsed.
Click to expand it.
aleksis/core/views.py
+
4
−
0
View file @
1c80eb1e
...
...
@@ -20,6 +20,8 @@ from .models import Activity, Group, Notification, Person, School
from
.tables
import
GroupsTable
,
PersonsTable
from
.util
import
messages
from
aleksis.apps.dashboardfeeds.views
import
get_widgets
@person_required
def
index
(
request
:
HttpRequest
)
->
HttpResponse
:
...
...
@@ -33,6 +35,8 @@ def index(request: HttpRequest) -> HttpResponse:
context
[
"
notifications
"
]
=
notifications
context
[
"
unread_notifications
"
]
=
unread_notifications
context
[
"
widgets
"
]
=
get_widgets
(
request
)
return
render
(
request
,
"
core/index.html
"
,
context
)
...
...
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