]> _ Git - fluidbook-toolbox.git/commitdiff
wip #6494 @1.25
authorVincent Vanwaelscappel <vincent@cubedesigners.com>
Mon, 20 Nov 2023 14:02:57 +0000 (15:02 +0100)
committerVincent Vanwaelscappel <vincent@cubedesigners.com>
Mon, 20 Nov 2023 14:02:57 +0000 (15:02 +0100)
app/Models/Base/ToolboxStatusModel.php
app/Models/FluidbookPublication.php
resources/views/vendor/backpack/crud/buttons/fluidbook_publication/preview.blade.php

index 0c2b261135c17dc0bd2c3a7378b35334ffbdea98..bec1af3791c68410cab197f0a3ff2435236c1521 100644 (file)
@@ -37,10 +37,10 @@ class ToolboxStatusModel extends ToolboxModel
 
     public function allowsPreview()
     {
-        if (!can(static::$_permissionBase.':write')) {
+        if (can(static::$_permissionBase . ':write')) {
             return true;
         }
-        if (!can(static::$_permissionBase.':read')) {
+        if (!can(static::$_permissionBase . ':read')) {
             return false;
         }
         if ($this->status == 0) {
index eeef3ebcf382e507b2ac8a3119cc7bd8d20fc6f6..910718b514f07ba96f595eff146a8992a88b5360 100644 (file)
@@ -1049,8 +1049,8 @@ class FluidbookPublication extends ToolboxStatusModel
         return $list;
     }
 
-    public function hasIssue()
+    public function allowsPreview()
     {
-
+        return parent::allowsPreview() && $this->getPagesNumber() > 0;
     }
 }
index f3521fb8e94d42b6db51d53b3d4d5d79e2f66ef2..2c25fb7f35f5ee7dc1139fca007e57ccc8c09108 100644 (file)
@@ -18,7 +18,7 @@
 
 @endphp
 
-@if($entry->getPagesNumber()>0 && $entry->allowsPreview())
+@if($entry->allowsPreview())
     <a class="btn btn-sm btn-link" target="{!! $actions['preview']['target'] !!}"
        href="{!! $actions['preview']['url'] !!}"
        @if(count($actions)>1)