FEATURE: add search
This commit is contained in:
@@ -1,12 +1,16 @@
|
|||||||
<?php
|
<?php
|
||||||
namespace App\Handlers\Search\Presenters;
|
namespace App\Handlers\Search\Presenters;
|
||||||
|
|
||||||
|
use App\Enumerations\ContentStatuses;
|
||||||
use App\Handlers\Contracts\SearchPresenterHandler;
|
use App\Handlers\Contracts\SearchPresenterHandler;
|
||||||
|
|
||||||
class AdminContent implements SearchPresenterHandler
|
class AdminContent implements SearchPresenterHandler
|
||||||
{
|
{
|
||||||
public function render($foundItems)
|
public function render($foundItems)
|
||||||
{
|
{
|
||||||
return view('admin.content.overviewTiles', ['pages' => $foundItems, 'tileClass' => 'large-4']);
|
return view('admin.search.results.content', [
|
||||||
|
'pages' => $foundItems,
|
||||||
|
'statuses' => ContentStatuses::getWithTranslations(),
|
||||||
|
]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -14,6 +14,6 @@ class AdminFiles implements SearchPresenterHandler
|
|||||||
*/
|
*/
|
||||||
public function render($foundItems)
|
public function render($foundItems)
|
||||||
{
|
{
|
||||||
return view('admin.fileManager.filesTiles', ['files' => $foundItems]);
|
return view('admin.fileManager.filesTiles', ['files' => $foundItems, 'hideDelete' => true]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -57,7 +57,6 @@ class Search extends Controller
|
|||||||
* @var SearchHandler $search
|
* @var SearchHandler $search
|
||||||
* @var SearchPresenterHandler $presenter
|
* @var SearchPresenterHandler $presenter
|
||||||
*/
|
*/
|
||||||
|
|
||||||
list ($search, $presenter) = $engine;
|
list ($search, $presenter) = $engine;
|
||||||
|
|
||||||
// try to find given term
|
// try to find given term
|
||||||
|
|||||||
@@ -11,10 +11,12 @@
|
|||||||
{{str_limit($file->original_filename, 10)}}
|
{{str_limit($file->original_filename, 10)}}
|
||||||
</a>
|
</a>
|
||||||
|
|
||||||
<a href="{{route('upload.delete', ['id' => $file->id])}}" class="btn btn-sm btn-danger"
|
@if(!isset($hideDelete) || !$hideDelete)
|
||||||
title="@lang('admin/fileManager.delete')">
|
<a href="{{route('upload.delete', ['id' => $file->id])}}" class="btn btn-sm btn-danger"
|
||||||
<i class="fa fa-remove"></i>
|
title="@lang('admin/fileManager.delete')">
|
||||||
</a>
|
<i class="fa fa-remove"></i>
|
||||||
|
</a>
|
||||||
|
@endif
|
||||||
</div>
|
</div>
|
||||||
@empty
|
@empty
|
||||||
<div class="alert alert-info">
|
<div class="alert alert-info">
|
||||||
|
|||||||
@@ -0,0 +1,14 @@
|
|||||||
|
<form action="{{route('search')}}" method="get">
|
||||||
|
|
||||||
|
<div class="col-sm-11">
|
||||||
|
<input type="text" class="form-control" value="@if(isset($search)){{$search}}@endif"
|
||||||
|
placeholder="@lang('search.term')" name="search" />
|
||||||
|
</div>
|
||||||
|
<div class="col-sm-1">
|
||||||
|
<button class="btn btn-primary"><i class="fa fa-search"></i></button>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</form>
|
||||||
@@ -0,0 +1,22 @@
|
|||||||
|
@extends('admin.layoutWithNavigation')
|
||||||
|
|
||||||
|
@section('pageHeading', @trans('search.pageTitle'))
|
||||||
|
|
||||||
|
@section('content')
|
||||||
|
@if ($search)
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-lg-8">
|
||||||
|
<h3>@lang('search.results')</h3>
|
||||||
|
@include('admin.search.results')
|
||||||
|
</div>
|
||||||
|
<div class="col-lg-4">
|
||||||
|
<h3>@lang('search.term')</h3>
|
||||||
|
@include('admin.search.form')
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
@else
|
||||||
|
<div class="row">
|
||||||
|
@include('admin.search.form')
|
||||||
|
</div>
|
||||||
|
@endif
|
||||||
|
@endsection
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
|
||||||
|
@foreach($results as $id => $result)
|
||||||
|
{{--<div class="search-result" id="{{$id}}">--}}
|
||||||
|
<h4>{{$result['name']}} ({{$result['count']}})</h4>
|
||||||
|
{!! $result['content'] !!}
|
||||||
|
{{--</div>--}}
|
||||||
|
@endforeach
|
||||||
@@ -0,0 +1,37 @@
|
|||||||
|
<div class="search-result">
|
||||||
|
@if (count($pages))
|
||||||
|
<table class="table item-list full-width content-overview table-striped table-bordered table-hover">
|
||||||
|
<tr>
|
||||||
|
<th></th>
|
||||||
|
<th>@lang('admin/contents.title')</th>
|
||||||
|
<th>@lang('admin/contents.status')</th>
|
||||||
|
<th>@lang('admin/contents.createdAt')</th>
|
||||||
|
</tr>
|
||||||
|
@foreach($pages as $page)
|
||||||
|
<tr>
|
||||||
|
<td class="text-center with-placeholder">
|
||||||
|
<a href="{{route('content.edit', ['id' => $page->id])}}">
|
||||||
|
@if(!empty($page->title_photo))
|
||||||
|
<img src="@upload($page->title_photo)" class="placeholder" alt="{{$page->title}}" />
|
||||||
|
@else
|
||||||
|
<img src="{{asset('resources/assets/admin/img/placeholder.png')}}" class="placeholder"
|
||||||
|
alt="{{$page->title}}" />
|
||||||
|
@endif
|
||||||
|
</a>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<a href="{{route('content.edit', ['id' => $page->id])}}">
|
||||||
|
{{$page->title}}
|
||||||
|
</a>
|
||||||
|
</td>
|
||||||
|
<td>{{$statuses[$page->status]}}</td>
|
||||||
|
<td>@date($page->created_at)</td>
|
||||||
|
</tr>
|
||||||
|
@endforeach
|
||||||
|
</table>
|
||||||
|
@else
|
||||||
|
<div class="alert alert-info">
|
||||||
|
@lang('admin/contents.noPagesAvailable')
|
||||||
|
</div>
|
||||||
|
@endif
|
||||||
|
</div>
|
||||||
Reference in New Issue
Block a user