Tell segment IO whenever a page is loaded. Once this works, we
can add more detailed instrumentation for events we care about.
Will be turned off in prod until the SEGMENT_IO_LMS feature flag is
set to True and a SEGMENT_IO_LMS_KEY is set.
Developers can have private settings files by creating
lms/envs/private.py or cms/envs/private.py. They are imported
at the end of dev.py. Note that they won't be imported if you
are using one of the other dev*.py variants.
Themes do not necessarily want all of the available LMS routes, such
as `/jobs` and `/university_profiles`. This change splits up the
`lms/urls.py` file and selectively enables/disables routes based on
whether or not a theme is enabled. This is a naive solution for now;
a better solution gives themes a way to selectively overrides such
routes.
Additionally, with the `MKTG_URL_LINK_MAP` setting that hits certain
routes immediately on each page render (whenever the `marketing_link`
helper function is called), themes may crash if they don't leave
all marketing link routes present in `lms/urls.py`. This change also
provides the ability to override the `MKTG_URL_LINK_MAP` in the
settings.
Finally, modify the mitxmako marketing URL middleware to not try to
reverse disabled URLs, which are those keys in the map whose values
are `None`.
Configure the technical support email address in the settings so that
themes can override with an email of their own in the appropriate
env.json file in production.
This setting is used to control the display name of the platform. The
default is "edX", but themes may wish to override. For example,
Stanford will use "Stanford Online" for the time being.
The `FAVICON_PATH` setting determines the location of the favicon for
the site. It's automatically adjusted when a theme is enabled,
establishing the convention that themes will place their favicon in
`static/images/favicon.ico`.
Rather than directly invoke command-line Python (and Mako) from the
assets Rakefile, or call an external Python script, use a Django
management command to preprocess all asset template files.
An "asset template file" is defined as a static asset file with a
file extension indicating that it needs to be run through a template
engine prior to Sass/CoffeeScript compilation or packaging with other
assets. The preprocess_assets management command will look through
all of the files listed in the `STATICFILES_DIRS`, preprocessing each
as needed. Preprocessing strips off the special template file
extension, creating a new file in the process.
Currently, the only variable accessible in an asset template file is
the `THEME_NAME`, defined in the settings.
This commit adds the requisite settings and startup features to
enable integration of themes into the edX platform. It does not
yet provide hooks in any of the templates, but it does cause the
main `lms/static/sass/application.scss` file to `@import` a theme's
base Sass. Template hooks will come down the road.
CHANGELOG
---------
Define a new `MITX_FEATURE`, `USE_CUSTOM_THEME`, that when enabled,
can be used in templates to determine whether or not custom theme
templates should be used instead of the defaults.
Also define a new setting, `THEME_NAME`, which will be used to
locate theme-specific files. Establish the convention that themes
will be stored outside of the `REPO_ROOT`, inside the `ENV_ROOT`,
in a directory named `themes/`. `themes/<THEME_NAME>` will store
the files for a particular theme.
Provide a function, `enable_theme`, that modifies the template and
static asset load paths appropriately to include the theme's files.
Move the main LMS Sass file to a Mako template that conditionally
`@import`s the theme's base Sass file when a theme is enabled.
Add logic to the assets Rakefile to properly preprocess any Sass/
Mako templates before compiling them.