Skip to content

Commit

Permalink
v3.6.3
Browse files Browse the repository at this point in the history
- more cleanups
- add dir bookmarking feature
- fix locking only selected file
  • Loading branch information
ctf0 committed Dec 8, 2019
1 parent 230caff commit d5bae67
Show file tree
Hide file tree
Showing 53 changed files with 921 additions and 914 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@
<a href="https://packagist.org/packages/ctf0/media-manager"><img src="https://img.shields.io/packagist/v/ctf0/media-manager.svg" alt="Latest Stable Version"/></a>
<a href="https://packagist.org/packages/ctf0/media-manager"><img src="https://img.shields.io/packagist/dt/ctf0/media-manager.svg" alt="Total Downloads"/></a>
<br>
<img src="https://badges.herokuapp.com/browsers?firefox=61&amp;microsoftedge=17&amp;googlechrome=51&amp;safari=10?&amp;iexplore=!?" alt="Browser Status"/>
<img src="https://badges.herokuapp.com/browsers?firefox=61&amp;microsoftedge=17&amp;googlechrome=51&amp;safari=10&amp;iexplore=!?" alt="Browser Status"/>
</h1>

<p align="center">
<img alt="main" src="https://user-images.githubusercontent.com/7388088/69991346-288b3480-1550-11ea-84d3-a5928d655d84.png"/>
<img alt="main" src="https://user-images.githubusercontent.com/7388088/70385131-c0937e80-1993-11ea-9513-cb5c90f4281b.png"/>
<img alt="card" src="https://user-images.githubusercontent.com/7388088/46549215-892dcb80-c8d1-11e8-8c23-d8bbfe7a10cc.jpg"/>
<img alt="img-filter" src="https://user-images.githubusercontent.com/7388088/46004313-dda3a080-c0b2-11e8-814a-af5b3953846f.jpg"/>
<img alt="img-diff" src="https://user-images.githubusercontent.com/7388088/46004311-dd0b0a00-c0b2-11e8-82f1-d6c75235690f.jpg"/>
Expand Down
43 changes: 21 additions & 22 deletions src/App/Controllers/Modules/GetContent.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public function getFiles(Request $request)

return response()->json(
array_merge(
$this->lockList($path),
$this->lockList(),
[
'files' => [
'path' => $path,
Expand Down Expand Up @@ -56,7 +56,7 @@ protected function getData($dir)

if (!preg_grep($pattern, [$path])) {
if ($this->GFI) {
$info = $this->getFolderInfo($path);
$info = $this->getFolderInfoFromList($this->getFolderContent($path, true));
}

$list[] = [
Expand Down Expand Up @@ -95,7 +95,7 @@ protected function getData($dir)
}

/**
* helpers for folder ops.
* get directory data.
*
* @param mixed $folder
* @param mixed $rec
Expand All @@ -109,23 +109,12 @@ protected function getFolderContent($folder, $rec = false)
);
}

protected function getFolderInfo($folder)
{
return $this->getFolderInfoFromList(
$this->getFolderContent($folder, true)
);
}

protected function getFolderInfoFromList($list)
{
$list = collect($list)->where('type', 'file');

return [
'count' => $list->count(),
'size' => $list->pluck('size')->sum(),
];
}

/**
* filter directory data by type.
*
* @param [type] $list
* @param [type] $type
*/
protected function getFolderListByType($list, $type)
{
$list = collect($list)->where('type', $type);
Expand All @@ -137,8 +126,18 @@ protected function getFolderListByType($list, $type)
return $items;
}

protected function getDirectoriesList($location)
/**
* get folder size.
*
* @param [type] $list
*/
protected function getFolderInfoFromList($list)
{
return str_replace($location, '', $this->storageDisk->allDirectories($location));
$list = collect($list)->where('type', 'file');

return [
'count' => $list->count(),
'size' => $list->pluck('size')->sum(),
];
}
}
10 changes: 4 additions & 6 deletions src/App/Controllers/Modules/Lock.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,21 +12,20 @@ trait Lock
*
* @param [type] $dirs
*/
public function getLockList(Request $request)
public function getLockList()
{
return response()->json($this->lockList($request->path));
return response()->json($this->lockList());
}

/**
* get data.
*
* @param [type] $path
*/
public function lockList($path)
public function lockList()
{
return [
'locked' => $this->db->pluck('path'),
'dirs' => $this->getDirectoriesList($path),
];
}

Expand Down Expand Up @@ -71,8 +70,7 @@ public function lockItem(Request $request)

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

return compact('result');
Expand Down
9 changes: 4 additions & 5 deletions src/MediaRoutes.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,17 +17,16 @@ public static function routes()
app('router')->post('upload-cropped', ['uses' => "$controller@uploadEditedImage", 'as' => 'uploadCropped']);
app('router')->post('upload-link', ['uses' => "$controller@uploadLink", 'as' => 'uploadLink']);

app('router')->post('files', ['uses' => "$controller@getFiles", 'as' => 'files']);
app('router')->post('directories', ['uses' => "$controller@getFolders", 'as' => 'directories']);
app('router')->post('new-folder', ['uses' => "$controller@createNewFolder", 'as' => 'new_folder']);
app('router')->post('get-files', ['uses' => "$controller@getFiles", 'as' => 'get_files']);
app('router')->post('create-new-folder', ['uses' => "$controller@createNewFolder", 'as' => 'new_folder']);
app('router')->post('delete-file', ['uses' => "$controller@deleteItem", 'as' => 'delete_file']);
app('router')->post('move-file', ['uses' => "$controller@moveItem", 'as' => 'move_file']);
app('router')->post('rename-file', ['uses' => "$controller@renameItem", 'as' => 'rename_file']);
app('router')->post('change-vis', ['uses' => "$controller@changeItemVisibility", 'as' => 'change_vis']);
app('router')->post('change-visibility', ['uses' => "$controller@changeItemVisibility", 'as' => 'change_vis']);
app('router')->post('lock-file', ['uses' => "$controller@lockItem", 'as' => 'lock_file']);

app('router')->get('global-search', ['uses' => "$controller@globalSearch", 'as' => 'global_search']);
app('router')->post('locked-list', ['uses' => "$controller@getLockList", 'as' => 'locked_list']);
app('router')->post('get-locked-list', ['uses' => "$controller@getLockList", 'as' => 'locked_list']);

app('router')->post('folder-download', ['uses' => "$controller@downloadFolder", 'as' => 'folder_download']);
app('router')->post('files-download', ['uses' => "$controller@downloadFiles", 'as' => 'files_download']);
Expand Down
2 changes: 1 addition & 1 deletion src/resources/assets/js/components/globalSearch/button.vue
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
:disabled="loading || isLoading"
:title="trans('glbl_search')"
class="button"
@click="done ? showSearchPanel() : init()">
@click.stop="done ? showSearchPanel() : init()">
<span class="icon">
<icon :spin="loading"
name="globe"/>
Expand Down
55 changes: 16 additions & 39 deletions src/resources/assets/js/components/globalSearch/panel.vue
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
<transition-group name="mm-gs"
tag="ul"
class="columns is-multiline is-marginless">
<li v-for="(item, i) in filterdList"
<li v-for="(item, i) in filterdFilesList"
:key="`${i}-${item.name}`"
class="column is-2">
<div class="card">
Expand All @@ -48,48 +48,25 @@

<div v-else
class="glbl_search_panel">
<icon v-if="fileTypeIs(item, 'folder')"
class="svg-prev-icon"
name="folder"
scale="5.0"/>
<icon v-else-if="fileTypeIs(item, 'application')"
class="svg-prev-icon"
name="cogs"
scale="5.0"/>
<icon v-else-if="fileTypeIs(item, 'video')"
class="svg-prev-icon"
name="film"
scale="5.0"/>
<icon v-else-if="fileTypeIs(item, 'audio')"
class="svg-prev-icon"
name="music"
scale="5.0"/>
<icon v-else-if="fileTypeIs(item, 'pdf')"
class="svg-prev-icon"
name="file-pdf-o"
scale="5.0"/>
<icon v-else-if="fileTypeIs(item, 'text')"
class="svg-prev-icon"
name="file-text-o"
scale="5.0"/>
<icon v-else-if="fileTypeIs(item, 'compressed')"
class="svg-prev-icon"
name="file-archive-o"
scale="5.0"/>
<icon-types :file="item"
:file-type-is="fileTypeIs"
:scale="5"
classes="svg-prev-icon"
:except="['image']"/>
</div>
</div>
<div class="card-content">
<p v-tippy="{arrow: true, hideOnClick: false, followCursor: true}"
:title="linkCopied ? trans('copied') : trans('to_cp')"
class="title is-marginless link"
@click="copyLink(item.path)"
@click.stop="copyLink(item.path)"
@hidden="linkCopied = false">
{{ item.name }}
</p>
<br>

<p class="subtitle is-marginless link"
@click="goToFolder(item.dir_path, item.name)">
@click.stop="goToFolder(item.dir_path, item.name)">
<span class="icon"><icon name="folder"/></span>
<span v-tippy
:title="trans('go_to_folder')">{{ item.dir_path }}</span>
Expand All @@ -99,12 +76,12 @@
<span>{{ item.last_modified_formated }}</span>
</time>
<p class="subtitle is-marginless link"
@click="deleteItem(item, i)">
@click.stop="deleteItem(item, i)">
<span class="icon"><icon name="times"/></span>
<span>{{ trans('delete') }}</span>
</p>
<p class="subtitle is-marginless link"
@click="addToMovableList(item)">
@click.stop="addToMovableList(item)">
<span class="icon"><icon name="shopping-cart"/></span>
<span>{{ inMovableList(item) ? trans('added') : trans('add_to_list') }}</span>
</p>
Expand All @@ -123,7 +100,7 @@
</transition-group>
</div>
<button class="modal-close is-large"
@click="closePanel()"/>
@click.stop="closePanel()"/>
</div>
</template>

Expand Down Expand Up @@ -153,7 +130,7 @@ export default {
data() {
return {
filesIndex: [],
filterdList: [],
filterdFilesList: [],
search: '',
noData: false,
linkCopied: false,
Expand All @@ -169,7 +146,7 @@ export default {
})
},
listCount() {
return this.filterdList.length
return this.filterdFilesList.length
}
},
methods: {
Expand All @@ -187,7 +164,7 @@ export default {
})
EventHub.listen('global-search-deleted', (path) => {
let list = this.filterdList
let list = this.filterdFilesList
return list.some((e, i) => {
if (e.path == path) {
Expand Down Expand Up @@ -220,12 +197,12 @@ export default {
let search = this.search
if (search) {
this.filterdList = this.fuseLib.search(search)
this.filterdFilesList = this.fuseLib.search(search)
return this.noData = this.listCount ? false : true
}
this.filterdList = []
this.filterdFilesList = []
}, 500),
ontransitionend() {
this.noData = this.search && !this.listCount ? true : false
Expand Down
11 changes: 6 additions & 5 deletions src/resources/assets/js/components/image/editor/controls.vue
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
<template>
<div>
<button v-tippy="{arrow: true, theme: 'mm'}"
v-for="item in controlsList"
:class="{'is-active': item.mode ? dragModeIs(item.mode) : false}"
<button v-for="item in controlsList"
:key="item.op"
v-tippy="{arrow: true, theme: 'mm'}"
:class="{'is-active': item.mode ? dragModeIs(item.mode) : false}"
:title="trans(item.trans)"
:disabled="processing"
class="btn-plain"
@click="operations(item.op)">
<span class="icon"><icon :name="processing ? 'spinner' : item.icon" :pulse="processing"/></span>
@click.stop="operations(item.op)">
<span class="icon"><icon :name="processing ? 'spinner' : item.icon"
:pulse="processing"/></span>
</button>
</div>
</template>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
<div v-show="range != 0"
class="level-item">
<p class="heading is-marginless link"
@click="resetFilter()">
@click.stop="resetFilter()">
<span class="icon"><icon name="times"/></span>
</p>
</div>
Expand All @@ -43,7 +43,7 @@
:class="{'is-active': isUsed()}"
:disabled="processing"
class="btn-plain"
@click="update()">
@click.stop="update()">
<span class="icon">
<icon :name="processing ? 'spinner' : icon"
:pulse="processing"/>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,18 +1,24 @@
<template>
<div>
<h3 :style="{'opacity': processing ? 0.5 : 1}">{{ trans('presets') }}</h3>
<h3 :style="{'opacity': processing ? 0.5 : 1}">
{{ trans('presets') }}
</h3>

<section>
<div v-for="(chunk, i) in chunkedItems" :key="i" class="col">
<button v-tippy="{arrow: true, theme: 'mm'}"
v-for="item in chunk"
<div v-for="(chunk, i) in chunkedItems"
:key="i"
class="col">
<button v-for="item in chunk"
:key="item"
v-tippy="{arrow: true, theme: 'mm'}"
:disabled="processing"
:class="{'is-active': isUsed(item)}"
:title="item"
class="btn-plain"
@click="apply(item)">
<span v-show="processing" class="icon is-small"><icon :pulse="processing" name="spinner"/></span>
@click.stop="apply(item)">
<span v-show="processing"
class="icon is-small"><icon :pulse="processing"
name="spinner"/></span>
<span v-show="!processing">{{ truncate(item) }}</span>
</button>
</div>
Expand Down
Loading

0 comments on commit d5bae67

Please sign in to comment.