Skip to content

Commit

Permalink
Updaes
Browse files Browse the repository at this point in the history
  • Loading branch information
Ryan Thompson committed Oct 21, 2015
1 parent 9dd1aa8 commit 5f55dd4
Show file tree
Hide file tree
Showing 13 changed files with 51 additions and 140 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -52,22 +52,15 @@ class AnomalyModuleFilesCreateFilesFields extends Migration
]
],
'entry' => 'anomaly.field_type.polymorphic',
'title' => 'anomaly.field_type.text',
'caption' => 'anomaly.field_type.textarea',
'description' => 'anomaly.field_type.textarea',
'path' => 'anomaly.field_type.text',
'keywords' => 'anomaly.field_type.tags',
'alt_text' => 'anomaly.field_type.text',
'extension' => 'anomaly.field_type.text',
'width' => 'anomaly.field_type.text',
'height' => 'anomaly.field_type.text',
'mime_type' => 'anomaly.field_type.text',
'size' => 'anomaly.field_type.integer',
'downloads' => [
'type' => 'anomaly.field_type.integer',
'config' => [
'default_value' => 0
]
]
'size' => 'anomaly.field_type.integer'
];

}
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,7 @@ class AnomalyModuleFilesCreateDisksStream extends Migration
*/
protected $stream = [
'slug' => 'disks',
'title_column' => 'name',
'locked' => true
'title_column' => 'name'
];

/**
Expand All @@ -29,9 +28,17 @@ class AnomalyModuleFilesCreateDisksStream extends Migration
* @var array
*/
protected $assignments = [
'name' => ['required' => true, 'unique' => true],
'slug' => ['required' => true, 'unique' => true],
'adapter' => ['required' => true],
'name' => [
'required' => true,
'unique' => true
],
'slug' => [
'required' => true,
'unique' => true
],
'adapter' => [
'required' => true
],
'description'
];

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,7 @@ class AnomalyModuleFilesCreateFoldersStream extends Migration
*/
protected $stream = [
'slug' => 'folders',
'title_column' => 'name',
'locked' => true
'title_column' => 'name'
];

/**
Expand All @@ -35,6 +34,9 @@ class AnomalyModuleFilesCreateFoldersStream extends Migration
'disk' => [
'required' => true
],
'path' => [
'required' => true
],
'parent'
];

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,7 @@ class AnomalyModuleFilesCreateFilesStream extends Migration
*/
protected $stream = [
'slug' => 'files',
'title_column' => 'name',
'locked' => true
'title_column' => 'name'
];

/**
Expand All @@ -47,10 +46,10 @@ class AnomalyModuleFilesCreateFilesStream extends Migration
'entry' => [
'required' => true
],
'title',
'caption',
'path' => [
'required' => true
],
'description',
'downloads',
'keywords',
'alt_text',
'folder'
Expand Down
28 changes: 0 additions & 28 deletions src/Adapter/AdapterExtension.php

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,28 @@
use Anomaly\FilesModule\Disk\Contract\DiskInterface;

/**
* Interface DiskLoaderInterface
* Interface AdapterInterface
*
* @link http://anomaly.is/streams-platform
* @author AnomalyLabs, Inc. <[email protected]>
* @author Ryan Thompson <[email protected]>
* @package Anomaly\FilesModule\Adapter\Contract
*/
interface DiskLoaderInterface
interface AdapterInterface
{

/**
* Load the disk into Laravel / Flysystem.
* Load the disk.
*
* @param DiskInterface $disk
*/
public function load(DiskInterface $disk);

/**
* Validate adapter configuration.
*
* @param array $configuration
* @return bool
*/
public function validate(array $configuration);
}
72 changes: 0 additions & 72 deletions src/Adapter/Form/AdapterFormBuilder.php

This file was deleted.

3 changes: 2 additions & 1 deletion src/Disk/Contract/DiskInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

use Anomaly\FilesModule\Adapter\AdapterExtension;
use Anomaly\FilesModule\Adapter\AdapterFilesystem;
use Anomaly\FilesModule\Adapter\Contract\AdapterInterface;
use Anomaly\Streams\Platform\Stream\Contract\StreamInterface;

/**
Expand Down Expand Up @@ -62,7 +63,7 @@ public function getSlug();
/**
* Get the adapter.
*
* @return AdapterExtension
* @return AdapterInterface
*/
public function getAdapter();

Expand Down
7 changes: 3 additions & 4 deletions src/Disk/DiskManager.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<?php namespace Anomaly\FilesModule\Disk;

use Anomaly\FilesModule\Adapter\AdapterExtension;
use Anomaly\FilesModule\Adapter\Contract\AdapterInterface;
use Anomaly\FilesModule\Disk\Contract\DiskInterface;
use Illuminate\Container\Container;

Expand Down Expand Up @@ -39,11 +40,9 @@ function __construct(Container $container)
*/
public function register(DiskInterface $disk)
{
/* @var AdapterExtension $adapter */
/* @var AdapterInterface $adapter */
$adapter = $disk->getAdapter();

if ($loader = $adapter->newLoader()) {
$loader->load($disk);
}
$adapter->load($disk);
}
}
3 changes: 2 additions & 1 deletion src/Disk/DiskModel.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

use Anomaly\FilesModule\Adapter\AdapterExtension;
use Anomaly\FilesModule\Adapter\AdapterFilesystem;
use Anomaly\FilesModule\Adapter\Contract\AdapterInterface;
use Anomaly\FilesModule\Disk\Command\GetDiskEntriesStream;
use Anomaly\FilesModule\Disk\Contract\DiskInterface;
use Anomaly\Streams\Platform\Model\Files\FilesDisksEntryModel;
Expand Down Expand Up @@ -90,7 +91,7 @@ public function getSlug()
/**
* Get the adapter.
*
* @return AdapterExtension
* @return AdapterInterface
*/
public function getAdapter()
{
Expand Down
11 changes: 6 additions & 5 deletions src/Disk/Form/DiskFormBuilder.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<?php namespace Anomaly\FilesModule\Disk\Form;

use Anomaly\FilesModule\Adapter\AdapterExtension;
use Anomaly\FilesModule\Adapter\Contract\AdapterInterface;
use Anomaly\Streams\Platform\Addon\Extension\Extension;
use Anomaly\Streams\Platform\Ui\Form\FormBuilder;

/**
Expand All @@ -17,7 +18,7 @@ class DiskFormBuilder extends FormBuilder
/**
* The storage adapter.
*
* @var null|AdapterExtension
* @var Extension|AdapterInterface|null
*/
protected $adapter = null;

Expand Down Expand Up @@ -57,7 +58,7 @@ public function onSaving()
/**
* Get the adapter.
*
* @return AdapterExtension|null
* @return Extension|AdapterInterface|null
*/
public function getAdapter()
{
Expand All @@ -67,10 +68,10 @@ public function getAdapter()
/**
* Set the adapter.
*
* @param AdapterExtension $adapter
* @param AdapterInterface $adapter
* @return $this
*/
public function setAdapter(AdapterExtension $adapter)
public function setAdapter(AdapterInterface $adapter)
{
$this->adapter = $adapter;

Expand Down
1 change: 0 additions & 1 deletion src/File/Form/FileFormBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ class FileFormBuilder extends FormBuilder
*/
protected $fields = [
'title',
'caption',
'alt_text',
'name' => [
'disabled' => true
Expand Down
9 changes: 5 additions & 4 deletions src/Http/Controller/Admin/DisksController.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
use Anomaly\FilesModule\Disk\Table\DiskTableBuilder;
use Anomaly\Streams\Platform\Addon\Extension\ExtensionCollection;
use Anomaly\Streams\Platform\Http\Controller\AdminController;
use Anomaly\Streams\Platform\Ui\Form\Multiple\MultipleFormBuilder;

/**
* Class DisksController
Expand Down Expand Up @@ -51,14 +52,14 @@ public function choose(ExtensionCollection $extensions)
* Return the form to create a new disk.
*
* @param DiskFormBuilder $disk
* @param AdapterFormBuilder $form
* @param MultipleFormBuilder $form
* @param ExtensionCollection $adapters
* @param ConfigurationFormBuilder $configuration
* @return \Symfony\Component\HttpFoundation\Response
*/
public function create(
DiskFormBuilder $disk,
AdapterFormBuilder $form,
MultipleFormBuilder $form,
ExtensionCollection $adapters,
ConfigurationFormBuilder $configuration
) {
Expand All @@ -74,15 +75,15 @@ public function create(
* Return the form to edit an existing disk.
*
* @param DiskFormBuilder $disk
* @param AdapterFormBuilder $form
* @param MultipleFormBuilder $form
* @param DiskRepositoryInterface $disks
* @param ConfigurationFormBuilder $configuration
* @param $id
* @return \Symfony\Component\HttpFoundation\Response
*/
public function edit(
DiskFormBuilder $disk,
AdapterFormBuilder $form,
MultipleFormBuilder $form,
DiskRepositoryInterface $disks,
ConfigurationFormBuilder $configuration,
$id
Expand Down

0 comments on commit 5f55dd4

Please sign in to comment.