Skip to content
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

Add Ajax views for retrieving sidebar and user dropdown links #1366

Closed
4 tasks done
Tracked by #1389
mikkonie opened this issue Feb 20, 2024 · 1 comment · Fixed by #1420
Closed
4 tasks done
Tracked by #1389

Add Ajax views for retrieving sidebar and user dropdown links #1366

mikkonie opened this issue Feb 20, 2024 · 1 comment · Fixed by #1420
Assignees
Labels
app: projectroles Issue in the projectroles app feature Requested feature or enhancement
Milestone

Comments

@mikkonie
Copy link
Collaborator

mikkonie commented Feb 20, 2024

In Varfish there is a case where several new views are implemented as single page apps and they don't really work with the base SODAR Core template.

It was requested to add Ajax views to provide the content for the sidebar and the user dropdown, so they can be rendered as suits best by the SPA. This can also be useful in other cases in the future where we may have views or entire sites which forego the base server side template.

Naturally, we want to reuse existing server side context code and wrap it in Ajax views.

We'll need to return the following:

  • Link icon (as namespace:id, e.g. mdi:home)
  • Text legend
  • Link URL
  • Boolean for "active"

Spec

  • Do Refactor sidebar logic into reusable component #1380 and Refactor user dropdown logic into reusable component #1381
  • Add Ajax view SidebarContentAjaxView in projectroles
    • URL name = ajax_sidebar
    • project:uuid given in the URL (no reason to call this without a project context)
    • Implement logic in get()
    • Challenge: where to get the current server-side URL to determine the active state?
      • The request URL will, of course, be the URL to the Ajax view itself. So that doesn't help..
      • In my opinion we have two options:
        • Figure out how to get the current URL the browser is on from the client (either from the request somehow or by an explicit parameter provided by the client to the Ajax view call)
        • Or, skip active for the Ajax views altogether: add a parameter to leave it out from the AppLinkContent methods
      • Let me know when you reach this point and if you'll figure out a nice way to implement it
  • Add Ajax view UserDropdownContentAjaxView in projectroles
    • URL name = ajax_user_dropdown
    • No project context (irrelevant for user dropdown as we only show site/admin apps)
    • Use the AppLinkContent helper again
  • Add documentation via docstrings and sphinx
  • Add tests

Tasks

  • Add SidebarContentAjaxView
  • Add UserDropdownContentAjaxView
  • Document
  • Test
@mikkonie
Copy link
Collaborator Author

Done by @gromdimon and merged. It still needs to be documented, but I'll handle that in release cleanup.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
app: projectroles Issue in the projectroles app feature Requested feature or enhancement
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants