Showing results for 
Show  only  | Search instead for 
Did you mean: 
Community Participant

How can I add "course code" to All Courses and Admin Courses via JS?

Greetings JavaScript Gurus!

I'm back with another request from your US Air Force....  We've received a request to display the contents of the course code column on the "All Courses" and "Admin/Courses" pages.  Global or theme level JS is preferred, but a user-script would work as well, since this is mostly for admin/designer/course director use.

See two images below.

291976_all courses.png

291980_admin courses.png

Any thoughts?



3 Replies
Community Champion

Hi Mike.

I'm curious to see if anyone else can make this work. Here are my thoughts without diving to far.

On the user's All Courses page, the course code doesn't seem available in the DOM. Using API calls to get all the enrollments for that page, a script could be written to replace or add columns to that page.

// current user enrollments, output to console
$.getJSON('/api/v1/users/self/enrollments', r => console.log(r))

On the Admin Course Search, I think this would require additional parameters in the DOM or a custom LTI all together. The Developer Tools/Network Tab shows me that course_code is in the XHR API response, but there's no way to access that data after it's returned and we didn't make that call.

However, there's a lot to be said for naming conventions and regular expressions. For instance, an SIS course generated in our custom integration has plenty of details for multiple purposes. Here's an example

English 11 - S1 -- P02 - LASTNAME, F | 10600AB1-1112 - FAL18

and it's course code 

English 11 - S1 - P02

But we also auto generate some other courses and enrollments, like Workrooms and school Conference rooms, which are courses for collaboration at each school or department, not grading. These are prefixed with WORKROOM and CONF, and can be matched programmatically with something like courseName.match(/^WORKROOM/i)

Using Regular Expressions, we do fancy things like break up the All Courses into table groups.

292031_Screen Shot 2018-09-26 at 7.34.17 AM.png

Obviously, if it's in the course name, you might not need a new column, but we're here to discuss. :smileygrin:

Community Participant


Thanks for the input.  You confirmed my suspicions from poking around. I'll listen quietly here for a bit, while I formulate a workaround that will make everybody here happy.

That's a very neat approach to the courses page. We've been considering creating "workroom" like courses, and that would really clean up the courses page.  I'm not up to speed on regular expressions, so I may come back to you if this idea gets any traction here.

Thanks again!