From 082e1b165809df8921b3f4c179b0600879036894 Mon Sep 17 00:00:00 2001 From: Muah Date: Thu, 16 Aug 2018 22:29:56 +0200 Subject: [PATCH] rdme --- README.md | 2 ++ .../assets/js/components/globalSearch/button.vue | 11 +++++++++-- src/resources/assets/js/components/media.vue | 3 ++- src/resources/assets/js/modules/scroll.js | 14 ++++++++------ src/resources/lang/en/messages.php | 5 +++-- src/resources/views/_manager.blade.php | 1 + src/resources/views/media.blade.php | 4 ++-- 7 files changed, 27 insertions(+), 13 deletions(-) diff --git a/README.md b/README.md index 868cad0..01b93ad 100644 --- a/README.md +++ b/README.md @@ -43,6 +43,8 @@ - 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 + // app.js + window.Vue = require('vue') require('../vendor/MediaManager/js/manager') diff --git a/src/resources/assets/js/components/globalSearch/button.vue b/src/resources/assets/js/components/globalSearch/button.vue index 99d6ebe..0920131 100644 --- a/src/resources/assets/js/components/globalSearch/button.vue +++ b/src/resources/assets/js/components/globalSearch/button.vue @@ -1,5 +1,9 @@ @@ -28,12 +32,15 @@ export default { this.loading = false this.done = true EventHub.fire('global-search-index', data) - parent.showNotif(parent.trans('glbl_search')) + parent.showNotif(this.trans('glbl_search_avail')) }).catch((err) => { console.error(err) }) }, + trans(key) { + return this.$parent.trans(key) + }, showSearchPanel() { EventHub.fire('show-global-search') } diff --git a/src/resources/assets/js/components/media.vue b/src/resources/assets/js/components/media.vue index 8dc7b13..5588d44 100644 --- a/src/resources/assets/js/components/media.vue +++ b/src/resources/assets/js/components/media.vue @@ -115,7 +115,7 @@ export default { }, created() { window.addEventListener('popstate', this.urlNavigation) - window.addEventListener('resize', debounce(this.scrollByRow, 500)) + window.addEventListener('resize', debounce(this.scrollByRow, 250)) document.addEventListener('keydown', this.shortCuts) this.init() }, @@ -140,6 +140,7 @@ export default { }, 250), beforeDestroy() { window.removeEventListener('popstate', this.urlNavigation) + window.removeEventListener('resize', this.scrollByRow) document.removeEventListener('keydown', this.shortCuts) this.noScroll('remove') }, diff --git a/src/resources/assets/js/modules/scroll.js b/src/resources/assets/js/modules/scroll.js index f88cf60..4470fb7 100644 --- a/src/resources/assets/js/modules/scroll.js +++ b/src/resources/assets/js/modules/scroll.js @@ -37,14 +37,16 @@ export default { }) }, scrollByRow() { - const cont = this.$refs['__stack-files'].$el + const cont = this.$refs['__stack-files'] ? this.$refs['__stack-files'].$el : null - 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 ? this.$refs.filesList.firstChild.clientWidth : 0 + if (cont) { + 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 ? this.$refs.filesList.firstChild.clientWidth : 0 - this.scrollByRows = Math.floor(contWidth / itemWidth) + this.scrollByRows = Math.floor(contWidth / itemWidth) + } } } } diff --git a/src/resources/lang/en/messages.php b/src/resources/lang/en/messages.php index f88793b..f6da95a 100755 --- a/src/resources/lang/en/messages.php +++ b/src/resources/lang/en/messages.php @@ -52,6 +52,8 @@ 'find' => 'Find...', 'folder' => 'Folder', 'found' => 'Found', + 'glbl_search_avail' => 'Global Search Is Now Available.', + 'go_to_folder' => 'Go To Folder !', 'image' => 'Image', 'items' => 'Item(s)', 'last_modified' => 'Last Modified', @@ -107,6 +109,5 @@ 'visibility_error' => '":attr" Visibility Couldn\'t Be Changed', 'visibility_set' => 'Change Visibility', 'visibility_success' => '":attr" Visibility Was Updated', - 'go_to_folder' => 'Go To Folder !', - 'glbl_search' => 'Global Search Is Now Available', + 'glbl_search' => 'Global Search', ); \ No newline at end of file diff --git a/src/resources/views/_manager.blade.php b/src/resources/views/_manager.blade.php index 69c8844..2c2f4f5 100644 --- a/src/resources/views/_manager.blade.php +++ b/src/resources/views/_manager.blade.php @@ -30,6 +30,7 @@ 'stand_by' => trans('MediaManager::messages.stand_by'), 'new_uploads_notif' => trans('MediaManager::messages.new_uploads_notif'), 'glbl_search' => trans('MediaManager::messages.glbl_search'), + 'glbl_search_avail' => trans('MediaManager::messages.glbl_search_avail'), 'go_to_folder' => trans('MediaManager::messages.go_to_folder'), 'find' => trans('MediaManager::messages.find') ]) }}" diff --git a/src/resources/views/media.blade.php b/src/resources/views/media.blade.php index 1708dc7..b0d0e16 100644 --- a/src/resources/views/media.blade.php +++ b/src/resources/views/media.blade.php @@ -30,6 +30,6 @@ {{-- footer --}} @stack('styles') @stack('scripts') - + - \ No newline at end of file +