\r\n\r\n\r\n```\r\n\r\n**2)** The next step is to contribute to the \"RESULTS_SELECTION_ACTIONS\" slot. You can do this by creating another HTML file with the following content. I named this file \"nuxeo-custom-bundle-contribution.html\", but you can name it as you want.\r\n\r\n```\r\n\r\n\r\n\r\n \r\n\r\n```\r\nTake in mind that you need to import the HTML we have created before, and add the new element (that in my case, I named \"nuxeo-delete-documents-button-v2\"). Also pay attention to the \"hard\" label I have added in the element.\r\n\r\n**3)** Just like any WebUI contribution, you need to add it to the resources point. To do that, create a new extension like this:\r\n\r\n```\r\n\r\n \r\n\t/ui/nuxeo-custom-bundle-contribution.html\r\n \r\n\r\n\r\n \r\n\t\r\n\t nuxeo-custom-bundle-contribution.html\r\n\t\r\n \r\n\r\n```\r\nAs you can see, I have referenced \"nuxeo-custom-bundle-contribution.html\" file, which is the file I have created in step 2.\r\n\r\nWith this, you will have the \"hard delete\" button when you select trashed documents, keeping the \"trash document\" button if you select not trashed documents.\r\n\r\nRegards!\r\n\r\n", "htmlContent" : "

Hello,

\n

the solution to this is quite tricky, as I think there is a small bug in “nuxeo-delete-documents-button” element, more specifically in the “_isAvailable” function. Anyway, here is the step-by-step solution:

\n

1) First of all, create your own “nuxeo-delete-documents-button” element. Take special attention to the “_isAvailable” function, as I have changed it. The last condition should be this.hard && this._checkDocsAreTrashed(). In this way, the “hard delete” button will only appears if you are selecting trashed documents.

\n

As you are creating a new element, remember to change its “id” in the first line and in the Polymer script. In my case, for example, I named it “nuxeo-delete-documents-button-v2”.

\n
<dom-module id=\"nuxeo-delete-documents-button-v2\" assetpath=\"nuxeo-document-bulk-actions/\">\n  <template>\n    <style include=\"nuxeo-action-button-styles\"></style>\n\n    <nuxeo-operation id=\"deleteOp\" op=\"Document.Delete\" sync-indexing=\"\"></nuxeo-operation>\n\n    <nuxeo-operation id=\"trashOp\" op=\"Document.Trash\" sync-indexing=\"\"></nuxeo-operation>\n\n    <template is=\"dom-if\" if=\"[[_isAvailable(documents.splices)]]\">\n      <div class=\"action\" on-tap=\"deleteDocuments\">\n        <paper-icon-button icon=\"[[_icon]]\" id=\"deleteAllButton\"></paper-icon-button>\n        <span class=\"label\" hidden$=\"[[!showLabel]]\">[[_label]]</span>\n      </div>\n      <nuxeo-tooltip for=\"deleteAllButton\" position=\"[[tooltipPosition]]\">[[_label]]</nuxeo-tooltip>\n    </template>\n  </template>\n\n  <script>\n    Polymer({\n      is: 'nuxeo-delete-documents-button-v2',\n      behaviors: [Nuxeo.I18nBehavior, Nuxeo.FiltersBehavior],\n      properties: {\n        documents: {\n          type: Array,\n          notify: true,\n          value: []\n        },\n\n        /**\n         * Permanently delete the documents.\n         */\n        hard: {\n          type: Boolean,\n          value: false\n        },\n\n        tooltipPosition: {\n          type: String,\n          value: 'bottom'\n        },\n\n        /**\n         * `true` if the action should display the label, `false` otherwise.\n         */\n        showLabel: {\n          type: Boolean,\n          value: false,\n        },\n\n        _icon: {\n          type: 'String',\n          computed: '_computeIcon(hard)'\n        },\n\n        _label: {\n          type: 'String',\n          computed: '_computeLabel(hard, i18n)'\n        }\n      },\n\n      deleteDocuments: function() {\n        if (this.docsHavePermissions && confirm(this.i18n('deleteDocumentsButton.confirm.deleteDocuments'))) {\n          if (this.documents && this.documents.length) {\n            var uids = this.documents.map(function(doc) {\n              return doc.uid;\n            }).join(',');\n            var op = this.hard ? this.$.deleteOp : this.$.trashOp;\n            op.input = 'docs:' + uids;\n            op.execute().then(function() {\n              this.fire('nuxeo-documents-deleted', {documents: this.documents});\n              this.documents = [];\n              this.fire('refresh');\n            }.bind(this),\n            function(error) {\n              this.fire('nuxeo-documents-deleted', {error: error, documents: this.documents});\n            }.bind(this));\n          }\n        }\n      },\n\n      /**\n       * Action is available if all selected items are not trashed and `hard` is not active OR if all selected items\n       * are trashed and `hard` is active.\n       */\n      _isAvailable: function() {\n        return this.documents && this.documents.length > 0 && this._checkDocsPermissions() &&\n            (this.hard && this._checkDocsAreTrashed());\n      },\n\n      /**\n       * Checks if all selected documents are trashed.\n       */\n      _checkDocsAreTrashed: function() {\n        return this.documents.every(function(document) {\n          return this.isTrashed(document);\n        }.bind(this));\n      },\n\n      _checkDocsPermissions: function() {\n        this.docsHavePermissions = this.documents && !(this.documents.some(\n          function(document) {\n            return !this._docHasPermissions(document);\n          }.bind(this)));\n        return this.docsHavePermissions;\n      },\n\n      /*\n       * Checks if a single given document has 'Everything' permission to delete or 'Write' to trash\n       */\n      _docHasPermissions: function(document) {\n        return this.hasPermission(document, 'Everything') || (!this.hard && this.hasPermission(document, 'Write'));\n      },\n\n      _computeIcon: function(hard) {\n        return hard ? 'nuxeo:delete-permanently' : 'nuxeo:delete';\n      },\n\n      _computeLabel: function(hard) {\n        return this.i18n(hard ? 'deleteDocumentsButton.tooltip.permanently' : 'deleteDocumentsButton.tooltip');\n      }\n    });\n  </script>\n\n</dom-module>\n
\n

2) The next step is to contribute to the “RESULTS_SELECTION_ACTIONS” slot. You can do this by creating another HTML file with the following content. I named this file “nuxeo-custom-bundle-contribution.html”, but you can name it as you want.

\n
<link rel=\"import\" href=\"nuxeo-delete-documents-button-v2.html\">\n\n<nuxeo-slot-content name=\"hardDeleteSelectionAction\" slot=\"RESULTS_SELECTION_ACTIONS\" order=\"30\">\n  <template>\n    <nuxeo-delete-documents-button-v2 documents=\"[[selectedItems]]\" hard></nuxeo-delete-documents-button-v2>\n  </template>\n</nuxeo-slot-content>\n
\n

Take in mind that you need to import the HTML we have created before, and add the new element (that in my case, I named “nuxeo-delete-documents-button-v2”). Also pay attention to the “hard” label I have added in the element.

\n

3) Just like any WebUI contribution, you need to add it to the resources point. To do that, create a new extension like this:

\n
<extension target=\"org.nuxeo.ecm.platform.WebResources\" point=\"resources\">\n    <resource name=\"nuxeo-custom-bundle-contribution.html\" type=\"import\" shrinkable=\"false\">\n    <uri>/ui/nuxeo-custom-bundle-contribution.html</uri>\n    </resource>\n</extension>\n<extension target=\"org.nuxeo.ecm.platform.WebResources\" point=\"bundles\">\n    <bundle name=\"web-ui\">\n    <resources append=\"true\">\n            <resource>nuxeo-custom-bundle-contribution.html</resource>\n    </resources>\n    </bundle>\n</extension>\n
\n

As you can see, I have referenced “nuxeo-custom-bundle-contribution.html” file, which is the file I have created in step 2.

\n

With this, you will have the “hard delete” button when you select trashed documents, keeping the “trash document” button if you select not trashed documents.

\n

Regards!

" }, { "id" : "f3dfda86-2dc7-47df-bfec-6e33b6d14a61", "label" : "1", "active" : false, "author" : { "uid" : "b0011555-846d-404a-b4a4-85bc56946f40", "name" : "b0011555-846d-404a-b4a4-85bc56946f40", "email" : "rodricmate@gmail.com", "firstName" : "Rodri", "lastName" : "", "title" : "Member", "score" : 2962, "disabled" : false, "virtual" : false, "badgeCount" : null, "notifications" : null, "badges" : [ "lucky", "watcher", "editor", "lonesome", "fairplay", "puzzler", "student", "notableq", "revival", "hope", "scholar", "commentator", "watched", "teacher", "striker", "popular" ], "loginCount" : 63, "lastLogin" : 1604065963343, "avatarUrl" : "https://app.quandora.com/skin/avatar/b0011555-846d-404a-b4a4-85bc56946f40?sz=%s" }, "created" : "2020-03-07T10:18:40.90Z", "createdAt" : "03/07/2020", "title" : null, "content" : "Hello,\r\n\r\nthe solution to this is quite tricky, as I think there is a small bug in \"nuxeo-delete-documents-button\" element, more specifically in the \"_isAvailable\" function. Anyway, here is the step-by-step solution:\r\n\r\n1) First of all, create your own \"nuxeo-delete-documents-button\" element. Take special attention to the \"_isAvailable\" function, as I have change it. The last condition should be **this.hard && this._checkDocsAreTrashed()**. In this way, the \"hard delete\" button will only appears if you are selecting trashed documents.\r\n\r\nAs you are creating a new element, remember to change its \"id\" in the first line and in the Polymer script. In my case, for example, I named it \"nuxeo-delete-documents-button-v2\".\r\n\r\n```\r\n\r\n \r\n\r\n \r\n\r\n\r\n```\r\n\r\n2) The next step is to contribute to the \"RESULTS_SELECTION_ACTIONS\" slot. You can do this by creating another HTML file with the following content. I name this file \"nuxeo-custom-bundle-contribution.html\", but you can named it as you want.\r\n\r\n```\r\n\r\n\r\n\r\n \r\n\r\n```\r\nTake in mind that you need to import the HTML we have created before, and add the new element (that in my case, I named \"nuxeo-delete-documents-button-v2\"). Also pay attention to the \"hard\" label I have added in the element.\r\n\r\n3) Just like any WebUI contributions, you need to add it to the resources point. Create a new extension like this:\r\n\r\n```\r\n\r\n \r\n\t/ui/nuxeo-custom-bundle-contribution.html\r\n \r\n\r\n\r\n \r\n\t\r\n\t nuxeo-custom-bundle-contribution.html\r\n\t\r\n \r\n\r\n```\r\nAs you can see, I have referenced \"nuxeo-custom-bundle-contribution.html\" file, which is the file I have created in step 2.\r\n\r\nWith this, you will have the \"hard delete\" button when you select trashed documents.\r\n\r\nRegards!\r\n\r\n", "htmlContent" : "

Hello,

\n

the solution to this is quite tricky, as I think there is a small bug in “nuxeo-delete-documents-button” element, more specifically in the “_isAvailable” function. Anyway, here is the step-by-step solution:

\n

1) First of all, create your own “nuxeo-delete-documents-button” element. Take special attention to the “_isAvailable” function, as I have change it. The last condition should be this.hard && this._checkDocsAreTrashed(). In this way, the “hard delete” button will only appears if you are selecting trashed documents.

\n

As you are creating a new element, remember to change its “id” in the first line and in the Polymer script. In my case, for example, I named it “nuxeo-delete-documents-button-v2”.

\n
<dom-module id=\"nuxeo-delete-documents-button-v2\" assetpath=\"nuxeo-document-bulk-actions/\">\n  <template>\n    <style include=\"nuxeo-action-button-styles\"></style>\n\n    <nuxeo-operation id=\"deleteOp\" op=\"Document.Delete\" sync-indexing=\"\"></nuxeo-operation>\n\n    <nuxeo-operation id=\"trashOp\" op=\"Document.Trash\" sync-indexing=\"\"></nuxeo-operation>\n\n    <template is=\"dom-if\" if=\"[[_isAvailable(documents.splices)]]\">\n      <div class=\"action\" on-tap=\"deleteDocuments\">\n        <paper-icon-button icon=\"[[_icon]]\" id=\"deleteAllButton\"></paper-icon-button>\n        <span class=\"label\" hidden$=\"[[!showLabel]]\">[[_label]]</span>\n      </div>\n      <nuxeo-tooltip for=\"deleteAllButton\" position=\"[[tooltipPosition]]\">[[_label]]</nuxeo-tooltip>\n    </template>\n  </template>\n\n  <script>\n    Polymer({\n      is: 'nuxeo-delete-documents-button-v2',\n      behaviors: [Nuxeo.I18nBehavior, Nuxeo.FiltersBehavior],\n      properties: {\n        documents: {\n          type: Array,\n          notify: true,\n          value: []\n        },\n\n        /**\n         * Permanently delete the documents.\n         */\n        hard: {\n          type: Boolean,\n          value: false\n        },\n\n        tooltipPosition: {\n          type: String,\n          value: 'bottom'\n        },\n\n        /**\n         * `true` if the action should display the label, `false` otherwise.\n         */\n        showLabel: {\n          type: Boolean,\n          value: false,\n        },\n\n        _icon: {\n          type: 'String',\n          computed: '_computeIcon(hard)'\n        },\n\n        _label: {\n          type: 'String',\n          computed: '_computeLabel(hard, i18n)'\n        }\n      },\n\n      deleteDocuments: function() {\n        if (this.docsHavePermissions && confirm(this.i18n('deleteDocumentsButton.confirm.deleteDocuments'))) {\n          if (this.documents && this.documents.length) {\n            var uids = this.documents.map(function(doc) {\n              return doc.uid;\n            }).join(',');\n            var op = this.hard ? this.$.deleteOp : this.$.trashOp;\n            op.input = 'docs:' + uids;\n            op.execute().then(function() {\n              this.fire('nuxeo-documents-deleted', {documents: this.documents});\n              this.documents = [];\n              this.fire('refresh');\n            }.bind(this),\n            function(error) {\n              this.fire('nuxeo-documents-deleted', {error: error, documents: this.documents});\n            }.bind(this));\n          }\n        }\n      },\n\n      /**\n       * Action is available if all selected items are not trashed and `hard` is not active OR if all selected items\n       * are trashed and `hard` is active.\n       */\n      _isAvailable: function() {\n        return this.documents && this.documents.length > 0 && this._checkDocsPermissions() &&\n            (this.hard && this._checkDocsAreTrashed());\n      },\n\n      /**\n       * Checks if all selected documents are trashed.\n       */\n      _checkDocsAreTrashed: function() {\n        return this.documents.every(function(document) {\n          return this.isTrashed(document);\n        }.bind(this));\n      },\n\n      _checkDocsPermissions: function() {\n        this.docsHavePermissions = this.documents && !(this.documents.some(\n          function(document) {\n            return !this._docHasPermissions(document);\n          }.bind(this)));\n        return this.docsHavePermissions;\n      },\n\n      /*\n       * Checks if a single given document has 'Everything' permission to delete or 'Write' to trash\n       */\n      _docHasPermissions: function(document) {\n        return this.hasPermission(document, 'Everything') || (!this.hard && this.hasPermission(document, 'Write'));\n      },\n\n      _computeIcon: function(hard) {\n        return hard ? 'nuxeo:delete-permanently' : 'nuxeo:delete';\n      },\n\n      _computeLabel: function(hard) {\n        return this.i18n(hard ? 'deleteDocumentsButton.tooltip.permanently' : 'deleteDocumentsButton.tooltip');\n      }\n    });\n  </script>\n\n</dom-module>\n
\n

2) The next step is to contribute to the “RESULTS_SELECTION_ACTIONS” slot. You can do this by creating another HTML file with the following content. I name this file “nuxeo-custom-bundle-contribution.html”, but you can named it as you want.

\n
<link rel=\"import\" href=\"nuxeo-delete-documents-button-v2.html\">\n\n<nuxeo-slot-content name=\"hardDeleteSelectionAction\" slot=\"RESULTS_SELECTION_ACTIONS\" order=\"30\">\n  <template>\n    <nuxeo-delete-documents-button-v2 documents=\"[[selectedItems]]\" hard></nuxeo-delete-documents-button-v2>\n  </template>\n</nuxeo-slot-content>\n
\n

Take in mind that you need to import the HTML we have created before, and add the new element (that in my case, I named “nuxeo-delete-documents-button-v2”). Also pay attention to the “hard” label I have added in the element.

\n

3) Just like any WebUI contributions, you need to add it to the resources point. Create a new extension like this:

\n
<extension target=\"org.nuxeo.ecm.platform.WebResources\" point=\"resources\">\n    <resource name=\"nuxeo-custom-bundle-contribution.html\" type=\"import\" shrinkable=\"false\">\n    <uri>/ui/nuxeo-custom-bundle-contribution.html</uri>\n    </resource>\n</extension>\n<extension target=\"org.nuxeo.ecm.platform.WebResources\" point=\"bundles\">\n    <bundle name=\"web-ui\">\n    <resources append=\"true\">\n            <resource>nuxeo-custom-bundle-contribution.html</resource>\n    </resources>\n    </bundle>\n</extension>\n
\n

As you can see, I have referenced “nuxeo-custom-bundle-contribution.html” file, which is the file I have created in step 2.

\n

With this, you will have the “hard delete” button when you select trashed documents.

\n

Regards!

" } ] }; Versioning.getActiveVersion = function() { var versions = this.versions; for (var i=0,len=versions.length;i

Select a revision to compare with:
Side by side diff