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
f4aa0f5f
Commit
f4aa0f5f
authored
Jan 22, 2021
by
Seb
Browse files
Added some more hooks and custom css
parent
67d3ae96
Changes
3
Hide whitespace changes
Inline
Side-by-side
wagtailvideos/static/wagtailvideos/css/summary-override.css
0 → 100644
View file @
f4aa0f5f
section
.summary
>
.stats
{
display
:
grid
!important
;
grid-template-columns
:
repeat
(
4
,
1
fr
);
}
section
.summary
>
.stats
::before
{
display
:
none
!important
;
}
section
.summary
>
.stats
>
li
{
display
:
flex
!important
;
}
@media
only
screen
and
(
max-width
:
50em
)
{
section
.summary
>
.stats
{
grid-template-columns
:
repeat
(
2
,
1
fr
);
}
}
\ No newline at end of file
wagtailvideos/templates/wagtailvideos/homepage/videos_summary.html
0 → 100644
View file @
f4aa0f5f
{% load i18n wagtailadmin_tags %}
<li
class=
"icon icon-media"
>
<a
href=
"{% url 'wagtailvideos:index' %}"
>
{% blocktrans count counter=total_videos with total_videos|intcomma as total %}
<span>
{{ total }}
</span>
Video
<span
class=
"visuallyhidden"
>
created in {{ site_name }}
</span>
{% plural %}
<span>
{{ total }}
</span>
Videos
<span
class=
"visuallyhidden"
>
created in {{ site_name }}
</span>
{% endblocktrans %}
</a>
</li>
\ No newline at end of file
wagtailvideos/wagtail_hooks.py
View file @
f4aa0f5f
...
@@ -3,10 +3,16 @@ from django.urls import reverse
...
@@ -3,10 +3,16 @@ from django.urls import reverse
from
django.utils.html
import
format_html
from
django.utils.html
import
format_html
from
django.utils.translation
import
ugettext_lazy
as
_
from
django.utils.translation
import
ugettext_lazy
as
_
from
wagtail.admin.menu
import
MenuItem
from
wagtail.admin.menu
import
MenuItem
from
wagtail.admin.search
import
SearchArea
from
wagtail.admin.site_summary
import
SummaryItem
from
wagtail.core
import
hooks
from
wagtail.core
import
hooks
from
django.utils.html
import
format_html
from
django.templatetags.static
import
static
from
wagtailvideos
import
urls
from
wagtailvideos
import
urls
from
wagtailvideos.forms
import
GroupVideoPermissionFormSet
from
wagtailvideos.forms
import
GroupVideoPermissionFormSet
from
wagtailvideos.models
import
Video
from
.permissions
import
permission_policy
@
hooks
.
register
(
'register_admin_urls'
)
@
hooks
.
register
(
'register_admin_urls'
)
...
@@ -39,3 +45,46 @@ def register_images_menu_item():
...
@@ -39,3 +45,46 @@ def register_images_menu_item():
_
(
'Videos'
),
reverse
(
'wagtailvideos:index'
),
_
(
'Videos'
),
reverse
(
'wagtailvideos:index'
),
name
=
'videos'
,
classnames
=
'icon icon-media'
,
order
=
300
name
=
'videos'
,
classnames
=
'icon icon-media'
,
order
=
300
)
)
class
VideoSummaryItem
(
SummaryItem
):
order
=
300
template
=
"wagtailvideos/homepage/videos_summary.html"
def
get_context
(
self
):
return
{
"total_videos"
:
Video
.
objects
.
count
(),
}
def
is_shown
(
self
):
return
permission_policy
.
user_has_any_permission
(
self
.
request
.
user
,
[
"add"
,
"change"
,
"delete"
]
)
@
hooks
.
register
(
"construct_homepage_summary_items"
)
def
add_media_summary_item
(
request
,
items
):
items
.
append
(
VideoSummaryItem
(
request
))
class
VideoSearchArea
(
SearchArea
):
def
is_shown
(
self
,
request
):
return
permission_policy
.
user_has_any_permission
(
request
.
user
,
[
"add"
,
"change"
,
"delete"
]
)
@
hooks
.
register
(
"register_admin_search_area"
)
def
register_media_search_area
():
return
VideoSearchArea
(
_
(
"Video"
),
reverse
(
"wagtailvideos:index"
),
name
=
"video"
,
classnames
=
"icon icon-media"
,
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