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
08c9fd94
Commit
08c9fd94
authored
Jan 08, 2014
by
David Baumgold
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Do theme post-processing in startup hook
parent
eeb5f812
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
35 additions
and
36 deletions
+35
-36
lms/envs/aws.py
+0
-8
lms/envs/common.py
+0
-27
lms/startup.py
+34
-0
lms/templates/main.html
+1
-1
No files found.
lms/envs/aws.py
View file @
08c9fd94
...
...
@@ -188,14 +188,6 @@ BULK_EMAIL_ROUTING_KEY = HIGH_PRIORITY_QUEUE
# Theme overrides
THEME_NAME
=
ENV_TOKENS
.
get
(
'THEME_NAME'
,
None
)
# Workaround for setting THEME_NAME to an empty
# string which is the default due to this ansible
# bug: https://github.com/ansible/ansible/issues/4812
if
THEME_NAME
==
""
:
THEME_NAME
=
None
if
not
THEME_NAME
is
None
:
enable_theme
(
THEME_NAME
)
FAVICON_PATH
=
'themes/
%
s/images/favicon.ico'
%
THEME_NAME
# Marketing link overrides
MKTG_URL_LINK_MAP
.
update
(
ENV_TOKENS
.
get
(
'MKTG_URL_LINK_MAP'
,
{}))
...
...
lms/envs/common.py
View file @
08c9fd94
...
...
@@ -1038,33 +1038,6 @@ MKTG_URL_LINK_MAP = {
}
############################### THEME ################################
def
enable_theme
(
theme_name
):
"""
Enable the settings for a custom theme, whose files should be stored
in ENV_ROOT/themes/THEME_NAME (e.g., edx_all/themes/stanford).
The THEME_NAME setting should be configured separately since it can't
be set here (this function closes too early). An idiom for doing this
is:
THEME_NAME = "stanford"
enable_theme(THEME_NAME)
"""
FEATURES
[
'USE_CUSTOM_THEME'
]
=
True
# Calculate the location of the theme's files
theme_root
=
ENV_ROOT
/
"themes"
/
theme_name
# Include the theme's templates in the template search paths
TEMPLATE_DIRS
.
append
(
theme_root
/
'templates'
)
MAKO_TEMPLATES
[
'main'
]
.
append
(
theme_root
/
'templates'
)
# Namespace the theme's static files to 'themes/<theme_name>' to
# avoid collisions with default edX static files
STATICFILES_DIRS
.
append
((
u'themes/
%
s'
%
theme_name
,
theme_root
/
'static'
))
################# Student Verification #################
VERIFY_STUDENT
=
{
"DAYS_GOOD_FOR"
:
365
,
# How many days is a verficiation good for?
...
...
lms/startup.py
View file @
08c9fd94
...
...
@@ -22,3 +22,37 @@ def run():
if
settings
.
INIT_MODULESTORE_ON_STARTUP
:
for
store_name
in
settings
.
MODULESTORE
:
modulestore
(
store_name
)
if
settings
.
FEATURES
.
get
(
'USE_CUSTOM_THEME'
,
False
):
enable_theme
()
def
enable_theme
():
"""
Enable the settings for a custom theme, whose files should be stored
in ENV_ROOT/themes/THEME_NAME (e.g., edx_all/themes/stanford).
"""
# Workaround for setting THEME_NAME to an empty
# string which is the default due to this ansible
# bug: https://github.com/ansible/ansible/issues/4812
if
settings
.
THEME_NAME
==
""
:
settings
.
THEME_NAME
=
None
return
assert
settings
.
FEATURES
[
'USE_CUSTOM_THEME'
]
settings
.
FAVICON_PATH
=
'themes/{name}/images/favicon.ico'
.
format
(
name
=
settings
.
THEME_NAME
)
# Calculate the location of the theme's files
theme_root
=
settings
.
ENV_ROOT
/
"themes"
/
settings
.
THEME_NAME
# Include the theme's templates in the template search paths
settings
.
TEMPLATE_DIRS
.
append
(
theme_root
/
'templates'
)
settings
.
MAKO_TEMPLATES
[
'main'
]
.
append
(
theme_root
/
'templates'
)
# Namespace the theme's static files to 'themes/<theme_name>' to
# avoid collisions with default edX static files
settings
.
STATICFILES_DIRS
.
append
(
(
u'themes/{}'
.
format
(
settings
.
THEME_NAME
),
theme_root
/
'static'
)
)
lms/templates/main.html
View file @
08c9fd94
...
...
@@ -8,7 +8,7 @@
## templates have access to these functions, and we can import these
## into non-inheriting templates via the %namespace tag.
<
%
def
name=
"theme_enabled()"
>
<
%
return
settings
.
FEATURES
["
USE_CUSTOM_THEME
"]
%
>
<
%
return
settings
.
FEATURES
.
get
("
USE_CUSTOM_THEME
",
False
)
%
>
</
%
def>
<
%
def
name=
"stanford_theme_enabled()"
>
...
...
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