Exemplo n.º 1
0
 /**
  * Return a list of folders to choose from.
  *
  * @param FolderRepositoryInterface $folders
  * @param Repository                $cache
  * @param Request                   $request
  * @return \Illuminate\View\View
  */
 public function choose(FolderRepositoryInterface $folders, Repository $cache, Request $request)
 {
     $allowed = [];
     $config = $cache->get('file-field_type::' . $request->route('key'), []);
     foreach (array_get($config, 'folders', []) as $identifier) {
         /* @var FolderInterface $folder */
         if ($folder = $this->dispatch(new GetFolder($identifier))) {
             $allowed[] = $folder;
         }
     }
     if (!$allowed) {
         $allowed = $folders->all();
     }
     return $this->view->make('anomaly.field_type.file::choose', ['folders' => $allowed]);
 }
 /**
  * Handle the filters.
  *
  * @param FileTableBuilder          $builder
  * @param FolderRepositoryInterface $folders
  * @param Repository                $cache
  * @param Request                   $request
  */
 public function handle(FileTableBuilder $builder, FolderRepositoryInterface $folders, Repository $cache, Request $request)
 {
     $allowed = [];
     $config = $cache->get('files-field_type::' . $request->route('key'), []);
     foreach (array_get($config, 'folders', []) as $identifier) {
         /* @var FolderInterface $folder */
         if ($folder = $this->dispatch(new GetFolder($identifier))) {
             $allowed[$folder->getId()] = $folder->getName();
         }
     }
     if (!$allowed) {
         $allowed = $folders->all()->pluck('name', 'id')->all();
     }
     $builder->setFolders($allowed)->setFilters(['search' => ['columns' => ['name', 'keywords', 'mime_type']], 'folder' => ['exact' => true, 'filter' => 'select', 'options' => $allowed, 'enabled' => count($allowed) !== 1]]);
 }
Exemplo n.º 3
0
 /**
  * Return a list of folders to choose from.
  *
  * @param FolderRepositoryInterface $folders
  * @return \Illuminate\View\View
  */
 public function choose(FolderRepositoryInterface $folders)
 {
     return $this->view->make('anomaly.field_type.wysiwyg::choose', ['folders' => $folders->all()]);
 }
Exemplo n.º 4
0
 /**
  * Return an ajax modal to choose the folder
  * to use for uploading files.
  *
  * @param FolderRepositoryInterface
  * @return \Illuminate\View\View
  */
 public function choose(FolderRepositoryInterface $folders)
 {
     return view('module::ajax/choose_folder', ['folders' => $folders->all()]);
 }