Commit 90c1ec40 authored by Nicolas Widart's avatar Nicolas Widart

Adding configuration options for dropzone

parent 5a83fc92
......@@ -12,7 +12,7 @@ return [
| Specify all the allowed file extensions a user can upload on the server
|--------------------------------------------------------------------------
*/
'allowed-types' => 'jpg,png',
'allowed-types' => '.jpg,.png',
/*
|--------------------------------------------------------------------------
| Determine the max file size upload rate
......
<?php namespace Modules\Media\Http\Controllers\Admin;
use Illuminate\Contracts\Config\Repository;
use Illuminate\Support\Facades\Redirect;
use Illuminate\Support\Facades\View;
use Laracasts\Flash\Flash;
......@@ -14,10 +15,15 @@ class MediaController extends AdminBaseController
* @var FileRepository
*/
private $file;
/**
* @var Repository
*/
private $config;
public function __construct(FileRepository $file)
public function __construct(FileRepository $file, Repository $config)
{
$this->file = $file;
$this->config = $config;
}
/**
......@@ -29,7 +35,9 @@ class MediaController extends AdminBaseController
{
$files = $this->file->all();
return View::make('media::admin.index', compact('files'));
$config = $this->config->get('media::config');
return View::make('media::admin.index', compact('files', 'config'));
}
public function gridFiles()
......
......@@ -117,7 +117,9 @@ $( document ).ready(function() {
var myDropzone = new Dropzone(".dropzone", {
url: $(this).attr('action'),
autoProcessQueue: true
autoProcessQueue: true,
maxFilesize: '<?php echo $config["max-file-size"] ?>',
acceptedFiles : '<?php echo $config["allowed-types"] ?>'
});
myDropzone.on("success", function(file, http) {
var tableRow = '<tr><td>' + http.created_at + '</td><td></td><td>'+http.filename+'</td><td></td></tr>';
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment