aulasneo / tutor-contrib-branding

GNU Affero General Public License v3.0
7 stars 6 forks source link

Customizing Header #1

Closed FatemeKhodayari closed 1 year ago

FatemeKhodayari commented 1 year ago

Hi. I need to customize the header but I'm a little lost on how to do it. In the templates/theme/lms/templates/index.html file you have included some files like main.html and index_overlay.html which I couldn't find anywhere in the repository or the installed theme. Would you please guide me on this matter?

angonz commented 1 year ago

Hi Fateme, If you want to customize the header of the pages that are still in HTML (e.g., the dashboard, catalog or course about), you will have to do the traditional comprehensive theming by editing the templates in env/build/openedx/themes/<theme name>/. This plugin will not help much with this currently.

To customize the MFE headers, you will have to fork the frontend-component-header repo, make your customizations and declare your fork using this plugin's BRANDING_FRONTEND_COMPONENT_HEADER_REPO settings.

Please note that customizing MFEs is a complex endeavor. We have a lot of experience with this. Contact me at andres@aulasneo.com if you need support with this.

FatemeKhodayari commented 1 year ago

Thanks for the explanation. Actually we had changed the header in the learning MFE, but not in the described way. I'll give this a try. Sounds to be a better way!

About the traditional pages, I'm using your theme that is generated with the branding package (v0.5.3). But I have no idea where you are getting the current header from. I can't find it anywhere. Is it the one in edx-platform/lms/templates/header/? If so, do we have any way of changing it from outside? I don't know, something like putting the file in a specific path causing it to replace the original file, etc?

I tried adding my HTML header to env/build/openedx/themes/theme/lms/templates/static_templates/ and then including it in env/build/openedx/themes/theme/lms/templates/index.html. But after running tutor images build openedx all changes were overwritten by the default code and no new header was visible.

angonz commented 1 year ago

I tried adding my HTML header to env/build/openedx/themes/theme/lms/templates/static_templates/ and then including it in env/build/openedx/themes/theme/lms/templates/index.html. But after running tutor images build openedx all changes were overwritten by the default code and no new header was visible.

Exactly. Just don't do tutor config save so the env files don't get overriden.

Another option is to fork this repo and add new templates in tutorbranding/theme/lms/templates. Just follow the structure in https://github.com/openedx/edx-platform/tree/master/lms/templates

FatemeKhodayari commented 1 year ago

I didn't run tutor config save, just applied the changes and then tutor images build openedx but everything got overwritten and nothing changed.

Then I tried adding my header to env/build/openedx/themes/theme/lms/templates/header/ with the filename being header.html and this time the header changed even without forking this repo. Thanks a lot for the help!

angonz commented 1 year ago

Then I tried adding my header to env/build/openedx/themes/theme/lms/templates/header/ with the filename being header.html and this time the header changed even without forking this repo. Thanks a lot for the help!

Great. Just remember that tutor config save may change files inside env. Actually, you should be able to delete complete env and recreate it with tutor config save. If you are putting things inside env that don't come from tutor config save, make sure to keep a copy in a safe place.