diff options
-rw-r--r-- | newspipe/templates/layout.html | 22 | ||||
-rw-r--r-- | newspipe/web/views/home.py | 4 |
2 files changed, 23 insertions, 3 deletions
diff --git a/newspipe/templates/layout.html b/newspipe/templates/layout.html index 459727de..45ad7fdf 100644 --- a/newspipe/templates/layout.html +++ b/newspipe/templates/layout.html @@ -72,7 +72,7 @@ </div> <button type="submit" class="btn btn-primary"><i class="fa fa-plus" aria-hidden="true"></i></button> </div> - </form> + </form> </div> </li> @@ -85,6 +85,26 @@ </li> <li class="nav-item dropdown"> + <a class="nav-link dropdown-toggle" href="#" id="navbarDropdownSearch" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"><i class="fa fa-search" aria-hidden="true"></i></i> {{ _('Search') }}</a> + <div class="dropdown-menu dropdown-menu-right" aria-labelledby="navbarDropdownSearch"> + <form class="navbar-form navbar-left px-4 py-3" action="{{ url_for('home') }}" method="GET"> + <div class="form-group"> + <input class="form-control" name="query" type="text" placeholder="{{_('Query')}}" required="required"/> + </div> + <div class="form-group form-check"> + <input type="checkbox" class="form-check-input" id="checkTitle" name="search_title" checked> + <label class="form-check-label" for="checkTitle">Search in title</label> + </div> + <div class="form-group form-check"> + <input type="checkbox" class="form-check-input" id="checkContent" name="search_content"> + <label class="form-check-label" for="checkContent">Search in content</label> + </div> + <button type="submit" class="btn btn-primary">OK</button> + </form> + </div> + </li> + + <li class="nav-item dropdown"> <a class="nav-link dropdown-toggle" href="#" id="navbarDropdownUser" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"><i class="fa fa-user" aria-hidden="true"></i></a> <div class="dropdown-menu dropdown-menu-right" aria-labelledby="navbarDropdownUser"> <a class="dropdown-item" href="{{ url_for('user.profile') }}">{{ _('Profile') }}</a> diff --git a/newspipe/web/views/home.py b/newspipe/web/views/home.py index 0368c11f..7d4ad604 100644 --- a/newspipe/web/views/home.py +++ b/newspipe/web/views/home.py @@ -98,8 +98,8 @@ def _get_filters(in_dict): filters = {} query = in_dict.get("query") if query: - search_title = in_dict.get("search_title") == "true" - search_content = in_dict.get("search_content") == "true" + search_title = in_dict.get("search_title") == "on" + search_content = in_dict.get("search_content") == "on" if search_title: filters["title__ilike"] = "%%%s%%" % query if search_content: |