Support simple search disabling
Add new new SEARCH_DISABLE_SIMPLE_SEARCH setting. Signed-off-by: Roberto Rosario <roberto.rosario@mayan-edms.com>
This commit is contained in:
@@ -80,6 +80,7 @@
|
||||
Deploy a Redis container.
|
||||
- Improve document version upload form.
|
||||
- Use dropzone for document version upload form.
|
||||
<<<<<<< HEAD
|
||||
- Allow the "Execute document tools" permission to be
|
||||
granted via ACL.
|
||||
- Add support for custom IMAP search criteria.
|
||||
@@ -90,6 +91,8 @@
|
||||
- Add support for specifing a destination IMAP mailbox for
|
||||
processed messages. GitLab issue #399. Thanks to
|
||||
Robert Schöftner (@robert.schoeftner).
|
||||
- Support simple search disable via the new
|
||||
SEARCH_DISABLE_SIMPLE_SEARCH setting.
|
||||
|
||||
3.2.8 (2019-10-01)
|
||||
==================
|
||||
|
||||
@@ -97,6 +97,8 @@ Changes
|
||||
Robert Schöftner (@robert.schoeftner).
|
||||
- Add support to execute the IMAP expunge command after each
|
||||
processed message.
|
||||
- Support simple search disable via the new
|
||||
SEARCH_DISABLE_SIMPLE_SEARCH setting.
|
||||
|
||||
Removals
|
||||
--------
|
||||
|
||||
17
mayan/apps/dynamic_search/settings.py
Normal file
17
mayan/apps/dynamic_search/settings.py
Normal file
@@ -0,0 +1,17 @@
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from django.conf import settings
|
||||
from django.utils.translation import ugettext_lazy as _
|
||||
|
||||
from mayan.apps.smart_settings.classes import Namespace
|
||||
|
||||
namespace = Namespace(label=_('Search'), name='search')
|
||||
|
||||
setting_disable_simple_search = namespace.add_setting(
|
||||
global_name='SEARCH_DISABLE_SIMPLE_SEARCH',
|
||||
default=False, help_text=_(
|
||||
'Disables the single term bar search leaving only the advanced '
|
||||
'search button.'
|
||||
)
|
||||
)
|
||||
|
||||
@@ -1,13 +1,25 @@
|
||||
{% load i18n %}
|
||||
|
||||
{% load search_tags %}
|
||||
{% load smart_settings_tags %}
|
||||
|
||||
{% get_search_models as search_models %}
|
||||
{% smart_setting global_name="SEARCH_DISABLE_SIMPLE_SEARCH" as setting_disable_simple_search %}
|
||||
|
||||
{% if setting_disable_simple_search %}
|
||||
<div class="row">
|
||||
<div class="col-xs-6 col-xs-offset-3">
|
||||
{% endif %}
|
||||
|
||||
<div class="well center-block">
|
||||
<div class="row">
|
||||
<div class="col-xs-12">
|
||||
<form action="{% url 'search:results' %}" class="form-horizontal" id="formSearch" method="get" role="search">
|
||||
<div class="col-sm-2">
|
||||
{% if setting_disable_simple_search == False %}
|
||||
<div class="col-sm-2">
|
||||
{% else %}
|
||||
<div class="col-sm-8">
|
||||
{% endif %}
|
||||
<select class="form-control" id="selectSearchModel" name="_search_model">
|
||||
{% for search_model in search_models %}
|
||||
{{ search_model.self.get_full_name }}
|
||||
@@ -16,12 +28,21 @@
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="col-sm-10">
|
||||
{% if setting_disable_simple_search == False %}
|
||||
<div class="col-sm-10">
|
||||
{% else %}
|
||||
<div class="col-sm-4">
|
||||
{% endif %}
|
||||
|
||||
<div class="input-group">
|
||||
<input class="form-control" name="q" placeholder="{% trans 'Search terms' %}" type="text" value="{{ search_terms|default:'' }}">
|
||||
{% if setting_disable_simple_search == False %}
|
||||
<input class="form-control" name="q" placeholder="{% trans 'Search terms' %}" type="text" value="{{ search_terms|default:'' }}">
|
||||
{% endif %}
|
||||
<span class="input-group-btn">
|
||||
<button class="btn btn-default" type="submit">{% trans 'Search' %}</button>
|
||||
<a class="btn btn-primary" href="" id="btnSearchAdvanced" >{% trans 'Advanced' %}</a>
|
||||
{% if setting_disable_simple_search == False %}
|
||||
<button class="btn btn-default" type="submit">{% trans 'Search' %}</button>
|
||||
{% endif %}
|
||||
<a class="btn btn-primary" href="" id="btnSearchAdvanced" > {% if setting_disable_simple_search == False %}{% trans 'Advanced' %}{% else %}{% trans 'Advanced search' %}{% endif %}</a>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
@@ -30,6 +51,12 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{% if setting_disable_simple_search %}
|
||||
</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
|
||||
<script>
|
||||
jQuery(document).ready(function() {
|
||||
var $selectSearchModel = $('#selectSearchModel');
|
||||
|
||||
Reference in New Issue
Block a user