Merge branch 'develop'

This commit is contained in:
shibafu 2018-03-06 23:50:12 +09:00
commit 46f049c2b8
7 changed files with 75 additions and 46 deletions

View File

@ -12,9 +12,18 @@ use Illuminate\Support\Facades\Auth;
class EjaculationController extends Controller class EjaculationController extends Controller
{ {
public function create() public function create(Request $request)
{ {
return view('ejaculation.checkin'); $defaults = [
'date' => $request->input('date', date('Y/m/d')),
'time' => $request->input('time', date('H:i')),
'link' => $request->input('link', ''),
'tags' => $request->input('tags', ''),
'note' => $request->input('note', ''),
'is_private' => $request->input('is_private', 0) == 1
];
return view('ejaculation.checkin')->with('defaults', $defaults);
} }
public function store(Request $request) public function store(Request $request)
@ -24,7 +33,7 @@ class EjaculationController extends Controller
$inputs['note'] = str_replace(["\r\n", "\r"], "\n", $inputs['note']); $inputs['note'] = str_replace(["\r\n", "\r"], "\n", $inputs['note']);
} }
Validator::make($inputs, [ $validator = Validator::make($inputs, [
'date' => 'required|date_format:Y/m/d', 'date' => 'required|date_format:Y/m/d',
'time' => 'required|date_format:H:i', 'time' => 'required|date_format:H:i',
'note' => 'nullable|string|max:500', 'note' => 'nullable|string|max:500',
@ -38,7 +47,11 @@ class EjaculationController extends Controller
$validator->errors()->add('datetime', '既にこの日時にチェックインしているため、登録できません。'); $validator->errors()->add('datetime', '既にこの日時にチェックインしているため、登録できません。');
} }
} }
})->validate(); });
if ($validator->fails()) {
return redirect()->route('checkin')->withErrors($validator)->withInput();
}
$ejaculation = Ejaculation::create([ $ejaculation = Ejaculation::create([
'user_id' => Auth::id(), 'user_id' => Auth::id(),
@ -98,7 +111,7 @@ class EjaculationController extends Controller
$inputs['note'] = str_replace(["\r\n", "\r"], "\n", $inputs['note']); $inputs['note'] = str_replace(["\r\n", "\r"], "\n", $inputs['note']);
} }
Validator::make($inputs, [ $validator = Validator::make($inputs, [
'date' => 'required|date_format:Y/m/d', 'date' => 'required|date_format:Y/m/d',
'time' => 'required|date_format:H:i', 'time' => 'required|date_format:H:i',
'note' => 'nullable|string|max:500', 'note' => 'nullable|string|max:500',
@ -112,7 +125,11 @@ class EjaculationController extends Controller
$validator->errors()->add('datetime', '既にこの日時にチェックインしているため、登録できません。'); $validator->errors()->add('datetime', '既にこの日時にチェックインしているため、登録できません。');
} }
} }
})->validate(); });
if ($validator->fails()) {
return redirect()->route('checkin')->withErrors($validator)->withInput();
}
$ejaculation->fill([ $ejaculation->fill([
'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']),

View File

@ -13,7 +13,7 @@
<div class="form-group col-sm-6"> <div class="form-group col-sm-6">
<label for="date"><span class="oi oi-calendar"></span> 日付</label> <label for="date"><span class="oi oi-calendar"></span> 日付</label>
<input id="date" name="date" type="text" class="form-control {{ $errors->has('date') || $errors->has('datetime') ? ' is-invalid' : '' }}" <input id="date" name="date" type="text" class="form-control {{ $errors->has('date') || $errors->has('datetime') ? ' is-invalid' : '' }}"
pattern="^20[0-9]{2}/(0[1-9]|1[0-2])/(0[1-9]|[12][0-9]|3[01])$" value="{{ old('date') ?? date('Y/m/d') }}" required> pattern="^20[0-9]{2}/(0[1-9]|1[0-2])/(0[1-9]|[12][0-9]|3[01])$" value="{{ old('date') ?? $defaults['date'] }}" required>
@if ($errors->has('date')) @if ($errors->has('date'))
<div class="invalid-feedback">{{ $errors->first('date') }}</div> <div class="invalid-feedback">{{ $errors->first('date') }}</div>
@ -22,7 +22,7 @@
<div class="form-group col-sm-6"> <div class="form-group col-sm-6">
<label for="time"><span class="oi oi-clock"></span> 時刻</label> <label for="time"><span class="oi oi-clock"></span> 時刻</label>
<input id="time" name="time" type="text" class="form-control {{ $errors->has('time') || $errors->has('datetime') ? ' is-invalid' : '' }}" <input id="time" name="time" type="text" class="form-control {{ $errors->has('time') || $errors->has('datetime') ? ' is-invalid' : '' }}"
pattern="^([01][0-9]|2[0-3]):[0-5][0-9]$" value="{{ old('time') ?? date('H:i') }}" required> pattern="^([01][0-9]|2[0-3]):[0-5][0-9]$" value="{{ old('time') ?? $defaults['time'] }}" required>
@if ($errors->has('time')) @if ($errors->has('time'))
<div class="invalid-feedback">{{ $errors->first('time') }}</div> <div class="invalid-feedback">{{ $errors->first('time') }}</div>
@ -36,7 +36,7 @@
</div> </div>
<div class="form-row"> <div class="form-row">
<div class="form-group col-sm-12"> <div class="form-group col-sm-12">
<input name="tags" type="hidden" value="{{ old('tags') }}"> <input name="tags" type="hidden" value="{{ old('tags') ?? $defaults['tags'] }}">
<label for="tagInput"><span class="oi oi-tags"></span> タグ</label> <label for="tagInput"><span class="oi oi-tags"></span> タグ</label>
<div class="form-control {{ $errors->has('tags') ? ' is-invalid' : '' }}"> <div class="form-control {{ $errors->has('tags') ? ' is-invalid' : '' }}">
<ul id="tags" class="list-inline d-inline"></ul> <ul id="tags" class="list-inline d-inline"></ul>
@ -54,7 +54,7 @@
<div class="form-row"> <div class="form-row">
<div class="form-group col-sm-12"> <div class="form-group col-sm-12">
<label for="link"><span class="oi oi-link-intact"></span> オカズリンク</label> <label for="link"><span class="oi oi-link-intact"></span> オカズリンク</label>
<input id="link" name="link" type="text" class="form-control {{ $errors->has('link') ? ' is-invalid' : '' }}" placeholder="http://..." value="{{ old('link') }}"> <input id="link" name="link" type="text" class="form-control {{ $errors->has('link') ? ' is-invalid' : '' }}" placeholder="http://..." value="{{ old('link') ?? $defaults['link'] }}">
<small class="form-text text-muted"> <small class="form-text text-muted">
オカズのURLを貼り付けて登録することができます。 オカズのURLを貼り付けて登録することができます。
</small> </small>
@ -66,7 +66,7 @@
<div class="form-row"> <div class="form-row">
<div class="form-group col-sm-12"> <div class="form-group col-sm-12">
<label for="note"><span class="oi oi-comment-square"></span> ノート</label> <label for="note"><span class="oi oi-comment-square"></span> ノート</label>
<textarea id="note" name="note" class="form-control {{ $errors->has('note') ? ' is-invalid' : '' }}" rows="4">{{ old('note') }}</textarea> <textarea id="note" name="note" class="form-control {{ $errors->has('note') ? ' is-invalid' : '' }}" rows="4">{{ old('note') ?? $defaults['note'] }}</textarea>
<small class="form-text text-muted"> <small class="form-text text-muted">
最大 500 文字 最大 500 文字
</small> </small>
@ -80,7 +80,7 @@
<div class="form-group col-sm-12"> <div class="form-group col-sm-12">
<div class="form-check"> <div class="form-check">
<label class="custom-control custom-checkbox"> <label class="custom-control custom-checkbox">
<input name="is_private" type="checkbox" class="custom-control-input" {{ old('is_private') ? 'checked' : '' }}> <input name="is_private" type="checkbox" class="custom-control-input" {{ old('is_private') || $defaults['is_private'] ? 'checked' : '' }}>
<span class="custom-control-indicator"></span> <span class="custom-control-indicator"></span>
<span class="custom-control-description"> <span class="custom-control-description">
<span class="oi oi-lock-locked"></span> このチェックインを非公開にする <span class="oi oi-lock-locked"></span> このチェックインを非公開にする

View File

@ -46,18 +46,20 @@
@endif @endif
<!-- okazu link --> <!-- okazu link -->
@if (!empty($ejaculation->link)) @if (!empty($ejaculation->link))
<div class="card link-card mb-2 w-50 d-none" style="font-size: small;"> <div class="row mx-0">
<a class="text-dark card-link" href="{{ $ejaculation->link }}" target="_blank" rel="noopener"> <div class="card link-card mb-2 px-0 col-12 col-md-6 d-none" style="font-size: small;">
<img src="" alt="Thumbnail" class="card-img-top bg-secondary"> <a class="text-dark card-link" href="{{ $ejaculation->link }}" target="_blank" rel="noopener">
<div class="card-body"> <img src="" alt="Thumbnail" class="card-img-top bg-secondary">
<h6 class="card-title font-weight-bold">タイトル</h6> <div class="card-body">
<p class="card-text">コンテンツの説明文</p> <h6 class="card-title font-weight-bold">タイトル</h6>
<p class="card-text">コンテンツの説明文</p>
</div>
</a>
</div> </div>
</a> <p class="mb-2 col-12 px-0">
</div> <span class="oi oi-link-intact mr-1"></span><a href="{{ $ejaculation->link }}" target="_blank" rel="noopener">{{ $ejaculation->link }}</a>
<p class="mb-2"> </p>
<span class="oi oi-link-intact mr-1"></span><a href="{{ $ejaculation->link }}" target="_blank" rel="noopener">{{ $ejaculation->link }}</a> </div>
</p>
@endif @endif
<!-- note --> <!-- note -->
@if (!empty($ejaculation->note)) @if (!empty($ejaculation->note))

View File

@ -48,18 +48,20 @@
@endif @endif
<!-- okazu link --> <!-- okazu link -->
@if (!empty($ejaculation->link)) @if (!empty($ejaculation->link))
<div class="card link-card mb-2 w-50 d-none" style="font-size: small;"> <div class="row mx-0">
<a class="text-dark card-link" href="{{ $ejaculation->link }}" target="_blank" rel="noopener"> <div class="card link-card mb-2 px-0 col-12 col-md-6 d-none" style="font-size: small;">
<img src="" alt="Thumbnail" class="card-img-top bg-secondary"> <a class="text-dark card-link" href="{{ $ejaculation->link }}" target="_blank" rel="noopener">
<div class="card-body"> <img src="" alt="Thumbnail" class="card-img-top bg-secondary">
<h6 class="card-title font-weight-bold">タイトル</h6> <div class="card-body">
<p class="card-text">コンテンツの説明文</p> <h6 class="card-title font-weight-bold">タイトル</h6>
</div> <p class="card-text">コンテンツの説明文</p>
</a> </div>
</a>
</div>
<p class="mb-2 col-12 px-0">
<span class="oi oi-link-intact mr-1"></span><a href="{{ $ejaculation->link }}" target="_blank" rel="noopener">{{ $ejaculation->link }}</a>
</p>
</div> </div>
<p class="mb-2">
<span class="oi oi-link-intact mr-1"></span><a href="{{ $ejaculation->link }}" target="_blank" rel="noopener">{{ $ejaculation->link }}</a>
</p>
@endif @endif
<!-- note --> <!-- note -->
@if (!empty($ejaculation->note)) @if (!empty($ejaculation->note))

View File

@ -61,7 +61,12 @@
</form> </form>
@endauth @endauth
@guest @guest
<form class="form-inline ml-auto"> <ul class="navbar-nav ml-auto mr-2">
<li class="nav-item">
<a href="{{ route('register') }}" class="nav-link">会員登録</a>
</li>
</ul>
<form class="form-inline">
<a href="{{ route('login') }}" class="btn btn-outline-secondary">ログイン</a> <a href="{{ route('login') }}" class="btn btn-outline-secondary">ログイン</a>
</form> </form>
@endguest @endguest

View File

@ -32,18 +32,20 @@
@endif @endif
<!-- okazu link --> <!-- okazu link -->
@if (!empty($ejaculation->link)) @if (!empty($ejaculation->link))
<div class="card link-card mb-2 w-50 d-none" style="font-size: small;"> <div class="row mx-0">
<a class="text-dark card-link" href="{{ $ejaculation->link }}" target="_blank" rel="noopener"> <div class="card link-card mb-2 px-0 col-12 col-md-6 d-none" style="font-size: small;">
<img src="" alt="Thumbnail" class="card-img-top bg-secondary"> <a class="text-dark card-link" href="{{ $ejaculation->link }}" target="_blank" rel="noopener">
<div class="card-body"> <img src="" alt="Thumbnail" class="card-img-top bg-secondary">
<h6 class="card-title font-weight-bold">タイトル</h6> <div class="card-body">
<p class="card-text">コンテンツの説明文</p> <h6 class="card-title font-weight-bold">タイトル</h6>
<p class="card-text">コンテンツの説明文</p>
</div>
</a>
</div> </div>
</a> <p class="mb-2 col-12 px-0">
</div> <span class="oi oi-link-intact mr-1"></span><a href="{{ $ejaculation->link }}" target="_blank" rel="noopener">{{ $ejaculation->link }}</a>
<p class="mb-2"> </p>
<span class="oi oi-link-intact mr-1"></span><a href="{{ $ejaculation->link }}" target="_blank" rel="noopener">{{ $ejaculation->link }}</a> </div>
</p>
@endif @endif
<!-- note --> <!-- note -->
@if (!empty($ejaculation->note)) @if (!empty($ejaculation->note))

View File

@ -32,6 +32,7 @@
domain: 'month', domain: 'month',
subDomain: 'day', subDomain: 'day',
domainLabelFormat: '%Y/%m', domainLabelFormat: '%Y/%m',
weekStartOnMonday: false,
start: new Date({{ \Carbon\Carbon::now()->addMonths(-9)->timestamp * 1000 }}), start: new Date({{ \Carbon\Carbon::now()->addMonths(-9)->timestamp * 1000 }}),
range: 10, range: 10,
data: @json($dailySum), data: @json($dailySum),