Update underscore template in comprehensive theming

Hi, I want to update the static/discussion/templates/search.underscore file in my theme, is that possible? Just copying and editing this file seems to make no difference in tutor development mode, any way to work around this? Any suggestion would be appreciated, thanks!

2 Likes

Hi @teruun

I am not sure that if you already tried this, you can put the same directory structure in your themes directory, that is themes/YOUR_THEME/static/discussion/templates/search.underscore.

I don’t have the experience to override this template but I had to override the static/templates/student_account/account_settings_section.underscore and I have done it as mentioned above.

1 Like

Thanks, I tried this and the search form totally disappeared, just the outer div is remaining. It should work if yours is working. I’ll try one more and make sure I didn’t do something wrong.

@teruun I forgot to mention one JS file, underscore files are called from js file so you have to override that js file put that js also in theme folder, i.e ‘text!’ + currentTheme + templates/student_account/account_settings.underscore’

Sorry, I can’t see what’s the difference between the js file and the template file from your answer. So can’t really working it out.
Or, if that possible, would you help me have a try to update the search.underscore and the js file to see if it work in your environment? I just want to add an outer

element outside the element.

Thanks very much.

Okay…I will try it in my environment if it works then surely I will message you.

@teruun, updating an underscore file in the theme requires overriding the corresponding JavaScript files that use it to use the correct path to the underscore file in the theme and then recursively updating the JavaScript files that use it. Eventually, you will have to override the build.js file in your theme and that will require overriding the default build.js file used in REQUIRE_BUILD_PROFILE variable in lms/envs/settings.py. Then you can run the paver update_assets command to build your theme and then use it.

The REQUIRE_BUILD_PROFILE settings variable cannot be overridden from lms.env.json and there is an open PR for it. So you will have to make a local change and retain it.

4 Likes