Skip to content

Commit

Permalink
feat(context-menu): remove selected appendings
Browse files Browse the repository at this point in the history
Closes #1
  • Loading branch information
julianpoemp committed Apr 8, 2018
1 parent 2415f82 commit dfe77b3
Show file tree
Hide file tree
Showing 4 changed files with 53 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,25 @@

tr {
border-bottom: 1px solid #c0c0c0;
padding: 5px auto;
padding: 3px auto;
text-align: left;
}

tr td:first-of-type {
width: 30px;
text-align: center;
}

td {
padding: 2px;
border-bottom: 1px solid #e3e3e3;
border-top: none;
font-size: 0.9em;
text-align: left;
}

tr:first-of-type {
text-align: center;
}

.table-hover {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<table class="table-hover">
<table class="table table-hover">
<tbody>
<tr *ngIf="filesCount > 0 || dirCount > 0" (click)="onDeleteTasks()">
<td><i class="fa fa-times"></i></td>
Expand All @@ -14,6 +14,10 @@
</ng-container>
</td>
</tr>
<tr *ngIf="selected_tasks.length > 0">
<td></td>
<td (click)="onRemoveAppendings()">Remove appendings</td>
</tr>
<tr *ngIf="selectedOperationType != undefined" (click)="onCompress()">
<td><i class="fa fa-file-archive-o"></i></td>
<td>Save all {{selectedOperationType.name}} results</td>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,4 +46,8 @@ export class ContextMenuComponent implements OnInit {

return test.length;
}

public onRemoveAppendings() {
this.optionselected.emit('appendings-remove');
}
}
25 changes: 25 additions & 0 deletions src/app/components/proceedings/proceedings.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -277,6 +277,8 @@ export class ProceedingsComponent implements OnInit, OnDestroy {
} else if (option === 'compress') {
this.contextmenu.hidden = false;
this.openContentModal(this.selectedOperation);
} else if (option === 'appendings-remove') {
this.removeAppendings();
}
this.contextmenu.hidden = true;
}
Expand Down Expand Up @@ -338,6 +340,29 @@ export class ProceedingsComponent implements OnInit, OnDestroy {
}
}

removeAppendings() {
for (let i = 0; i < this.selected_tasks.length; i++) {
const entry = this.selected_tasks[i];

if (entry instanceof Task) {
if (entry.files.length > 1) {
entry.files.splice(1)
entry.operations[1].enabled = this.taskService.operations[1].enabled;
entry.operations[1].changeState(entry.state);
}
} else {
for (let j = 0; j < entry.entries.length; j++) {
const task = <Task> entry.entries[j];
if (task.files.length > 1) {
task.files.splice(1);
task.operations[1].enabled = this.taskService.operations[1].enabled;
task.operations[1].changeState(task.state);
}
}
}
}
}

isEntrySelected(entry: (Task | TaskDirectory)) {
if (entry instanceof Task) {
const search = this.selected_tasks.findIndex((a) => {
Expand Down

0 comments on commit dfe77b3

Please sign in to comment.