forked from evt-project/evt-viewer
-
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.
Merge pull request evt-project#103 from evt-project/feature/line-groups
Feature/line groups
- Loading branch information
Showing
9 changed files
with
136 additions
and
3 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
<span class="verses-group {{data.class}} {{data.groupType}}" [evtHtmlAttributes]="data.attributes" | ||
[class.display-block]="displayBlock$ | async"> | ||
<span class="verses-group-num">{{data.n}}</span> | ||
<evt-content-viewer *ngFor="let el of data.content" [content]="el" [editionLevel]="editionLevel" | ||
[itemsToHighlight]="itemsToHighlight" [evtHighlight]="highlightData"> | ||
</evt-content-viewer> | ||
</span> |
33 changes: 33 additions & 0 deletions
33
src/app/components/verses-group/verses-group.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,33 @@ | ||
@import "../../../assets/scss/colors"; | ||
@import "../../../assets/scss/themes"; | ||
|
||
.verses-group { | ||
.verses-group-num { | ||
display: none; | ||
} | ||
&.display-block { | ||
margin-bottom: 1.3rem; | ||
display: block; | ||
|
||
.verses-group-num { | ||
background: none; | ||
border: none; | ||
margin-right: 5px; | ||
display: inline-flex; | ||
vertical-align: middle; | ||
justify-content: center; | ||
align-items: center; | ||
|
||
min-width: 16px; | ||
height: 16px; | ||
padding: 1px; | ||
text-align: center; | ||
|
||
font-size: 0.7em; | ||
line-height: 1.4em; | ||
@include themify($themes) { | ||
color: themed("secondaryColorDark"); | ||
} | ||
} | ||
} | ||
} |
25 changes: 25 additions & 0 deletions
25
src/app/components/verses-group/verses-group.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,25 @@ | ||
import { async, ComponentFixture, TestBed } from '@angular/core/testing'; | ||
|
||
import { VersesGroupComponent } from './verses-group.component'; | ||
|
||
describe('VersesGroupComponent', () => { | ||
let component: VersesGroupComponent; | ||
let fixture: ComponentFixture<VersesGroupComponent>; | ||
|
||
beforeEach(async(() => { | ||
TestBed.configureTestingModule({ | ||
declarations: [ VersesGroupComponent ] | ||
}) | ||
.compileComponents(); | ||
})); | ||
|
||
beforeEach(() => { | ||
fixture = TestBed.createComponent(VersesGroupComponent); | ||
component = fixture.componentInstance; | ||
fixture.detectChanges(); | ||
}); | ||
|
||
it('should create', () => { | ||
expect(component).toBeTruthy(); | ||
}); | ||
}); |
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,42 @@ | ||
import { Component, Input } from '@angular/core'; | ||
import { map } from 'rxjs/operators'; | ||
|
||
import { VersesGroup } from '../../models/evt-models'; | ||
import { register } from '../../services/component-register.service'; | ||
import { EVTModelService } from '../../services/evt-model.service'; | ||
import { EditionlevelSusceptible, Highlightable } from '../components-mixins'; | ||
|
||
export interface VersesGroupComponent extends EditionlevelSusceptible, Highlightable { } | ||
|
||
@Component({ | ||
selector: 'evt-verses-group', | ||
templateUrl: './verses-group.component.html', | ||
styleUrls: ['./verses-group.component.scss'], | ||
}) | ||
@register(VersesGroup) | ||
export class VersesGroupComponent { | ||
@Input() data: VersesGroup; | ||
|
||
get displayBlock$() { | ||
return this.evtModelService.lines$.pipe( | ||
map(lines => lines.length > 0), | ||
map(hasLines => { | ||
// In diplomatic and interpretative edition, if the text doesn't have any line, verses group are shown as block items | ||
// In critical edition verses are always shown as block items | ||
switch (this.editionLevel) { | ||
case 'diplomatic': | ||
case 'interpretative': | ||
return !hasLines; | ||
case 'critical': | ||
return true; | ||
} | ||
}), | ||
); | ||
} | ||
|
||
constructor( | ||
private evtModelService: EVTModelService, | ||
) { | ||
} | ||
|
||
} |
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