Added app store pagination
This commit is contained in:
parent
b8087bf29c
commit
2ea4722dcf
@ -23,7 +23,15 @@ class Tiles extends Controller
|
||||
{
|
||||
$this->checkApiToken();
|
||||
|
||||
$data = $this->getModulesByCategory($alias);
|
||||
$page = request('page', 1);
|
||||
|
||||
$request = [
|
||||
'query' => [
|
||||
'page' => $page,
|
||||
]
|
||||
];
|
||||
|
||||
$data = $this->getModulesByCategory($alias, $request);
|
||||
|
||||
$title = $data->category->name;
|
||||
$modules = $data->modules;
|
||||
@ -41,8 +49,16 @@ class Tiles extends Controller
|
||||
{
|
||||
$this->checkApiToken();
|
||||
|
||||
$page = request('page', 1);
|
||||
|
||||
$data = [
|
||||
'query' => [
|
||||
'page' => $page,
|
||||
]
|
||||
];
|
||||
|
||||
$title = trans('modules.top_paid');
|
||||
$modules = $this->getPaidModules();
|
||||
$modules = $this->getPaidModules($data);
|
||||
$installed = Module::all()->pluck('status', 'alias')->toArray();
|
||||
|
||||
return view('modules.tiles.index', compact('title', 'modules', 'installed'));
|
||||
@ -57,8 +73,16 @@ class Tiles extends Controller
|
||||
{
|
||||
$this->checkApiToken();
|
||||
|
||||
$page = request('page', 1);
|
||||
|
||||
$data = [
|
||||
'query' => [
|
||||
'page' => $page,
|
||||
]
|
||||
];
|
||||
|
||||
$title = trans('modules.new');
|
||||
$modules = $this->getNewModules();
|
||||
$modules = $this->getNewModules($data);
|
||||
$installed = Module::all()->pluck('status', 'alias')->toArray();
|
||||
|
||||
return view('modules.tiles.index', compact('title', 'modules', 'installed'));
|
||||
@ -73,8 +97,16 @@ class Tiles extends Controller
|
||||
{
|
||||
$this->checkApiToken();
|
||||
|
||||
$page = request('page', 1);
|
||||
|
||||
$data = [
|
||||
'query' => [
|
||||
'page' => $page,
|
||||
]
|
||||
];
|
||||
|
||||
$title = trans('modules.top_free');
|
||||
$modules = $this->getFreeModules();
|
||||
$modules = $this->getFreeModules($data);
|
||||
$installed = Module::all()->pluck('status', 'alias')->toArray();
|
||||
|
||||
return view('modules.tiles.index', compact('title', 'modules', 'installed'));
|
||||
@ -90,10 +122,12 @@ class Tiles extends Controller
|
||||
$this->checkApiToken();
|
||||
|
||||
$keyword = $request['keyword'];
|
||||
$page = request('page', 1);
|
||||
|
||||
$data = [
|
||||
'query' => [
|
||||
'keyword' => $keyword,
|
||||
'page' => $page,
|
||||
]
|
||||
];
|
||||
|
||||
|
@ -68,9 +68,9 @@ trait Modules
|
||||
return [];
|
||||
}
|
||||
|
||||
public function getModulesByCategory($alias)
|
||||
public function getModulesByCategory($alias, $data = [])
|
||||
{
|
||||
$response = $this->getRemote('apps/categories/' . $alias);
|
||||
$response = $this->getRemote('apps/categories/' . $alias, 'GET', $data);
|
||||
|
||||
if ($response && ($response->getStatusCode() == 200)) {
|
||||
return json_decode($response->getBody())->data;
|
||||
|
8
public/css/app.css
vendored
8
public/css/app.css
vendored
@ -677,3 +677,11 @@ input[type="number"] {
|
||||
.pull-right.rating {
|
||||
margin-top: -30px;
|
||||
}
|
||||
|
||||
.pager {
|
||||
margin: inherit !important;
|
||||
}
|
||||
|
||||
.pager li>a, .pager li>span {
|
||||
border-radius: 3px !important;
|
||||
}
|
||||
|
@ -16,7 +16,7 @@
|
||||
<h3>{{ trans('modules.top_paid') }}</h3>
|
||||
</div>
|
||||
|
||||
@foreach ($paid as $module)
|
||||
@foreach ($paid->data as $module)
|
||||
@include('partials.modules.item')
|
||||
@endforeach
|
||||
</div>
|
||||
@ -26,7 +26,7 @@
|
||||
<h3>{{ trans('modules.new') }}</h3>
|
||||
</div>
|
||||
|
||||
@foreach ($new as $module)
|
||||
@foreach ($new->data as $module)
|
||||
@include('partials.modules.item')
|
||||
@endforeach
|
||||
</div>
|
||||
@ -36,7 +36,7 @@
|
||||
<h3>{{ trans('modules.top_free') }}</h3>
|
||||
</div>
|
||||
|
||||
@foreach ($free as $module)
|
||||
@foreach ($free->data as $module)
|
||||
@include('partials.modules.item')
|
||||
@endforeach
|
||||
</div>
|
||||
|
@ -17,9 +17,19 @@
|
||||
</div>
|
||||
|
||||
@if ($modules)
|
||||
@foreach ($modules as $module)
|
||||
@foreach ($modules->data as $module)
|
||||
@include('partials.modules.item')
|
||||
@endforeach
|
||||
<div class="col-md-12 no-padding-left">
|
||||
<ul class="pager nomargin">
|
||||
@if ($modules->current_page < $modules->last_page)
|
||||
<li class="next"><a href="{{ url(request()->path()) }}?page={{ $modules->current_page + 1 }}" class="btn btn-default btn-sm">{{ trans('pagination.next') }}</a></li>
|
||||
@endif
|
||||
@if ($modules->current_page > 1)
|
||||
<li class="previous"><a href="{{ url(request()->path()) }}?page={{ $modules->current_page - 1 }}" class="btn btn-default btn-sm">{{ trans('pagination.previous') }}</a></li>
|
||||
@endif
|
||||
</ul>
|
||||
</div>
|
||||
@else
|
||||
<div class="box box-success">
|
||||
<div class="box-body">
|
||||
|
Loading…
x
Reference in New Issue
Block a user