Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
PaaS-templates
python-flask-template
Commits
3c8e54df
Commit
3c8e54df
authored
Nov 30, 2021
by
Madi Baig
Browse files
Add panopto_example button
parent
0616ca42
Pipeline
#213313
failed with stages
in 4 minutes and 45 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
blueprints/home.py
View file @
3c8e54df
...
...
@@ -2,6 +2,7 @@ from flask import Blueprint, render_template, request, redirect
from
imperial_panopto
import
panopto_login_required
from
config
import
url_for2
from
config.config
import
ENV
,
APP_NAME
from
database.db
import
db
from
models.entity
import
Entity
from
imperial_ldap.auth
import
login_required
,
get_user_from_session
...
...
@@ -13,7 +14,7 @@ home_blueprint = Blueprint('home', __name__, url_prefix='/')
@
home_blueprint
.
route
(
''
)
def
index
():
user
=
get_user_from_session
()
# If there is no user logged, this returns None
return
render_template
(
'index.html'
,
user
=
user
)
return
render_template
(
'index.html'
,
user
=
user
,
dev
=
ENV
,
appname
=
APP_NAME
)
@
home_blueprint
.
route
(
'/dashboard'
)
...
...
@@ -21,14 +22,14 @@ def index():
@
using_materials
# Indicate that we want to access the Materials API
def
dashboard
(
materials_client
,
user
):
my_courses
=
materials_client
.
get_courses_for_year
(
"2122"
)
return
render_template
(
'dashboard.html'
,
user
=
user
,
my_courses
=
my_courses
)
return
render_template
(
'dashboard.html'
,
user
=
user
,
my_courses
=
my_courses
,
dev
=
ENV
,
appname
=
APP_NAME
)
@
home_blueprint
.
route
(
'/panopto_example'
)
@
panopto_login_required
def
panopto_example
(
panopto_client
):
video
=
panopto_client
.
get_partially_viewed_videos
()[
0
]
return
render_template
(
'panopto_example.html'
,
video
=
video
,
iframe
=
panopto_client
.
get_iframe_of_video
(
video
.
id
))
return
render_template
(
'panopto_example.html'
,
video
=
video
,
iframe
=
panopto_client
.
get_iframe_of_video
(
video
.
id
)
,
dev
=
ENV
,
appname
=
APP_NAME
)
@
home_blueprint
.
route
(
'/entities'
,
methods
=
[
'GET'
,
'POST'
])
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment