From 98a92a3da0f2147215ea219f6521766a269b8228 Mon Sep 17 00:00:00 2001 From: Henrique Dias Date: Thu, 29 Jun 2017 17:54:57 +0100 Subject: [PATCH] updates --- _assets/_old/js/listing.js | 26 +---- _assets/build/config.js | 6 +- _assets/build/service-worker-prod.js | 2 +- _assets/build/webpack.prod.conf.js | 3 +- _assets/index.html | 153 ++++++++++++++++++++++----- _assets/src/App.vue | 19 +--- _assets/src/components/Listing.vue | 19 ++++ _assets/src/css/listing.css | 42 +++++--- _assets/src/css/styles.css | 39 ++----- cmd/filemanager/main.go | 2 +- filemanager.go | 4 +- 11 files changed, 190 insertions(+), 125 deletions(-) diff --git a/_assets/_old/js/listing.js b/_assets/_old/js/listing.js index 1edfab26..04e3c562 100644 --- a/_assets/_old/js/listing.js +++ b/_assets/_old/js/listing.js @@ -82,33 +82,9 @@ listing.addDoubleTapEvent = function () { document.addEventListener('DOMContentLoaded', event => { - listing.updateColumns() listing.addDoubleTapEvent() - - document.getElementById('multiple-selection-activate').addEventListener('click', event => { - listing.selectMultiple = true - clickOverlay.click() - - document.getElementById('multiple-selection').classList.add('active') - document.querySelector('body').style.paddingBottom = '4em' - }) - - document.getElementById('multiple-selection-cancel').addEventListener('click', event => { - listing.selectMultiple = false - - document.querySelector('body').style.paddingBottom = '0' - document.getElementById('multiple-selection').classList.remove('active') - }) - - if (user.AllowEdit) { - buttons.move.addEventListener('click', listing.moveEvent) - buttons.rename.addEventListener('click', listing.rename) - } - - let items = document.getElementsByClassName('item') - + if (user.AllowNew) { - buttons.new.addEventListener('click', listing.newFileButton) } }) diff --git a/_assets/build/config.js b/_assets/build/config.js index cc26c4b6..7525a0df 100644 --- a/_assets/build/config.js +++ b/_assets/build/config.js @@ -6,10 +6,10 @@ module.exports = { env: { NODE_ENV: '"production"' }, - index: path.resolve(__dirname, '../dist/index.html'), + index: path.resolve(__dirname, '../dist/templates/index.html'), assetsRoot: path.resolve(__dirname, '../dist'), - assetsSubDirectory: 'static', - assetsPublicPath: '/', + assetsSubDirectory: '_', + assetsPublicPath: '{{ .BaseURL }}', productionSourceMap: true, // Gzip off by default as many popular static hosts such as // Surge or Netlify already gzip all static assets for you. diff --git a/_assets/build/service-worker-prod.js b/_assets/build/service-worker-prod.js index dd6f0063..cc9d4936 100644 --- a/_assets/build/service-worker-prod.js +++ b/_assets/build/service-worker-prod.js @@ -16,7 +16,7 @@ window.addEventListener('load', function() { if ('serviceWorker' in navigator && (window.location.protocol === 'https:' || isLocalhost)) { - navigator.serviceWorker.register('service-worker.js') + navigator.serviceWorker.register('{{ .BaseURL }}/_/service-worker.js') .then(function(registration) { // updatefound is fired if service-worker.js changes. registration.onupdatefound = function() { diff --git a/_assets/build/webpack.prod.conf.js b/_assets/build/webpack.prod.conf.js index 8cba2668..2f1e461c 100644 --- a/_assets/build/webpack.prod.conf.js +++ b/_assets/build/webpack.prod.conf.js @@ -58,7 +58,8 @@ var webpackConfig = merge(baseWebpackConfig, { minify: { removeComments: true, collapseWhitespace: true, - removeAttributeQuotes: true + removeAttributeQuotes: true, + minifyCSS: true // more options: // https://github.com/kangax/html-minifier#options-quick-reference }, diff --git a/_assets/index.html b/_assets/index.html index 0f6f04b9..6951984a 100644 --- a/_assets/index.html +++ b/_assets/index.html @@ -20,38 +20,135 @@ + <% for (var chunk of webpack.chunks) { - for (var file of chunk.files) { - if (file.match(/\.(js|css)$/)) { %> + for (var file of chunk.files) { + if (file.match(/\.(js|css)$/)) { %> <% }}} %> - - + + + {{- if ne .User.StyleSheet "" -}} {{- end -}} - - -
- - This is your fallback content in case JavaScript fails to load. -
- - <%= htmlWebpackPlugin.options.serviceWorkerLoader %> - + + +
+
+ +
+
+
+
+
+
+ +<%= htmlWebpackPlugin.options.serviceWorkerLoader %> + diff --git a/_assets/src/App.vue b/_assets/src/App.vue index 0e136b73..0a5b821a 100644 --- a/_assets/src/App.vue +++ b/_assets/src/App.vue @@ -1,5 +1,5 @@ @@ -66,6 +80,8 @@ import Item from './ListingItem' import webdav from '../webdav.js' import page from '../page.js' +var $ = window.info + export default { name: 'listing', data: function () { @@ -111,6 +127,9 @@ export default { base64: function (name) { return window.btoa(name) }, + cancelMultiple: function () { + $.multiple = false + }, dragEnter: function (event) { let items = document.getElementsByClassName('item') diff --git a/_assets/src/css/listing.css b/_assets/src/css/listing.css index e2bcb119..98f0dbc5 100644 --- a/_assets/src/css/listing.css +++ b/_assets/src/css/listing.css @@ -1,9 +1,3 @@ - - -/* * * * * * * * * * * * * * * * - * LISTING * - * * * * * * * * * * * * * * * */ - #listing { max-width: calc(100% - 1.2em); width: 100%; @@ -81,11 +75,6 @@ vertical-align: middle; } - -/* * * * * * * * * * * * * * * * - * LISTING - MOSAIC * - * * * * * * * * * * * * * * * */ - #listing.mosaic { padding-top: 1em; } @@ -114,11 +103,6 @@ width: calc(100% - 5vw); } - -/* * * * * * * * * * * * * * * * - * LISTING - DETAIL * - * * * * * * * * * * * * * * * */ - #listing.list { flex-direction: column; padding-top: 3.25em; @@ -240,4 +224,28 @@ #listing.list .item.header .active { font-weight: bold; -} \ No newline at end of file +} + +#listing #multiple-selection { + position: fixed; + bottom: -4em; + left: 0; + z-index: 99999; + width: 100%; + background-color: #2196f3; + height: 4em; + display: flex !important; + padding: 0.5em 0.5em 0.5em 1em; + justify-content: space-between; + align-items: center; + transition: .2s ease bottom; +} + +#listing #multiple-selection.active { + bottom: 0; +} + +#listing #multiple-selection p, +#listing #multiple-selection i { + color: #fff; +} diff --git a/_assets/src/css/styles.css b/_assets/src/css/styles.css index b977bbb8..3cba1d1e 100644 --- a/_assets/src/css/styles.css +++ b/_assets/src/css/styles.css @@ -78,6 +78,14 @@ i.spin { } +#app { + transition: .2s ease padding; +} + +#app.multiple { + padding-bottom: 4em; +} + /* * * * * * * * * * * * * * * * * EDITOR * * * * * * * * * * * * * * * * */ @@ -500,37 +508,6 @@ main { } -/* * * * * * * * * * * * * * * * - * MULTIPLE SELECTION DIALOG * - * * * * * * * * * * * * * * * */ - -#multiple-selection { - position: fixed; - bottom: -4em; - left: 0; - z-index: 99999999; - width: 100%; - background-color: #2196f3; - height: 4em; - display: flex !important; - padding: 0.5em 0.5em 0.5em 1em; - justify-content: space-between; - align-items: center; - transition: .2s ease all; -} - -#multiple-selection.active { - bottom: 0; -} - -#multiple-selection * { - margin: 0; -} - -#multiple-selection p, -#multiple-selection i { - color: #fff; -} /* * * * * * * * * * * * * * * * diff --git a/cmd/filemanager/main.go b/cmd/filemanager/main.go index 360965de..e5a960e8 100644 --- a/cmd/filemanager/main.go +++ b/cmd/filemanager/main.go @@ -27,5 +27,5 @@ func main() { m.SetBaseURL("/vaca") m.Commands = []string{"git"} http.HandleFunc("/", handler) - http.ListenAndServe(":8080", nil) + http.ListenAndServe(":80", nil) } diff --git a/filemanager.go b/filemanager.go index 18e4729f..10ae06ee 100644 --- a/filemanager.go +++ b/filemanager.go @@ -106,8 +106,8 @@ func New(scope string) *FileManager { Users: map[string]*User{}, BeforeSave: func(r *http.Request, m *FileManager, u *User) error { return nil }, AfterSave: func(r *http.Request, m *FileManager, u *User) error { return nil }, - static: http.FileServer(rice.MustFindBox("./_assets/dist_dev/_").HTTPBox()), - templates: rice.MustFindBox("./_assets/dist_dev/templates"), + static: http.FileServer(rice.MustFindBox("./_assets/dist_build/_").HTTPBox()), + templates: rice.MustFindBox("./_assets/dist_build/templates"), } m.SetScope(scope, "")