Show sharing in menu in grid view

Signed-off-by: John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>
This commit is contained in:
John Molakvoæ (skjnldsv) 2019-03-14 18:01:44 +01:00
parent 6ea5beccd7
commit 4ad922d4f6
No known key found for this signature in database
GPG Key ID: 60C25B8C072916CF
9 changed files with 18897 additions and 13 deletions

View File

@ -544,6 +544,9 @@ a.action > img {
opacity: .3;
&.action-share {
padding: 17px 14px;
> span:not(.icon) {
display: none;
}
.avatar {
display: inline-block;
vertical-align: middle;
@ -936,6 +939,18 @@ table.dragshadow td.size {
}
}
.fileActionsMenu {
// force show the sharing entry in the dropdown menu
.action-share-container.hidden {
display: block !important;
// avatar in shared by user dropdown menu
.action-share img {
padding: 6px;
border-radius: 50%;
}
}
}
form {
padding: 3px 14px;
border-radius: var(--border-radius);

View File

@ -84,10 +84,7 @@
);
var items = _.filter(actions, function(actionSpec) {
return (
actionSpec.type === OCA.Files.FileActions.TYPE_DROPDOWN &&
(!defaultAction || actionSpec.name !== defaultAction.name)
);
return !defaultAction || actionSpec.name !== defaultAction.name;
});
items = _.map(items, function(item) {
if (_.isFunction(item.displayName)) {
@ -99,6 +96,12 @@
item = _.extend({}, item);
item.iconClass = item.iconClass(fileName, self._context);
}
if (_.isFunction(item.icon)) {
var fileName = self._context.$file.attr('data-file');
item = _.extend({}, item);
item.icon = item.icon(fileName, self._context);
}
item.inline = item.type === OCA.Files.FileActions.TYPE_INLINE
return item;
});
items = items.sort(function(actionA, actionB) {
@ -109,6 +112,7 @@
}
return orderA - orderB;
});
items = _.map(items, function(item) {
item.nameLowerCase = item.name.toLowerCase();
return item;

View File

@ -92,32 +92,38 @@ templates['file_action_trigger'] = template({"1":function(container,depth0,helpe
templates['fileactionsmenu'] = template({"1":function(container,depth0,helpers,partials,data) {
var stack1, helper, alias1=depth0 != null ? depth0 : (container.nullContext || {}), alias2=helpers.helperMissing, alias3="function", alias4=container.escapeExpression;
return " <li>\n <a href=\"#\" class=\"menuitem action action-"
return " <li class=\""
+ ((stack1 = helpers["if"].call(alias1,(depth0 != null ? depth0.inline : depth0),{"name":"if","hash":{},"fn":container.program(2, data, 0),"inverse":container.noop,"data":data})) != null ? stack1 : "")
+ " action-"
+ alias4(((helper = (helper = helpers.nameLowerCase || (depth0 != null ? depth0.nameLowerCase : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{"name":"nameLowerCase","hash":{},"data":data}) : helper)))
+ "-container\">\n <a href=\"#\" class=\"menuitem action action-"
+ alias4(((helper = (helper = helpers.nameLowerCase || (depth0 != null ? depth0.nameLowerCase : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{"name":"nameLowerCase","hash":{},"data":data}) : helper)))
+ " permanent\" data-action=\""
+ alias4(((helper = (helper = helpers.name || (depth0 != null ? depth0.name : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{"name":"name","hash":{},"data":data}) : helper)))
+ "\">\n "
+ ((stack1 = helpers["if"].call(alias1,(depth0 != null ? depth0.icon : depth0),{"name":"if","hash":{},"fn":container.program(2, data, 0),"inverse":container.program(4, data, 0),"data":data})) != null ? stack1 : "")
+ ((stack1 = helpers["if"].call(alias1,(depth0 != null ? depth0.icon : depth0),{"name":"if","hash":{},"fn":container.program(4, data, 0),"inverse":container.program(6, data, 0),"data":data})) != null ? stack1 : "")
+ " <span>"
+ alias4(((helper = (helper = helpers.displayName || (depth0 != null ? depth0.displayName : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{"name":"displayName","hash":{},"data":data}) : helper)))
+ "</span>\n </a>\n </li>\n";
},"2":function(container,depth0,helpers,partials,data) {
return "hidden";
},"4":function(container,depth0,helpers,partials,data) {
var helper;
return "<img class=\"icon\" src=\""
+ container.escapeExpression(((helper = (helper = helpers.icon || (depth0 != null ? depth0.icon : depth0)) != null ? helper : helpers.helperMissing),(typeof helper === "function" ? helper.call(depth0 != null ? depth0 : (container.nullContext || {}),{"name":"icon","hash":{},"data":data}) : helper)))
+ "\"/>\n";
},"4":function(container,depth0,helpers,partials,data) {
},"6":function(container,depth0,helpers,partials,data) {
var stack1;
return ((stack1 = helpers["if"].call(depth0 != null ? depth0 : (container.nullContext || {}),(depth0 != null ? depth0.iconClass : depth0),{"name":"if","hash":{},"fn":container.program(5, data, 0),"inverse":container.program(7, data, 0),"data":data})) != null ? stack1 : "");
},"5":function(container,depth0,helpers,partials,data) {
return ((stack1 = helpers["if"].call(depth0 != null ? depth0 : (container.nullContext || {}),(depth0 != null ? depth0.iconClass : depth0),{"name":"if","hash":{},"fn":container.program(7, data, 0),"inverse":container.program(9, data, 0),"data":data})) != null ? stack1 : "");
},"7":function(container,depth0,helpers,partials,data) {
var helper;
return " <span class=\"icon "
+ container.escapeExpression(((helper = (helper = helpers.iconClass || (depth0 != null ? depth0.iconClass : depth0)) != null ? helper : helpers.helperMissing),(typeof helper === "function" ? helper.call(depth0 != null ? depth0 : (container.nullContext || {}),{"name":"iconClass","hash":{},"data":data}) : helper)))
+ "\"></span>\n";
},"7":function(container,depth0,helpers,partials,data) {
},"9":function(container,depth0,helpers,partials,data) {
return " <span class=\"no-icon\"></span>\n";
},"compiler":[7,">= 4.0.0"],"main":function(container,depth0,helpers,partials,data) {
var stack1;

View File

@ -1,6 +1,6 @@
<ul>
{{#each items}}
<li>
<li class="{{#if inline}}hidden{{/if}} action-{{nameLowerCase}}-container">
<a href="#" class="menuitem action action-{{nameLowerCase}} permanent" data-action="{{name}}">
{{#if icon}}<img class="icon" src="{{icon}}"/>
{{else}}

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,224 @@
(window["webpackJsonp"] = window["webpackJsonp"] || []).push([[1],{
/***/ "./apps/files_sharing/src/collaborationresources.js":
/*!**********************************************************!*\
!*** ./apps/files_sharing/src/collaborationresources.js ***!
\**********************************************************/
/*! exports provided: Vue, View */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony import */ var vue__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! vue */ "./node_modules/vue/dist/vue.runtime.esm.js");
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "Vue", function() { return vue__WEBPACK_IMPORTED_MODULE_0__["default"]; });
/* harmony import */ var nextcloud_vue__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! nextcloud-vue */ "./node_modules/nextcloud-vue/dist/ncvuecomponents.js");
/* harmony import */ var nextcloud_vue__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(nextcloud_vue__WEBPACK_IMPORTED_MODULE_1__);
/* harmony import */ var vue_click_outside__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! vue-click-outside */ "./node_modules/vue-click-outside/index.js");
/* harmony import */ var vue_click_outside__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(vue_click_outside__WEBPACK_IMPORTED_MODULE_2__);
/* harmony import */ var v_tooltip__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! v-tooltip */ "./node_modules/v-tooltip/dist/v-tooltip.esm.js");
/* harmony import */ var _views_CollaborationView__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./views/CollaborationView */ "./apps/files_sharing/src/views/CollaborationView.vue");
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "View", function() { return _views_CollaborationView__WEBPACK_IMPORTED_MODULE_4__["default"]; });
/*
* @copyright Copyright (c) 2019 Julius Härtl <jus@bitgrid.net>
*
* @author Julius Härtl <jus@bitgrid.net>
*
* @license GNU AGPL version 3 or any later version
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
vue__WEBPACK_IMPORTED_MODULE_0__["default"].prototype.t = t;
vue__WEBPACK_IMPORTED_MODULE_0__["default"].component('PopoverMenu', nextcloud_vue__WEBPACK_IMPORTED_MODULE_1__["PopoverMenu"]);
vue__WEBPACK_IMPORTED_MODULE_0__["default"].directive('ClickOutside', vue_click_outside__WEBPACK_IMPORTED_MODULE_2___default.a);
vue__WEBPACK_IMPORTED_MODULE_0__["default"].directive('Tooltip', v_tooltip__WEBPACK_IMPORTED_MODULE_3__["VTooltip"]);
/***/ }),
/***/ "./apps/files_sharing/src/views/CollaborationView.vue":
/*!************************************************************!*\
!*** ./apps/files_sharing/src/views/CollaborationView.vue ***!
\************************************************************/
/*! exports provided: default */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony import */ var _CollaborationView_vue_vue_type_template_id_20578814___WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./CollaborationView.vue?vue&type=template&id=20578814& */ "./apps/files_sharing/src/views/CollaborationView.vue?vue&type=template&id=20578814&");
/* harmony import */ var _CollaborationView_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./CollaborationView.vue?vue&type=script&lang=js& */ "./apps/files_sharing/src/views/CollaborationView.vue?vue&type=script&lang=js&");
/* empty/unused harmony star reexport *//* harmony import */ var _node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../../../node_modules/vue-loader/lib/runtime/componentNormalizer.js */ "./node_modules/vue-loader/lib/runtime/componentNormalizer.js");
/* normalize component */
var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__["default"])(
_CollaborationView_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__["default"],
_CollaborationView_vue_vue_type_template_id_20578814___WEBPACK_IMPORTED_MODULE_0__["render"],
_CollaborationView_vue_vue_type_template_id_20578814___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
false,
null,
null,
null
)
/* hot reload */
if (false) { var api; }
component.options.__file = "apps/files_sharing/src/views/CollaborationView.vue"
/* harmony default export */ __webpack_exports__["default"] = (component.exports);
/***/ }),
/***/ "./apps/files_sharing/src/views/CollaborationView.vue?vue&type=script&lang=js&":
/*!*************************************************************************************!*\
!*** ./apps/files_sharing/src/views/CollaborationView.vue?vue&type=script&lang=js& ***!
\*************************************************************************************/
/*! exports provided: default */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony import */ var _node_modules_babel_loader_lib_index_js_ref_3_node_modules_vue_loader_lib_index_js_vue_loader_options_CollaborationView_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! -!../../../../node_modules/babel-loader/lib??ref--3!../../../../node_modules/vue-loader/lib??vue-loader-options!./CollaborationView.vue?vue&type=script&lang=js& */ "./node_modules/babel-loader/lib/index.js?!./node_modules/vue-loader/lib/index.js?!./apps/files_sharing/src/views/CollaborationView.vue?vue&type=script&lang=js&");
/* empty/unused harmony star reexport */ /* harmony default export */ __webpack_exports__["default"] = (_node_modules_babel_loader_lib_index_js_ref_3_node_modules_vue_loader_lib_index_js_vue_loader_options_CollaborationView_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_0__["default"]);
/***/ }),
/***/ "./apps/files_sharing/src/views/CollaborationView.vue?vue&type=template&id=20578814&":
/*!*******************************************************************************************!*\
!*** ./apps/files_sharing/src/views/CollaborationView.vue?vue&type=template&id=20578814& ***!
\*******************************************************************************************/
/*! exports provided: render, staticRenderFns */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony import */ var _node_modules_vue_loader_lib_loaders_templateLoader_js_vue_loader_options_node_modules_vue_loader_lib_index_js_vue_loader_options_CollaborationView_vue_vue_type_template_id_20578814___WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! -!../../../../node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!../../../../node_modules/vue-loader/lib??vue-loader-options!./CollaborationView.vue?vue&type=template&id=20578814& */ "./node_modules/vue-loader/lib/loaders/templateLoader.js?!./node_modules/vue-loader/lib/index.js?!./apps/files_sharing/src/views/CollaborationView.vue?vue&type=template&id=20578814&");
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "render", function() { return _node_modules_vue_loader_lib_loaders_templateLoader_js_vue_loader_options_node_modules_vue_loader_lib_index_js_vue_loader_options_CollaborationView_vue_vue_type_template_id_20578814___WEBPACK_IMPORTED_MODULE_0__["render"]; });
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return _node_modules_vue_loader_lib_loaders_templateLoader_js_vue_loader_options_node_modules_vue_loader_lib_index_js_vue_loader_options_CollaborationView_vue_vue_type_template_id_20578814___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"]; });
/***/ }),
/***/ "./node_modules/babel-loader/lib/index.js?!./node_modules/vue-loader/lib/index.js?!./apps/files_sharing/src/views/CollaborationView.vue?vue&type=script&lang=js&":
/*!*******************************************************************************************************************************************************************************!*\
!*** ./node_modules/babel-loader/lib??ref--3!./node_modules/vue-loader/lib??vue-loader-options!./apps/files_sharing/src/views/CollaborationView.vue?vue&type=script&lang=js& ***!
\*******************************************************************************************************************************************************************************/
/*! exports provided: default */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony import */ var nextcloud_vue_collections__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! nextcloud-vue-collections */ "./node_modules/nextcloud-vue-collections/dist/nextcloud-vue-collections.js");
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
/**
* Those translations will be used by the vue component but they should be shipped with the server
* t('files_sharing', 'Add to a collection')
* t('files_sharing', 'Details')
* t('files_sharing', 'Rename collection')
*/
/* harmony default export */ __webpack_exports__["default"] = ({
name: 'CollaborationView',
computed: {
fileId: function fileId() {
if (this.$root.model && this.$root.model.id) {
return '' + this.$root.model.id;
}
return null;
},
filename: function filename() {
if (this.$root.model && this.$root.model.name) {
return '' + this.$root.model.name;
}
return '';
}
},
components: {
CollectionList: nextcloud_vue_collections__WEBPACK_IMPORTED_MODULE_0__["CollectionList"]
}
});
/***/ }),
/***/ "./node_modules/vue-loader/lib/loaders/templateLoader.js?!./node_modules/vue-loader/lib/index.js?!./apps/files_sharing/src/views/CollaborationView.vue?vue&type=template&id=20578814&":
/*!*************************************************************************************************************************************************************************************************************************!*\
!*** ./node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!./node_modules/vue-loader/lib??vue-loader-options!./apps/files_sharing/src/views/CollaborationView.vue?vue&type=template&id=20578814& ***!
\*************************************************************************************************************************************************************************************************************************/
/*! exports provided: render, staticRenderFns */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
var render = function() {
var _vm = this
var _h = _vm.$createElement
var _c = _vm._self._c || _h
return _vm.fileId
? _c("collection-list", {
attrs: { type: "files", id: _vm.fileId, name: _vm.filename }
})
: _vm._e()
}
var staticRenderFns = []
render._withStripped = true
/***/ })
}]);
//# sourceMappingURL=files_sharing.1.js.map

File diff suppressed because one or more lines are too long

View File

@ -162,11 +162,33 @@
fileActions.registerAction({
name: 'Share',
displayName: '',
displayName: function(context) {
if (context && context.$file) {
var shareType = parseInt(context.$file.data('share-types'), 10)
var shareOwner = context.$file.data('share-owner-id')
if (shareType >= 0 || shareOwner) {
return t('core', 'Shared')
}
}
return t('core', 'Share')
},
altText: t('core', 'Share'),
mime: 'all',
order: -60,
permissions: OC.PERMISSION_ALL,
iconClass: 'icon-shared',
iconClass: function(fileName, context) {
var shareType = parseInt(context.$file.data('share-types'), 10)
if (shareType === OC.Share.SHARE_TYPE_EMAIL) {
return 'icon-public'
}
return 'icon-shared'
},
icon: function(fileName, context) {
var shareOwner = context.$file.data('share-owner-id')
if (shareOwner) {
return OC.generateUrl(`/avatar/${shareOwner}/32`)
}
},
type: OCA.Files.FileActions.TYPE_INLINE,
actionHandler: function(fileName, context) {
// do not open sidebar if permission is set and equal to 0