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
ad5a98e4
Commit
ad5a98e4
authored
Jul 07, 2015
by
Davorin Šego
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #8282 from Stanford-Online/giulio/default-course-about-images
Default "Course About" image
parents
796e4cb5
84f7aef9
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
12 additions
and
6 deletions
+12
-6
lms/djangoapps/courseware/courses.py
+3
-4
lms/djangoapps/courseware/tests/test_module_render.py
+5
-2
lms/envs/aws.py
+3
-0
lms/envs/common.py
+1
-0
lms/static/images/pencils.jpg
+0
-0
No files found.
lms/djangoapps/courseware/courses.py
View file @
ad5a98e4
...
@@ -126,10 +126,9 @@ def course_image_url(course):
...
@@ -126,10 +126,9 @@ def course_image_url(course):
url
+=
'/'
+
course
.
course_image
url
+=
'/'
+
course
.
course_image
else
:
else
:
url
+=
'/images/course_image.jpg'
url
+=
'/images/course_image.jpg'
elif
course
.
course_image
==
''
:
elif
not
course
.
course_image
:
# if course_image is empty the url will be blank as location
# if course_image is empty, use the default image url from settings
# of the course_image does not exist
url
=
settings
.
STATIC_URL
+
settings
.
DEFAULT_COURSE_ABOUT_IMAGE_URL
url
=
''
else
:
else
:
loc
=
StaticContent
.
compute_location
(
course
.
id
,
course
.
course_image
)
loc
=
StaticContent
.
compute_location
(
course
.
id
,
course
.
course_image
)
url
=
StaticContent
.
serialize_asset_key_with_slash
(
loc
)
url
=
StaticContent
.
serialize_asset_key_with_slash
(
loc
)
...
...
lms/djangoapps/courseware/tests/test_module_render.py
View file @
ad5a98e4
...
@@ -794,16 +794,19 @@ class TestHtmlModifiers(ModuleStoreTestCase):
...
@@ -794,16 +794,19 @@ class TestHtmlModifiers(ModuleStoreTestCase):
self
.
assertTrue
(
url
.
startswith
(
'/static/toy_course_dir/'
))
self
.
assertTrue
(
url
.
startswith
(
'/static/toy_course_dir/'
))
self
.
course
.
static_asset_path
=
""
self
.
course
.
static_asset_path
=
""
@override_settings
(
DEFAULT_COURSE_ABOUT_IMAGE_URL
=
'test.png'
)
@override_settings
(
STATIC_URL
=
'static/'
)
@ddt.data
(
ModuleStoreEnum
.
Type
.
mongo
,
ModuleStoreEnum
.
Type
.
split
)
@ddt.data
(
ModuleStoreEnum
.
Type
.
mongo
,
ModuleStoreEnum
.
Type
.
split
)
def
test_course_image_for_split_course
(
self
,
store
):
def
test_course_image_for_split_course
(
self
,
store
):
"""
"""
for split courses if course_image is empty then course_image_url will be blank
for split courses if course_image is empty then course_image_url will be
the default image url defined in settings
"""
"""
self
.
course
=
CourseFactory
.
create
(
default_store
=
store
)
self
.
course
=
CourseFactory
.
create
(
default_store
=
store
)
self
.
course
.
course_image
=
''
self
.
course
.
course_image
=
''
url
=
course_image_url
(
self
.
course
)
url
=
course_image_url
(
self
.
course
)
self
.
assertEqual
(
''
,
url
)
self
.
assertEqual
(
'
static/test.png
'
,
url
)
def
test_get_course_info_section
(
self
):
def
test_get_course_info_section
(
self
):
self
.
course
.
static_asset_path
=
"toy_course_dir"
self
.
course
.
static_asset_path
=
"toy_course_dir"
...
...
lms/envs/aws.py
View file @
ad5a98e4
...
@@ -131,6 +131,9 @@ if STATIC_URL_BASE:
...
@@ -131,6 +131,9 @@ if STATIC_URL_BASE:
if
not
STATIC_URL
.
endswith
(
"/"
):
if
not
STATIC_URL
.
endswith
(
"/"
):
STATIC_URL
+=
"/"
STATIC_URL
+=
"/"
# DEFAULT_COURSE_ABOUT_IMAGE_URL specifies the default image to show for courses that don't provide one
DEFAULT_COURSE_ABOUT_IMAGE_URL
=
ENV_TOKENS
.
get
(
'DEFAULT_COURSE_ABOUT_IMAGE_URL'
,
DEFAULT_COURSE_ABOUT_IMAGE_URL
)
# MEDIA_ROOT specifies the directory where user-uploaded files are stored.
# MEDIA_ROOT specifies the directory where user-uploaded files are stored.
MEDIA_ROOT
=
ENV_TOKENS
.
get
(
'MEDIA_ROOT'
,
MEDIA_ROOT
)
MEDIA_ROOT
=
ENV_TOKENS
.
get
(
'MEDIA_ROOT'
,
MEDIA_ROOT
)
MEDIA_URL
=
ENV_TOKENS
.
get
(
'MEDIA_URL'
,
MEDIA_URL
)
MEDIA_URL
=
ENV_TOKENS
.
get
(
'MEDIA_URL'
,
MEDIA_URL
)
...
...
lms/envs/common.py
View file @
ad5a98e4
...
@@ -843,6 +843,7 @@ STATICFILES_DIRS = [
...
@@ -843,6 +843,7 @@ STATICFILES_DIRS = [
]
]
FAVICON_PATH
=
'images/favicon.ico'
FAVICON_PATH
=
'images/favicon.ico'
DEFAULT_COURSE_ABOUT_IMAGE_URL
=
'images/pencils.jpg'
# User-uploaded content
# User-uploaded content
MEDIA_ROOT
=
'/edx/var/edxapp/media/'
MEDIA_ROOT
=
'/edx/var/edxapp/media/'
...
...
lms/static/images/pencils.jpg
0 → 100644
View file @
ad5a98e4
29.4 KB
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