Skip to content
This repository has been archived by the owner on Nov 23, 2018. It is now read-only.

Commit

Permalink
Add delete function
Browse files Browse the repository at this point in the history
  • Loading branch information
Maxime Lucas committed Jun 14, 2018
1 parent f7f9cb1 commit 5856357
Show file tree
Hide file tree
Showing 3 changed files with 623 additions and 18 deletions.
623 changes: 605 additions & 18 deletions assets/mm.min.js

Large diffs are not rendered by default.

14 changes: 14 additions & 0 deletions src/controllers/ApiController.php
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,20 @@ public function actionUpload()
throw new \yii\web\BadRequestHttpException();
}

public function actionDelete() {
$path = Yii::$app->request->post('path');

$fs = $this->module->fs;
$path = $fs->normalizePath($path);

if ($fs->has($path)) {
$stream = $fs->delete($path);
$response = Yii::$app->getResponse();
$response->setStatusCode(204);
return true;
}
}

/**
* @return mixed
*/
Expand Down
4 changes: 4 additions & 0 deletions src/widgets/MediaManagerAsset.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,18 @@ class MediaManagerAsset extends AssetBundle
{

public $sourcePath = '@vendor/mlcsthor/yii2-media-manager/assets';

public $css = [
'mm.min.css',
];

public $js = [
'mm.min.js',
];

public $depends = [
];

public $publishOptions = [
'forceCopy' => YII_DEBUG,
];
Expand Down

0 comments on commit 5856357

Please sign in to comment.