From 78bb7dae28e7e556c24375ae9aff606ce5321bf9 Mon Sep 17 00:00:00 2001 From: MitarashiDango Date: Mon, 16 Sep 2019 13:24:22 +0900 Subject: [PATCH 1/5] =?UTF-8?q?=E3=82=BF=E3=82=B0=E4=B8=80=E8=A6=A7?= =?UTF-8?q?=E7=94=BB=E9=9D=A2=E3=82=92=E8=BF=BD=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Http/Controllers/TagController.php | 29 ++++++++++++++++++++++++++ resources/assets/sass/app.scss | 3 +++ resources/assets/sass/tag/_index.scss | 22 +++++++++++++++++++ resources/views/layouts/base.blade.php | 3 +++ resources/views/tag/index.blade.php | 20 ++++++++++++++++++ routes/web.php | 2 ++ 6 files changed, 79 insertions(+) create mode 100644 app/Http/Controllers/TagController.php create mode 100644 resources/assets/sass/tag/_index.scss create mode 100644 resources/views/tag/index.blade.php diff --git a/app/Http/Controllers/TagController.php b/app/Http/Controllers/TagController.php new file mode 100644 index 0000000..3e489d5 --- /dev/null +++ b/app/Http/Controllers/TagController.php @@ -0,0 +1,29 @@ +join('ejaculation_tag', 'tags.id', '=', 'ejaculation_tag.tag_id') + ->join('ejaculations', 'ejaculations.id', '=', 'ejaculation_tag.ejaculation_id') + ->where('ejaculations.is_private', false) + ->groupBy('tags.name') + ->orderByDesc('checkins_count') + ->orderBy('tags.name') + ->paginate(100); + + return view('tag.index', compact('tags')); + } +} diff --git a/resources/assets/sass/app.scss b/resources/assets/sass/app.scss index 0fe2b4f..6f38126 100644 --- a/resources/assets/sass/app.scss +++ b/resources/assets/sass/app.scss @@ -13,3 +13,6 @@ $primary: #e53fb1; // Components @import "components/ejaculation"; @import "components/link-card"; + +// Tag +@import "tag/index"; diff --git a/resources/assets/sass/tag/_index.scss b/resources/assets/sass/tag/_index.scss new file mode 100644 index 0000000..eed3db6 --- /dev/null +++ b/resources/assets/sass/tag/_index.scss @@ -0,0 +1,22 @@ +.tags { + & > .btn-tag { + width: 100%; + + .tag-name { + display: inline-block; + max-width: 80%; + overflow: hidden; + line-height: 40px; + text-overflow: ellipsis; + white-space: nowrap; + vertical-align: middle; + } + + .checkins-count { + display: inline-block; + line-height: 40px; + white-space: nowrap; + vertical-align: middle; + } + } +} diff --git a/resources/views/layouts/base.blade.php b/resources/views/layouts/base.blade.php index 14943e4..f4f4f77 100644 --- a/resources/views/layouts/base.blade.php +++ b/resources/views/layouts/base.blade.php @@ -79,6 +79,9 @@ + {{----}} diff --git a/resources/views/tag/index.blade.php b/resources/views/tag/index.blade.php new file mode 100644 index 0000000..fb088b4 --- /dev/null +++ b/resources/views/tag/index.blade.php @@ -0,0 +1,20 @@ +@extends('layouts.base') + +@section('title', 'タグ一覧') + +@section('content') +
+

タグ一覧

+

公開チェックインに付けられているタグを、チェックイン数の多い順で表示しています。

+
+
+
+ @foreach($tags as $tag) + + @endforeach +
+ {{ $tags->links(null, ['className' => 'mt-4 justify-content-center']) }} +
+@endsection diff --git a/routes/web.php b/routes/web.php index 6eba7e1..6c0fbdb 100644 --- a/routes/web.php +++ b/routes/web.php @@ -46,6 +46,8 @@ Route::redirect('/search', '/search/checkin', 301); Route::get('/search/checkin', 'SearchController@index')->name('search'); Route::get('/search/related-tag', 'SearchController@relatedTag')->name('search.related-tag'); +Route::get('/tag', 'TagController@index')->name('tag'); + Route::middleware('can:admin') ->namespace('Admin') ->prefix('admin') From dd07940aeaabadfb4bb11d5ce08228f6f89d42e3 Mon Sep 17 00:00:00 2001 From: MitarashiDango Date: Mon, 16 Sep 2019 14:02:19 +0900 Subject: [PATCH 2/5] =?UTF-8?q?=E3=82=B9=E3=83=9E=E3=83=9B=E5=90=91?= =?UTF-8?q?=E3=81=91=E3=83=AC=E3=82=A4=E3=82=A2=E3=82=A6=E3=83=88=E3=81=B8?= =?UTF-8?q?=E3=82=BF=E3=82=B0=E4=B8=80=E8=A6=A7=E3=83=9C=E3=82=BF=E3=83=B3?= =?UTF-8?q?=E3=82=92=E8=BF=BD=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- resources/views/layouts/base.blade.php | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/resources/views/layouts/base.blade.php b/resources/views/layouts/base.blade.php index f4f4f77..9d03065 100644 --- a/resources/views/layouts/base.blade.php +++ b/resources/views/layouts/base.blade.php @@ -140,6 +140,13 @@ オカズ +
+ +
+
+
{{--
ランキング From d5ee59825f95fb3b0d19baec9889e5136fcc2a9f Mon Sep 17 00:00:00 2001 From: MitarashiDango Date: Thu, 19 Sep 2019 00:09:41 +0900 Subject: [PATCH 3/5] =?UTF-8?q?=E5=B9=B4=E9=BD=A2=E7=A2=BA=E8=AA=8D?= =?UTF-8?q?=E3=83=80=E3=82=A4=E3=82=A2=E3=83=AD=E3=82=B0=E8=A1=A8=E7=A4=BA?= =?UTF-8?q?=E6=99=82=E3=81=AE=E3=83=96=E3=83=A9=E3=83=BC=E3=82=92=E3=82=BF?= =?UTF-8?q?=E3=82=B0=E4=B8=80=E8=A6=A7=E3=81=B8=E9=81=A9=E7=94=A8=E3=81=95?= =?UTF-8?q?=E3=81=9B=E3=82=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- resources/views/tag/index.blade.php | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/resources/views/tag/index.blade.php b/resources/views/tag/index.blade.php index fb088b4..e097f4c 100644 --- a/resources/views/tag/index.blade.php +++ b/resources/views/tag/index.blade.php @@ -6,15 +6,15 @@

タグ一覧

公開チェックインに付けられているタグを、チェックイン数の多い順で表示しています。

-
-
-
- @foreach($tags as $tag) - - @endforeach +
+
+ @foreach($tags as $tag) + + @endforeach +
+ {{ $tags->links(null, ['className' => 'mt-4 justify-content-center']) }}
- {{ $tags->links(null, ['className' => 'mt-4 justify-content-center']) }}
@endsection From a434a45e4a938f2513bce397a33672eeaf3f14c2 Mon Sep 17 00:00:00 2001 From: MitarashiDango Date: Wed, 25 Sep 2019 23:39:36 +0900 Subject: [PATCH 4/5] =?UTF-8?q?=E3=82=BF=E3=82=B0=E4=B8=80=E8=A6=A7?= =?UTF-8?q?=E3=81=AE=E4=BB=B6=E6=95=B0=E3=82=AB=E3=82=A6=E3=83=B3=E3=83=88?= =?UTF-8?q?=E6=9D=A1=E4=BB=B6=E3=82=92=E6=A4=9C=E7=B4=A2=E6=A9=9F=E8=83=BD?= =?UTF-8?q?=E3=81=A8=E6=8F=83=E3=81=88=E3=82=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Http/Controllers/TagController.php | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/app/Http/Controllers/TagController.php b/app/Http/Controllers/TagController.php index 3e489d5..0fb8859 100644 --- a/app/Http/Controllers/TagController.php +++ b/app/Http/Controllers/TagController.php @@ -4,6 +4,7 @@ namespace App\Http\Controllers; use App\Tag; use Illuminate\Http\Request; +use Illuminate\Support\Facades\Auth; use Illuminate\Support\Facades\DB; class TagController extends Controller @@ -18,7 +19,14 @@ SQL )) ->join('ejaculation_tag', 'tags.id', '=', 'ejaculation_tag.tag_id') ->join('ejaculations', 'ejaculations.id', '=', 'ejaculation_tag.ejaculation_id') + ->join('users', 'users.id', '=', 'ejaculations.user_id') ->where('ejaculations.is_private', false) + ->where(function ($query) { + $query->where('users.is_protected', false); + if (Auth::check()) { + $query->orWhere('users.id', Auth::id()); + } + }) ->groupBy('tags.name') ->orderByDesc('checkins_count') ->orderBy('tags.name') From 900e4c94a7352f86a2902d51adf11a41b4824af2 Mon Sep 17 00:00:00 2001 From: MitarashiDango Date: Wed, 25 Sep 2019 23:46:06 +0900 Subject: [PATCH 5/5] =?UTF-8?q?=E6=80=92=E3=82=89=E3=82=8C=E3=81=9F?= =?UTF-8?q?=E3=81=AE=E3=81=A7=E3=81=AA=E3=81=8A=E3=81=97=E3=81=9F...?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Http/Controllers/TagController.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/Http/Controllers/TagController.php b/app/Http/Controllers/TagController.php index 0fb8859..811153f 100644 --- a/app/Http/Controllers/TagController.php +++ b/app/Http/Controllers/TagController.php @@ -16,7 +16,7 @@ class TagController extends Controller tags.name, count(*) AS "checkins_count" SQL - )) + )) ->join('ejaculation_tag', 'tags.id', '=', 'ejaculation_tag.tag_id') ->join('ejaculations', 'ejaculations.id', '=', 'ejaculation_tag.ejaculation_id') ->join('users', 'users.id', '=', 'ejaculations.user_id')