from django.urls import reverse
from django.utils.html import format_html, format_html_join
from django.utils.translation import ugettext_lazy as _
from django.conf import settings
from wagtail.core import hooks
from import MenuItem
from wagtail.core.whitelist import attribute_rule, check_url

def register_django_admin_menu_item():
    return MenuItem(_('Django Admin'), reverse('admin:index'),
                    classnames='icon icon-cogs', order=700)

def whitelister_element_rules():
    # Whitelist custom elements to the hallo.js editor
    return {
        'a': attribute_rule({'href': check_url, 'target': True}),
        'blockquote': attribute_rule({'class': True})

def editor_js():
    # Add extra JS files to the admin
    js_files = [
    js_includes = format_html_join(
        '\n', '<script src="{0}{1}"></script>',
        ((settings.STATIC_URL, filename) for filename in js_files)

    return js_includes + format_html(

def editor_css():
    # Add extra CSS files to the admin like font-awesome
    css_files = [

    css_includes = format_html_join(
        '\n', '<link rel="stylesheet" href="{0}{1}">',
        ((settings.STATIC_URL, filename) for filename in css_files)

    return css_includes