Skip to content

Commit

Permalink
Assets path fixed for new versions of Wagtail
Browse files Browse the repository at this point in the history
  • Loading branch information
jordij committed May 25, 2015
1 parent 694d679 commit 93b3f7f
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 3 deletions.
5 changes: 3 additions & 2 deletions wagtailgmaps/templates/wagtailadmin/admin_base.html
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
{% extends "wagtailadmin/skeleton.html" %}
{% load compress wagtailadmin_tags %}
{% load wagtailgmaps_tags %}

{% block css %}
{% compress css %}
<link rel="stylesheet" href="{{ STATIC_URL }}wagtailadmin/scss/vendor/jquery-ui/jquery-ui-1.10.3.verdant.css" type="text/css" />
<link rel="stylesheet" href="{{ STATIC_URL }}wagtailadmin/scss/core.scss" type="text/x-scss" />
<link rel="stylesheet" href="{{ STATIC_URL }}wagtailadmin/{% wagtail_version %}/vendor/jquery-ui/jquery-ui-1.10.3.verdant.css" />
<link rel="stylesheet" href="{{ STATIC_URL }}wagtailadmin/{% wagtail_version %}/core.{% wagtail_version %}" type="text/{% wagtail_version %}" />
<link rel="stylesheet" href="{{ STATIC_URL }}wagtailgmaps/css/admin.css" type="text/css" />
{% endcompress %}

Expand Down
20 changes: 19 additions & 1 deletion wagtailgmaps/templatetags/wagtailgmaps_tags.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
import uuid

from django import template
from django.conf import settings
import uuid

from distutils.version import StrictVersion

from wagtailgmaps.utils import get_wagtail_version

register = template.Library()

Expand Down Expand Up @@ -28,3 +33,16 @@ def map_editor(address, width, width_units, height, height_units, zoom):
'height': height,
'height_units': height_units,
}


@register.simple_tag
def wagtail_version():
"""
Return css folder used in the path of admin assets depending on the Wagtail version
"""
current_version = get_wagtail_version()

if StrictVersion(current_version) >= StrictVersion('1.0b2'):
return 'css'
else:
return 'scss'
5 changes: 5 additions & 0 deletions wagtailgmaps/utils.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import pkg_resources


def get_wagtail_version():
return pkg_resources.get_distribution("wagtail").version

0 comments on commit 93b3f7f

Please sign in to comment.