Merge remote-tracking branch 'origin/features/disable_simple_search' into clients/bc
This commit is contained in:
@@ -83,6 +83,8 @@
|
|||||||
- Remove the DOCUMENTS_DISABLE_BASE_IMAGE_CACHE,
|
- Remove the DOCUMENTS_DISABLE_BASE_IMAGE_CACHE,
|
||||||
DOCUMENTS_DISABLE_TRANSFORMED_IMAGE_CACHE, and
|
DOCUMENTS_DISABLE_TRANSFORMED_IMAGE_CACHE, and
|
||||||
DOCUMENTS_FIX_ORIENTATION settings.
|
DOCUMENTS_FIX_ORIENTATION settings.
|
||||||
|
- Support simple search disable via the new
|
||||||
|
SEARCH_DISABLE_SIMPLE_SEARCH setting.
|
||||||
|
|
||||||
3.2.8 (2019-10-01)
|
3.2.8 (2019-10-01)
|
||||||
==================
|
==================
|
||||||
|
|||||||
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 i18n %}
|
||||||
|
|
||||||
{% load search_tags %}
|
{% load search_tags %}
|
||||||
|
{% load smart_settings_tags %}
|
||||||
|
|
||||||
{% get_search_models as search_models %}
|
{% 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="well center-block">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-xs-12">
|
<div class="col-xs-12">
|
||||||
<form action="{% url 'search:results' %}" class="form-horizontal" id="formSearch" method="get" role="search">
|
<form action="{% url 'search:results' %}" class="form-horizontal" id="formSearch" method="get" role="search">
|
||||||
|
{% if setting_disable_simple_search == False %}
|
||||||
<div class="col-sm-2">
|
<div class="col-sm-2">
|
||||||
|
{% else %}
|
||||||
|
<div class="col-sm-8">
|
||||||
|
{% endif %}
|
||||||
<select class="form-control" id="selectSearchModel" name="_search_model">
|
<select class="form-control" id="selectSearchModel" name="_search_model">
|
||||||
{% for search_model in search_models %}
|
{% for search_model in search_models %}
|
||||||
{{ search_model.self.get_full_name }}
|
{{ search_model.self.get_full_name }}
|
||||||
@@ -16,12 +28,21 @@
|
|||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
{% if setting_disable_simple_search == False %}
|
||||||
<div class="col-sm-10">
|
<div class="col-sm-10">
|
||||||
|
{% else %}
|
||||||
|
<div class="col-sm-4">
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
<div class="input-group">
|
<div class="input-group">
|
||||||
|
{% if setting_disable_simple_search == False %}
|
||||||
<input class="form-control" name="q" placeholder="{% trans 'Search terms' %}" type="text" value="{{ search_terms|default:'' }}">
|
<input class="form-control" name="q" placeholder="{% trans 'Search terms' %}" type="text" value="{{ search_terms|default:'' }}">
|
||||||
|
{% endif %}
|
||||||
<span class="input-group-btn">
|
<span class="input-group-btn">
|
||||||
|
{% if setting_disable_simple_search == False %}
|
||||||
<button class="btn btn-default" type="submit">{% trans 'Search' %}</button>
|
<button class="btn btn-default" type="submit">{% trans 'Search' %}</button>
|
||||||
<a class="btn btn-primary" href="" id="btnSearchAdvanced" >{% trans 'Advanced' %}</a>
|
{% endif %}
|
||||||
|
<a class="btn btn-primary" href="" id="btnSearchAdvanced" > {% if setting_disable_simple_search == False %}{% trans 'Advanced' %}{% else %}{% trans 'Advanced search' %}{% endif %}</a>
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -30,6 +51,12 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
{% if setting_disable_simple_search %}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
jQuery(document).ready(function() {
|
jQuery(document).ready(function() {
|
||||||
var $selectSearchModel = $('#selectSearchModel');
|
var $selectSearchModel = $('#selectSearchModel');
|
||||||
|
|||||||
Reference in New Issue
Block a user