diff --git a/app/Http/Controllers/FileBrowser/BrowseController.php b/app/Http/Controllers/FileBrowser/BrowseController.php index a761d832..8ee67b38 100644 --- a/app/Http/Controllers/FileBrowser/BrowseController.php +++ b/app/Http/Controllers/FileBrowser/BrowseController.php @@ -95,9 +95,9 @@ class BrowseController extends Controller public function latest() { // Get User - // TODO: SFORMATOVAT! $user = User::with(['latest_uploads' => function($query) { - $query->sortable(); }]) + $query->sortable(); + }]) ->where('id', Auth::id()) ->first(); @@ -134,7 +134,6 @@ class BrowseController extends Controller $user_id = Auth::id(); // Get folder trash items - // TODO: do funkcii nizsie potrebujeme tiez sortable, totizto foldre v kosi vies tiez prechadzat, takisto spojazdnit na frontende. Lokacie mame 'trash-root' a 'trash' if ($request->query('trash')) { // Get folders and files @@ -142,12 +141,14 @@ class BrowseController extends Controller ->with('parent') ->where('user_id', $user_id) ->where('parent_id', $unique_id) + ->sortable() ->get(); $files = FileManagerFile::onlyTrashed() ->with('parent') ->where('user_id', $user_id) ->where('folder_id', $unique_id) + ->sortable() ->get(); // Collect folders and files to single array @@ -158,13 +159,13 @@ class BrowseController extends Controller $folders = FileManagerFolder::with(['parent', 'shared:token,id,item_id,permission,protected,expire_in']) ->where('user_id', $user_id) ->where('parent_id', $unique_id) - ->sortable(['name', 'DESC']) + ->sortable() ->get(); $files = FileManagerFile::with(['parent', 'shared:token,id,item_id,permission,protected,expire_in']) ->where('user_id', $user_id) ->where('folder_id', $unique_id) - ->sortable(['name', 'DESC']) + ->sortable() ->get(); // Collect folders and files to single array diff --git a/app/Http/Controllers/User/AccountController.php b/app/Http/Controllers/User/AccountController.php index e4b2346d..64ba5a6b 100644 --- a/app/Http/Controllers/User/AccountController.php +++ b/app/Http/Controllers/User/AccountController.php @@ -107,7 +107,15 @@ class AccountController extends Controller */ public function update_user_settings(Request $request) { - // TODO: validation + // Validate request + $validator = Validator::make($request->all(), [ + 'name' => 'string', + 'value' => 'string', + ]); + + // Return error + if ($validator->fails()) abort(400, 'Bad input'); + // Get user $user = Auth::user(); diff --git a/app/User.php b/app/User.php index 62f58c2c..bfc7cdf6 100644 --- a/app/User.php +++ b/app/User.php @@ -195,15 +195,14 @@ class User extends Authenticatable */ public function getFolderTreeAttribute() { - + // Get sorting setup $sort = strtolower(request()->input('sort')); $direction = strtolower(request()->input('direction')); - // TODO: pozor pozor tu by sme mali pouzit sortable(), tak ako si pouzil v BrowseController return FileManagerFolder::with(['folders.shared', 'shared:token,id,item_id,permission,protected,expire_in']) ->where('parent_id', 0) ->where('user_id', $this->id) - ->orderBy($sort , $direction) + ->sortable($sort , $direction) ->get(); } diff --git a/resources/js/App.vue b/resources/js/App.vue index 1ae34c5b..f78107a7 100644 --- a/resources/js/App.vue +++ b/resources/js/App.vue @@ -163,11 +163,16 @@ }, mounted() { + this.$checkOS() + // Handle mobile navigation scale animation events.$on('show:mobile-navigation', () => this.isScaledDown = true) events.$on('hide:mobile-navigation', () => this.isScaledDown = false) events.$on('mobileMenu:show', () => this.isScaledDown = true) events.$on('fileItem:deselect', () => this.isScaledDown = false) + events.$on('mobileSortingAndPreview', (state) => { + this.isScaledDown = state + }) } } diff --git a/resources/js/components/FilesView/ContextMenu.vue b/resources/js/components/FilesView/ContextMenu.vue index 0ec608e1..3305cfd0 100644 --- a/resources/js/components/FilesView/ContextMenu.vue +++ b/resources/js/components/FilesView/ContextMenu.vue @@ -466,6 +466,7 @@ export default { this.$store.dispatch('fileInfoToggle', true) }, deleteItem() { + // Dispatch remove item // If is context menu open on non selected item delete this single item if (!this.fileInfoDetail.includes(this.item)) { this.$store.dispatch('deleteItem', this.item) diff --git a/resources/js/components/FilesView/DesktopToolbar.vue b/resources/js/components/FilesView/DesktopToolbar.vue index ff3c97e7..a2123f01 100644 --- a/resources/js/components/FilesView/DesktopToolbar.vue +++ b/resources/js/components/FilesView/DesktopToolbar.vue @@ -84,11 +84,13 @@ { + this.sortingAndPreview = state + }) + } }; diff --git a/resources/js/components/FilesView/DragUI.vue b/resources/js/components/FilesView/DragUI.vue index 46f7b97a..36023efa 100644 --- a/resources/js/components/FilesView/DragUI.vue +++ b/resources/js/components/FilesView/DragUI.vue @@ -13,21 +13,34 @@ import {events} from '@/bus' computed: { ...mapGetters(['fileInfoDetail']), title(){ + + // Title for multiple selected items if(this.fileInfoDetail.length > 1 && this.fileInfoDetail.includes(this.draggedItem)) { return this.$t('file_detail.selected_multiple') } + // Title for single item if((this.fileInfoDetail.length < 2 || !this.fileInfoDetail.includes(this.draggedItem)) && this.draggedItem ) { return this.draggedItem.name } }, subtitle(){ + // Subtitle for multiple selected items if(this.fileInfoDetail.length > 1 && this.fileInfoDetail.includes(this.draggedItem) ) { return this.fileInfoDetail.length + ' ' + this.$tc('file_detail.items', this.fileInfoDetail.length) } - if((this.fileInfoDetail.length < 2 || !this.fileInfoDetail.includes(this.draggedItem)) && this.draggedItem && this.draggedItem.mimetype) { - return '.'+this.draggedItem.mimetype + if((this.fileInfoDetail.length < 2 || !this.fileInfoDetail.includes(this.draggedItem)) && this.draggedItem) { + + // Subtitle for single folder + if(this.draggedItem.type === 'folder') { + return this.draggedItem.items == 0 ? this.$t('folder.empty') : this.$tc('folder.item_counts', this.draggedItem.items) + } + + // Subtitle for single file + if(this.draggedItem !== 'folder' && this.draggedItem.mimetype){ + return '.'+this.draggedItem.mimetype + } } }, }, diff --git a/resources/js/components/FilesView/FileBrowser.vue b/resources/js/components/FilesView/FileBrowser.vue index 4d4121d1..3277dc8b 100644 --- a/resources/js/components/FilesView/FileBrowser.vue +++ b/resources/js/components/FilesView/FileBrowser.vue @@ -230,11 +230,11 @@ } }, created() { - events.$on('mobileSelecting-start' , () => { + events.$on('mobileSelecting:start' , () => { this.mobileMultiSelect =true }) - events.$on('mobileSelecting-stop' , () => { + events.$on('mobileSelecting:stop' , () => { this.mobileMultiSelect = false }) diff --git a/resources/js/components/FilesView/FileItemGrid.vue b/resources/js/components/FilesView/FileItemGrid.vue index d3d9a169..1751cfc7 100644 --- a/resources/js/components/FilesView/FileItemGrid.vue +++ b/resources/js/components/FilesView/FileItemGrid.vue @@ -157,6 +157,8 @@ export default { clickedItem(e) { events.$emit('contextMenu:hide') + events.$emit('sortingAndPreview', false) + if (!this.$isMobile()) { if (e.ctrlKey || e.metaKey && !e.shiftKey) { // Click + Ctrl @@ -263,12 +265,12 @@ export default { created() { this.itemName = this.data.name - events.$on('mobileSelecting-start', () => { + events.$on('mobileSelecting:start', () => { this.mobileMultiSelect = true this.$store.commit('CLEAR_FILEINFO_DETAIL') }) - events.$on('mobileSelecting-stop', () => { + events.$on('mobileSelecting:stop', () => { this.mobileMultiSelect = false this.$store.commit('CLEAR_FILEINFO_DETAIL') }) diff --git a/resources/js/components/FilesView/FileItemList.vue b/resources/js/components/FilesView/FileItemList.vue index 3cb190f1..c280efae 100644 --- a/resources/js/components/FilesView/FileItemList.vue +++ b/resources/js/components/FilesView/FileItemList.vue @@ -168,6 +168,8 @@ export default { clickedItem(e) { events.$emit('contextMenu:hide') + events.$emit('sortingAndPreview', false) + if(!this.$isMobile()) { if( (e.ctrlKey || e.metaKey ) && !e.shiftKey) { @@ -271,12 +273,12 @@ export default { created() { this.itemName = this.data.name - events.$on('mobileSelecting-start', () => { + events.$on('mobileSelecting:start', () => { this.mobileMultiSelect = true this.$store.commit('CLEAR_FILEINFO_DETAIL') }) - events.$on('mobileSelecting-stop', () => { + events.$on('mobileSelecting:stop', () => { this.mobileMultiSelect = false this.$store.commit('CLEAR_FILEINFO_DETAIL') }) diff --git a/resources/js/components/FilesView/MobileActionButton.vue b/resources/js/components/FilesView/MobileActionButton.vue index 7e2e35a5..afc60503 100644 --- a/resources/js/components/FilesView/MobileActionButton.vue +++ b/resources/js/components/FilesView/MobileActionButton.vue @@ -8,7 +8,7 @@ - diff --git a/resources/js/components/FilesView/MobileActions.vue b/resources/js/components/FilesView/MobileActions.vue index c1ad09d1..3a02311f 100644 --- a/resources/js/components/FilesView/MobileActions.vue +++ b/resources/js/components/FilesView/MobileActions.vue @@ -3,15 +3,15 @@
- - {{$t('preview_sorting.preview_sorting_button')}} - - - {{ $t('context_menu.select') }} - {{ $t('context_menu.empty_trash') }} + + {{ $t('context_menu.select') }} + + + {{$t('preview_sorting.preview_sorting_button')}} +
@@ -25,20 +25,19 @@ {{ $t('context_menu.select') }} - - + {{$t('preview_sorting.preview_sorting_button')}}
- - {{$t('preview_sorting.preview_sorting_button')}} - {{ $t('context_menu.select') }} + + {{$t('preview_sorting.preview_sorting_button')}} +
@@ -80,20 +79,22 @@ mobileMultiSelect () { if(this.mobileMultiSelect ) { - events.$emit('mobileSelecting-start') + events.$emit('mobileSelecting:start') } if(!this.mobileMultiSelect) { - events.$emit('mobileSelecting-stop') + events.$emit('mobileSelecting:stop') } }, mobileSortingAndPreview (oldValue , newValue) { if(this.mobileSortingAndPreview) { - events.$emit('mobileSortingAndPreview-open') + events.$emit('mobileSortingAndPreview' , true) + events.$emit('mobileSortingAndPreviewVignette' , true) this.mobileMultiSelect = false } if(!this.mobileSortingAndPreview) { - events.$emit('mobileSortingAndPreview-close') + events.$emit('mobileSortingAndPreview', false) + events.$emit('mobileSortingAndPreviewVignette' , false) } } }, @@ -112,12 +113,12 @@ }, }, mounted () { - events.$on('mobileSelecting-stop', () => { + events.$on('mobileSelecting:stop', () => { this.mobileMultiSelect = false }) - events.$on('mobileSortingAndPreview-close', () => { - this.mobileSortingAndPreview = false + events.$on('mobileSortingAndPreview', (state) => { + this.mobileSortingAndPreview = state }) @@ -128,10 +129,17 @@ diff --git a/resources/js/components/FilesView/MobileMultiSelectButton.vue b/resources/js/components/FilesView/MobileMultiSelectButton.vue index 12fcf003..1bd07abf 100644 --- a/resources/js/components/FilesView/MobileMultiSelectButton.vue +++ b/resources/js/components/FilesView/MobileMultiSelectButton.vue @@ -27,11 +27,11 @@ } }, mounted() { - events.$on('mobileSelecting-start' , () => { + events.$on('mobileSelecting:start' , () => { this.mobileSelectingActive = true }) - events.$on('mobileSelecting-stop' , () => { + events.$on('mobileSelecting:stop' , () => { this.mobileSelectingActive = false }) } diff --git a/resources/js/components/FilesView/MobileMultiSelectMenu.vue b/resources/js/components/FilesView/MobileMultiSelectMenu.vue index e3270004..55e2ddec 100644 --- a/resources/js/components/FilesView/MobileMultiSelectMenu.vue +++ b/resources/js/components/FilesView/MobileMultiSelectMenu.vue @@ -30,7 +30,7 @@ export default { }, methods: { closeSelecting() { - events.$emit('mobileSelecting-stop') + events.$emit('mobileSelecting:stop') }, downloadItem() { this.fileInfoDetail.forEach((item , i) => { @@ -52,12 +52,12 @@ export default { } }, created() { - events.$on('mobileSelecting-start', () => { + events.$on('mobileSelecting:start', () => { this.mobileMultiSelect = true }) - events.$on('mobileSelecting-stop', () => { + events.$on('mobileSelecting:stop', () => { this.mobileMultiSelect = false }) diff --git a/resources/js/components/FilesView/MobileSortingAndPreview.vue b/resources/js/components/FilesView/MobileSortingAndPreview.vue index 0cee585e..c36c8544 100644 --- a/resources/js/components/FilesView/MobileSortingAndPreview.vue +++ b/resources/js/components/FilesView/MobileSortingAndPreview.vue @@ -1,6 +1,5 @@ diff --git a/resources/js/helpers.js b/resources/js/helpers.js index afc3bd92..096da3c3 100644 --- a/resources/js/helpers.js +++ b/resources/js/helpers.js @@ -301,9 +301,6 @@ const Helpers = { title: i18n.t('popup_mimetypes_blacklist.title'), message: i18n.t('popup_mimetypes_blacklist.message', {mimetype: fileType[1]}), }) - }else { - // TODO: tento else tu nemusi byt, defaultne je uz prednastaveny true cize ak sa nevykona podmienka vyssie tak vzdy bude true - validated = true } } return validated @@ -315,11 +312,11 @@ const Helpers = { let actions = { 'base' : ['getFolder', [{ folder: folder, back: true, init: false, sorting:true}]], 'public' : ['browseShared', [{ folder: folder, back: true, init: false, sorting:true}]], + 'trash' : ['getFolder', [{ folder: folder, back: true, init: false, sorting:true}]], + 'participant_uploads' : ['getParticipantUploads'], + 'trash-root' : ['getTrash'], 'latest' : ['getLatest'], 'shared' : ['getShared'], - 'trash-root' : ['getTrash'], - // 'trash' : ['getTrash'], TODO: skontrolovat a spojazdnit - 'participant_uploads' : ['getParticipantUploads'], } this.$store.dispatch(...actions[folder.location]) @@ -330,14 +327,14 @@ const Helpers = { // Get data of Navigator tree this.$store.dispatch('getFolderTree') } + Vue.prototype.$checkOS = function() { + // Handle styled scrollbar for Windows + if (navigator.userAgent.indexOf('Windows') != -1) { + let body = document.body + body.classList.add('windows') + } + } } } -export default Helpers - -// Handle styled scrollbar for Windows -// TODO: toto treba dat jednoznacne na svoje spravne miesto -if (navigator.userAgent.indexOf('Windows') != -1) { - let body = document.body - body.classList.add('windows') -} \ No newline at end of file +export default Helpers \ No newline at end of file diff --git a/resources/js/i18n/lang/cn.json b/resources/js/i18n/lang/cn.json index bf1cb950..97a36b1e 100644 --- a/resources/js/i18n/lang/cn.json +++ b/resources/js/i18n/lang/cn.json @@ -6,7 +6,9 @@ "preview": "更改预览", "share": "Share item", "upload": "上传文件", - "close": "Close" + "close": "Close", + "sorting_view": "Sorting and View", + "info_panel": "Info panel" }, "activation": { "stripe": { diff --git a/resources/js/i18n/lang/en.json b/resources/js/i18n/lang/en.json index 00f3b4ba..17562b58 100644 --- a/resources/js/i18n/lang/en.json +++ b/resources/js/i18n/lang/en.json @@ -8,7 +8,9 @@ "upload": "Upload file", "download": "Download item", "print": "Print item", - "close": "Close" + "close": "Close", + "sorting_view": "Sorting and View", + "info_panel": "Info panel" }, "activation": { "stripe": { diff --git a/resources/js/i18n/lang/sk.json b/resources/js/i18n/lang/sk.json index dc1b6f8e..553c0502 100644 --- a/resources/js/i18n/lang/sk.json +++ b/resources/js/i18n/lang/sk.json @@ -8,7 +8,9 @@ "upload": "Nahrať súbory", "download": "Stiahnuť položku", "print": "Vytlačiť položku", - "close": "Zatvoriť" + "close": "Zatvoriť", + "sorting_view" : "Zoradenie a zobrazenie ", + "info_panel" : "Informačný panel" }, "activation": { "stripe": { diff --git a/resources/js/store/modules/fileBrowser.js b/resources/js/store/modules/fileBrowser.js index eeefc4e6..1801e12e 100644 --- a/resources/js/store/modules/fileBrowser.js +++ b/resources/js/store/modules/fileBrowser.js @@ -36,11 +36,11 @@ const actions = { commit('STORE_PREVIOUS_FOLDER', getters.currentFolder) let url = payload.folder.location === 'trash' - ? '/folders/' + payload.folder.unique_id + '?trash=true' - : '/folders/' + payload.folder.unique_id + ? '/folders/' + payload.folder.unique_id + getters.sorting.URI + '&trash=true' + : '/folders/' + payload.folder.unique_id + getters.sorting.URI axios - .get(getters.api + url + getters.sorting.URI) + .get(getters.api + url) .then(response => { commit('LOADING_STATE', {loading: false, data: response.data}) commit('STORE_CURRENT_FOLDER', payload.folder)