]> BookStack Code Mirror - bookstack/commitdiff
Updated page exports to use absolute time format
authorDan Brown <redacted>
Sat, 22 Dec 2018 16:35:04 +0000 (16:35 +0000)
committerDan Brown <redacted>
Sat, 22 Dec 2018 16:35:04 +0000 (16:35 +0000)
For #1065

resources/views/pages/export.blade.php
resources/views/partials/entity-export-meta.blade.php [new file with mode: 0644]
tests/Entity/ExportTest.php

index ca708f8e0c99e17bd9854ba5201c52bd75c46597..0f76a8861a964239bcdf1eb35086c62947db3c2f 100644 (file)
@@ -23,7 +23,7 @@
                 <hr>
 
                 <div class="text-muted text-small">
-                    @include('partials.entity-meta', ['entity' => $page])
+                    @include('partials.entity-export-meta', ['entity' => $page])
                 </div>
 
             </div>
diff --git a/resources/views/partials/entity-export-meta.blade.php b/resources/views/partials/entity-export-meta.blade.php
new file mode 100644 (file)
index 0000000..fa1394e
--- /dev/null
@@ -0,0 +1,33 @@
+<div class="entity-meta">
+    @if($entity->isA('revision'))
+        @icon('history'){{ trans('entities.pages_revision') }}
+        {{ trans('entities.pages_revisions_number') }}{{ $entity->revision_number == 0 ? '' : $entity->revision_number }}
+        <br>
+    @endif
+
+    @if ($entity->isA('page'))
+        @if (userCan('page-update', $entity)) <a href="{{ $entity->getUrl('/revisions') }}"> @endif
+        @icon('history'){{ trans('entities.meta_revision', ['revisionCount' => $entity->revision_count]) }} <br>
+        @if (userCan('page-update', $entity))</a>@endif
+    @endif
+
+    @if ($entity->createdBy)
+        @icon('star'){!! trans('entities.meta_created_name', [
+            'timeLength' => '<span>'.$entity->created_at->toDayDateTimeString() . '</span>',
+            'user' => "<a href='{$entity->createdBy->getProfileUrl()}'>".htmlentities($entity->createdBy->name). "</a>"
+            ]) !!}
+    @else
+        @icon('star')<span>{{ trans('entities.meta_created', ['timeLength' => $entity->created_at->toDayDateTimeString()]) }}</span>
+    @endif
+
+    <br>
+
+    @if ($entity->updatedBy)
+        @icon('edit'){!! trans('entities.meta_updated_name', [
+                'timeLength' => '<span>' . $entity->updated_at->toDayDateTimeString() .'</span>',
+                'user' => "<a href='{$entity->updatedBy->getProfileUrl()}'>".htmlentities($entity->updatedBy->name). "</a>"
+            ]) !!}
+    @elseif (!$entity->isA('revision'))
+        @icon('edit')<span>{{ trans('entities.meta_updated', ['timeLength' => $entity->updated_at->toDayDateTimeString()]) }}</span>
+    @endif
+</div>
\ No newline at end of file
index 51090650c267514b67a840bd8909e16c5a09a6d4..fdcd833665d267f380631110fc2fc51a7a6b6f27 100644 (file)
@@ -123,4 +123,15 @@ class ExportTest extends TestCase
         $resp->assertSee($customHeadContent);
     }
 
+    public function test_page_html_export_use_absolute_dates()
+    {
+        $page = Page::first();
+
+        $resp = $this->asEditor()->get($page->getUrl('/export/html'));
+        $resp->assertSee($page->created_at->toDayDateTimeString());
+        $resp->assertDontSee($page->created_at->diffForHumans());
+        $resp->assertSee($page->updated_at->toDayDateTimeString());
+        $resp->assertDontSee($page->updated_at->diffForHumans());
+    }
+
 }
\ No newline at end of file