ソースを参照

ページネーション

dev-master
コミット
4472773f4b
  1. 2
      app/Http/Controllers/Peertube/Channel.php
  2. 12
      app/Http/Controllers/Peertube/Videos/Local.php
  3. 12
      app/Http/Controllers/Peertube/Videos/Recentlyadded.php
  4. 8
      resources/views/theme/techsuwa/component/peertube/parts/c/videos.blade.php
  5. 2
      resources/views/theme/techsuwa/component/peertube/parts/common/paginate.blade.php
  6. 3
      resources/views/theme/techsuwa/component/peertube/videos/local.blade.php
  7. 3
      resources/views/theme/techsuwa/component/peertube/videos/recentlyadded.blade.php

2
app/Http/Controllers/Peertube/Channel.php

@ -20,10 +20,12 @@ class Channel extends Common {
'page' => 'channel',
'cat' => $cat,
'paginate' => $page,
'pagetotal' => 500,
'userinfo' => $this->common->user,
];
$res['channel'] = $this->getChannel($id);
$res['video'] = $this->getVideo($id, ($page*$this->count), $this->count);
$res['pagetotal'] = $res['video']->total;
return view('pages.peertube.c', ['res' => $res]);
}

12
app/Http/Controllers/Peertube/Videos/Local.php

@ -8,22 +8,26 @@ use App\Http\Controllers\Peertube\Common;
class Local extends Common {
private $common;
private $count;
public function __construct () {
$this->common = new Common;
$this->count = 50;
}
public function index () {
public function index ($page=0) {
$res = [
'page' => 'videoslist',
'paginate' => $page,
'pagetotal' => 500,
'userinfo' => $this->common->user,
];
$res['video'] = $this->getVideo();
$res['video'] = $this->getVideo(($page*$this->count), $this->count);
return view('pages.peertube.videos.local', ['res' => $res]);
}
function getVideo () {
$get = $this->ptapi_get('/api/v1/videos/?start=0&count=50&sort=-publishedAt&filter=local&skipCount=true&nsfw=both');
function getVideo ($start, $count) {
$get = $this->ptapi_get('/api/v1/videos/?start='.$start.'&count='.$count.'&sort=-publishedAt&filter=local&skipCount=true&nsfw=both');
return $this->vidlist($get);
}
}

12
app/Http/Controllers/Peertube/Videos/Recentlyadded.php

@ -8,22 +8,26 @@ use App\Http\Controllers\Peertube\Common;
class Recentlyadded extends Common {
private $common;
private $count;
public function __construct () {
$this->common = new Common;
$this->count = 25;
}
public function index () {
public function index ($page=0) {
$res = [
'page' => 'videoslist',
'paginate' => $page,
'pagetotal' => 500,
'userinfo' => $this->common->user,
];
$res['video'] = $this->getVideo();
$res['video'] = $this->getVideo(($page*$this->count), $this->count);
return view('pages.peertube.videos.recentlyadded', ['res' => $res]);
}
function getVideo () {
$get = $this->ptapi_get('/api/v1/videos/?start=0&count=25&sort=-publishedAt&skipCount=true&nsfw=both');
function getVideo ($start, $count) {
$get = $this->ptapi_get('/api/v1/videos/?start='.$start.'&count='.$count.'&sort=-publishedAt&skipCount=true&nsfw=both');
return $this->vidlist($get);
}
}

8
resources/views/theme/techsuwa/component/peertube/parts/c/videos.blade.php

@ -19,9 +19,9 @@
@include('theme.'.env('THEME').'.component.peertube.parts.common.videominature')
@endforeach
</div>
@include('theme.'.env('THEME').'.component.peertube.parts.common.paginate', [
'root' => '/peertube/c/'.$res['channel']->name.($res['channel']->host != 'video.076.ne.jp' ? '@'.$res['channel']->host : '').'/'.$res['cat']
])
</div>
</my-videos-list>
</my-video-channel-videos>
@if ($res['paginate'] != 0) <a href="/peertube/c/{{ $res['channel']->name }}{{ $res['channel']->host != 'video.076.ne.jp' ? '@'.$res['channel']->host : '' }}/{{ $res['cat'] }}/{{ $res['paginate']-1 }}" class="block-title">戻り</a> @endif
@if (($res['paginate']*25) < $res['video']->total) <a href="/peertube/c/{{ $res['channel']->name }}{{ $res['channel']->host != 'video.076.ne.jp' ? '@'.$res['channel']->host : '' }}/{{ $res['cat'] }}/{{ $res['paginate']+1 }}" class="block-title"></a> @endif
</my-video-channel-videos>

2
resources/views/theme/techsuwa/component/peertube/parts/common/paginate.blade.php

@ -0,0 +1,2 @@
@if ($res['paginate'] != 0) <a href="{{ $root }}/{{ $res['paginate']-1 }}" class="block-title">戻り</a> @endif
@if (($res['paginate']*25) < $res['pagetotal']) <a href="{{ $root }}/{{ $res['paginate']+1 }}" class="block-title"></a> @endif

3
resources/views/theme/techsuwa/component/peertube/videos/local.blade.php

@ -19,6 +19,9 @@
<div _ngcontent-jba-c163="" class="action-block"></div>
</div>
@include('theme.'.env('THEME').'.component.peertube.parts.common.videosbydate')
@include('theme.'.env('THEME').'.component.peertube.parts.common.paginate', [
'root' => '/peertube/videos/local'
])
</div>
</div>
</div>

3
resources/views/theme/techsuwa/component/peertube/videos/recentlyadded.blade.php

@ -19,6 +19,9 @@
<div _ngcontent-jba-c163="" class="action-block"></div>
</div>
@include('theme.'.env('THEME').'.component.peertube.parts.common.videosbydate')
@include('theme.'.env('THEME').'.component.peertube.parts.common.paginate', [
'root' => '/peertube/videos/recently-added'
])
</div>
</div>
</div>

読み込み中…
キャンセル
保存