-
Notifications
You must be signed in to change notification settings - Fork 4
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
refs #23 検索仮実装 #67
Merged
euledge
merged 8 commits into
code-for-hamamatsu:main
from
hmatsu47:feature-23-search-box
Dec 21, 2021
Merged
refs #23 検索仮実装 #67
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
b0956d4
refs #23 検索仮実装
hmatsu47 99321a5
検索窓が長すぎたので調整
hmatsu47 7eb025e
refs #23 各カードの下の余白が消えてしまうので調整
hmatsu47 c0a6dee
refs #23 検索窓を調整
hmatsu47 c72f25a
refs #23 検索結果ページの検索窓の幅調整
hmatsu47 53231f7
refs #23 トップページの検索が Safari では使えなかったので修正
hmatsu47 501a9c1
refs #23 バナーの下側の厚みを調整
hmatsu47 b175ece
refs #23 トップページの表示調整
hmatsu47 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
--- | ||
title: "全てのカテゴリから検索" | ||
draft: false | ||
--- | ||
<input id = "query" onkeyup="search(this.value)" size="28" autocomplete="off" autofocus placeholder="検索キーワードを入れてください" /> | ||
|
||
<script> | ||
// 検索 | ||
function search(query) { | ||
$(".card").each(function(i, elem) { | ||
var question = $(elem).find("span").text().toLowerCase(); | ||
var answer = $(elem).find(".card-body").text().toLowerCase(); | ||
if (query == "" || (question.indexOf(query) == -1 && answer.indexOf(query) == -1)) { | ||
$(elem).css("display", "none"); | ||
} else { | ||
$(elem).css("display", "block"); | ||
} | ||
}) | ||
} | ||
// ハッシュフラグメントの値で検索を実行 | ||
function searchWithHash() { | ||
const hash = decodeURI(location.hash.substring(1)); | ||
search(hash); | ||
// 必要があれば input 要素の値を更新 | ||
const queryElem = document.getElementById('query'); | ||
if (queryElem.value !== hash) { | ||
queryElem.value = hash; | ||
} | ||
} | ||
// ハッシュフラグメント付きの URL でページを開いたときに検索 | ||
window.addEventListener('DOMContentLoaded', searchWithHash); | ||
// ページ表示後にハッシュフラグメントが変化したら検索 | ||
window.addEventListener('hashchange', searchWithHash); | ||
</script> | ||
|
||
{{< result >}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
{{ $_hugo_config := `{ "version": 1 }` }} | ||
{{ range $faq := (where $.Site.Data.faq.faq "カテゴリ名" "!=" "") }} | ||
<div class="card mb-4 rounded-0 shadow border-0" style="display: none;"> | ||
<div class="card-header rounded-0 bg-white border p-0 border-0"> | ||
<a class="card-link h4 d-flex tex-dark mb-0 py-3 px-4 justify-content-between" data-toggle="collapse" | ||
href="#{{ $faq.質問 | sha1 }}"> | ||
<span>{{ $faq.質問 }}</span> <i class="ti-plus text-primary text-right"></i> | ||
</a> | ||
</div> | ||
<div id="{{ $faq.質問 | sha1 }}" class="collapse" data-parent="#accordion"> | ||
<div class="card-body font-secondary text-color pt-0" style="white-space:pre-wrap; margin-bottom: 0px;">{{ $faq.回答 | markdownify }}</div> | ||
<div class="card-footer rounded-0 bg-white border p-0 border-0" style="text-align: right; margin-bottom: 0px; margin-right: 20px;"> | ||
{{ if eq (len $faq.更新日) 8 }} | ||
最終更新日:{{ slicestr $faq.更新日 0 4 }}年{{ slicestr $faq.更新日 4 6 | strings.TrimLeft "0" }}月{{ slicestr $faq.更新日 6 | strings.TrimLeft "0" }}日 | ||
{{ end}} | ||
<br/> | ||
<br/> | ||
</div> | ||
</div> | ||
{{ .Inner }} | ||
</div> | ||
{{ end }} |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ページタイトルですが、
のほうがいいかな?と思いましたがどうでしょうか。
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGMT
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
どうでしょうね?
ヘッダに書かれている分冗長になるかな、とも思ったのですが。
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
https://test.d2qv7xiwv4i3gl.amplifyapp.com/faq1/
この辺のタイトルもアプリ名称ないので、まぁ、いいか。
もしやるにしても、別チケットにしましょう!