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
cf848bdb
Verified
Commit
cf848bdb
authored
5 years ago
by
Nik | Klampfradler
Browse files
Options
Downloads
Patches
Plain Diff
Add template tag for better widget inclusion
parent
75a060c3
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!142
Implement core functionality for dashboard widgets
Pipeline
#763
failed
5 years ago
Stage: test
Stage: build
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
aleksis/core/templates/core/index.html
+2
-4
2 additions, 4 deletions
aleksis/core/templates/core/index.html
aleksis/core/templatetags/dashboard.py
+13
-0
13 additions, 0 deletions
aleksis/core/templatetags/dashboard.py
with
15 additions
and
4 deletions
aleksis/core/templates/core/index.html
+
2
−
4
View file @
cf848bdb
{% extends 'core/base.html' %}
{% load i18n static %}
{% load i18n static
dashboard
%}
{% block browser_title %}{% blocktrans %}Home{% endblocktrans %}{% endblock %}
...
...
@@ -27,9 +27,7 @@
<div
class=
"row"
id=
"live_load"
>
{% for widget in widgets %}
<div
class=
"col s12 m12 l6 xl4"
>
{% with widget as d_widget %}
{% include widget.template %}
{% endwith %}
{% include_widget widget %}
</div>
{% endfor %}
</div>
...
...
This diff is collapsed.
Click to expand it.
aleksis/core/templatetags/dashboard.py
0 → 100644
+
13
−
0
View file @
cf848bdb
from
django.template
import
Context
,
Library
,
loader
register
=
Library
()
@register.simple_tag
def
include_widget
(
widget
)
->
dict
:
"""
Render a template with context from a defined widget
"""
template
=
loader
.
get_template
(
widget
.
get_template
())
context
=
Context
(
widget
.
get_context
())
return
template
.
render
(
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