Skip to content

Commit

Permalink
管理画面>カテゴリ管理 入力チェック時のアラート調整 プラグインでの項目追加にも対応
Browse files Browse the repository at this point in the history
  • Loading branch information
watarukashii committed Apr 21, 2022
1 parent 4331d1b commit 6b4b1b7
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
3 changes: 3 additions & 0 deletions src/Eccube/Controller/Admin/Product/CategoryController.php
Original file line number Diff line number Diff line change
Expand Up @@ -185,8 +185,10 @@ public function index(Request $request, $parent_id = null, $id = null, CacheUtil
}

$formViews = [];
$formErrors = [];
foreach ($forms as $key => $value) {
$formViews[$key] = $value->createView();
$formErrors[$key]['count'] = $value->getErrors(true)->count();
}

$Ids = [];
Expand All @@ -205,6 +207,7 @@ public function index(Request $request, $parent_id = null, $id = null, CacheUtil
'TopCategories' => $TopCategories,
'TargetCategory' => $TargetCategory,
'forms' => $formViews,
'error_forms' => $formErrors,
];
}

Expand Down
4 changes: 2 additions & 2 deletions src/Eccube/Resource/template/admin/Product/category.twig
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ file that was distributed with this source code.
{% for Category in Categories %}
<li id="ex-category-{{ Category.id }}" class="list-group-item sortable-item" data-id="{{ Category.id }}" data-sort-no="{{ Category.sort_no }}">
{% if Category.id != TargetCategory.id %}
<div class="row justify-content-around mode-view {% if forms[Category.id].name.vars.errors.count() %} d-none {% endif %}">
<div class="row justify-content-around mode-view {% if error_forms[Category.id].count %} d-none {% endif %}">
<div class="col-auto d-flex align-items-center"><i class="fa fa-bars text-ec-gray"></i></div>
<div class="col-auto d-flex align-items-center">{{ Category.id }}</div>
<div class="col d-flex align-items-center">
Expand Down Expand Up @@ -265,7 +265,7 @@ file that was distributed with this source code.
</div>
</div>
</div>
<form class="form-row {% if forms[Category.id].name.vars.errors.count() == 0 %} d-none {% endif %} mode-edit" method="POST" action="{{ (Parent and Parent.id) ? url('admin_product_category_show', {'parent_id': Parent.id}) : url('admin_product_category') }}" enctype="multipart/form-data">
<form class="form-row {% if error_forms[Category.id].count == 0 %} d-none {% endif %} mode-edit" method="POST" action="{{ (Parent and Parent.id) ? url('admin_product_category_show', {'parent_id': Parent.id}) : url('admin_product_category') }}" enctype="multipart/form-data">
{{ form_widget(forms[Category.id]._token) }}
<div class="col-auto align-items-center">
{{ form_widget(forms[Category.id].name, {'attr': {'data-origin-value': forms[Category.id].name.vars.value}}) }}
Expand Down

0 comments on commit 6b4b1b7

Please sign in to comment.