Skip to content
Snippets Groups Projects
Unverified Commit 40a3d22d authored by Bekerle, Patrizio's avatar Bekerle, Patrizio :fire:
Browse files

Refactor whitespaces and some other things

parent 2b6dc73f
No related branches found
No related tags found
No related merge requests found
...@@ -88,7 +88,6 @@ export class FileHandlingClipboard extends ScopedElementsMixin(DBPLitElement) { ...@@ -88,7 +88,6 @@ export class FileHandlingClipboard extends ScopedElementsMixin(DBPLitElement) {
} }
disconnectedCallback() { disconnectedCallback() {
//We doesn't want to deregister this event, because we want to use this event over activities //We doesn't want to deregister this event, because we want to use this event over activities
//window.removeEventListener('beforeunload', this._onReceiveBeforeUnload); //window.removeEventListener('beforeunload', this._onReceiveBeforeUnload);
...@@ -118,8 +117,7 @@ export class FileHandlingClipboard extends ScopedElementsMixin(DBPLitElement) { ...@@ -118,8 +117,7 @@ export class FileHandlingClipboard extends ScopedElementsMixin(DBPLitElement) {
responsive: 1, responsive: 1,
formatter: (cell, formatterParams, onRendered) => { formatter: (cell, formatterParams, onRendered) => {
const icon_tag = that.getScopedTagName("dbp-icon"); const icon_tag = that.getScopedTagName("dbp-icon");
let icon = `<${icon_tag} name="empty-file" class="nextcloud-picker-icon"></${icon_tag}>`; return `<${icon_tag} name="empty-file" class="nextcloud-picker-icon"></${icon_tag}>`;
return icon;
} }
}, },
{ {
...@@ -189,30 +187,21 @@ export class FileHandlingClipboard extends ScopedElementsMixin(DBPLitElement) { ...@@ -189,30 +187,21 @@ export class FileHandlingClipboard extends ScopedElementsMixin(DBPLitElement) {
{column: "type", dir: "asc"}, {column: "type", dir: "asc"},
], ],
rowClick: (e, row) => { rowClick: (e, row) => {
if (this.tabulatorTable !== null this.showSelectAllButton = !(this.tabulatorTable !== null
&& this.tabulatorTable.getSelectedRows().length === this.tabulatorTable.getRows().filter(row => this.checkFileType(row.getData())).length) { && this.tabulatorTable.getSelectedRows().length === this.tabulatorTable.getRows().filter(row => this.checkFileType(row.getData())).length);
this.showSelectAllButton = false;
} else {
this.showSelectAllButton = true;
}
}, },
rowSelectionChanged: (data, rows) => { rowSelectionChanged: (data, rows) => {
if (this.tabulatorTable && this.tabulatorTable.getSelectedRows().length > 0) { this.clipboardSelectBtnDisabled = !(this.tabulatorTable && this.tabulatorTable.getSelectedRows().length > 0);
this.clipboardSelectBtnDisabled = false;
} else {
this.clipboardSelectBtnDisabled = true;
}
} }
}); });
} }
}); });
if (!this.clipboardSource) { if (!this.clipboardSource) {
if(!window.clipboardWarning) { if (!window.clipboardWarning) {
window.addEventListener('beforeunload', this._onReceiveBeforeUnload, false); window.addEventListener('beforeunload', this._onReceiveBeforeUnload, false);
window.clipboardWarning = true; window.clipboardWarning = true;
} }
} }
} }
/** /**
...@@ -256,7 +245,7 @@ export class FileHandlingClipboard extends ScopedElementsMixin(DBPLitElement) { ...@@ -256,7 +245,7 @@ export class FileHandlingClipboard extends ScopedElementsMixin(DBPLitElement) {
generateClipboardTable() { generateClipboardTable() {
if (this.clipboardFiles.files) { if (this.clipboardFiles.files) {
let data = []; let data = [];
for (let i = 0; i < this.clipboardFiles.files.length; i++){ for (let i = 0; i < this.clipboardFiles.files.length; i++) {
data[i] = { data[i] = {
name: this.clipboardFiles.files[i].name, name: this.clipboardFiles.files[i].name,
size: this.clipboardFiles.files[i].size, size: this.clipboardFiles.files[i].size,
...@@ -266,7 +255,7 @@ export class FileHandlingClipboard extends ScopedElementsMixin(DBPLitElement) { ...@@ -266,7 +255,7 @@ export class FileHandlingClipboard extends ScopedElementsMixin(DBPLitElement) {
}; };
} }
if (this.tabulatorTable !== null){ if (this.tabulatorTable !== null) {
this.tabulatorTable.clearData(); this.tabulatorTable.clearData();
this.tabulatorTable.setData(data); this.tabulatorTable.setData(data);
} }
...@@ -274,14 +263,12 @@ export class FileHandlingClipboard extends ScopedElementsMixin(DBPLitElement) { ...@@ -274,14 +263,12 @@ export class FileHandlingClipboard extends ScopedElementsMixin(DBPLitElement) {
} }
async sendClipboardFiles(files) { async sendClipboardFiles(files) {
for (let i = 0; i < files.length; i ++) {
for(let i = 0; i < files.length; i ++)
{
await this.sendFileEvent(files[i].file); await this.sendFileEvent(files[i].file);
} }
this.tabulatorTable.deselectRow(); this.tabulatorTable.deselectRow();
//this.closeDialog(); //this.closeDialog();
} }
async sendFileEvent(file) { async sendFileEvent(file) {
...@@ -297,17 +284,14 @@ export class FileHandlingClipboard extends ScopedElementsMixin(DBPLitElement) { ...@@ -297,17 +284,14 @@ export class FileHandlingClipboard extends ScopedElementsMixin(DBPLitElement) {
* *
* @param event * @param event
*/ */
onReceiveBeforeUnload(event){ onReceiveBeforeUnload(event) {
// we don't need to stop if there are no signed files // we don't need to stop if there are no signed files
if (this.clipboardFiles.files.length === 0) { if (this.clipboardFiles.files.length === 0) {
return; return;
} }
// we need to handle custom events ourselves // we need to handle custom events ourselves
if(event.target && event.target.activeElement && event.target.activeElement.nodeName) { if (event.target && event.target.activeElement && event.target.activeElement.nodeName) {
send({ send({
"summary": i18n.t('clipboard.file-warning'), "summary": i18n.t('clipboard.file-warning'),
"body": i18n.t('clipboard.file-warning-body', {count: this.clipboardFiles.files.length}), "body": i18n.t('clipboard.file-warning-body', {count: this.clipboardFiles.files.length}),
...@@ -331,9 +315,8 @@ export class FileHandlingClipboard extends ScopedElementsMixin(DBPLitElement) { ...@@ -331,9 +315,8 @@ export class FileHandlingClipboard extends ScopedElementsMixin(DBPLitElement) {
} }
} }
saveFilesToClipboard() saveFilesToClipboard() {
{ // save it
//save it
let data = {}; let data = {};
if (this.filesToSave && this.filesToSave.length !== 0) { if (this.filesToSave && this.filesToSave.length !== 0) {
data = {"files": this.filesToSave}; data = {"files": this.filesToSave};
...@@ -348,11 +331,8 @@ export class FileHandlingClipboard extends ScopedElementsMixin(DBPLitElement) { ...@@ -348,11 +331,8 @@ export class FileHandlingClipboard extends ScopedElementsMixin(DBPLitElement) {
"timeout": 5, "timeout": 5,
}); });
} }
} }
getClipboardFileList() { getClipboardFileList() {
let files = []; let files = [];
for(let i = 0; i < this.clipboardFiles.files.length; i ++) for(let i = 0; i < this.clipboardFiles.files.length; i ++)
...@@ -384,8 +364,7 @@ export class FileHandlingClipboard extends ScopedElementsMixin(DBPLitElement) { ...@@ -384,8 +364,7 @@ export class FileHandlingClipboard extends ScopedElementsMixin(DBPLitElement) {
${commonStyles.getModalDialogCSS()} ${commonStyles.getModalDialogCSS()}
${commonStyles.getRadioAndCheckboxCss()} ${commonStyles.getRadioAndCheckboxCss()}
${fileHandlingStyles.getFileHandlingCss()} ${fileHandlingStyles.getFileHandlingCss()}
.clipboard-container {
.clipboard-container{
display: flex; display: flex;
flex-direction: column; flex-direction: column;
justify-content: center; justify-content: center;
...@@ -395,7 +374,7 @@ export class FileHandlingClipboard extends ScopedElementsMixin(DBPLitElement) { ...@@ -395,7 +374,7 @@ export class FileHandlingClipboard extends ScopedElementsMixin(DBPLitElement) {
position: relative; position: relative;
} }
.clipboard-container .wrapper{ .clipboard-container .wrapper {
overflow-y: auto; overflow-y: auto;
text-align: center; text-align: center;
width: 100%; width: 100%;
...@@ -405,51 +384,51 @@ export class FileHandlingClipboard extends ScopedElementsMixin(DBPLitElement) { ...@@ -405,51 +384,51 @@ export class FileHandlingClipboard extends ScopedElementsMixin(DBPLitElement) {
justify-content: center; justify-content: center;
} }
.clipboard-container .wrapper.table{ .clipboard-container .wrapper.table {
justify-content: start; justify-content: start;
} }
.clipboard-container .wrapper .inner{ .clipboard-container .wrapper .inner {
overflow-y: auto; overflow-y: auto;
text-align: center; text-align: center;
width: 100%; width: 100%;
} }
.clipboard-footer{ .clipboard-footer {
align-self: end; align-self: end;
} }
#select-all-wrapper{ #select-all-wrapper {
text-align: right; text-align: right;
} }
.clipboard-container{ .clipboard-container {
display: flex; display: flex;
flex-direction: column; flex-direction: column;
justify-content: center; justify-content: center;
} }
.clipboard-container.table{ .clipboard-container.table {
justify-content: start; justify-content: start;
} }
.clipboard-container .inner{ .clipboard-container .inner {
overflow-y: scroll; overflow-y: scroll;
text-align: center; text-align: center;
width: 100%; width: 100%;
} }
.warning-icon{ .warning-icon {
font-size: 2rem; font-size: 2rem;
padding: 0 1rem; padding: 0 1rem;
padding-left: 0px; padding-left: 0;
} }
.clipboard-btn{ .clipboard-btn {
margin-bottom: 2rem; margin-bottom: 2rem;
} }
.warning-container{ .warning-container {
display: flex; display: flex;
text-align: left; text-align: left;
margin: auto; margin: auto;
...@@ -457,73 +436,74 @@ export class FileHandlingClipboard extends ScopedElementsMixin(DBPLitElement) { ...@@ -457,73 +436,74 @@ export class FileHandlingClipboard extends ScopedElementsMixin(DBPLitElement) {
margin-bottom: 2rem; margin-bottom: 2rem;
} }
.clipboard-data{ .clipboard-data {
text-align: left; text-align: left;
} }
.clipboard-data h4{ .clipboard-data h4 {
margin-top: 2rem; margin-top: 2rem;
margin-bottom: 1rem; margin-bottom: 1rem;
} }
.clipboard-data p{ .clipboard-data p {
margin-top: 1rem; margin-top: 1rem;
margin-bottom: 1rem; margin-bottom: 1rem;
} }
.clipboard-list{ .clipboard-list {
padding: 1rem 0; padding: 1rem 0;
border-top: 1px solid #eee; border-top: 1px solid #eee;
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;
} }
.button-wrapper{ .button-wrapper {
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;
} }
.border{ .border {
border-top:solid 1px #888; border-top: solid 1px #888;
} }
.clipboard-list-name{ .clipboard-list-name {
width: 80%; width: 80%;
overflow: hidden; overflow: hidden;
white-space: nowrap; white-space: nowrap;
text-overflow: ellipsis; text-overflow: ellipsis;
} }
.clipboard-list-size{
} .clipboard-list-size {
}
@media only screen @media only screen
and (orientation: portrait) and (orientation: portrait)
and (max-device-width: 765px) { and (max-device-width: 765px) {
.clipboard-container p, .clipboard-container h3{ .clipboard-container p, .clipboard-container h3 {
text-align: center; text-align: center;
} }
.warning-container{
.warning-container {
flex-direction: column; flex-direction: column;
align-items: center; align-items: center;
} }
.warning-icon{
.warning-icon {
margin-bottom: 1rem; margin-bottom: 1rem;
padding: 0px; padding: 0;
} }
.clipboard-footer{ .clipboard-footer {
padding-top: 10px; padding-top: 10px;
align-self: center; align-self: center;
} }
.button-wrapper{ .button-wrapper {
flex-direction: column; flex-direction: column;
} }
.clipboard-container .inner{ .clipboard-container .inner {
overflow-y: auto; overflow-y: auto;
} }
} }
...@@ -534,7 +514,6 @@ export class FileHandlingClipboard extends ScopedElementsMixin(DBPLitElement) { ...@@ -534,7 +514,6 @@ export class FileHandlingClipboard extends ScopedElementsMixin(DBPLitElement) {
const tabulatorCss = commonUtils.getAssetURL(pkgName, 'tabulator-tables/css/tabulator.min.css'); const tabulatorCss = commonUtils.getAssetURL(pkgName, 'tabulator-tables/css/tabulator.min.css');
if (this.clipboardSource) { if (this.clipboardSource) {
return html` return html`
<link rel="stylesheet" href="${tabulatorCss}"> <link rel="stylesheet" href="${tabulatorCss}">
<div class="block clipboard-container"> <div class="block clipboard-container">
...@@ -596,18 +575,11 @@ export class FileHandlingClipboard extends ScopedElementsMixin(DBPLitElement) { ...@@ -596,18 +575,11 @@ export class FileHandlingClipboard extends ScopedElementsMixin(DBPLitElement) {
@click="${() => { this.saveFilesToClipboard(); }}"> @click="${() => { this.saveFilesToClipboard(); }}">
${this.buttonLabel || i18n.t('file-sink.save-to-clipboard-btn', {count:this.filesToSave ? this.filesToSave.length : 0})} ${this.buttonLabel || i18n.t('file-sink.save-to-clipboard-btn', {count:this.filesToSave ? this.filesToSave.length : 0})}
</button> </button>
</div> </div>
<div class="border ${classMap({"hidden": this.clipboardFiles.files.length === 0})}"> <div class="border ${classMap({"hidden": this.clipboardFiles.files.length === 0})}">
<div class="clipboard-data ${classMap({"hidden": this.clipboardFiles.files.length === 0})}"> <div class="clipboard-data ${classMap({"hidden": this.clipboardFiles.files.length === 0})}">
<h4>${i18n.t('file-sink.clipboard-files', {count: this.clipboardFiles.files.length})}</h4> <h4>${i18n.t('file-sink.clipboard-files', {count: this.clipboardFiles.files.length})}</h4>
<dbp-file-sink id="file-sink-clipboard" <dbp-file-sink id="file-sink-clipboard"
context="${i18n.t('clipboard.save-files-from-clipboard', {count: this.clipboardFiles ? this.clipboardFiles.files.length : 0})}" context="${i18n.t('clipboard.save-files-from-clipboard', {count: this.clipboardFiles ? this.clipboardFiles.files.length : 0})}"
filename="clipboard-documents.zip" filename="clipboard-documents.zip"
...@@ -619,7 +591,7 @@ export class FileHandlingClipboard extends ScopedElementsMixin(DBPLitElement) { ...@@ -619,7 +591,7 @@ export class FileHandlingClipboard extends ScopedElementsMixin(DBPLitElement) {
fullsize-modal="true" fullsize-modal="true"
lang="${this.lang}" lang="${this.lang}"
></dbp-file-sink> ></dbp-file-sink>
<details> <details>
<summary>Dateien anzeigen</summary> <summary>Dateien anzeigen</summary>
<p>${i18n.t('file-sink.clipboard-files-overwrite')}</p> <p>${i18n.t('file-sink.clipboard-files-overwrite')}</p>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment