Merge pull request #124 from shikorism/feature/public-timeline

お惣菜コーナーをもっとたくさん見る画面
This commit is contained in:
shibafu 2019-03-05 01:09:15 +09:00 committed by GitHub
commit 7a421d648d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 92 additions and 0 deletions

View File

@ -0,0 +1,23 @@
<?php
namespace App\Http\Controllers;
use App\Ejaculation;
use Illuminate\Http\Request;
class TimelineController extends Controller
{
public function showPublic()
{
$ejaculations = Ejaculation::join('users', 'users.id', '=', 'ejaculations.user_id')
->where('users.is_protected', false)
->where('ejaculations.is_private', false)
->where('ejaculations.link', '<>', '')
->orderBy('ejaculations.ejaculated_date', 'desc')
->select('ejaculations.*')
->with('user', 'tags')
->paginate(21);
return view('timeline.public')->with(compact('ejaculations'));
}
}

View File

@ -91,6 +91,9 @@
@endif @endif
</li> </li>
@endforeach @endforeach
<li class="list-group-item no-side-border text-right">
<a href="{{ route('timeline.public') }}">もっと見る &raquo;</a>
</li>
</ul> </ul>
@endif @endif
</div> </div>

View File

@ -0,0 +1,64 @@
@extends('layouts.base')
@section('title', 'お惣菜コーナー')
@section('content')
<div class="container pb-1">
<h2 class="mb-3">お惣菜コーナー</h2>
<p class="text-secondary">公開チェックインから、オカズリンク付きのものを表示しています。</p>
</div>
<div class="container-fluid">
<div class="row mx-1">
@foreach($ejaculations as $ejaculation)
<div class="col-12 col-lg-6 col-xl-4 py-3 tis-word-wrap border-top">
<!-- span -->
<div class="d-flex justify-content-between">
<h5>
<a href="{{ route('user.profile', ['id' => $ejaculation->user->name]) }}" class="text-dark"><img src="{{ $ejaculation->user->getProfileImageUrl(30) }}" width="30" height="30" class="rounded d-inline-block align-bottom"> {{ $ejaculation->user->display_name }}</a>
<a href="{{ route('checkin.show', ['id' => $ejaculation->id]) }}" class="text-muted"><small>{{ $ejaculation->ejaculated_date->format('Y/m/d H:i') }}</small></a>
</h5>
<div>
<a class="text-secondary timeline-action-item" href="{{ route('checkin', ['link' => $ejaculation->link, 'tags' => $ejaculation->textTags()]) }}"><span class="oi oi-reload" data-toggle="tooltip" data-placement="bottom" title="同じオカズでチェックイン"></span></a>
</div>
</div>
<!-- tags -->
@if ($ejaculation->is_private || $ejaculation->tags->isNotEmpty())
<p class="mb-2">
@if ($ejaculation->is_private)
<span class="badge badge-warning"><span class="oi oi-lock-locked"></span> 非公開</span>
@endif
@foreach ($ejaculation->tags as $tag)
<a class="badge badge-secondary" href="{{ route('search', ['q' => $tag->name]) }}"><span class="oi oi-tag"></span> {{ $tag->name }}</a>
@endforeach
</p>
@endif
<!-- okazu link -->
@if (!empty($ejaculation->link))
<div class="row mx-0">
@component('components.link-card', ['link' => $ejaculation->link])
@endcomponent
<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>
</p>
</div>
@endif
<!-- note -->
@if (!empty($ejaculation->note))
<p class="mb-0 tis-word-wrap">
{!! Formatter::linkify(nl2br(e($ejaculation->note))) !!}
</p>
@endif
</div>
@endforeach
</div>
{{ $ejaculations->links(null, ['className' => 'mt-4 justify-content-center']) }}
</div>
@endsection
@push('script')
<script>
$('.link-card').linkCard({
endpoint: '{{ url('/api/checkin/card') }}'
});
</script>
@endpush

View File

@ -28,6 +28,8 @@ Route::middleware('auth')->group(function () {
Route::put('/checkin/{id}', 'EjaculationController@update')->name('checkin.update'); Route::put('/checkin/{id}', 'EjaculationController@update')->name('checkin.update');
Route::delete('/checkin/{id}', 'EjaculationController@destroy')->name('checkin.destroy'); Route::delete('/checkin/{id}', 'EjaculationController@destroy')->name('checkin.destroy');
Route::get('/timeline/public', 'TimelineController@showPublic')->name('timeline.public');
Route::redirect('/setting', '/setting/profile', 301); Route::redirect('/setting', '/setting/profile', 301);
Route::get('/setting/profile', 'SettingController@profile')->name('setting'); Route::get('/setting/profile', 'SettingController@profile')->name('setting');
Route::post('/setting/profile', 'SettingController@updateProfile')->name('setting.profile.update'); Route::post('/setting/profile', 'SettingController@updateProfile')->name('setting.profile.update');