apluslms / a-plus

A+ frontend portal - A+ LMS documentation:
https://apluslms.github.io/
Other
68 stars 73 forks source link

Change html_url to use display_url in API #1218

Closed etanttila closed 1 year ago

etanttila commented 1 year ago

Description

What?

In the API, change the html_url to use the display_url rather than the absolute_url of an object.

Also, slightly clarify and simplify code by using local function build_aplus_api rather than building the url using the request object.

Why?

Exercises are often embedded in chapters, and if that is the case, it's more convenient for the html_url to direct the user to the display_url, which links to the chapter if the exercise is embedded.

How?

Change HtmlViewField to use display_url rather than absolute_url.

Fixes Jutut issue #29

Fixes #1217

Testing

Remember to add or update unit tests for new features and changes.

What type of test did you run?

Tested locally that the field gets the correct value in the API. Also tested locally that Jutut works correctly (possible to respond to feedback, etc.) and that the link does in fact direct the chapter when the feedback questionnaire is embedded.

Did you test the changes in

Think of what is affected by these changes and could become broken

Translation

Programming style

Have you updated the README or other relevant documentation?

Is it Done?

Clean up your git commit history before submitting the pull request!