1
0
mirror of https://github.com/netbox-community/netbox.git synced 2024-05-10 07:54:54 +00:00

Closes #8248: User bookmarks (#13035)

* Initial work on #8248

* Add tests

* Fix tests

* Add feature query for bookmarks

* Add BookmarksWidget

* Correct generic relation name

* Add docs for bookmarks

* Remove inheritance from ChangeLoggedModel
This commit is contained in:
Jeremy Stretch
2023-06-29 14:36:11 -04:00
committed by GitHub
parent 1056e513b1
commit 6e222f8dce
30 changed files with 590 additions and 7 deletions

View File

@@ -0,0 +1,9 @@
{% if bookmarks %}
<div class="list-group list-group-flush">
{% for bookmark in bookmarks %}
<a href="{{ bookmark.object.get_absolute_url }}" class="list-group-item list-group-item-action">
{{ bookmark.object }}
</a>
{% endfor %}
</div>
{% endif %}

View File

@@ -59,6 +59,9 @@ Context:
{# Extra buttons #}
{% block extra_controls %}{% endblock %}
{% if perms.extras.add_bookmark %}
{% bookmark_button object %}
{% endif %}
{% if request.user|can_add:object %}
{% clone_button object %}
{% endif %}

View File

@@ -23,6 +23,11 @@
<i class="mdi mdi-account"></i> Profile
</a>
</li>
<li>
<a class="dropdown-item" href="{% url 'users:bookmarks' %}">
<i class="mdi mdi-bookmark"></i> Bookmarks
</a>
</li>
<li>
<a class="dropdown-item" href="{% url 'users:preferences' %}">
<i class="mdi mdi-wrench"></i> Preferences

View File

@@ -5,6 +5,9 @@
<li role="presentation" class="nav-item">
<a class="nav-link{% if active_tab == 'profile' %} active{% endif %}" href="{% url 'users:profile' %}">Profile</a>
</li>
<li role="presentation" class="nav-item">
<a class="nav-link{% if active_tab == 'bookmarks' %} active{% endif %}" href="{% url 'users:bookmarks' %}">Bookmarks</a>
</li>
<li role="presentation" class="nav-item">
<a class="nav-link{% if active_tab == 'preferences' %} active{% endif %}" href="{% url 'users:preferences' %}">Preferences</a>
</li>

View File

@@ -0,0 +1,34 @@
{% extends 'users/base.html' %}
{% load buttons %}
{% load helpers %}
{% load render_table from django_tables2 %}
{% block title %}Bookmarks{% endblock %}
{% block content %}
<form method="post" class="form form-horizontal">
{% csrf_token %}
<input type="hidden" name="return_url" value="{% url 'users:bookmarks' %}" />
{# Table #}
<div class="row">
<div class="col col-md-12">
<div class="card">
<div class="card-body htmx-container table-responsive" id="object_list">
{% include 'htmx/table.html' %}
</div>
</div>
</div>
</div>
{# Form buttons #}
<div class="noprint bulk-buttons">
<div class="bulk-button-group">
{% if 'bulk_delete' in actions %}
{% bulk_delete_button model query_params=request.GET %}
{% endif %}
</div>
</div>
</form>
{% endblock %}