Skip to content
This repository has been archived by the owner on May 5, 2022. It is now read-only.

Commit

Permalink
Merge pull request #251 from CTemplar/dev
Browse files Browse the repository at this point in the history
v1.1.3
  • Loading branch information
atifsaddique211f authored Oct 10, 2018
2 parents 4a4b28b + a73578a commit 1b4361d
Show file tree
Hide file tree
Showing 36 changed files with 877 additions and 326 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ <h3 class="modal-title w-100 text-dark" id="createFoldersModalLabel">
<div class="row align-items-center">
<div class="col-sm-3">
<label for="folderName" class="modal-form-label mb-2 mb-sm-0">
<small>Folder name:</small>
Folder name:
</label>
</div>
<div class="col-sm-9">
Expand All @@ -28,7 +28,7 @@ <h3 class="modal-title w-100 text-dark" id="createFoldersModalLabel">
<div class="row">
<div class="col-sm-3">
<label for="colorSelection" class="modal-form-label mb-2 mb-sm-0 pt-sm-2">
<small>Select color:</small>
Select color:
</label>
</div>
<div class="col-sm-9">
Expand All @@ -46,8 +46,8 @@ <h3 class="modal-title w-100 text-dark" id="createFoldersModalLabel">
</div>
</div>
<div class="modal-footer justify-content-center justify-content-sm-end">
<app-loading-spinner [showSpinner]="mailBoxesState?.inProgress"></app-loading-spinner>
<button type="submit" [disabled]="mailBoxesState?.inProgress" class="btn btn-secondary btn-sm">Create</button>
<app-loading-spinner [showSpinner]="userState?.inProgress"></app-loading-spinner>
<button type="submit" [disabled]="userState?.inProgress" class="btn btn-secondary btn-sm">Create</button>
</div>
</form>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,4 +46,8 @@
.form-control{
font-size: 14px;
}


// == Modal cotents
.modal-form-label {
font-size: 14px;
}
15 changes: 9 additions & 6 deletions src/app/mail/dialogs/create-folder/create-folder.component.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Component, OnInit } from '@angular/core';
import { OnDestroy, TakeUntilDestroy } from 'ngx-take-until-destroy';
import { Observable } from 'rxjs/Observable';
import { AppState, MailBoxesState } from '../../../store/datatypes';
import { AppState, MailBoxesState, UserState } from '../../../store/datatypes';
import { Store } from '@ngrx/store';
import { FormGroup, FormBuilder, Validators } from '@angular/forms';
import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap';
Expand All @@ -20,10 +20,10 @@ export class CreateFolderComponent implements OnInit, OnDestroy {
readonly destroyed$: Observable<boolean>;

customFolderForm: FormGroup;
mailBoxesState: MailBoxesState;
folderColors: string[] = FOLDER_COLORS;
selectedColorIndex: number = 0;
currentMailbox: Mailbox;
userState: UserState;

constructor(private store: Store<AppState>,
private fb: FormBuilder,
Expand All @@ -38,11 +38,14 @@ export class CreateFolderComponent implements OnInit, OnDestroy {

this.store.select(state => state.mailboxes).takeUntil(this.destroyed$)
.subscribe((mailboxes: MailBoxesState) => {
if (this.mailBoxesState && this.mailBoxesState.inProgress && !mailboxes.inProgress) {
this.currentMailbox = mailboxes.currentMailbox;
});
this.store.select(state => state.user).takeUntil(this.destroyed$)
.subscribe((user: UserState) => {
if (this.userState && this.userState.inProgress && !user.inProgress) {
this.activeModal.close();
}
this.mailBoxesState = mailboxes;
this.currentMailbox = mailboxes.currentMailbox;
this.userState = user;
});
}

Expand All @@ -52,7 +55,7 @@ export class CreateFolderComponent implements OnInit, OnDestroy {
color: this.folderColors[this.selectedColorIndex],
mailbox: this.currentMailbox.id
};
if (this.currentMailbox.customFolders
if (this.userState.customFolders
.filter(folder => folder.name.toLowerCase() === customFolder.name.toLowerCase()).length > 0) {
this.onHide();
return;
Expand Down
6 changes: 3 additions & 3 deletions src/app/mail/mail-contact/mail-contact.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -88,15 +88,15 @@
class="icon icon-garbage"></i></a>
</li>
<li class="pr-0">
<a class="no-icon" (click)="showComposeMailDialog()" [translate]="'common.compose'">Compose</a>
<a class="no-icon text-grey-dark-500" (click)="showComposeMailDialog()" [translate]="'common.compose'">Compose</a>
</li>
<li class="hidden-xs-down pr-0">
<a class="no-icon" role="button"
<a class="no-icon text-grey-dark-500" role="button"
[translate]="'contacts.new_contact'"
(click)="editContact(null, addUserContent);">New Contact</a>
</li>
<li class="">
<a class="no-icon" (click)="openImportContactsModal()">Import Contacts</a>
<a class="no-icon text-grey-dark-500" (click)="openImportContactsModal()">Import Contacts</a>
</li>
<li *ngIf="inProgress">
<app-loading-spinner [showSpinner]="inProgress"></app-loading-spinner>
Expand Down
4 changes: 2 additions & 2 deletions src/app/mail/mail-detail/mail-detail.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ export class MailDetailComponent implements OnInit, OnDestroy {
} else {
const decryptedContent = mailState.decryptedContents[this.mail.id];
if (!decryptedContent || (!decryptedContent.inProgress && !decryptedContent.content && this.mail.content)) {
this.pgpService.decrypt(this.mail.id, this.mail.content);
this.pgpService.decrypt(this.mail.mailbox, this.mail.id, this.mail.content);
}
if (decryptedContent && !decryptedContent.inProgress && decryptedContent.content) {
this.decryptedContents[this.mail.id] = decryptedContent.content;
Expand All @@ -63,7 +63,7 @@ export class MailDetailComponent implements OnInit, OnDestroy {
} else {
const childDecryptedContent = mailState.decryptedContents[child.id];
if (!childDecryptedContent || (!childDecryptedContent.inProgress && !childDecryptedContent.content && child.content)) {
this.pgpService.decrypt(child.id, child.content);
this.pgpService.decrypt(child.mailbox, child.id, child.content);
}
if (childDecryptedContent && !childDecryptedContent.inProgress && childDecryptedContent.content) {
this.decryptedContents[child.id] = childDecryptedContent.content;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,27 +25,30 @@
</div>
</li>
<li class="px-0">
<a (click)="refresh(true)" ngbTooltip="Refresh" placement="top">
<i class="fa fa-redo-alt"></i>
<a (click)="refresh(true)" ngbTooltip="Refresh" placement="top" class="border-right-0 border-radius-0">
<i class="icon-self-timer"></i>
</a>
</li>
<li class="px-0">
<a class="border-right-0 border-radius-right-0" placement="top"
(click)="moveToFolder(mailFolderTypes.ARCHIVE)"
[ngbTooltip]="'mail_list.move_to_archive' | translate">
[ngbTooltip]="'mail_list.move_to_archive' | translate"
[ngClass]="{'disabled': disableFolderActions}">
<i class="icon icon-archive"></i>
</a>
</li>
<li class="pr-0 pl-0 hidden-xs-down">
<a class="border-right-0 border-radius-0"
(click)="moveToFolder(mailFolderTypes.SPAM)"
placement="top" [ngbTooltip]="'mail_list.move_to_spam' |translate">
placement="top" [ngbTooltip]="'mail_list.move_to_spam' |translate"
[ngClass]="{'disabled': disableFolderActions}">
<i class="icon icon-warning"></i>
</a>
</li>
<li class="px-0">
<a (click)="moveToTrash()" class="border-radius-left-0" placement="top"
[ngbTooltip]="(mailFolder !== mailFolderTypes.TRASH) ? ('mail_list.move_to_trash' | translate) : ('mail_list.permanently_delete' | translate)">
[ngbTooltip]="(mailFolder !== mailFolderTypes.TRASH) ? ('mail_list.move_to_trash' | translate) : ('mail_list.permanently_delete' | translate)"
[ngClass]="{'disabled': disableFolderActions}">
<i class="icon icon-garbage"></i>
</a>
</li>
Expand Down Expand Up @@ -172,7 +175,7 @@
<!-- Check box -->
<td class="mail-checkbox pl-4">
<div class="fancy-field-group">
<input class="d-none fancy-field-control" id={{mail.id}} type="checkbox" [(ngModel)]="mail.marked"/>
<input class="d-none fancy-field-control" id={{mail.id}} type="checkbox" [ngModel]="mail.marked" (ngModelChange)="toggleEmailSelection(mail, $event)"/>
<label for={{mail.id}} class="fancy-field-empty"></label>
</div>
</td>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
a.disabled {
pointer-events: none;
cursor: default;
color: #9E9E9E;
}
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ export class GenericFolderComponent implements OnInit, OnDestroy, OnChanges {

mailFolderTypes = MailFolderType;
selectAll: boolean;
disableFolderActions: boolean = true;

userState: UserState;

Expand Down Expand Up @@ -62,6 +63,7 @@ export class GenericFolderComponent implements OnInit, OnDestroy, OnChanges {
this.store.select(state => state.user).takeUntil(this.destroyed$)
.subscribe((user: UserState) => {
this.userState = user;
this.customFolders = user.customFolders;
if (this.fetchMails && this.userState.settings) {
this.LIMIT = user.settings.emails_per_page;
if (this.LIMIT) {
Expand All @@ -71,13 +73,6 @@ export class GenericFolderComponent implements OnInit, OnDestroy, OnChanges {
}
});

this.store.select(state => state.mailboxes).takeUntil(this.destroyed$)
.subscribe((mailboxes: MailBoxesState) => {
if (mailboxes.currentMailbox) {
this.customFolders = mailboxes.currentMailbox.customFolders;
}
});

this.store.select(state => state.search).takeUntil(this.destroyed$)
.subscribe((searchState: SearchState) => {
// TODO: apply search
Expand Down Expand Up @@ -119,12 +114,14 @@ export class GenericFolderComponent implements OnInit, OnDestroy, OnChanges {
return mail;
});
this.selectAll = true;
this.disableFolderActions = false;
} else {
this.mails.map(mail => {
mail.marked = false;
return mail;
});
this.selectAll = false;
this.disableFolderActions = true;
}
}

Expand Down Expand Up @@ -274,6 +271,20 @@ export class GenericFolderComponent implements OnInit, OnDestroy, OnChanges {
}
}


toggleEmailSelection(mail, event) {
mail.marked = event;
if (event) {
this.disableFolderActions = false;
} else {
if (this.mails.filter(m => m.marked === true).length > 0) {
this.disableFolderActions = false;
} else {
this.disableFolderActions = true;
}
}
}

/**
* @name getMailIDs
* @description Get list of comma separated IDs from mail object list
Expand Down
10 changes: 4 additions & 6 deletions src/app/mail/mail-list/mail-list.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { Folder, MailFolderType } from '../../store/models';
import { Observable } from 'rxjs/Observable';
import { OnDestroy, TakeUntilDestroy } from 'ngx-take-until-destroy';
import { ActivatedRoute } from '@angular/router';
import { AppState, MailBoxesState } from '../../store/datatypes';
import { AppState, MailBoxesState, UserState } from '../../store/datatypes';
import { Store } from '@ngrx/store';

@TakeUntilDestroy()
Expand All @@ -28,11 +28,9 @@ export class MailListComponent implements OnInit, OnDestroy {
this.mailFolder = params['folder'] as MailFolderType;
});

this.store.select(state => state.mailboxes).takeUntil(this.destroyed$)
.subscribe((mailboxes: MailBoxesState) => {
if (mailboxes.currentMailbox) {
this.customFolders = mailboxes.currentMailbox.customFolders;
}
this.store.select(state => state.user).takeUntil(this.destroyed$)
.subscribe((user: UserState) => {
this.customFolders = user.customFolders;
});
}

Expand Down
Loading

0 comments on commit 1b4361d

Please sign in to comment.