Skip to content

Commit

Permalink
feat:デバッグモード有効時に通知する機能
Browse files Browse the repository at this point in the history
  • Loading branch information
dotani1111 committed Sep 18, 2023
1 parent 93e0961 commit e6cb605
Show file tree
Hide file tree
Showing 7 changed files with 53 additions and 0 deletions.
29 changes: 29 additions & 0 deletions html/template/default/assets/css/style.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions src/Eccube/EventListener/TwigInitializeListener.php
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,7 @@ public function setFrontVariables(RequestEvent $event)
$this->twig->addGlobal('Page', $Page);
$this->twig->addGlobal('title', $Page->getName());
$this->twig->addGlobal('isMaintenance', $this->systemService->isMaintenanceMode());
$this->twig->addGlobal('isDebugMode', env('APP_DEBUG'));
}

public function setAdminGlobals(RequestEvent $event)
Expand All @@ -253,6 +254,7 @@ public function setAdminGlobals(RequestEvent $event)
$eccubeNav = $this->getDisplayEccubeNav($eccubeNav, $AuthorityRoles, $baseUrl);
}
$this->twig->addGlobal('eccubeNav', $eccubeNav);
$this->twig->addGlobal('isDebugMode', env('APP_DEBUG'));
}

/**
Expand Down
2 changes: 2 additions & 0 deletions src/Eccube/Resource/locale/messages.en.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -392,6 +392,7 @@ front.shopping.payment_method_unselected: Please select the payment method.
front.shopping.not_available_payment_method: The payment method you have selected is not available.
front.shopping.payment_method_not_fount: Sorry, you have no payment options. If you have selected multiple delivery methods, you can only select the same payment option for them all.
front.under_maintenance: The site is currently under maintenance.
front.under_debug_mode: The site is currently under debug mode.

#====================================================================================
# Admin Console
Expand Down Expand Up @@ -503,6 +504,7 @@ admin.common.move_to_confirm_move_only: Move
admin.common.move_to_confirm_save_and_move: Save & Move
admin.common.admin_url_warning: 'Please set the Admin Console URL that is hard to guess for security. You can set it at "<a href="%url%">Security</a>".'
admin.common.restrict_file_upload_info: 'If this feature is used infrequently, disabling it while not in use provides additional security. You can disable this feature by setting the environment variable ECCUBE_RESTRICT_FILE_UPLOAD to 1.'
admin.common.notice_debug_mode: The site is currently under debug mode.


# Labels related to entity
Expand Down
3 changes: 3 additions & 0 deletions src/Eccube/Resource/locale/messages.ja.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -392,6 +392,8 @@ front.shopping.payment_method_unselected: お支払い方法を選択してく
front.shopping.not_available_payment_method: 選択したお支払い方法はご利用できません。
front.shopping.payment_method_not_fount: 選択できるお支払い方法がありません。配送方法が異なる場合は同じ配送方法を選んでください。
front.under_maintenance: メンテナンスモードが有効になっています。
front.under_debug_mode: デバッグモードが有効になっています。


#====================================================================================
# 管理画面
Expand Down Expand Up @@ -503,6 +505,7 @@ admin.common.move_to_confirm_move_only: 保存せずに移動
admin.common.move_to_confirm_save_and_move: 保存して移動
admin.common.admin_url_warning: '管理画面URLは、セキュリティのため推測されにくいものを設定してください。「<a href="%url%">セキュリティ管理</a>」から設定できます。'
admin.common.restrict_file_upload_info: 'この機能の利用頻度が低い場合、使用しない間は無効化することでセキュリティを更に向上させることができます。環境変数 ECCUBE_RESTRICT_FILE_UPLOAD を 1 に設定することで機能を無効化することが可能です。'
admin.common.notice_debug_mode: 'デバッグモードが有効になっています。'


# エンティティに関連するラベル
Expand Down
1 change: 1 addition & 0 deletions src/Eccube/Resource/template/admin/default_frame.twig
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ file that was distributed with this source code.
</div>

{{ include('@admin/alert.twig') }}
{{ include('@admin/notice_debug_mode.twig') }}

{% block main %}{% endblock %}

Expand Down
8 changes: 8 additions & 0 deletions src/Eccube/Resource/template/admin/notice_debug_mode.twig
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{% if isDebugMode %}
<div class="alert alert-warning alert-dismissible fade show m-3" role="alert">
<i class="fa fa-warning fa-lg me-2"></i>
<span class="fw-bold">{{ 'admin.common.notice_debug_mode'|trans }}</span>
<button class="btn-close" type="button" data-bs-dismiss="alert" aria-label="Close">
</button>
</div>
{% endif %}
8 changes: 8 additions & 0 deletions src/Eccube/Resource/template/default/default_frame.twig
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,14 @@ file that was distributed with this source code.
</div>
</div>
{% endif %}
{% if isDebugMode %}
<div class="ec-debugModeAlert">
<div>
<div class="ec-debugModeAlert__icon"><img src="{{ asset('assets/icon/exclamation-white.svg') }}"/></div>
{{ 'front.under_debug_mode'|trans }}
</div>
</div>
{% endif %}

<div class="ec-layoutRole">
{# Layout: HEADER #}
Expand Down

0 comments on commit e6cb605

Please sign in to comment.