return parent::allowsPreview() && $this->getPagesNumber() > 0;
}
+ public function allowsTesting()
+ {
+ return $this->allowsPreview() && can(static::$_permissionBase . ':admin');
+ }
+
public static function getProtectedPath($id, $path)
{
return cache()->tags([FluidbookPublication::class])->rememberForever("fluidbook_protected_path_" . $id . '_' . $path, function () use ($id, $path) {
@php
$actions=[];
$suffixv3='';
-// if($entry->version==2){
-// $actions['compilev2']=['label'=>'<span class="context-menu-subtitle">'.__('Compilateur V2').'</span>','disabled'=>true,'url'=>'#'];
-// $actions['preview_v2'] = ['label'=>__('Version online'),'url'=>'https://workshop.fluidbook.com/viewerh/'.$entry->getKey().'_'.$entry->hash,'target'=>'_blank'];
-// if($entry->isSCORMEnabled()){
-// $actions['scorm_v2'] = ['label'=>__('Version SCORM'),'url'=>'https://workshop.fluidbook.com/viewers/'.$entry->getKey().'_'.$entry->hash,'target'=>'_blank'];
-// }
-// $actions['sep']='---------';
-// $actions['testv3']=['label'=>'<span class="context-menu-subtitle">'.__('Tester le compilateur V3').'</span>','disabled'=>true,'url'=>'#'];
-// }
- $actions['preview']=['label'=>__('Version online'),'url'=>$crud->route.'/preview/'.$entry->getKey().'_'.$entry->hash,'target'=>'_blank'];
+ $previewURL=$crud->route.'/preview/'.$entry->getKey().'_'.$entry->hash;
+ $actions['preview']=['label'=>__('Version online'),'url'=>$previewURL,'target'=>'_blank'];
if($entry->isSCORMEnabled()){
$actions['scorm']=['label'=>__('Version SCORM'),'url'=>$crud->route.'/preview/scorm/'.$entry->getKey().'_'.$entry->hash,'target'=>'_blank'];
}
+ if($entry->allowsTesting()){
+ $defaults=['start'=>'true','zoom_to_fit'=>'true' ,'full_screen'=>'true','speed'=>'1','url'=>$previewURL];
+ $tests=[
+ 'iOS Safari'=>['os'=>'iOS','os_version'=>'17.0','device_browser'=>'safari'],
+ 'Android Chrome'=>['os'=>'android','os_version'=>'15.0','device'=>'Google Pixel 9','device_browser'=>'chrome'],
+ ];
+
+ $actions['sep_testing']='---------';
+ foreach ($tests as $k=>$device) {
+ $url='https://live.browserstack.com/start#'.http_build_query(array_merge($defaults,$device));
+ $actions['browserstack_'.\Cubist\Util\Str::snake($k)]=
+ [
+ 'label'=>__('Tester sur :device',['device'=>$k]),
+ 'url'=>$url,
+ 'target'=>'_blank'
+ ];
+ }
+ }
@endphp
@if($entry->allowsPreview())
title="{{__('Voir le fluidbook')}}"><i class="las la-eye"></i> {{__('Voir')}}
</a>
@endif
+