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

【ブロック管理】数が増えるので絞り込みがほしい #3438

Merged
Merged
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
51 changes: 50 additions & 1 deletion src/Eccube/Resource/template/admin/Content/block.twig
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,62 @@ file that was distributed with this source code.
</style>
{% endblock %}

{% block javascript %}
<script>
var searchWord = function () {
var searchText = $(this).val(), // 検索ボックスに入力された値
targetText;

// 検索ボックスに値が入っていない場合
if (searchText == '') {
// 全て表示する
$('.list-group li').show();
return;
}

// 検索ボックスに値が入ってる場合
// 表示を全て空にする
$('.list-group li').hide();

// 検索ワードが(子を含めて)含まれる要素のみ表示
$('.list-group li').each(function () {
targetText = $(this).find('> div.row > div > a').text();

// 検索対象となるリストに入力された文字列が存在するかどうかを判断
if (targetText.indexOf(searchText) != -1) {
// 存在する場合はそのリストのテキストを用意した配列に格納
$(this).show();
}
});
};

// searchWordの実行
$('#search-block').on('input', searchWord);
</script>
{% endblock javascript %}

{% block main %}
<div class="c-contentsArea__cols">
<div class="c-contentsArea__primaryCol">
<div class="c-primaryCol">
<div class="row justify-content-between mb-2">
<div class="col-9"></div>
<div class="col-3">
<div class="form-row">
<div class="col">
<div class="input-group mb-3">
<div class="input-group-prepend">
<span class="input-group-text" id="basic-addon1"><i class="fa fa-search"></i></span>
</div>
<input id="search-block" class="form-control" type="search" aria-label="Search">
</div>
</div>
</div>
</div>
</div>
<div class="card rounded border-0 mb-4">
<div class="card-body p-0">
<div class="card rounded border-0 mb-2">
<div class="card rounded border-0">
<ul class="list-group list-group-flush">
{% for Block in Blocks %}
<li class="list-group-item">
Expand Down