Page index

This commit is contained in:
Alexander Yakovlev 2022-09-02 21:23:39 +07:00
parent 8a31bbafea
commit e2b1290483
Signed by: oreolek
GPG key ID: 8D24103F5EE2A6C0
4 changed files with 15 additions and 6 deletions

View file

@ -27,7 +27,6 @@ class IndexComposer extends ReadComposer
$view->with('id', $this->item->id);
$view->with('load_comments_action', route('comments.load', $this->item->id));
}
$view->with('load_comment_form_action', route('comments.post'));
$view->with('navigation', $this->navigation());
}
}

View file

@ -2,6 +2,8 @@
namespace App\Http\View;
use App\Models\Page;
use App\Models\Post;
use Illuminate\Pagination\Paginator;
use Illuminate\View\View;
use Illuminate\Support\Facades\Route;
@ -58,9 +60,16 @@ class ReadComposer extends GenericView
}
// TODO Text
// $output['speed'] = '<span class="fa fa-clock-o"></span> ≈'.Text::time_to_read($item->content).' '.__('min');
$output['view_link'] = route('view', array(
'id' => $item->id
));
if ($item instanceof Post) {
$output['view_link'] = route('view', array(
'id' => $item->id
));
}
elseif ($item instanceof Page) {
$output['view_link'] = route('page.view', array(
'id' => $item->id
));
}
$output['heading'] = $item->name;
$output['comments_link'] = route('default', array(
'controller' => Route::current()->getController(),

View file

@ -16,6 +16,7 @@ class ViewServiceProvider extends ServiceProvider
{
// Using class based composers...
View::composer('read', 'App\Http\View\ReadComposer');
View::composer('index', 'App\Http\View\IndexComposer');
View::composer('single', 'App\Http\View\ViewComposer');
View::composer('comment.index', 'App\Http\View\CommentIndexComposer');
View::composer('comment.ajaxlist', 'App\Http\View\CommentIndexComposer');

View file

@ -14,11 +14,11 @@
<tr>
<td class="hyphenate">
<a class="link_view" href="{!! $item['view_link'] !!}">
{{ $item['name'] }}
{{ $item['heading'] }}
</a>
</td>
<td class="date">{{ $item['date'] }}</td>
@if (isset($item['edit_link']))
@if (isset($item['edit_link']) && isset($item['delete_link']))
<td>
<a class="btn" href="{{ $item['edit_link']}}">
<i class="fa fa-pencil-square-o"></i>