diff --git a/app/Enums/ContentOpenType.php b/app/Enums/ContentOpenType.php index 2a67e0fbe..26bee91d2 100644 --- a/app/Enums/ContentOpenType.php +++ b/app/Enums/ContentOpenType.php @@ -14,6 +14,7 @@ final class ContentOpenType extends EnumsBase const always_close = 2; const limited_open = 3; const login_close = 4; + const login_open = 5; // key/valueの連想配列 const enum = [ @@ -21,5 +22,6 @@ final class ContentOpenType extends EnumsBase self::always_close => '非公開', self::limited_open => '限定公開', self::login_close => 'ログイン後非表示', + self::login_open => 'ログイン後表示', ]; } diff --git a/app/Models/Common/Frame.php b/app/Models/Common/Frame.php index 888ada8d9..abe2751b2 100644 --- a/app/Models/Common/Frame.php +++ b/app/Models/Common/Frame.php @@ -233,20 +233,27 @@ public function isVisible($page = null, $user = null) */ public function isInvisiblePrivateFrame() { - // 非ログインまたはフレーム編集権限を持たない、且つ、非表示条件(非公開、又は、限定公開、又は、ログイン後非表示)にマッチした場合はフレームを非表示にする + // 非ログインまたはフレーム編集権限を持たない、且つ、非表示条件(非公開、又は、限定公開、又は、ログイン後非表示、又は、ログイン後表示(未ログインで非表示))にマッチした場合はフレームを非表示にする if (Auth::check() && Auth::user()->can('role_arrangement') && app('request')->input('mode') != 'preview') { // 表示 return false; } - if ($this->content_open_type == ContentOpenType::always_close || - ( - $this->content_open_type == ContentOpenType::limited_open && - !Carbon::now()->between($this->content_open_date_from, $this->content_open_date_to) - ) || - (Auth::check() && $this->content_open_type == ContentOpenType::login_close) - ) { + if ($this->content_open_type == ContentOpenType::always_close) { + // 非表示 + return true; + + } elseif ($this->content_open_type == ContentOpenType::limited_open && + !Carbon::now()->between($this->content_open_date_from, $this->content_open_date_to)) { + // 非表示 + return true; + + } elseif ($this->content_open_type == ContentOpenType::login_close && Auth::check()) { + // 非表示 + return true; + + } elseif ($this->content_open_type == ContentOpenType::login_open && !Auth::check()) { // 非表示 return true; } diff --git a/resources/views/core/cms_frame_edit.blade.php b/resources/views/core/cms_frame_edit.blade.php index 4a3f62336..c1c2ed96a 100644 --- a/resources/views/core/cms_frame_edit.blade.php +++ b/resources/views/core/cms_frame_edit.blade.php @@ -195,8 +195,8 @@
{{-- コンテンツ公開区分 --}}
- -
+ +
@foreach (ContentOpenType::enum as $key => $value)
content_open_type != ContentOpenType::always_open) - - - - - - {{ ContentOpenType::getDescription($frame->content_open_type) }} - @if ($frame->content_open_type == ContentOpenType::limited_open) - {{-- 期限付き公開の場合は日付も表示 --}} - {{ '(' . Carbon::parse($frame->content_open_date_from)->format('Y/n/j H:i:s') . ' - ' . Carbon::parse($frame->content_open_date_to)->format('Y/n/j H:i:s') . ')' }} - @endif - - - @endif + {{-- 権限あり & 公開以外の場合にステータス表示 ※デフォルト状態の公開もステータス表示すると画面表示が煩雑になる為、意識的な設定(非公開、又は、限定公開)のみステータス表示を行う --}} + @can('frames.edit',[[null, null, null, $frame]]) + @if ($frame->content_open_type != ContentOpenType::always_open) + + + + + + {{ ContentOpenType::getDescription($frame->content_open_type) }} + @if ($frame->content_open_type == ContentOpenType::limited_open) + {{-- 期限付き公開の場合は日付も表示 --}} + {{ '(' . Carbon::parse($frame->content_open_date_from)->format('Y/n/j H:i:s') . ' - ' . Carbon::parse($frame->content_open_date_to)->format('Y/n/j H:i:s') . ')' }} + @endif + + + @endif + @endcan + {{-- ログインしていて、権限があれば、編集機能を有効にする --}} {{-- @if (Auth::check() &&