-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add checkbox to hide published tests #673
- Loading branch information
Showing
13 changed files
with
171 additions
and
46 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
38 changes: 38 additions & 0 deletions
38
src/app/events/components/test-table-filter/test-table-filter.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,38 @@ | ||
<div class="only-mine-buttons"> | ||
<button | ||
type="button" | ||
class="btn desktop" | ||
(click)="showAll()" | ||
[ngClass]="{ | ||
'btn-primary': !filter.onlyMine, | ||
'btn-outline-secondary': filter.onlyMine | ||
}" | ||
> | ||
{{ "tests.all-tests" | translate }} | ||
</button> | ||
<button | ||
type="button" | ||
class="btn ms-2 desktop" | ||
(click)="showOnlyMine()" | ||
[ngClass]="{ | ||
'btn-primary': filter.onlyMine, | ||
'btn-outline-secondary': !filter.onlyMine | ||
}" | ||
> | ||
{{ "tests.owned-tests" | translate }} | ||
</button> | ||
</div> | ||
<div class="hide-published"> | ||
<div class="form-check"> | ||
<input | ||
id="hide-published" | ||
class="form-check-input" | ||
type="checkbox" | ||
[checked]="filter.hidePublished" | ||
(change)="onHidePublishedChange($event)" | ||
/> | ||
<label class="form-check-label" for="hide-published"> | ||
{{ "tests.hide-published" | translate }} | ||
</label> | ||
</div> | ||
</div> |
29 changes: 29 additions & 0 deletions
29
src/app/events/components/test-table-filter/test-table-filter.component.scss
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,29 @@ | ||
@import "../../../../bootstrap-variables"; | ||
|
||
:host { | ||
display: flex; | ||
flex-direction: column; | ||
justify-content: space-between; | ||
height: 100%; | ||
} | ||
|
||
.only-mine-buttons { | ||
display: flex; | ||
align-items: center; | ||
height: calc($font-size-base * $line-height-base + 2 * 1rem); | ||
} | ||
|
||
.hide-published { | ||
display: flex; | ||
align-items: center; | ||
height: calc($btn-font-size * $btn-line-height + 2 * $btn-padding-y); | ||
margin-bottom: 1rem; | ||
} | ||
|
||
.hide-published label { | ||
font-weight: $font-weight-base; | ||
} | ||
|
||
.hide-published .form-check { | ||
margin-bottom: 0; | ||
} |
24 changes: 24 additions & 0 deletions
24
src/app/events/components/test-table-filter/test-table-filter.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,24 @@ | ||
import { ComponentFixture, TestBed } from "@angular/core/testing"; | ||
import { buildTestModuleMetadata } from "src/spec-helpers"; | ||
import { TestTableFilterComponent } from "./test-table-filter.component"; | ||
|
||
describe("TestTableFilterComponent", () => { | ||
let component: TestTableFilterComponent; | ||
let fixture: ComponentFixture<TestTableFilterComponent>; | ||
|
||
beforeEach(async () => { | ||
await TestBed.configureTestingModule( | ||
buildTestModuleMetadata({ | ||
imports: [TestTableFilterComponent], | ||
}), | ||
).compileComponents(); | ||
|
||
fixture = TestBed.createComponent(TestTableFilterComponent); | ||
component = fixture.componentInstance; | ||
fixture.detectChanges(); | ||
}); | ||
|
||
it("should create", () => { | ||
expect(component).toBeTruthy(); | ||
}); | ||
}); |
37 changes: 37 additions & 0 deletions
37
src/app/events/components/test-table-filter/test-table-filter.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,37 @@ | ||
import { NgClass } from "@angular/common"; | ||
import { Component, EventEmitter, Input, Output } from "@angular/core"; | ||
import { FormsModule } from "@angular/forms"; | ||
import { TranslateModule } from "@ngx-translate/core"; | ||
import { | ||
INITIAL_TESTS_FILTER, | ||
TestsFilter, | ||
} from "../../services/test-state.service"; | ||
|
||
@Component({ | ||
selector: "bkd-test-table-filter", | ||
standalone: true, | ||
imports: [NgClass, FormsModule, TranslateModule], | ||
templateUrl: "./test-table-filter.component.html", | ||
styleUrl: "./test-table-filter.component.scss", | ||
}) | ||
export class TestTableFilterComponent { | ||
@Input() filter: TestsFilter = INITIAL_TESTS_FILTER; | ||
@Output() filterChange = new EventEmitter<TestsFilter>(); | ||
|
||
showOnlyMine(): void { | ||
this.filterChange.next({ ...this.filter, onlyMine: true }); | ||
} | ||
|
||
showAll(): void { | ||
this.filterChange.next({ ...this.filter, onlyMine: false }); | ||
} | ||
|
||
onHidePublishedChange(event: Event): void { | ||
const hidePublished = | ||
(event.target && | ||
event.target instanceof HTMLInputElement && | ||
event.target?.checked) ?? | ||
false; | ||
this.filterChange.next({ ...this.filter, hidePublished }); | ||
} | ||
} |
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 was deleted.
Oops, something went wrong.
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