{"id":20156208,"url":"https://github.com/openfun/edx-theme","last_synced_at":"2025-03-03T01:45:06.382Z","repository":{"id":16088285,"uuid":"18832995","full_name":"openfun/edx-theme","owner":"openfun","description":"FUN theme","archived":false,"fork":false,"pushed_at":"2015-09-09T07:43:50.000Z","size":12490,"stargazers_count":10,"open_issues_count":0,"forks_count":13,"subscribers_count":20,"default_branch":"dev","last_synced_at":"2025-01-13T12:48:45.134Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"france-universite-numerique-mooc.fr","language":"HTML","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/openfun.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2014-04-16T08:47:15.000Z","updated_at":"2024-06-25T03:58:48.000Z","dependencies_parsed_at":"2022-08-31T15:21:26.264Z","dependency_job_id":null,"html_url":"https://github.com/openfun/edx-theme","commit_stats":null,"previous_names":[],"tags_count":25,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/openfun%2Fedx-theme","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/openfun%2Fedx-theme/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/openfun%2Fedx-theme/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/openfun%2Fedx-theme/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/openfun","download_url":"https://codeload.github.com/openfun/edx-theme/tar.gz/refs/heads/dev","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241596242,"owners_count":19988041,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-13T23:37:58.831Z","updated_at":"2025-03-03T01:45:06.358Z","avatar_url":"https://github.com/openfun.png","language":"HTML","readme":"Overview (v1.1)\n===============\nThis directory stores FUN's theming files for its edX instance.\nIt is based on the Stanford theme. We're storing the stuff here \nand then pulling it in to our instance when we deploy.\n\nInstallation\n============\n\nInstallation with ansible\n-------------------------\n\nlms/envs/common.py  also contains the variable 'USE_CUSTOM_THEME' and the function enable_theme, see its docstring\nrakelib/assets.rake contains THEME_NAME = ENV_TOKENS['THEME_NAME']\nOne can add \"THEME_NAME\":\"stanford\" to env.json, still does not seem to make a difference\n\n\nFirst, you need to surcharge the theme-related variables from \n`playbooks/roles/edxapp/vars/main.yml`:\n\n```\nedxapp_theme_name: 'fun'\nedxapp_theme_source_repo: 'https://github.com/FUNMOOC/edx-theme.git'\nedxapp_theme_version: 'mooclab/funisation'\n```\n\nAlso, unless this was changed since the last time I installed a theme, you also need to\nset the `THEME_NAME` like this, still in your ansible playbooks (the files\n`/opt/wwc/*.json` are handled by ansible, so you shouldn't alter them directly):\n\n```\ngeneric_env_config: \u0026edxapp_generic_env\n    ...\n    'THEME_NAME': 'fun'\n    'MKTG_URL_LINK_MAP':\n      \"ABOUT\": \"about\"\n      \"HELP\": \"help\"\n      \"HONOR\": \"honor\"\n      \"HOW-IT-WORKS\": \"how-it-works\"\n      \"TOS\": \"tos\"\n      \"FAQ\": null\n      \"PRIVACY\": null,\n      \"CONTACT\": null\n```\n\nThis will make ansible add the `THEME_NAME` variable  to the env tokens in `/opt/wwc/lms*.env.json`\n(there can be several variants of the LMS service on a single host, and thus different\nfiles).\n\nThis will also ensure that the new 'FAQ' page doesn't add a view requirement which isn't\nhandled by the theme (to remove once this is fixed upstream).\n\nWhen playing the playbook with these variables, the theme repository is fetched and \nthe configuration variables get the code from `edx-platform` to load the\ntemplates and static files from the theme directory.\n\nNote: this explanation is adapted from \nhttps://github.com/pdehaye/antoviaque-questions/blob/master/theming.utf8\n\n\nManual installation\n-------------------\n\nFirst, go one level up from the directory containing `edx-platform` on your installation (on \nproduction instances, it's usually `/opt/wwc` with `edx-platform` located at `/opt/wwc/edx-platform`).\n\n```\n$ cd /opt/wwc\n```\n\nCreate a directory for themes and get the theme source repository in a folder nammed `fun`:\n\n```\n$ mkdir /opt/wwc/themes\n$ cd themes\n$ git clone git@github.com:FUNMOOC/edx-theme.git fun\n```\n\nThen change to the branch you would like to use:\n\n```\n$ cd /opt/wwc/themes/fun\n$ git checkout xxxx\n```\n\nProbably the most obnoxious part of themes is that both Django and Rake need to know:\n\n* whether or not a theme is enabled\n* what the theme's name is (since that tells them where to look for templates, static files, etc.)\n\nAs is done in production environments, we use a JSON file located in the ENV_ROOT (the parent dir \nof your repo dir) to set the theme settings. The JSON file in dev environments is simply called \nenv.json; in production, it's named slightly differently. If you want to turn a theme on, then \nyou must have this file (or Rake won't invoke Mako and set up Sass properly), and if you want to \ndisable the theme, then you either cannot have this file (or else Rake will invoke Mako and set \nup Sass to load the theme's Sass).\n \nHere are the env.json with the proper values to enable the `fun` theme:\n\n```\n{\n  \"PLATFORM_NAME\": \"FUN\",\n  \"SITE_NAME\": \"france-universite-numerique-mooc.fr\",\n  \"DEFAULT_FROM_EMAIL\": \"inscription@france-universite-numerique-mooc.fr\",\n  \"DEFAULT_FEEDBACK_EMAIL\": \"feedback@france-universite-numerique-mooc.fr\",\n  \"DEFAULT_BULK_FROM_EMAIL\": \"cours@france-universite-numerique-mooc.fr\",\n  \"SERVER_EMAIL\": \"dev@france-universite-numerique-mooc.fr\",\n  \"TECH_SUPPORT_EMAIL\": \"helpdesk@france-universite-numerique-mooc.fr\",\n  \"CONTACT_EMAIL\": \"contact@france-universite-numerique-mooc.fr\",\n  \"BUGS_EMAIL\": \"bugs@france-universite-numerique-mooc.fr\",\n  \"PAYMENT_SUPPORT_EMAIL\": \"paiements@france-universite-numerique-mooc.fr\",\n  \"ADMINS\": [\"dev@france-universite-numerique-mooc.fr\"],\n  \"THEME_NAME\": \"fun\",\n  \"MKTG_URL_LINK_MAP\": {\n    \"ABOUT\": \"about\",\n    \"HELP\": \"help\",\n    \"HONOR\": \"honor\",\n    \"HOW-IT-WORKS\": \"how-it-works\",\n    \"TOS\": \"tos\",\n    \"FAQ\": null,\n    \"PRIVACY\": null,\n    \"CONTACT\": null\n  }\n}\n```\n\nThe THEME_NAME setting is the important one, as it's the themes/\u003ctheme-name\u003e directory that Rake \nlooks for when compiling assets (Django will also reference it too). The others are standard \noverrides that you could just as well specify in your custom lms/envs/\u003csettings\u003e.py file. All of \nthe other settings, however, with the exception of SITE_NAME, are new in this PR.\n\nThen you need to use Django settings similar to what is in lms/envs/aws.py for loading `ENV_TOKENS`:\n\n```\nwith open(ENV_ROOT / \"env.json\") as env_file:\n    ENV_TOKENS = json.load(env_file)\n\nPLATFORM_NAME = ENV_TOKENS['PLATFORM_NAME']\nSITE_NAME = ENV_TOKENS['SITE_NAME']\n\n#Theme overrides\nTHEME_NAME = ENV_TOKENS.get('THEME_NAME', None)\nif not THEME_NAME is None:\n    enable_theme(THEME_NAME)\n    FAVICON_PATH = 'themes/%s/images/favicon.ico' % THEME_NAME\n\nDEFAULT_FROM_EMAIL = ENV_TOKENS.get('DEFAULT_FROM_EMAIL', DEFAULT_FROM_EMAIL)\nDEFAULT_FEEDBACK_EMAIL = ENV_TOKENS.get('DEFAULT_FEEDBACK_EMAIL', DEFAULT_FEEDBACK_EMAIL)\nDEFAULT_BULK_FROM_EMAIL = ENV_TOKENS.get('DEFAULT_BULK_FROM_EMAIL', DEFAULT_BULK_FROM_EMAIL)\nSERVER_EMAIL = ENV_TOKENS.get('SERVER_EMAIL', SERVER_EMAIL)\nTECH_SUPPORT_EMAIL = ENV_TOKENS.get('TECH_SUPPORT_EMAIL', TECH_SUPPORT_EMAIL)\nCONTACT_EMAIL = ENV_TOKENS.get('CONTACT_EMAIL', CONTACT_EMAIL)\nBUGS_EMAIL = ENV_TOKENS.get('BUGS_EMAIL', BUGS_EMAIL)\nPAYMENT_SUPPORT_EMAIL = ENV_TOKENS.get('PAYMENT_SUPPORT_EMAIL', PAYMENT_SUPPORT_EMAIL)\nADMINS = ENV_TOKENS.get('ADMINS', ADMINS)\nMANAGERS = ADMINS\n\n# Marketing link overrides\nfor key, value in ENV_TOKENS.get('MKTG_URL_LINK_MAP', {}).items():\n    MKTG_URL_LINK_MAP[key] = value\n```\n\nNote: A portion of these instructions come from\nhttps://github.com/edx/edx-platform/pull/57 which gives more \ndetails about the internals of themes activation, if needed.\n\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fopenfun%2Fedx-theme","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fopenfun%2Fedx-theme","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fopenfun%2Fedx-theme/lists"}