aboutsummaryrefslogtreecommitdiffhomepage
path: root/template
diff options
context:
space:
mode:
authorGravatar Frédéric Guillot <fred@miniflux.net>2018-07-04 22:05:19 -0700
committerGravatar Frédéric Guillot <fred@miniflux.net>2018-07-04 22:05:19 -0700
commit6d0dc451e45effc8cbb6953a766b111036d893ce (patch)
tree3c7be86a036dfc77534fe89abb7d88413e5fdb52 /template
parentaf15412954b9b36365f3fd723bf91b3c7c2f88bd (diff)
Add search form
Diffstat (limited to 'template')
-rw-r--r--template/common.go25
-rw-r--r--template/html/common/entry_pagination.html4
-rw-r--r--template/html/common/layout.html9
-rw-r--r--template/html/common/pagination.html4
-rw-r--r--template/html/search_entries.html30
-rw-r--r--template/views.go34
6 files changed, 93 insertions, 13 deletions
diff --git a/template/common.go b/template/common.go
index 1c0f5e2..be12839 100644
--- a/template/common.go
+++ b/template/common.go
@@ -1,5 +1,5 @@
// Code generated by go generate; DO NOT EDIT.
-// 2018-06-21 15:46:05.07724268 +0200 CEST m=+0.035251547
+// 2018-07-04 22:00:22.176755806 -0700 PDT m=+0.038649607
package template
@@ -8,7 +8,7 @@ var templateCommonMap = map[string]string{
<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 }}
@@ -16,7 +16,7 @@ var templateCommonMap = map[string]string{
<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 }}
@@ -140,6 +140,14 @@ var templateCommonMap = map[string]string{
<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">&laquo;&nbsp;{{ 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 }}
@@ -190,6 +198,7 @@ var templateCommonMap = map[string]string{
<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>
@@ -203,7 +212,7 @@ var templateCommonMap = map[string]string{
<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 }}&amp;q={{ .SearchQuery }}{{ end }}{{ else }}{{ if .SearchQuery }}?q={{ .SearchQuery }}{{ end }}{{ end }}" data-page="previous">{{ t "Previous" }}</a>
{{ else }}
{{ t "Previous" }}
{{ end }}
@@ -211,7 +220,7 @@ var templateCommonMap = map[string]string{
<div class="pagination-next">
{{ if .ShowNext }}
- <a href="{{ .Route }}?offset={{ .NextOffset }}" data-page="next">{{ t "Next" }}</a>
+ <a href="{{ .Route }}?offset={{ .NextOffset }}{{ if .SearchQuery }}&amp;q={{ .SearchQuery }}{{ end }}" data-page="next">{{ t "Next" }}</a>
{{ else }}
{{ t "Next" }}
{{ end }}
@@ -222,8 +231,8 @@ var templateCommonMap = map[string]string{
}
var templateCommonMapChecksums = map[string]string{
- "entry_pagination": "f1465fa70f585ae8043b200ec9de5bf437ffbb0c19fb7aefc015c3555614ee27",
+ "entry_pagination": "756ef122f3ebc73754b5fc4304bf05e59da0ab4af030b2509ff4c9b4a74096ce",
"item_meta": "6cff8ae243f19dac936e523867d2975f70aa749b2a461ae63f6ebbca94cf7419",
- "layout": "2cc3abf4d832b8368689d17091856ccae696f8a51b8fc29641107846f5d6661a",
- "pagination": "6ff462c2b2a53bc5448b651da017f40a39f1d4f16cef4b2f09784f0797286924",
+ "layout": "4738561d29c428157e83aa13601c463b5e73bd0e2a5fdee75089f3643d6d4055",
+ "pagination": "b592d58ea9d6abf2dc0b158621404cbfaeea5413b1c8b8b9818725963096b196",
}
diff --git a/template/html/common/entry_pagination.html b/template/html/common/entry_pagination.html
index 6c9f29c..bb2b84f 100644
--- a/template/html/common/entry_pagination.html
+++ b/template/html/common/entry_pagination.html
@@ -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 }}
diff --git a/template/html/common/layout.html b/template/html/common/layout.html
index d98de9d..59a3b23 100644
--- a/template/html/common/layout.html
+++ b/template/html/common/layout.html
@@ -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">&laquo;&nbsp;{{ 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>
diff --git a/template/html/common/pagination.html b/template/html/common/pagination.html
index 4c6766a..3ea32fb 100644
--- a/template/html/common/pagination.html
+++ b/template/html/common/pagination.html
@@ -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 }}&amp;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 }}&amp;q={{ .SearchQuery }}{{ end }}" data-page="next">{{ t "Next" }}</a>
{{ else }}
{{ t "Next" }}
{{ end }}
diff --git a/template/html/search_entries.html b/template/html/search_entries.html
new file mode 100644
index 0000000..85aa7c2
--- /dev/null
+++ b/template/html/search_entries.html
@@ -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 }}
diff --git a/template/views.go b/template/views.go
index a875ef2..c0c031d 100644
--- a/template/views.go
+++ b/template/views.go
@@ -1,5 +1,5 @@
// Code generated by go generate; DO NOT EDIT.
-// 2018-06-30 18:00:36.547092772 -0700 PDT m=+0.023261871
+// 2018-07-04 22:00:22.166425155 -0700 PDT m=+0.028318956
package template
@@ -1020,6 +1020,37 @@ var templateViewsMap = map[string]string{
</section>
{{ end }}
`,
+ "search_entries": `{{ 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 }}
+`,
"sessions": `{{ define "title"}}{{ t "Sessions" }}{{ end }}
{{ define "content"}}
@@ -1285,6 +1316,7 @@ var templateViewsMapChecksums = map[string]string{
"import": "73b5112e20bfd232bf73334544186ea419505936bc237d481517a8622901878f",
"integrations": "20c1c82070b93235d189b10acccd0cda5694cc5684d0b3be23de2ba5ae83e73f",
"login": "7d83c3067c02f1f6aafdd8816c7f97a4eb5a5a4bdaaaa4cc1e2fbb9c17ea65e8",
+ "search_entries": "2ed1fa914f322ee077bf4a63d29bb2c5bb415bc3245a0d47019ff8077a5d40fc",
"sessions": "3fa79031dd883847eba92fbafe5f535fa3a4e1614bb610f20588b6f8fc8b3624",
"settings": "d435dc37e82896ce9a7a573b3c2aeda1db71eec62349e2472ebbf1d5c3e0bc21",
"unread_entries": "ca3ef1547d7d170b005a2f48fabd4c0a15550884db5e481659c13ffe6a47d19d",