From a7b50c2de1772f232342a0d255ed977f4ea4a5be Mon Sep 17 00:00:00 2001 From: Henrique Dias Date: Thu, 29 Jun 2017 09:11:46 +0100 Subject: [PATCH] Updates on front end :D Former-commit-id: 032b13b1f3a6216ae6bafde75f583038916b4f74 [formerly 80588a95ad5168ecab65e3d8cc8968bad9a20a6b] [formerly 94b306854bac60361ddf1b945a3edec7204d1327 [formerly 193adea6bb8a5cdc0d4e072b2c59fc0e82f69548]] Former-commit-id: 67b5219c1a6488c1a797bec42a0dec2036441a48 [formerly 28183c674806c3125a285a48905a01e1e835be7e] Former-commit-id: d2169aab351eab252ea34e07bb943411aa8e9cb4 --- _assets/.editorconfig => .editorconfig | 0 _assets/_old/js/common_old.js | 4 - _assets/_old/js/listing.js | 3 - _assets/_old/templates/actions.tmpl | 102 ++------ _assets/build/webpack.prod.conf.js | 4 +- _assets/index.html | 1 + _assets/src/App.vue | 41 +++- _assets/src/components/DeleteButton.vue | 2 +- _assets/src/components/DownloadButton.vue | 35 +++ _assets/src/components/InfoButton.vue | 2 +- _assets/src/components/Listing.vue | 7 +- _assets/src/components/MoveButton.vue | 17 ++ _assets/src/components/Preview.vue | 19 +- _assets/src/components/RenameButton.vue | 17 ++ _assets/src/components/SwitchViewButton.vue | 33 +++ _assets/src/components/UploadButton.vue | 17 ++ _assets/src/css/listing.css | 243 ++++++++++++++++++++ _assets/src/css/prompts.css | 2 +- _assets/src/css/styles.css | 243 +------------------- 19 files changed, 449 insertions(+), 343 deletions(-) rename _assets/.editorconfig => .editorconfig (100%) create mode 100644 _assets/src/components/DownloadButton.vue create mode 100644 _assets/src/components/MoveButton.vue create mode 100644 _assets/src/components/RenameButton.vue create mode 100644 _assets/src/components/SwitchViewButton.vue create mode 100644 _assets/src/components/UploadButton.vue create mode 100644 _assets/src/css/listing.css diff --git a/_assets/.editorconfig b/.editorconfig similarity index 100% rename from _assets/.editorconfig rename to .editorconfig diff --git a/_assets/_old/js/common_old.js b/_assets/_old/js/common_old.js index 4fc09a5e..6ab995cb 100644 --- a/_assets/_old/js/common_old.js +++ b/_assets/_old/js/common_old.js @@ -1,7 +1,5 @@ 'use strict' -var data = (window.data || window.alert('Something is wrong, please refresh!')) - var tempID = '_fm_internal_temporary_id' var templates = {} @@ -9,8 +7,6 @@ var selectedItems = [] var overlay var clickOverlay - - // Sends a costum event to itself Document.prototype.sendCostumEvent = function (text) { this.dispatchEvent(new window.CustomEvent(text)) diff --git a/_assets/_old/js/listing.js b/_assets/_old/js/listing.js index 097b3f65..e6610a2b 100644 --- a/_assets/_old/js/listing.js +++ b/_assets/_old/js/listing.js @@ -350,9 +350,6 @@ document.addEventListener('DOMContentLoaded', event => { let items = document.getElementsByClassName('item') if (user.AllowNew) { - buttons.upload.addEventListener('click', (event) => { - document.getElementById('upload-input').click() - }) buttons.new.addEventListener('click', listing.newFileButton) } diff --git a/_assets/_old/templates/actions.tmpl b/_assets/_old/templates/actions.tmpl index 0d50c9e1..41b3e6be 100644 --- a/_assets/_old/templates/actions.tmpl +++ b/_assets/_old/templates/actions.tmpl @@ -1,91 +1,33 @@ -{{ define "right-side-actions" }} - {{ template "info-button" }} -{{ end }} - {{ define "right" }} {{- if not .IsEditor }} - - {{- if eq .Display "mosaic" }}view_list{{ else }}view_module{{ end }} - Switch view - - - {{- end }} + +{{- end }} - {{- if and (.User.AllowNew) (not .IsEditor) }} - - {{- end }} - - - - - {{ end }} - -{{ define "left-side-actions" }} - -{{ end }} - {{ define "left" }} - {{- if and (not .IsDir) (.User.AllowEdit) }} - {{- if .Editor}} +{{- if and (not .IsDir) (.User.AllowEdit) }} +{{- if .Editor}} - {{- if eq .Data.Mode "markdown" }} - - {{- end }} +{{- if eq .Data.Mode "markdown" }} + +{{- end }} - {{- if eq .Data.Visual true }} - - {{- end }} +{{- if eq .Data.Visual true }} + +{{- end }} - {{/* end if editor */}} +{{/* end if editor */}} - - {{- end }} - - {{/* end if not dir and AllowEdit */}} - {{- end }} - - {{- if and .IsDir .User.AllowEdit }} - - - - - - {{- end }} - {{ end }} \ No newline at end of file + +{{- end }} diff --git a/_assets/build/webpack.prod.conf.js b/_assets/build/webpack.prod.conf.js index e084e9cb..8cba2668 100644 --- a/_assets/build/webpack.prod.conf.js +++ b/_assets/build/webpack.prod.conf.js @@ -2,7 +2,7 @@ var fs = require('fs') var path = require('path') var utils = require('./utils') var webpack = require('webpack') -var config = require('../config') +var config = require('./config') var merge = require('webpack-merge') var baseWebpackConfig = require('./webpack.base.conf') var CopyWebpackPlugin = require('copy-webpack-plugin') @@ -52,7 +52,7 @@ var webpackConfig = merge(baseWebpackConfig, { // you can customize output by editing /index.html // see https://github.com/ampedandwired/html-webpack-plugin new HtmlWebpackPlugin({ - filename: config.prod.index, + filename: config.build.index, template: 'index.html', inject: true, minify: { diff --git a/_assets/index.html b/_assets/index.html index fe6e4260..420eddf7 100644 --- a/_assets/index.html +++ b/_assets/index.html @@ -42,6 +42,7 @@ showHelp: false, showDelete: false, showRename: false, + showMove: false, listing: { selected: [], multiple: false diff --git a/_assets/src/App.vue b/_assets/src/App.vue index 08191c7f..67caad42 100644 --- a/_assets/src/App.vue +++ b/_assets/src/App.vue @@ -6,7 +6,12 @@
+ + + + +
@@ -22,10 +27,10 @@
- +
- +
@@ -59,6 +64,11 @@ import Listing from './components/Listing' import InfoButton from './components/InfoButton' import InfoPrompt from './components/InfoPrompt' import DeleteButton from './components/DeleteButton' +import RenameButton from './components/RenameButton' +import UploadButton from './components/UploadButton' +import DownloadButton from './components/DownloadButton' +import SwitchButton from './components/SwitchViewButton' +import MoveButton from './components/MoveButton' import css from './css.js' function updateColumnSizes () { @@ -75,6 +85,7 @@ window.addEventListener('keydown', (event) => { window.info.showInfo = false window.info.showDelete = false window.info.showRename = false + window.info.showMove = false // Unselect all files and folders. if (window.info.req.kind === 'listing') { @@ -123,18 +134,38 @@ window.addEventListener('keydown', (event) => { export default { name: 'app', - components: { Search, Preview, Listing, InfoButton, InfoPrompt, Help, DeleteButton }, + components: { + Search, + Preview, + Listing, + InfoButton, + InfoPrompt, + Help, + DeleteButton, + RenameButton, + DownloadButton, + UploadButton, + SwitchButton, + MoveButton + }, mounted: function () { updateColumnSizes() window.addEventListener('resize', updateColumnSizes) - window.history.replaceState({ url: window.location.pathname, name: document.title }, document.title, window.location.pathname) + window.history.replaceState({ + url: window.location.pathname, + name: document.title + }, document.title, window.location.pathname) }, data: function () { return window.info }, methods: { showOverlay: function () { - return this.showInfo || this.showHelp + return this.showInfo || this.showHelp || this.showDelete || this.showRename || this.showMove + }, + showUpload: function () { + if (this.req.kind === 'editor') return false + return this.user.allowNew } } } diff --git a/_assets/src/components/DeleteButton.vue b/_assets/src/components/DeleteButton.vue index 0e553bc7..559b6fb4 100644 --- a/_assets/src/components/DeleteButton.vue +++ b/_assets/src/components/DeleteButton.vue @@ -1,5 +1,5 @@