Skip to content

Commit

Permalink
rdme
Browse files Browse the repository at this point in the history
  • Loading branch information
ctf0 committed Aug 16, 2018
1 parent f9d4233 commit 082e1b1
Show file tree
Hide file tree
Showing 7 changed files with 27 additions and 13 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand Down
11 changes: 9 additions & 2 deletions src/resources/assets/js/components/globalSearch/button.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
<template>
<button :disabled="loading" :class="{'is-static' : loading}" class="button" @click="done ? showSearchPanel() : init()">
<button v-tippy :disabled="loading"
:class="{'is-static' : loading}"
:title="trans('glbl_search')"
class="button"
@click="done ? showSearchPanel() : init()">
<span class="icon"><icon :spin="loading" name="globe"/></span>
</button>
</template>
Expand Down Expand Up @@ -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')
}
Expand Down
3 changes: 2 additions & 1 deletion src/resources/assets/js/components/media.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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()
},
Expand All @@ -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')
},
Expand Down
14 changes: 8 additions & 6 deletions src/resources/assets/js/modules/scroll.js
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
}
}
}
5 changes: 3 additions & 2 deletions src/resources/lang/en/messages.php
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down Expand Up @@ -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',
);
1 change: 1 addition & 0 deletions src/resources/views/_manager.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -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')
]) }}"
Expand Down
4 changes: 2 additions & 2 deletions src/resources/views/media.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,6 @@
{{-- footer --}}
@stack('styles')
@stack('scripts')
<script src="{{ asset("path/to/app.js") }}"></script>
<script src="{{ asset("js/app.js") }}"></script>
</body>
</html>
</html>

0 comments on commit 082e1b1

Please sign in to comment.