mirror of
https://github.com/miniflux/v2.git
synced 2025-06-27 16:36:00 +00:00
Add search form
This commit is contained in:
parent
af15412954
commit
6d0dc451e4
20 changed files with 383 additions and 49 deletions
|
@ -2,7 +2,7 @@
|
|||
<div class="pagination">
|
||||
<div class="pagination-prev">
|
||||
{{ if .prevEntry }}
|
||||
<a href="{{ .prevEntryRoute }}" title="{{ .prevEntry.Title }}" data-page="previous">{{ t "Previous" }}</a>
|
||||
<a href="{{ .prevEntryRoute }}{{ if .searchQuery }}?q={{ .searchQuery }}{{ end }}" title="{{ .prevEntry.Title }}" data-page="previous">{{ t "Previous" }}</a>
|
||||
{{ else }}
|
||||
{{ t "Previous" }}
|
||||
{{ end }}
|
||||
|
@ -10,7 +10,7 @@
|
|||
|
||||
<div class="pagination-next">
|
||||
{{ if .nextEntry }}
|
||||
<a href="{{ .nextEntryRoute }}" title="{{ .nextEntry.Title }}" data-page="next">{{ t "Next" }}</a>
|
||||
<a href="{{ .nextEntryRoute }}{{ if .searchQuery }}?q={{ .searchQuery }}{{ end }}" title="{{ .nextEntry.Title }}" data-page="next">{{ t "Next" }}</a>
|
||||
{{ else }}
|
||||
{{ t "Next" }}
|
||||
{{ end }}
|
||||
|
|
|
@ -65,6 +65,14 @@
|
|||
<a href="{{ route "logout" }}" title="{{ t "Logged as %s" .user.Username }}">{{ t "Logout" }}</a>
|
||||
</li>
|
||||
</ul>
|
||||
<div class="search">
|
||||
<div class="search-toggle-switch {{ if $.searchQuery }}has-search-query{{ end }}">
|
||||
<a href="#" data-action="search">« {{ t "Search" }}</a>
|
||||
</div>
|
||||
<form action="{{ route "searchEntries" }}" class="search-form {{ if $.searchQuery }}has-search-query{{ end }}">
|
||||
<input type="search" name="q" id="search-input" placeholder="{{ t "Search..." }}" {{ if $.searchQuery }}value="{{ .searchQuery }}"{{ end }} required>
|
||||
</form>
|
||||
</div>
|
||||
</nav>
|
||||
</header>
|
||||
{{ end }}
|
||||
|
@ -115,6 +123,7 @@
|
|||
<li>{{ t "Download original content" }} = <strong>d</strong></li>
|
||||
<li>{{ t "Toggle bookmark" }} = <strong>f</strong></li>
|
||||
<li>{{ t "Save article" }} = <strong>s</strong></li>
|
||||
<li>{{ t "Set focus on search form" }} = <strong>/</strong></li>
|
||||
<li>{{ t "Close modal dialog" }} = <strong>Esc</strong></li>
|
||||
</ul>
|
||||
</div>
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
<div class="pagination">
|
||||
<div class="pagination-prev">
|
||||
{{ if .ShowPrev }}
|
||||
<a href="{{ .Route }}{{ if gt .PrevOffset 0 }}?offset={{ .PrevOffset }}{{ end }}" data-page="previous">{{ t "Previous" }}</a>
|
||||
<a href="{{ .Route }}{{ if gt .PrevOffset 0 }}?offset={{ .PrevOffset }}{{ if .SearchQuery }}&q={{ .SearchQuery }}{{ end }}{{ else }}{{ if .SearchQuery }}?q={{ .SearchQuery }}{{ end }}{{ end }}" data-page="previous">{{ t "Previous" }}</a>
|
||||
{{ else }}
|
||||
{{ t "Previous" }}
|
||||
{{ end }}
|
||||
|
@ -10,7 +10,7 @@
|
|||
|
||||
<div class="pagination-next">
|
||||
{{ if .ShowNext }}
|
||||
<a href="{{ .Route }}?offset={{ .NextOffset }}" data-page="next">{{ t "Next" }}</a>
|
||||
<a href="{{ .Route }}?offset={{ .NextOffset }}{{ if .SearchQuery }}&q={{ .SearchQuery }}{{ end }}" data-page="next">{{ t "Next" }}</a>
|
||||
{{ else }}
|
||||
{{ t "Next" }}
|
||||
{{ end }}
|
||||
|
|
30
template/html/search_entries.html
Normal file
30
template/html/search_entries.html
Normal file
|
@ -0,0 +1,30 @@
|
|||
{{ define "title"}}{{ t "Search Results" }} ({{ .total }}){{ end }}
|
||||
|
||||
{{ define "content"}}
|
||||
<section class="page-header">
|
||||
<h1>{{ t "Search Results" }} ({{ .total }})</h1>
|
||||
</section>
|
||||
|
||||
{{ if not .entries }}
|
||||
<p class="alert alert-info">{{ t "There is no result for this search." }}</p>
|
||||
{{ else }}
|
||||
<div class="items">
|
||||
{{ range .entries }}
|
||||
<article class="item touch-item item-status-{{ .Status }}" data-id="{{ .ID }}">
|
||||
<div class="item-header">
|
||||
<span class="item-title">
|
||||
{{ if ne .Feed.Icon.IconID 0 }}
|
||||
<img src="{{ route "icon" "iconID" .Feed.Icon.IconID }}" width="16" height="16">
|
||||
{{ end }}
|
||||
<a href="{{ route "searchEntry" "entryID" .ID }}?q={{ $.searchQuery }}">{{ .Title }}</a>
|
||||
</span>
|
||||
<span class="category"><a href="{{ route "categoryEntries" "categoryID" .Feed.Category.ID }}">{{ .Feed.Category.Title }}</a></span>
|
||||
</div>
|
||||
{{ template "item_meta" dict "user" $.user "entry" . "hasSaveEntry" $.hasSaveEntry }}
|
||||
</article>
|
||||
{{ end }}
|
||||
</div>
|
||||
{{ template "pagination" .pagination }}
|
||||
{{ end }}
|
||||
|
||||
{{ end }}
|
Loading…
Add table
Add a link
Reference in a new issue