Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Websites UFRPE
Wagtail Videos
Commits
9a65727f
Commit
9a65727f
authored
Jan 29, 2021
by
Seb
Browse files
start of new video menu
parent
63870110
Changes
3
Hide whitespace changes
Inline
Side-by-side
wagtailvideos/models.py
View file @
9a65727f
...
...
@@ -315,7 +315,7 @@ class VideoTranscode(AbstractVideoTranscode):
class
AbstractTrack
(
models
.
Model
):
# TODO move to TextChoices once djang
p
<
2
is dropped
# TODO move to TextChoices once djang
0
<
3
is dropped
track_kinds
=
[
(
'subtitles'
,
'Subtitles'
),
(
'captions'
,
'Captions'
),
...
...
wagtailvideos/templates/wagtailvideos/videos/usage.html
View file @
9a65727f
{% extends "wagtailadmin/base.html" %}
{% load i18n %}
{% block titletag %}{% blocktrans with title=
image
.title %}Usage of {{ title }}{% endblocktrans %}{% endblock %}
{% block titletag %}{% blocktrans with title=
video
.title %}Usage of {{ title }}{% endblocktrans %}{% endblock %}
{% block content %}
{% trans "Usage of" as usage_str %}
{% include "wagtailadmin/shared/header.html" with title=usage_str subtitle=
image
.title %}
{% include "wagtailadmin/shared/header.html" with title=usage_str subtitle=
video
.title %}
<div
class=
"nice-padding"
>
<table
class=
"listing"
>
...
...
wagtailvideos/wagtail_hooks.py
View file @
9a65727f
...
...
@@ -2,7 +2,7 @@ from django.conf.urls import include, url
from
django.urls
import
reverse
from
django.utils.html
import
format_html
from
django.utils.translation
import
ugettext_lazy
as
_
from
wagtail.admin.menu
import
MenuItem
from
wagtail.admin.menu
import
MenuItem
,
SubmenuMenuItem
,
Menu
from
wagtail.admin.search
import
SearchArea
from
wagtail.admin.site_summary
import
SummaryItem
from
wagtail.core
import
hooks
...
...
@@ -11,7 +11,7 @@ from django.templatetags.static import static
from
wagtailvideos
import
urls
from
wagtailvideos.forms
import
GroupVideoPermissionFormSet
from
wagtailvideos
import
get_video_model
from
django.utils.safestring
import
mark_safe
from
.permissions
import
permission_policy
Video
=
get_video_model
()
...
...
@@ -41,15 +41,33 @@ def register_video_permissions_panel():
return
GroupVideoPermissionFormSet
class
VideoMenu
(
Menu
):
# Dummy class
def
__init__
(
self
,
*
args
,
**
kwargs
):
pass
def
menu_items_for_request
(
self
,
request
):
return
[
MenuItem
(
_
(
'Videos'
),
reverse
(
'wagtailvideos:index'
),
name
=
'videos'
,
classnames
=
'icon icon-media'
,
order
=
300
)
]
def
render_html
(
self
,
request
):
menu_items
=
self
.
menu_items_for_request
(
request
)
rendered_menu_items
=
[]
for
item
in
sorted
(
menu_items
,
key
=
lambda
i
:
i
.
order
):
rendered_menu_items
.
append
(
item
.
render_html
(
request
))
return
mark_safe
(
''
.
join
(
rendered_menu_items
))
@
hooks
.
register
(
'register_admin_menu_item'
)
def
register_images_menu_item
():
return
MenuItem
(
_
(
'Videos'
),
reverse
(
'wagtailvideos:index'
),
return
Submenu
MenuItem
(
_
(
'Videos'
),
VideoMenu
(
),
name
=
'videos'
,
classnames
=
'icon icon-media'
,
order
=
300
)
class
VideoSummaryItem
(
SummaryItem
):
order
=
300
template
=
"wagtailvideos/homepage/videos_summary.html"
...
...
@@ -87,6 +105,7 @@ def register_media_search_area():
order
=
400
,
)
@
hooks
.
register
(
'insert_global_admin_css'
)
def
summary_css
():
return
format_html
(
'<link rel="stylesheet" href="{}">'
,
static
(
'wagtailvideos/css/summary-override.css'
))
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