-
Notifications
You must be signed in to change notification settings - Fork 220
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use slugs for attachments urls, add badge for direct writeup downloads #2144
Conversation
…rects upon update failure
WalkthroughWalkthroughThe update focuses on improving attachment management by introducing slug functionality for attachments based on their names, enhancing URL readability. Additionally, styling adjustments were made to the assessment date element for better visual presentation. Changes
Recent Review DetailsConfiguration used: CodeRabbit UI Files selected for processing (1)
Files skipped from review due to trivial changes (1)
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (invoked as PR comments)
Additionally, you can add CodeRabbit Configration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 2
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure if this is desired but when for existing attachments, the url does not include the attachment name, it only includes after I rename the attachment or upon creating a new attachment
Also, is there a way to shorten the url in the case of duplicates, "test778-cf1a1964-f358-4cff-8136-8c9791b40ec6" this seems a little too long. Would it make sense if we generated a random string usingSecureRandom and took the difference to get a shortened slug that is still unique. |
Modified the code to tiebreak by appending the attachment's id |
That was intended and IMO it's fine, attachments don't seem to be widely used yet, and this change is more to facilitate attachments in future courses. According to the documentation, you'd have to do something similar to |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Small nit: I think some padding top: maybe .date p { padding-top: 4px} would be even more perfect.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, everything works as expected (slugs look nice and clean gj!)
Description
Motivation and Context
Some classes might use assessments as "placeholders" to distribute course materials (via writeups), as compared to attachments, since assessments can be easily bulk imported and the URL is "static" (only need to change course name between semesters). This PR further facilitates that workflow by allowing students to quickly download an assessment writeup from a course landing page by clicking on a badge. This is also useful for students to view writeups of normal assessments quickly.
This PR also switches to slugged URLs for attachments, i.e. the URL is generated from the attachment name. This would be helpful down the road if a way were added to mass import attachments since attachments would become a viable replacement for assessments.
This PR also fixes a docs syntax highlighting issue introduced by #2131.
Resolves #2035
How Has This Been Tested?
Slugged Attachments
Writeup badges
Badge appears only for assessments with writeups. Clicking on the badge brings you to the writeup.
Docs highlighting
Run
mkdocs serve
locally and ensure that the bash commands on e.g. the docker compose installation page now render correctly.Before
After
Types of changes
Checklist:
overcommit --install && overcommit --sign
to use pre-commit hook for linting