Move get_logo_url from branding/__init__.py to branding/api.py for consistency.
This commit is contained in:
@@ -64,28 +64,3 @@ def get_university_for_request():
|
||||
if no university was specified
|
||||
"""
|
||||
return microsite.get_value('university')
|
||||
|
||||
|
||||
def get_logo_url():
|
||||
"""
|
||||
Return the url for the branded logo image to be used
|
||||
"""
|
||||
|
||||
# if the MicrositeConfiguration has a value for the logo_image_url
|
||||
# let's use that
|
||||
image_url = microsite.get_value('logo_image_url')
|
||||
if image_url:
|
||||
return '{static_url}{image_url}'.format(
|
||||
static_url=settings.STATIC_URL,
|
||||
image_url=image_url
|
||||
)
|
||||
|
||||
# otherwise, use the legacy means to configure this
|
||||
university = microsite.get_value('university')
|
||||
|
||||
if university is None and settings.FEATURES.get('IS_EDX_DOMAIN', False):
|
||||
return staticfiles_storage.url('images/edx-theme/edx-logo-77x36.png')
|
||||
elif university:
|
||||
return staticfiles_storage.url('images/{uni}-on-edx-logo.png'.format(uni=university))
|
||||
else:
|
||||
return staticfiles_storage.url('images/logo.png')
|
||||
|
||||
@@ -372,6 +372,31 @@ def get_base_url(is_secure):
|
||||
return _absolute_url(is_secure=is_secure, url_path="")
|
||||
|
||||
|
||||
def get_logo_url():
|
||||
"""
|
||||
Return the url for the branded logo image to be used
|
||||
"""
|
||||
|
||||
# if the MicrositeConfiguration has a value for the logo_image_url
|
||||
# let's use that
|
||||
image_url = microsite.get_value('logo_image_url')
|
||||
if image_url:
|
||||
return '{static_url}{image_url}'.format(
|
||||
static_url=settings.STATIC_URL,
|
||||
image_url=image_url
|
||||
)
|
||||
|
||||
# otherwise, use the legacy means to configure this
|
||||
university = microsite.get_value('university')
|
||||
|
||||
if university is None and settings.FEATURES.get('IS_EDX_DOMAIN', False):
|
||||
return staticfiles_storage.url('images/edx-theme/edx-logo-77x36.png')
|
||||
elif university:
|
||||
return staticfiles_storage.url('images/{uni}-on-edx-logo.png'.format(uni=university))
|
||||
else:
|
||||
return staticfiles_storage.url('images/logo.png')
|
||||
|
||||
|
||||
def get_tos_and_honor_code_url():
|
||||
"""
|
||||
Lookup and return terms of services page url
|
||||
|
||||
@@ -29,7 +29,7 @@ from certificates.models import (
|
||||
CertificateTemplateAsset,
|
||||
)
|
||||
from certificates.queue import XQueueCertInterface
|
||||
from branding import api as branding_api, get_logo_url
|
||||
from branding import api as branding_api
|
||||
|
||||
log = logging.getLogger("edx.certificate")
|
||||
|
||||
@@ -499,7 +499,7 @@ def get_certificate_header_context(is_secure=True):
|
||||
data returned should be customized according to the microsite settings
|
||||
"""
|
||||
data = dict(
|
||||
logo_src=get_logo_url(),
|
||||
logo_src=branding_api.get_logo_url(),
|
||||
logo_url=branding_api.get_base_url(is_secure),
|
||||
)
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@ from microsite_configuration import microsite
|
||||
from microsite_configuration.templatetags.microsite import platform_name
|
||||
|
||||
# App that handles subdomain specific branding
|
||||
import branding
|
||||
from branding import api as branding_api
|
||||
# app that handles site status messages
|
||||
from status.status import get_site_status_msg
|
||||
%>
|
||||
@@ -41,7 +41,7 @@ site_status_msg = get_site_status_msg(course_id)
|
||||
<h1 class="logo" itemscope="" itemtype="http://schema.org/Organization">
|
||||
<a href="${marketing_link('ROOT')}" itemprop="url">
|
||||
<%block name="navigation_logo">
|
||||
<img src="${static.url(branding.get_logo_url())}" alt="${_("{platform_name} Home Page").format(platform_name=platform_name())}" itemprop="logo" />
|
||||
<img src="${static.url(branding_api.get_logo_url())}" alt="${_("{platform_name} Home Page").format(platform_name=platform_name())}" itemprop="logo" />
|
||||
</%block>
|
||||
</a>
|
||||
</h1>
|
||||
|
||||
@@ -10,7 +10,7 @@ from microsite_configuration.templatetags.microsite import platform_name
|
||||
from lms.djangoapps.ccx.overrides import get_current_ccx
|
||||
|
||||
# App that handles subdomain specific branding
|
||||
import branding
|
||||
from branding import api as branding_api
|
||||
# app that handles site status messages
|
||||
from status.status import get_site_status_msg
|
||||
%>
|
||||
@@ -42,7 +42,7 @@ site_status_msg = get_site_status_msg(course_id)
|
||||
<h1 class="logo">
|
||||
<a href="${marketing_link('ROOT')}">
|
||||
<%block name="navigation_logo">
|
||||
<img src="${static.url(branding.get_logo_url())}" alt="${_("{platform_name} Home Page").format(platform_name=platform_name())}"/>
|
||||
<img src="${static.url(branding_api.get_logo_url())}" alt="${_("{platform_name} Home Page").format(platform_name=platform_name())}"/>
|
||||
</%block>
|
||||
</a>
|
||||
</h1>
|
||||
|
||||
Reference in New Issue
Block a user