feat: DSAPP-106 CMS Plugin for User Guide Link#1653
Open
wesleyboar wants to merge 18 commits intomainfrom
Open
feat: DSAPP-106 CMS Plugin for User Guide Link#1653wesleyboar wants to merge 18 commits intomainfrom
wesleyboar wants to merge 18 commits intomainfrom
Conversation
…github.com:DesignSafe-CI/portal into feat/DSAPP-106-cms-page-user_guide_link-from-model
rstijerina
reviewed
Feb 2, 2026
| def get_entry_instance(url): | ||
| """Helper function to get an AppListingEntry instance based on URL.""" | ||
|
|
||
| app_listing_entries = AppListingEntry.objects.filter(enabled=True) |
Member
There was a problem hiding this comment.
Are you able to find by the href here, i.e. AppListingEntry.objects.get(href=url)?
Collaborator
Author
There was a problem hiding this comment.
I think not reliably.
Using exact match would require:
- data entry be exact (include trailing slash)
- user be on page with URL that does not have hash nor query params
Details
The url passed is context.get("request").path, which can include:
- trailing slashes (e.g.
/use-designsafe/…/adcirc/) - query parameters (e.g.
?tab=overview,?edit,?toolbar_off) - hash (e.g.
#specific-element)
Member
There was a problem hiding this comment.
Could you parse the url to conform to just the path?
Collaborator
Author
There was a problem hiding this comment.
Yes, like this?
from urllib.parse import __
path = ... # logic via `urllib` taht gets path from url
app_listing_entries = AppListingEntry.objects.get(href=path)And —
help_texts = {
"href": (
"Use absolute path. Include trailing slash."
),
}— yeah?
Collaborator
Author
There was a problem hiding this comment.
Okay.
@wesleyboar, prevent false positives e.g. what/ considered a match of whatever/, i/am/good/ considered a match of i/am/good--test/ — solution.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Overview
Add plugin to render User Guide link on CMS app overview page.
Status
Warning
Related
Changes
Testing & UI
Create/Find an App Listing Entry with an
hrefvalue.E.g. Ground-Motion Portal app. Scroll to "CMS Display Options:".
Create/Open page at a path that matches one of an App Listing Entry.
E.g.
/use-designsafe/tools-applications/hazard-apps/ground-motion-portal/.On page, add "User Guide Link" plugin; do not choose app.
Verify link is rendered that opens page at correct path for User Guide.
E.g.
/user-guide/tools/hazard/#scec.3-4.mov
✅ Link opens correct page. Video did not capture it.
Change page path to one that does not match an app.
Verify:
5-6.mov
✅ App can not be guessed at wrong path, so no button.
Change "User Guide Link" plugin; choose app.
Verify button URL is for the app chosen.
7-8.mov
✅ Link opens correct page. Video did not capture it.
Notes
The new function
get_instance_from_urlcould be used by existing plugins,RelatedAppsandAppVariants, so that their models,AppVariantsPluginandRelatedAppsPlugin, need not be used.