Skip to content

Commit

Permalink
Merge pull request #6039 from dotani1111/features/feat_notic_debug_mode
Browse files Browse the repository at this point in the history
feat:デバッグモード有効時に通知する機能
  • Loading branch information
chihiro-adachi authored Feb 21, 2024
2 parents e26bbbf + e0fcd58 commit 9bc3d4e
Show file tree
Hide file tree
Showing 7 changed files with 82 additions and 8 deletions.
34 changes: 33 additions & 1 deletion html/template/default/assets/css/style.css

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

3 changes: 3 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 @@ -254,6 +255,8 @@ public function setAdminGlobals(RequestEvent $event)
}
$this->twig->addGlobal('eccubeNav', $eccubeNav);
$this->twig->addGlobal('isMaintenance', $this->systemService->isMaintenanceMode());
$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 @@ -505,6 +506,7 @@ 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_maintenance_mode: 'Currently in maintenance mode.'
admin.common.notice_debug_mode: The site is currently under debug mode.


# Labels related to entity
Expand Down
4 changes: 3 additions & 1 deletion 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 @@ -505,7 +507,7 @@ 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_maintenance_mode: '現在メンテナンスモード中です。'

admin.common.notice_debug_mode: 'デバッグモードが有効になっています。'

# エンティティに関連するラベル
admin.common.id: ID
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 @@ -65,6 +65,7 @@ file that was distributed with this source code.

{{ include('@admin/alert.twig') }}
{{ include('@admin/info.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-danger 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 %}
38 changes: 32 additions & 6 deletions src/Eccube/Resource/template/default/default_frame.twig
Original file line number Diff line number Diff line change
Expand Up @@ -60,13 +60,39 @@ file that was distributed with this source code.
{{ include('block.twig', {'Blocks': Layout.BodyAfter}) }}
{% endif %}

{% if isMaintenance is defined and isMaintenance %}
<div class="ec-maintenanceAlert">
<div>
<div class="ec-maintenanceAlert__icon"><img src="{{ asset('assets/icon/exclamation-white.svg') }}"/></div>
{{ 'front.under_maintenance'|trans }}

{% if isMaintenance is defined and isMaintenance and isDebugMode %}
<dev class="ec-twoModeAlert">
<div class="ec-maintenanceAlert">
<div>
<div class="ec-maintenanceAlert__icon"><img src="{{ asset('assets/icon/exclamation-white.svg') }}"/></div>
{{ 'front.under_maintenance'|trans }}
</div>
</div>
</div>
<div class="ec-debugModeAlert bg-danger">
<div>
<div class="ec-debugModeAlert__icon"><img src="{{ asset('assets/icon/exclamation-white.svg') }}"/></div>
{{ 'front.under_debug_mode'|trans }}
</div>
</div>
</dev>
{% else %}
{% if isMaintenance %}
<div class="ec-maintenanceAlert">
<div>
<div class="ec-maintenanceAlert__icon"><img src="{{ asset('assets/icon/exclamation-white.svg') }}"/></div>
{{ 'front.under_maintenance'|trans }}
</div>
</div>
{% endif %}
{% if isDebugMode %}
<div class="ec-debugModeAlert bg-danger">
<div>
<div class="ec-debugModeAlert__icon"><img src="{{ asset('assets/icon/exclamation-white.svg') }}"/></div>
{{ 'front.under_debug_mode'|trans }}
</div>
</div>
{% endif %}
{% endif %}

<div class="ec-layoutRole">
Expand Down

0 comments on commit 9bc3d4e

Please sign in to comment.