Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
ctf0 committed Jul 18, 2018
1 parent 7d74883 commit cba7ef8
Show file tree
Hide file tree
Showing 18 changed files with 53 additions and 68 deletions.
35 changes: 13 additions & 22 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,15 @@
npm install vue vue-ls vue-async-computed vue-tippy@v1 vue2-filters vue-notif vue-clipboard2 vue-awesome@v2 vue-touch@next idb-keyval axios dropzone cropperjs keycode date-fns lottie-web fuse.js --save
```

- run `npm run watch` to compile your `js/css` files.
- if you are having issues [Check](https://ctf0.wordpress.com/2017/09/12/laravel-mix-es6/)
- add this one liner to your main js file and run `npm run watch` to compile your `js/css` files.
+ if you are having issues [Check](https://ctf0.wordpress.com/2017/09/12/laravel-mix-es6/).
```js
require('../vendor/MediaManager/js/manager')

new Vue({
el: '#app'
})
```
<br>

## Features
Expand All @@ -68,7 +75,7 @@
+ [with any wysiwyg editor](https://github.com/ctf0/Laravel-Media-Manager/wiki/Use-The-Manager-With-Any-WYSIWYG-Editor)
- auto scroll to selected item when using (left, up, righ, down, home, end)
- [lock/unlock](https://github.com/ctf0/Laravel-Media-Manager/wiki/Lock-Files-&-Folder) item/s ***"sqLite must be installed"***
- search "current / global"
- search `current/global`
- filter by
+ folder
+ image
Expand Down Expand Up @@ -239,23 +246,7 @@ return [
<br>

## Usage
> [Wiki](https://github.com/ctf0/Laravel-Media-Manager/wiki)<br>
> [Demo](https://github.com/ctf0/demos/tree/media-manager)
**1-** make sure you have pre-initiated vue
```js
// app.js

window.Vue = require('vue');

new Vue({
el: '#app'
})
```

**2-** under `resources/views/vendor/MediaManager/media.blade.php` update the path to that js file
```html
<script src="{{ asset("path/to/app.js") }}"></script>
```

**3-** visit `localhost:8000/media`

### [Check The Wiki](https://github.com/ctf0/Laravel-Media-Manager/wiki)
- visit `localhost:8000/media`
2 changes: 1 addition & 1 deletion src/Controllers/MediaController.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public function __construct()
$this->LMF = array_get($config, 'last_modified_format');
$this->GFI = array_get($config, 'get_folder_info', true);

$this->storageDisk = app('filesystem')->disk($this->fileSystem);
$this->storageDisk = app('filesystem')->disk($this->fileSystem);
$this->storageDiskInfo = app('config')->get("filesystems.disks.{$this->fileSystem}");
$this->baseUrl = $this->storageDisk->url('/');
$this->db = app('db')->connection('mediamanager')->table('locked');
Expand Down
12 changes: 6 additions & 6 deletions src/Controllers/Modules/Delete.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@ public function deleteItem(Request $request)
$toBroadCast = [];

foreach ($request->deleted_files as $one) {
$name = $one['name'];
$type = $one['type'];
$item_path = !$path ? $name : $this->clearDblSlash("$path/$name");
$defaults = [
$name = $one['name'];
$type = $one['type'];
$item_path = !$path ? $name : $this->clearDblSlash("$path/$name");
$defaults = [
'name' => $name,
'type' => $type,
];
Expand Down Expand Up @@ -83,8 +83,8 @@ public function deleteItem(Request $request)

// broadcast
broadcast(new MediaFileOpsNotifications([
'op' => 'delete',
'items' => $toBroadCast,
'op' => 'delete',
'items' => $toBroadCast,
]))->toOthers();

return response()->json($result);
Expand Down
12 changes: 6 additions & 6 deletions src/Controllers/Modules/Download.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,14 +50,14 @@ protected function zipAndDownload($name, $list)
{
return response()->stream(function () use ($name, $list) {
// track changes
$counter = 100 / count($list);
$counter = 100 / count($list);
$progress = 0;
broadcast(new MediaZipProgress(['progress'=>$progress]));

$zip = new ZipStream("$name.zip", $this->getZipOptions());

foreach ($list as $file) {
$file_name = $file['name'];
$file_name = $file['name'];
$streamRead = $this->storageDisk->readStream($this->clearUrl($file['path']));

// add to zip
Expand All @@ -83,16 +83,16 @@ protected function zipAndDownloadDir($name, $list)
{
return response()->stream(function () use ($name, $list) {
// track changes
$counter = 100 / count($list);
$counter = 100 / count($list);
$progress = 0;
broadcast(new MediaZipProgress(['progress'=>$progress]));

$zip = new ZipStream("$name.zip", $this->getZipOptions());

foreach ($list as $file) {
$dir_name = pathinfo($file, PATHINFO_DIRNAME);
$file_name = pathinfo($file, PATHINFO_BASENAME);
$full_name = "$dir_name/$file_name";
$dir_name = pathinfo($file, PATHINFO_DIRNAME);
$file_name = pathinfo($file, PATHINFO_BASENAME);
$full_name = "$dir_name/$file_name";
$streamRead = $this->storageDisk->readStream($file);

// add to zip
Expand Down
2 changes: 1 addition & 1 deletion src/Controllers/Modules/GetContent.php
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ protected function getData($dir)
protected function getFolderContent($folder, $rec = false)
{
return $this->storageDisk->listWith(
['mimetype', 'visibility'],
['mimetype', 'visibility', 'timestamp', 'size'],
$folder,
$rec
);
Expand Down
6 changes: 3 additions & 3 deletions src/Controllers/Modules/Move.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@ public function moveItem(Request $request)
$toBroadCast = [];

foreach ($request->moved_files as $one) {
$file_name = $one['name'];
$file_type = $one['type'];
$defaults = [
$file_name = $one['name'];
$file_type = $one['type'];
$defaults = [
'name' => $file_name,
'type' => $file_type,
'size' => $one['size'],
Expand Down
4 changes: 2 additions & 2 deletions src/Controllers/Modules/NewFolder.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ public function createNewFolder(Request $request)

// broadcast
broadcast(new MediaFileOpsNotifications([
'op' => 'new_folder',
'path' => $path,
'op' => 'new_folder',
'path' => $path,
]))->toOthers();

return compact('message', 'new_folder_name', 'full_path');
Expand Down
14 changes: 7 additions & 7 deletions src/Controllers/Modules/Rename.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@ trait Rename
*/
public function renameItem(Request $request)
{
$path = $request->path;
$filename = $request->filename;
$new_filename = $this->cleanName($request->new_filename);
$message = '';
$path = $request->path;
$filename = $request->filename;
$new_filename = $this->cleanName($request->new_filename);
$message = '';

$old_path = !$path ? $filename : $this->clearDblSlash("$path/$filename");
$new_path = !$path ? $new_filename : $this->clearDblSlash("$path/$new_filename");
Expand All @@ -30,9 +30,9 @@ public function renameItem(Request $request)
if ($this->storageDisk->move($old_path, $new_path)) {
// broadcast
broadcast(new MediaFileOpsNotifications([
'op' => 'rename',
'path' => $path,
'item' => [
'op' => 'rename',
'path' => $path,
'item' => [
'type' => $request->type,
'oldName' => $filename,
'newName' => $new_filename,
Expand Down
20 changes: 10 additions & 10 deletions src/Controllers/Modules/Upload.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,10 @@ public function upload(Request $request)
if ($this->allowUpload($one)) {
$one = $this->optimizeUpload($one);

$original = $one->getClientOriginalName();
$name_only = pathinfo($original, PATHINFO_FILENAME);
$ext_only = pathinfo($original, PATHINFO_EXTENSION);
$file_name = $random_name
$original = $one->getClientOriginalName();
$name_only = pathinfo($original, PATHINFO_FILENAME);
$ext_only = pathinfo($original, PATHINFO_EXTENSION);
$file_name = $random_name
? $this->sanitizedText . ".$ext_only"
: $this->cleanName($name_only, null) . ".$ext_only";

Expand Down Expand Up @@ -161,10 +161,10 @@ public function uploadLink(Request $request)
$path = $request->path;
$random_name = $request->random_names;

$original = substr($url, strrpos($url, '/') + 1);
$name_only = pathinfo($original, PATHINFO_FILENAME);
$ext_only = pathinfo($original, PATHINFO_EXTENSION);
$file_name = $random_name
$original = substr($url, strrpos($url, '/') + 1);
$name_only = pathinfo($original, PATHINFO_FILENAME);
$ext_only = pathinfo($original, PATHINFO_EXTENSION);
$file_name = $random_name
? $this->sanitizedText . ".$ext_only"
: $this->cleanName($name_only, null) . ".$ext_only";

Expand Down Expand Up @@ -194,8 +194,8 @@ public function uploadLink(Request $request)

// broadcast
broadcast(new MediaFileOpsNotifications([
'op' => 'upload',
'path' => $path,
'op' => 'upload',
'path' => $path,
]))->toOthers();

$result = [
Expand Down
10 changes: 2 additions & 8 deletions src/MediaManagerServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,6 @@ protected function packagePublish()
__DIR__ . '/database' => storage_path('logs'),
], 'db');

// public
$this->publishes([
__DIR__ . '/dist' => public_path('assets/vendor/MediaManager'),
], 'dist');

// resources
$this->publishes([
__DIR__ . '/resources/assets' => resource_path('assets/vendor/MediaManager'),
Expand Down Expand Up @@ -140,9 +135,8 @@ protected function autoReg()
<<<EOT
// MediaManager
mix.js('resources/assets/vendor/MediaManager/js/manager.js', 'public/assets/vendor/MediaManager')
.sass('resources/assets/vendor/MediaManager/sass/media.scss', 'public/assets/vendor/MediaManager/style.css')
.version();
mix.sass('resources/assets/vendor/MediaManager/sass/media.scss', 'public/assets/vendor/MediaManager/style.css')
.copyDirectory('resources/assets/vendor/MediaManager/dist', 'public/assets/vendor/MediaManager')
EOT;

$this->file->append($mix_file, $data);
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes
1 change: 1 addition & 0 deletions src/resources/assets/js/manager.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
/* Libs */
window.Vue = require('vue')
window.EventHub = require('vuemit')
window.keycode = require('keycode')
window.Fuse = require('fuse.js')
Expand Down
2 changes: 1 addition & 1 deletion src/resources/assets/js/modules/scroll.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ export default {
let width = cont.clientWidth
let pad = parseInt(window.getComputedStyle(cont).paddingLeft) + parseInt(window.getComputedStyle(cont).paddingRight)
let contWidth = width - pad
let itemWidth = this.$refs.filesList.firstChild.clientWidth
let itemWidth = this.$refs.filesList.firstChild ? this.$refs.filesList.firstChild.clientWidth : 0

this.scrollByRows = Math.floor(contWidth / itemWidth)
}
Expand Down
1 change: 0 additions & 1 deletion src/resources/views/_manager.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -1048,5 +1048,4 @@ class="button is-danger"
@push('scripts')
<script src="//cdnjs.cloudflare.com/ajax/libs/camanjs/4.1.2/caman.full.min.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/jsmediatags/3.9.0/jsmediatags.min.js"></script>
<script src="{{ asset('assets/vendor/MediaManager/manager.js') }}"></script>
@endpush

0 comments on commit cba7ef8

Please sign in to comment.