mirror of
https://github.com/ArchiveBox/ArchiveBox
synced 2024-11-22 12:13:05 +00:00
remove django-url-tools in favor of core_tags snippet
This commit is contained in:
parent
3f1a19dd35
commit
89a066da0b
3 changed files with 21 additions and 16 deletions
|
@ -99,7 +99,6 @@ INSTALLED_APPS = [
|
||||||
'django_jsonform', # handles rendering Pydantic models to Django HTML widgets/forms https://github.com/bhch/django-jsonform
|
'django_jsonform', # handles rendering Pydantic models to Django HTML widgets/forms https://github.com/bhch/django-jsonform
|
||||||
'signal_webhooks', # handles REST API outbound webhooks https://github.com/MrThearMan/django-signal-webhooks
|
'signal_webhooks', # handles REST API outbound webhooks https://github.com/MrThearMan/django-signal-webhooks
|
||||||
'django_object_actions', # provides easy Django Admin action buttons on change views https://github.com/crccheck/django-object-actions
|
'django_object_actions', # provides easy Django Admin action buttons on change views https://github.com/crccheck/django-object-actions
|
||||||
'url_tools', # adds template tags to append/toggle URL parameters https://bitbucket.org/monwara/django-url-tools
|
|
||||||
|
|
||||||
# Our ArchiveBox-provided apps
|
# Our ArchiveBox-provided apps
|
||||||
#'config', # ArchiveBox config settings (loaded as a plugin, don't need to add it here)
|
#'config', # ArchiveBox config settings (loaded as a plugin, don't need to add it here)
|
||||||
|
@ -204,7 +203,6 @@ TEMPLATES = [
|
||||||
'django.template.context_processors.request',
|
'django.template.context_processors.request',
|
||||||
'django.contrib.auth.context_processors.auth',
|
'django.contrib.auth.context_processors.auth',
|
||||||
'django.contrib.messages.context_processors.messages',
|
'django.contrib.messages.context_processors.messages',
|
||||||
'url_tools.context_processors.current_url',
|
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
|
@ -38,3 +38,9 @@ def result_list_tag(parser, token):
|
||||||
template_name='snapshots_grid.html',
|
template_name='snapshots_grid.html',
|
||||||
takes_context=False,
|
takes_context=False,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@register.simple_tag(takes_context=True)
|
||||||
|
def url_replace(context, **kwargs):
|
||||||
|
dict_ = context['request'].GET.copy()
|
||||||
|
dict_.update(**kwargs)
|
||||||
|
return dict_.urlencode()
|
||||||
|
|
|
@ -1,26 +1,27 @@
|
||||||
{% extends "base.html" %}
|
{% extends "base.html" %}
|
||||||
{% load static tz %}
|
{% load static tz %}
|
||||||
|
{% load core_tags %}
|
||||||
|
|
||||||
{% block body %}
|
{% block body %}
|
||||||
<div id="toolbar">
|
<div id="toolbar">
|
||||||
<form id="changelist-search" action="{% url 'public-index' %}" method="get">
|
<form id="changelist-search" action="{{ request.get_full_path }}" method="get">
|
||||||
<div>
|
<div>
|
||||||
<label for="searchbar"><img src="/static/admin/img/search.svg" alt="Search"></label>
|
<label for="searchbar"><img src="/static/admin/img/search.svg" alt="Search"></label>
|
||||||
<select name="query_type" id="query_type">
|
<select name="query_type" id="query_type">
|
||||||
<option value="all" selected>All</option>
|
<option {% if request.GET.query_type == 'all' %}selected{% endif %} value="all">All</option>
|
||||||
<option value="fulltext">Content</option>
|
<option {% if request.GET.query_type == 'fulltext' %}selected{% endif %} value="fulltext">Content</option>
|
||||||
<option value="meta">Metadata</option>
|
<option {% if request.GET.query_type == 'meta' %}selected{% endif %} value="meta">Metadata</option>
|
||||||
<option value="url">URL</option>
|
<option {% if request.GET.query_type == 'url' %}selected{% endif %} value="url">URL</option>
|
||||||
<option value="title">Title</option>
|
<option {% if request.GET.query_type == 'title' %}selected{% endif %} value="title">Title</option>
|
||||||
<option value="timestamp">Timestamp</option>
|
<option {% if request.GET.query_type == 'timestamp' %}selected{% endif %} value="timestamp">Timestamp</option>
|
||||||
<option value="tags">Tags</option>
|
<option {% if request.GET.query_type == 'tags' %}selected{% endif %} value="tags">Tags</option>
|
||||||
</select>
|
</select>
|
||||||
<input type="text" size="40" name="q" value="" id="searchbar" autofocus placeholder="Title, URL, tags, timestamp, or content...".>
|
<input type="text" size="40" name="q" value="{{ request.GET.q }}" id="searchbar" autofocus placeholder="Title, URL, tags, timestamp, or content...".>
|
||||||
<input type="submit" value="Search" style="height: 36px; padding-top: 6px; margin: 8px"/>
|
<input type="submit" value="Search" style="height: 36px; padding-top: 6px; margin: 8px"/>
|
||||||
<input type="button"
|
<input type="button"
|
||||||
value="♺"
|
value="♺"
|
||||||
title="Refresh..."
|
title="Refresh..."
|
||||||
onclick="location.href='{% url 'public-index' %}'"
|
onclick="location.href='{{ request.get_full_path }}'"
|
||||||
style="background-color: rgba(121, 174, 200, 0.8); height: 30px; font-size: 0.8em; margin-top: 12px; padding-top: 6px; float:right">
|
style="background-color: rgba(121, 174, 200, 0.8); height: 30px; font-size: 0.8em; margin-top: 12px; padding-top: 6px; float:right">
|
||||||
</input>
|
</input>
|
||||||
|
|
||||||
|
@ -54,8 +55,8 @@
|
||||||
<br/>
|
<br/>
|
||||||
<span class="step-links">
|
<span class="step-links">
|
||||||
{% if page_obj.has_previous %}
|
{% if page_obj.has_previous %}
|
||||||
<a href="{% add_params request.get_full_path page='1' %}">« first</a>
|
<a href="?{% url_replace page='1' %}">« first</a>
|
||||||
<a href="{% add_params request.get_full_path page=page_obj.previous_page_number %}">previous</a>
|
<a href="?{% url_replace page=page_obj.previous_page_number %}">previous</a>
|
||||||
|
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
|
@ -65,8 +66,8 @@
|
||||||
|
|
||||||
{% if page_obj.has_next %}
|
{% if page_obj.has_next %}
|
||||||
|
|
||||||
<a href="{% add_params request.get_full_path page=page_obj.next_page_number %}">next </a>
|
<a href="?{% url_replace page=page_obj.next_page_number %}">next </a>
|
||||||
<a href="{% add_params request.get_full_path page=page_obj.paginator.num_pages %}">last »</a>
|
<a href="?{% url_replace page=page_obj.paginator.num_pages %}">last »</a>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</span>
|
</span>
|
||||||
<br>
|
<br>
|
||||||
|
|
Loading…
Reference in a new issue