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

Sidebar bookmarks, closes #1175 #1176

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

jorge-leon
Copy link

This PR adds a configuration setting:

 HELPDESK_BOOKMARKS

When set to a list of 'bookmarks', an additional section is shown on the sidebar menu, rendering the bookmarks.

There are two types of bookmarks:

  • internal: given as names to resolve by the reverse() method of the URL dispatcher
  • external: given as URLs.

They are rendered differently so the user can distinguish if she will stay in the Django project or leave to another site.

A bookmark is specified in the following way:

  • internal: { 'name': internal_name, 'label': label }`
  • external: { 'URL': external_url, 'label': label }`

The label is the link text. It is optional, if not given the name or URL is used instead.

Georg Lehner and others added 2 commits April 27, 2024 12:20
A new setting HELPDESK_BOOKMARKS is added. Defaults to an empty list.

If it is set to to a list of dictionaries each list item is rendered
as either external or internal link in a separate section on the bottom
of the sidebar menu.

Bookmarks are specified as one of
- { 'URL': external_url, 'label': label } .. external link
- { 'name': internal_name, 'label': label } .. internal name, resolved with reverse()

If the 'label' is omitted, the URL or name is used as label.
@timthelion
Copy link
Collaborator

I personally would prefer to add sections to the django template if needed so that you can simply over-ride and reimport the the template than to have a new setting for this.

@jorge-leon
Copy link
Author

I personally would prefer to add sections to the django template if needed so that you can simply over-ride and reimport the the template than to have a new setting for this.

Can you elaborate on this. I'll consider doing the respective changes when I know how to do it. Maybe there is an example you can point me to.

@Benbb96
Copy link
Member

Benbb96 commented May 5, 2024

Yes I think documentation could be better explained on this page, maybe with an example like overriding the sidebar.

Following Django documentation, we could add custom blocks in django-helpdesk templates in order to avoid too much copy-pasting when overriding a file.

@timthelion
Copy link
Collaborator

@jorge-leon

To do this you would rename https://github.com/django-helpdesk/django-helpdesk/blob/main/helpdesk/templates/helpdesk/navigation-sidebar.html to navigation-sidebar-base.html you can then add blocks like so

{% block helpdesk_js %}{% endblock %}
where you want to insert things into the sidebar.

Then you would add a new navigation-sidebar.html file which uses an extends line like this https://github.com/django-helpdesk/django-helpdesk/tree/main/helpdesk/templates/helpdesk

Then you would create a PR to this repo.

After that, you can add a template file to the appropriate directory to override navigation-sidebar.html. Here is an example path for where you would place a file to over-ride a template:

- ./custom_navigation_header.html:/opt/django-helpdesk/helpdesk/templates/helpdesk/custom_navigation_header.html:r

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants