Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Changed file import to use columns [#965]
- Loading branch information
Showing
17 changed files
with
185 additions
and
650 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
14 changes: 14 additions & 0 deletions
14
...d-webui/src/app/comic-files/components/comic-file-covers/comic-file-covers.component.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
<div class="cx-detail-card-container"> | ||
<div | ||
*ngFor="let file of files" | ||
fxFlex.gt-lg="10%" | ||
fxFlex.lg="20%" | ||
fxFlex.md="50%" | ||
fxFlex.lt-md="100%" | ||
> | ||
<cx-comic-file-details | ||
[file]="file" | ||
[selected]="isFileSelected(file)" | ||
></cx-comic-file-details> | ||
</div> | ||
</div> |
File renamed without changes.
79 changes: 79 additions & 0 deletions
79
...ebui/src/app/comic-files/components/comic-file-covers/comic-file-covers.component.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
/* | ||
* ComiXed - A digital comic book library management application. | ||
* Copyright (C) 2020, The ComiXed Project | ||
* | ||
* This program is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU 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 General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU General Public License | ||
* along with this program. If not, see <http://www.gnu.org/licenses> | ||
*/ | ||
|
||
import { async, ComponentFixture, TestBed } from '@angular/core/testing'; | ||
import { ComicFileCoversComponent } from './comic-file-covers.component'; | ||
import { LoggerModule } from '@angular-ru/logger'; | ||
import { MockStore, provideMockStore } from '@ngrx/store/testing'; | ||
import { | ||
COMIC_FILE_1, | ||
COMIC_FILE_2, | ||
COMIC_FILE_3, | ||
COMIC_FILE_4 | ||
} from '@app/comic-files/comic-file.fixtures'; | ||
import { | ||
COMIC_IMPORT_FEATURE_KEY, | ||
initialState as initialComicImportState | ||
} from '@app/comic-files/reducers/comic-import.reducer'; | ||
import { TranslateModule } from '@ngx-translate/core'; | ||
|
||
describe('ComicFileCoversComponent', () => { | ||
const initialState = { [COMIC_IMPORT_FEATURE_KEY]: initialComicImportState }; | ||
const FILES = [COMIC_FILE_1, COMIC_FILE_2, COMIC_FILE_3, COMIC_FILE_4]; | ||
const FILE = COMIC_FILE_4; | ||
|
||
let component: ComicFileCoversComponent; | ||
let fixture: ComponentFixture<ComicFileCoversComponent>; | ||
let store: MockStore<any>; | ||
|
||
beforeEach(async(() => { | ||
TestBed.configureTestingModule({ | ||
declarations: [ComicFileCoversComponent], | ||
imports: [TranslateModule.forRoot(), LoggerModule.forRoot()], | ||
providers: [provideMockStore({ initialState })] | ||
}).compileComponents(); | ||
|
||
fixture = TestBed.createComponent(ComicFileCoversComponent); | ||
component = fixture.componentInstance; | ||
store = TestBed.inject(MockStore); | ||
spyOn(store, 'dispatch'); | ||
fixture.detectChanges(); | ||
})); | ||
|
||
it('should create', () => { | ||
expect(component).toBeTruthy(); | ||
}); | ||
|
||
describe('checking a selection', () => { | ||
const SELECTED_FILE = FILES[1]; | ||
const NOT_SELECTED_FILE = FILES[2]; | ||
|
||
beforeEach(() => { | ||
component.files = FILES; | ||
component.selectedFiles = [SELECTED_FILE]; | ||
}); | ||
|
||
it('returns true for an selected file', () => { | ||
expect(component.isFileSelected(SELECTED_FILE)).toBeTrue(); | ||
}); | ||
|
||
it('returns false for an unselected file', () => { | ||
expect(component.isFileSelected(NOT_SELECTED_FILE)).toBeFalse(); | ||
}); | ||
}); | ||
}); |
40 changes: 40 additions & 0 deletions
40
...xed-webui/src/app/comic-files/components/comic-file-covers/comic-file-covers.component.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
/* | ||
* ComiXed - A digital comic book library management application. | ||
* Copyright (C) 2020, The ComiXed Project | ||
* | ||
* This program is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU 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 General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU General Public License | ||
* along with this program. If not, see <http://www.gnu.org/licenses> | ||
*/ | ||
|
||
import { Component, Input, OnInit } from '@angular/core'; | ||
import { ComicFile } from '@app/comic-files/models/comic-file'; | ||
import { LoggerService } from '@angular-ru/logger'; | ||
import { Store } from '@ngrx/store'; | ||
|
||
@Component({ | ||
selector: 'cx-comic-file-covers', | ||
templateUrl: './comic-file-covers.component.html', | ||
styleUrls: ['./comic-file-covers.component.scss'] | ||
}) | ||
export class ComicFileCoversComponent implements OnInit { | ||
@Input() files: ComicFile[] = []; | ||
@Input() selectedFiles: ComicFile[] = []; | ||
|
||
constructor(private logger: LoggerService, private store: Store<any>) {} | ||
|
||
ngOnInit(): void {} | ||
|
||
isFileSelected(file: ComicFile): boolean { | ||
return this.selectedFiles.includes(file); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.