チェックインに対してセンシティブフラグを付与可能とする対応を実施

This commit is contained in:
MitarashiDango 2019-09-07 19:57:44 +09:00
parent 743272f8d6
commit 06cc18565e
12 changed files with 89 additions and 8 deletions

View File

@ -15,7 +15,7 @@ class Ejaculation extends Model
protected $fillable = [ protected $fillable = [
'user_id', 'ejaculated_date', 'user_id', 'ejaculated_date',
'note', 'geo_latitude', 'geo_longitude', 'link', 'note', 'geo_latitude', 'geo_longitude', 'link',
'is_private' 'is_private', 'is_too_sensitive'
]; ];
protected $dates = [ protected $dates = [

View File

@ -21,7 +21,8 @@ class EjaculationController extends Controller
'link' => $request->input('link', ''), 'link' => $request->input('link', ''),
'tags' => $request->input('tags', ''), 'tags' => $request->input('tags', ''),
'note' => $request->input('note', ''), 'note' => $request->input('note', ''),
'is_private' => $request->input('is_private', 0) == 1 'is_private' => $request->input('is_private', 0) == 1,
'is_too_sensitive' => $request->input('is_too_sensitive', 0) == 1
]; ];
return view('ejaculation.checkin')->with('defaults', $defaults); return view('ejaculation.checkin')->with('defaults', $defaults);
@ -56,7 +57,8 @@ class EjaculationController extends Controller
'ejaculated_date' => Carbon::createFromFormat('Y/m/d H:i', $inputs['date'] . ' ' . $inputs['time']), 'ejaculated_date' => Carbon::createFromFormat('Y/m/d H:i', $inputs['date'] . ' ' . $inputs['time']),
'note' => $inputs['note'] ?? '', 'note' => $inputs['note'] ?? '',
'link' => $inputs['link'] ?? '', 'link' => $inputs['link'] ?? '',
'is_private' => $request->has('is_private') ?? false 'is_private' => $request->has('is_private') ?? false,
'is_too_sensitive' => $request->has('is_too_sensitive') ?? false
]); ]);
$tagIds = []; $tagIds = [];
@ -137,7 +139,8 @@ class EjaculationController extends Controller
'ejaculated_date' => Carbon::createFromFormat('Y/m/d H:i', $inputs['date'] . ' ' . $inputs['time']), 'ejaculated_date' => Carbon::createFromFormat('Y/m/d H:i', $inputs['date'] . ' ' . $inputs['time']),
'note' => $inputs['note'] ?? '', 'note' => $inputs['note'] ?? '',
'link' => $inputs['link'] ?? '', 'link' => $inputs['link'] ?? '',
'is_private' => $request->has('is_private') ?? false 'is_private' => $request->has('is_private') ?? false,
'is_too_sensitive' => $request->has('is_too_sensitive') ?? false
])->save(); ])->save();
$tagIds = []; $tagIds = [];

View File

@ -30,6 +30,7 @@ id,
ejaculated_date, ejaculated_date,
note, note,
is_private, is_private,
is_too_sensitive,
link, link,
to_char(lead(ejaculated_date, 1, NULL) OVER (ORDER BY ejaculated_date DESC), 'YYYY/MM/DD HH24:MI') AS before_date, to_char(lead(ejaculated_date, 1, NULL) OVER (ORDER BY ejaculated_date DESC), 'YYYY/MM/DD HH24:MI') AS before_date,
to_char(ejaculated_date - (lead(ejaculated_date, 1, NULL) OVER (ORDER BY ejaculated_date DESC)), 'FMDDD日 FMHH24時間 FMMI分') AS ejaculated_span to_char(ejaculated_date - (lead(ejaculated_date, 1, NULL) OVER (ORDER BY ejaculated_date DESC)), 'FMDDD日 FMHH24時間 FMMI分') AS ejaculated_span
@ -151,6 +152,7 @@ id,
ejaculated_date, ejaculated_date,
note, note,
is_private, is_private,
is_too_sensitive,
link, link,
to_char(lead(ejaculated_date, 1, NULL) OVER (ORDER BY ejaculated_date DESC), 'YYYY/MM/DD HH24:MI') AS before_date, to_char(lead(ejaculated_date, 1, NULL) OVER (ORDER BY ejaculated_date DESC), 'YYYY/MM/DD HH24:MI') AS before_date,
to_char(ejaculated_date - (lead(ejaculated_date, 1, NULL) OVER (ORDER BY ejaculated_date DESC)), 'FMDDD日 FMHH24時間 FMMI分') AS ejaculated_span to_char(ejaculated_date - (lead(ejaculated_date, 1, NULL) OVER (ORDER BY ejaculated_date DESC)), 'FMDDD日 FMHH24時間 FMMI分') AS ejaculated_span

View File

@ -0,0 +1,32 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class AddIsTooSensitiveToEjaculations extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('ejaculations', function (Blueprint $table) {
$table->boolean('is_too_sensitive')->default(false);
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('ejaculations', function (Blueprint $table) {
$table->dropColumn('is_too_sensitive');
});
}
}

View File

@ -92,4 +92,10 @@ $(() => {
}); });
} }
}); });
$(document).on('click', '.card-spoiler-overlay', function (event) {
const $this = $(this);
$this.siblings(".card-link").removeClass("card-spoiler");
$this.remove();
});
}); });

View File

@ -30,4 +30,25 @@
.card-text { .card-text {
white-space: pre-line; white-space: pre-line;
} }
.card-spoiler-overlay {
position: absolute;
z-index: 1000;
display: flex;
align-items: center;
justify-content: center;
width: 100%;
height: 100%;
.warning-text {
padding: 10px;
background-color: rgba(240, 240, 240, 0.8);
border-radius: 5px;
}
}
.card-spoiler {
z-index: 1;
filter: blur(15px) grayscale(100%);
}
} }

View File

@ -19,7 +19,7 @@
<!-- okazu link --> <!-- okazu link -->
@if (!empty($ejaculation->link)) @if (!empty($ejaculation->link))
<div class="row mx-0"> <div class="row mx-0">
@component('components.link-card', ['link' => $ejaculation->link]) @component('components.link-card', ['link' => $ejaculation->link, 'is_too_sensitive' => $ejaculation->is_too_sensitive])
@endcomponent @endcomponent
<p class="d-flex align-items-baseline mb-2 col-12 px-0"> <p class="d-flex align-items-baseline mb-2 col-12 px-0">
<span class="oi oi-link-intact mr-1"></span><a class="overflow-hidden" href="{{ $ejaculation->link }}" target="_blank" rel="noopener">{{ $ejaculation->link }}</a> <span class="oi oi-link-intact mr-1"></span><a class="overflow-hidden" href="{{ $ejaculation->link }}" target="_blank" rel="noopener">{{ $ejaculation->link }}</a>

View File

@ -1,5 +1,10 @@
<div class="card link-card mb-2 px-0 col-12 d-none" style="font-size: small;"> <div class="card link-card mb-2 px-0 col-12 d-none" style="font-size: small;">
<a class="text-dark card-link" href="{{ $link }}" target="_blank" rel="noopener"> @if ($is_too_sensitive)
<div class="card-spoiler-overlay">
<span class="warning-text">クリックまたはタップで表示</span>
</div>
@endif
<a class="text-dark card-link {{ $is_too_sensitive ? 'card-spoiler' : '' }}" href="{{ $link }}" target="_blank" rel="noopener">
<div class="row no-gutters"> <div class="row no-gutters">
<div class="col-12 col-md-6 justify-content-center align-items-center"> <div class="col-12 col-md-6 justify-content-center align-items-center">
<img src="" alt="Thumbnail" class="w-100 bg-secondary"> <img src="" alt="Thumbnail" class="w-100 bg-secondary">

View File

@ -85,6 +85,12 @@
<span class="oi oi-lock-locked"></span> このチェックインを非公開にする <span class="oi oi-lock-locked"></span> このチェックインを非公開にする
</label> </label>
</div> </div>
<div class="custom-control custom-checkbox mb-3">
<input id="isTooSensitive" name="is_too_sensitive" type="checkbox" class="custom-control-input" {{ old('is_too_sensitive') || $defaults['is_too_sensitive'] ? 'checked' : '' }}>
<label class="custom-control-label" for="isTooSensitive">
<span class="oi oi-lock-locked"></span> チェックイン対象のオカズをより過激なオカズとして設定する
</label>
</div>
</div> </div>
</div> </div>

View File

@ -86,6 +86,12 @@
<span class="oi oi-lock-locked"></span> このチェックインを非公開にする <span class="oi oi-lock-locked"></span> このチェックインを非公開にする
</label> </label>
</div> </div>
<div class="custom-control custom-checkbox mb-3">
<input id="isTooSensitive" name="is_too_sensitive" type="checkbox" class="custom-control-input" {{ (is_bool(old('is_too_sensitive')) ? old('is_too_sensitive') : $ejaculation->is_too_sensitive) ? 'checked' : '' }}>
<label class="custom-control-label" for="isTooSensitive">
<span class="oi oi-lock-locked"></span> チェックイン対象のオカズをより過激なオカズとして設定する
</label>
</div>
</div> </div>
</div> </div>

View File

@ -47,7 +47,7 @@
<!-- okazu link --> <!-- okazu link -->
@if (!empty($ejaculation->link)) @if (!empty($ejaculation->link))
<div class="row mx-0"> <div class="row mx-0">
@component('components.link-card', ['link' => $ejaculation->link]) @component('components.link-card', ['link' => $ejaculation->link, 'is_too_sensitive' => $ejaculation->is_too_sensitive])
@endcomponent @endcomponent
<p class="d-flex align-items-baseline mb-2 col-12 px-0"> <p class="d-flex align-items-baseline mb-2 col-12 px-0">
<span class="oi oi-link-intact mr-1"></span><a class="overflow-hidden" href="{{ $ejaculation->link }}" target="_blank" rel="noopener">{{ $ejaculation->link }}</a> <span class="oi oi-link-intact mr-1"></span><a class="overflow-hidden" href="{{ $ejaculation->link }}" target="_blank" rel="noopener">{{ $ejaculation->link }}</a>

View File

@ -53,7 +53,7 @@
<!-- okazu link --> <!-- okazu link -->
@if (!empty($ejaculation->link)) @if (!empty($ejaculation->link))
<div class="row mx-0"> <div class="row mx-0">
@component('components.link-card', ['link' => $ejaculation->link]) @component('components.link-card', ['link' => $ejaculation->link, 'is_too_sensitive' => $ejaculation->is_too_sensitive])
@endcomponent @endcomponent
<p class="d-flex align-items-baseline mb-2 col-12 px-0"> <p class="d-flex align-items-baseline mb-2 col-12 px-0">
<span class="oi oi-link-intact mr-1"></span><a class="overflow-hidden" href="{{ $ejaculation->link }}" target="_blank" rel="noopener">{{ $ejaculation->link }}</a> <span class="oi oi-link-intact mr-1"></span><a class="overflow-hidden" href="{{ $ejaculation->link }}" target="_blank" rel="noopener">{{ $ejaculation->link }}</a>