1
0
mirror of https://github.com/BookStackApp/BookStack.git synced 2024-10-30 07:32:39 +01:00

Added listing of editor type to revisions

- Also tweaked some editor revision table styles and merged some
  sections to reduce space usage.
This commit is contained in:
Dan Brown 2022-04-23 15:03:58 +01:00
parent 1b46aa8756
commit bec61a56c0
No known key found for this signature in database
GPG Key ID: 46D9F943C24A2EF9
3 changed files with 41 additions and 12 deletions

View File

@ -235,6 +235,7 @@ return [
'pages_revisions_number' => '#',
'pages_revisions_numbered' => 'Revision #:id',
'pages_revisions_numbered_changes' => 'Revision #:id Changes',
'pages_revisions_editor' => 'Editor Type',
'pages_revisions_changelog' => 'Changelog',
'pages_revisions_changes' => 'Changes',
'pages_revisions_current' => 'Current Version',

View File

@ -21,26 +21,39 @@
<table class="table">
<tr>
<th width="3%">{{ trans('entities.pages_revisions_number') }}</th>
<th width="23%">{{ trans('entities.pages_name') }}</th>
<th colspan="2" width="8%">{{ trans('entities.pages_revisions_created_by') }}</th>
<th width="15%">{{ trans('entities.pages_revisions_date') }}</th>
<th width="25%">{{ trans('entities.pages_revisions_changelog') }}</th>
<th width="20%">{{ trans('common.actions') }}</th>
<th width="40">{{ trans('entities.pages_revisions_number') }}</th>
<th>
{{ trans('entities.pages_name') }} / {{ trans('entities.pages_revisions_editor') }}
</th>
<th colspan="2">{{ trans('entities.pages_revisions_created_by') }} / {{ trans('entities.pages_revisions_date') }}</th>
<th>{{ trans('entities.pages_revisions_changelog') }}</th>
<th class="text-right">{{ trans('common.actions') }}</th>
</tr>
@foreach($page->revisions as $index => $revision)
<tr>
<td>{{ $revision->revision_number == 0 ? '' : $revision->revision_number }}</td>
<td>{{ $revision->name }}</td>
<td style="line-height: 0;">
<td>
{{ $revision->name }}
<br>
<small class="text-muted">({{ $revision->markdown ? 'Markdown' : 'WYSIWYG' }})</small>
</td>
<td style="line-height: 0;" width="30">
@if($revision->createdBy)
<img class="avatar" src="{{ $revision->createdBy->getAvatar(30) }}" alt="{{ $revision->createdBy->name }}">
@endif
</td>
<td> @if($revision->createdBy) {{ $revision->createdBy->name }} @else {{ trans('common.deleted_user') }} @endif</td>
<td><small>{{ $revision->created_at->formatLocalized('%e %B %Y %H:%M:%S') }} <br> ({{ $revision->created_at->diffForHumans() }})</small></td>
<td>{{ $revision->summary }}</td>
<td class="actions">
<td width="260">
@if($revision->createdBy) {{ $revision->createdBy->name }} @else {{ trans('common.deleted_user') }} @endif
<br>
<div class="text-muted">
<small>{{ $revision->created_at->formatLocalized('%e %B %Y %H:%M:%S') }}</small>
<small>({{ $revision->created_at->diffForHumans() }})</small>
</div>
</td>
<td>
{{ $revision->summary }}
</td>
<td class="actions text-small text-right">
<a href="{{ $revision->getUrl('changes') }}" target="_blank" rel="noopener">{{ trans('entities.pages_revisions_changes') }}</a>
<span class="text-muted">&nbsp;|&nbsp;</span>

View File

@ -203,4 +203,19 @@ class PageRevisionTest extends TestCase
$revisionCount = $page->revisions()->count();
$this->assertEquals(12, $revisionCount);
}
public function test_revision_list_shows_editor_type()
{
/** @var Page $page */
$page = Page::first();
$this->asAdmin()->put($page->getUrl(), ['name' => 'Updated page', 'html' => 'new page html']);
$resp = $this->get($page->refresh()->getUrl('/revisions'));
$resp->assertElementContains('td', '(WYSIWYG)');
$resp->assertElementNotContains('td', '(Markdown)');
$this->asAdmin()->put($page->getUrl(), ['name' => 'Updated page', 'markdown' => '# Some markdown content']);
$resp = $this->get($page->refresh()->getUrl('/revisions'));
$resp->assertElementContains('td', '(Markdown)');
}
}