Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
edx-platform
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
edx
edx-platform
Commits
5503285f
Commit
5503285f
authored
Jul 11, 2016
by
Saleem Latif
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix branding api get_logo_url return value
parent
0332ebea
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
31 additions
and
6 deletions
+31
-6
lms/djangoapps/branding/api.py
+6
-4
lms/djangoapps/branding/tests/test_api.py
+23
-0
lms/djangoapps/certificates/api.py
+1
-1
lms/templates/navigation.html
+1
-1
No files found.
lms/djangoapps/branding/api.py
View file @
5503285f
...
...
@@ -367,18 +367,20 @@ def get_base_url(is_secure):
return
_absolute_url
(
is_secure
=
is_secure
,
url_path
=
""
)
def
get_logo_url
():
def
get_logo_url
(
is_secure
=
True
):
"""
Return the url for the branded logo image to be used
Arguments:
is_secure (bool): If true, use HTTPS as the protocol.
"""
# 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
return
_absolute_url_staticfile
(
is_secure
=
is_secure
,
name
=
image_url
,
)
# otherwise, use the legacy means to configure this
...
...
lms/djangoapps/branding/tests/test_api.py
0 → 100644
View file @
5503285f
# encoding: utf-8
"""Tests of Branding API """
from
django.test
import
TestCase
import
mock
from
branding.api
import
get_logo_url
class
TestHeader
(
TestCase
):
"""Test API end-point for retrieving the header. """
def
test_cdn_urls_for_logo
(
self
):
# Ordinarily, we'd use `override_settings()` to override STATIC_URL,
# which is what the staticfiles storage backend is using to construct the URL.
# Unfortunately, other parts of the system are caching this value on module
# load, which can cause other tests to fail. To ensure that this change
# doesn't affect other tests, we patch the `url()` method directly instead.
cdn_url
=
"http://cdn.example.com/static/image.png"
with
mock
.
patch
(
'branding.api.staticfiles_storage.url'
,
return_value
=
cdn_url
):
logo_url
=
get_logo_url
()
self
.
assertEqual
(
logo_url
,
cdn_url
)
lms/djangoapps/certificates/api.py
View file @
5503285f
...
...
@@ -571,7 +571,7 @@ def get_certificate_header_context(is_secure=True):
data returned should be customized according to the microsite settings
"""
data
=
dict
(
logo_src
=
branding_api
.
get_logo_url
(),
logo_src
=
branding_api
.
get_logo_url
(
is_secure
),
logo_url
=
branding_api
.
get_base_url
(
is_secure
),
)
...
...
lms/templates/navigation.html
View file @
5503285f
...
...
@@ -53,7 +53,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_api.get_logo_url()
)}"
alt=
"${_("
{
platform_name
}
Home
Page
").
format
(
platform_name=
static.get_platform_name())}"/
>
<img
src=
"${
branding_api.get_logo_url(is_secure
)}"
alt=
"${_("
{
platform_name
}
Home
Page
").
format
(
platform_name=
static.get_platform_name())}"/
>
</
%
block>
</a>
</h1>
...
...
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