mirror of
https://github.com/BookStackApp/BookStack.git
synced 2024-10-01 05:36:00 +00:00
Merge branch 'show_more_informations_on_recently_updated_pages'
This commit is contained in:
commit
af39ff15ac
@ -364,7 +364,8 @@ class PageController extends Controller
|
|||||||
*/
|
*/
|
||||||
public function showRecentlyUpdated()
|
public function showRecentlyUpdated()
|
||||||
{
|
{
|
||||||
$pages = Page::visible()->orderBy('updated_at', 'desc')
|
$pages = Page::visible()->with('updatedBy')
|
||||||
|
->orderBy('updated_at', 'desc')
|
||||||
->paginate(20)
|
->paginate(20)
|
||||||
->setPath(url('/pages/recently-updated'));
|
->setPath(url('/pages/recently-updated'));
|
||||||
|
|
||||||
@ -373,6 +374,7 @@ class PageController extends Controller
|
|||||||
return view('common.detailed-listing-paginated', [
|
return view('common.detailed-listing-paginated', [
|
||||||
'title' => trans('entities.recently_updated_pages'),
|
'title' => trans('entities.recently_updated_pages'),
|
||||||
'entities' => $pages,
|
'entities' => $pages,
|
||||||
|
'showUpdatedBy' => true,
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -20,4 +20,13 @@
|
|||||||
</div>
|
</div>
|
||||||
@endif
|
@endif
|
||||||
|
|
||||||
|
@if(($showUpdatedBy ?? false) && $entity->relationLoaded('updatedBy') && $entity->updatedBy)
|
||||||
|
<small title="{{ $entity->updated_at->toDayDateTimeString() }}">
|
||||||
|
{!! trans('entities.meta_updated_name', [
|
||||||
|
'timeLength' => $entity->updated_at->diffForHumans(),
|
||||||
|
'user' => e($entity->updatedBy->name)
|
||||||
|
]) !!}
|
||||||
|
</small>
|
||||||
|
@endif
|
||||||
|
|
||||||
@endcomponent
|
@endcomponent
|
@ -261,6 +261,21 @@ class PageTest extends TestCase
|
|||||||
->assertElementContains('.entity-list .page:nth-child(1)', $content['page']->name);
|
->assertElementContains('.entity-list .page:nth-child(1)', $content['page']->name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function test_recently_updated_pages_view_shows_updated_by_details()
|
||||||
|
{
|
||||||
|
$user = $this->getEditor();
|
||||||
|
/** @var Page $page */
|
||||||
|
$page = Page::query()->first();
|
||||||
|
|
||||||
|
$this->actingAs($user)->put($page->getUrl(), [
|
||||||
|
'name' => 'Updated title',
|
||||||
|
'html' => '<p>Updated content</p>',
|
||||||
|
]);
|
||||||
|
|
||||||
|
$resp = $this->asAdmin()->get('/pages/recently-updated');
|
||||||
|
$resp->assertElementContains('.entity-list .page:nth-child(1)', 'Updated 1 second ago by ' . $user->name);
|
||||||
|
}
|
||||||
|
|
||||||
public function test_recently_updated_pages_on_home()
|
public function test_recently_updated_pages_on_home()
|
||||||
{
|
{
|
||||||
/** @var Page $page */
|
/** @var Page $page */
|
||||||
|
Loading…
Reference in New Issue
Block a user