4

I'm attempting to modify the following file, defaulted by the OpenEDX lms.

account_settings_factory_spec.js

account_settings_view.js

But upon rerunning paver, files aren't changing. Is it actually possible to override the JS in themes? My end goal is to remove the tabs in the account section as well as edit the additional infomation.

Any help towards reaching a solution would be appreciated!

Thanks.

Sasha
  • 1,674
  • 1
  • 16
  • 23

1 Answers1

7

Is it actually possible to override the JS in themes?

yes, tricky

copy & paste from original and edit/modified "account_settings_view.js" and "account_settings_factory.js" to your theme folder

/edx/app/edxapp/themes/my_theme/lms/static/js/student_account/views/account_settings_view.js /edx/app/edxapp/themes/my_theme/lms/static/js/student_account/views/account_settings_factory.js

and copy(from original) & paste "account_settings.html" to your theme folder

/edx/app/edxapp/themes/my_theme/lms/templates/student_account/account_settings.html

and find this line and edit, this path should be your theme JS path. Check how your custom CSS or JS linked in the header(see image below, "payne" is my theme name).

<%static:require_module module_name="YOUR_THEME/js/student_account/views/account_settings_factory" class_name="AccountSettingsFactory">

enter image description here

I just changed here you can see below. Just added "xxxx" Here I used Docker devstack. enter image description here

Isanka Wijerathne
  • 3,746
  • 3
  • 26
  • 34
  • Ah, I'm using vagrant, not sure if there'd be a difference because of which method though. Which commands are you running to build? – Sasha Oct 31 '18 at 13:40
  • No, it should not be. same command, paver update_assets --settings=devstack_docker – Isanka Wijerathne Oct 31 '18 at 15:47
  • I've tried this, still the same issue. What's your theme pathing like? I've tried to copy the edx platform tree but perhaps i've misunderstood – Sasha Oct 31 '18 at 16:14
  • here you are trying to edit core files(account_settings_view.js). Not external theme. usually, we use a separate folder for themes. like "/edx/app/edxapp/themes" If there is anyway to see your codes let me know. will try to help – Isanka Wijerathne Oct 31 '18 at 17:10
  • I've got the theme working, the CSS and everything else works, but not the JS. the location of my file is: `/edx/app/edxapp/themes/my_theme/lms/static/js/student_account/views/account_settings_view.js` – Sasha Oct 31 '18 at 17:18
  • Hi, sorry I should have mentioned a few more thing. I have modified the answer and please check that. and not sure this is the best way to do this. – Isanka Wijerathne Nov 01 '18 at 02:37
  • 1
    Following your guide i've managed to get it working! Thanks so much! – Sasha Nov 01 '18 at 08:57
  • Is it possible to override underscore file also? – Dhruvil Amin Apr 22 '19 at 07:07