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

Add input form autofocus switch #118

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions blueprints.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,17 @@ form:
0: Disabled
validate:
type: bool

autofocus:
type: toggle
label: Autofocus
highlight: 1
default: 1
options:
1: Enabled
0: Disabled
validate:
type: bool

search_title:
type: spacer
Expand Down
2 changes: 1 addition & 1 deletion templates/partials/tntsearch.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
<form role="form" class="tntsearch-form" action="{{ nojs_action }}" method="get">
{% block tntsearch_input %}
<div id="tntsearch-wrapper" class="form-group{{ dropdown ? ' tntsearch-dropdown' : '' }}">
<input type="text" name="q" class="form-control form-input tntsearch-field{{ in_page ? ' tntsearch-field-inpage' : '' }}" data-tntsearch="{{ options|json_encode|e('html_attr') }}" placeholder="{{ placeholder }}" value="{{ not dropdown ? query|e : '' }}" autofocus>
<input type="text" name="q" class="form-control form-input tntsearch-field{{ in_page ? ' tntsearch-field-inpage' : '' }}" data-tntsearch="{{ options|json_encode|e('html_attr') }}" placeholder="{{ placeholder }}" value="{{ not dropdown ? query|e : '' }}" {% if config.get('plugins.tntsearch.autofocus') %}autofocus{% endif %}>
<span class="tntsearch-clear"{{ not query or dropdown ? ' style="display: none;"' : '' }}>&times;</span>
</div>
{% endblock %}
Expand Down