Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/crit app frame #219

Closed
wants to merge 63 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
63 commits
Select commit Hold shift + click to select a range
5c7f126
new component with basic style
davivcu Jun 8, 2023
b893269
optimazing code
davivcu Jun 17, 2023
3e2ad13
quote parsing with listbibl, bibl and ref support
davivcu Jul 25, 2023
ba1d000
added sources attribute for quote, listBibl and parallelPassage
davivcu Jul 25, 2023
40f3e70
optimazing code in critical apparatus component
davivcu Jul 26, 2023
5060fcb
style fixes
davivcu Jul 26, 2023
482284d
quote-entry-component with sources and biblio sub-components, transla…
davivcu Jul 26, 2023
978d292
including biblio component
davivcu Jul 26, 2023
05dcebc
fix tab borders
davivcu Jul 26, 2023
68bc783
adjusting sources style
davivcu Jul 26, 2023
e69bd15
adjusting sources style
davivcu Jul 27, 2023
617d53b
analogues parsing
davivcu Aug 9, 2023
89cc110
bibliolist component in order to reduce duplicated code in analogue a…
davivcu Aug 9, 2023
e5224e4
chainFirstChildTexts in utils, originalEncoding, external sources
davivcu Aug 10, 2023
f7c07e3
analogue component, minor changes to analogue parser, static basic st…
davivcu Aug 10, 2023
e2b7166
added config for bibliography, generalized get external source function
davivcu Aug 13, 2023
d1185b6
config to change bibliography appearance
davivcu Aug 13, 2023
598a7ea
fix for spacing in chained text from bibliography sub-elements
davivcu Aug 13, 2023
def4ee3
console.log commands removed
davivcu Aug 13, 2023
573bc89
send back to generic parser seg and ref element that doesnt contain s…
davivcu Aug 14, 2023
5d63aff
analogue entry component in text flow
davivcu Aug 16, 2023
1cc24f7
editorial conventions defaults for quote entry and analogues entry
davivcu Aug 16, 2023
f0093dd
moved bibl related parsers from basic-barsers.ts to specific file
davivcu Aug 16, 2023
1ed3bdf
changes to how the sources are displayed in sources and analogues com…
davivcu Aug 16, 2023
b2c0f05
popup for analogues / parallel passage in text, analogue-entry moved …
davivcu Aug 16, 2023
92ddd71
source-detail component
davivcu Aug 16, 2023
fea73c3
popup in text for quote elements
davivcu Aug 16, 2023
64d0518
removed console.log, revert fix to editorial conventions
davivcu Aug 16, 2023
517b8d1
fix dynamicComponents
davivcu Aug 16, 2023
776c0f7
cleaning for quote entry and analogue entry component, pointer on mou…
davivcu Aug 17, 2023
a4424b0
elements search improved
davivcu Aug 17, 2023
8b26344
hightlightcolor over and opened from config
davivcu Aug 18, 2023
0c2d49e
parsing retrieves quoted text in bibl and cit.quote elements, improve…
davivcu Aug 19, 2023
6e66f00
changes to sources display
davivcu Aug 19, 2023
a13b41c
cleaning
davivcu Aug 25, 2023
f4d51cf
editorial conventions default style for sources and analogues
davivcu Aug 25, 2023
4fda25e
editorial conventions default style for sources and analogues
davivcu Aug 25, 2023
34cf8cb
same operation, foreach no longer needed; default values are set in $…
davivcu Aug 25, 2023
513a4ae
constants for analogue and sources classes
davivcu Aug 28, 2023
8878279
parallel passage renamed analogue
davivcu Aug 28, 2023
65845a3
parallel passage renamed analogue
davivcu Aug 28, 2023
b074f88
constant for analogueEntry in parser service
davivcu Aug 28, 2023
4878430
using constants to refer to classes in hardcoded style
davivcu Aug 28, 2023
e2f7577
fix and exceptions
davivcu Sep 2, 2023
51eaa15
fix quotedText not found and tab displaying anyway
davivcu Sep 2, 2023
3298d79
default values for edition_config.json, limit to deep search,
davivcu Sep 3, 2023
5ab8201
quotes and analogues without textContent displayed as note
davivcu Sep 3, 2023
56e4705
supported generic elements in source detail view
davivcu Sep 4, 2023
b306716
merged two source parsers for performance and legibility
davivcu Sep 5, 2023
3d1f7d3
normalize text spaces in quote and analogues, not showing div for quo…
davivcu Sep 8, 2023
9fece8e
normalize text spaces in analogue.text
davivcu Sep 8, 2023
86bbb16
attribute 'sources' added to analogue notes' displayed list
davivcu Sep 8, 2023
99fe0bb
@spanTo @corresp and parsing milestone element
davivcu Sep 11, 2023
2d109a2
fix source recognition on ptr elements
davivcu Sep 13, 2023
783d1bb
anchor, span and snapGrp elements: parsing and displaying in sources
davivcu Sep 13, 2023
fd6e91c
quote-entries-parser-service renamed source-entries-parser-service
davivcu Sep 13, 2023
ac8608d
not showing empty source/analogue notes
davivcu Sep 14, 2023
287ccf0
source/analogue support for elem paragraph p, verse l, versesgroup lg…
davivcu Sep 15, 2023
87a7c20
evt-content-viewer instead of raw text in analogue and quote details …
davivcu Sep 16, 2023
a977c89
editorial conventions in nested elements of analogues and sources
davivcu Sep 17, 2023
e6ea535
support for analogue nested inside source entry
davivcu Sep 17, 2023
0da0773
Merge pull request #218 from evt-project/bugfix/editorial_conventions…
giuliac89 Sep 19, 2023
4faaaec
Merge remote-tracking branch 'origin/develop' into feature/crit_app_f…
davivcu Sep 19, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 34 additions & 1 deletion src/app/app.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,9 @@ import { TranslateService } from '@ngx-translate/core';
import { forkJoin } from 'rxjs';
import { map, switchMap } from 'rxjs/operators';
import { EntitiesSelectItemGroup } from './components/entities-select/entities-select.component';
import { ViewMode, ViewModeId } from './models/evt-models';
import { AnalogueClass, SourceClass, ViewMode, ViewModeId } from './models/evt-models';
import { Attributes, EditorialConventionLayout } from './models/evt-models';
import { updateCSS } from './utils/dom-utils';

@Injectable()
export class AppConfig {
Expand All @@ -31,6 +32,7 @@ export class AppConfig {
]).pipe(
map(([ui, edition, editorialConventions]) => {
console.log(ui, edition, files);
this.updateStyleFromConfig(edition);
// Handle default values => TODO: Decide how to handle defaults!!
if (ui.defaultLocalization) {
if (ui.availableLanguages.find((l) => l.code === ui.defaultLocalization && l.enable)) {
Expand All @@ -53,7 +55,24 @@ export class AppConfig {
});
});
}

/**
* Update once general css with values from config,
* this way we don't need to inject a style property in each element
* @param edition EditionConfig
*/
updateStyleFromConfig(edition: EditionConfig) {
const rules = [];
rules['.'+AnalogueClass+' .opened'] = `background-color: ${edition.readingColorDark}`;
rules['.'+SourceClass+' .opened'] = `background-color: ${edition.readingColorDark}`;
rules['.'+AnalogueClass+':hover'] = `background-color: ${edition.readingColorLight}; cursor:pointer`;
rules['.'+SourceClass+':hover'] = `background-color: ${edition.readingColorLight}; cursor:pointer`;
Object.entries(rules).forEach(([selector,style]) => { updateCSS([[selector,style]]) });
console.log('style from config',rules);
}

}

export interface EVTConfig {
ui: UiConfig;
edition: EditionConfig;
Expand Down Expand Up @@ -99,6 +118,20 @@ export interface EditionConfig {
verseNumberPrinter: number;
readingColorLight: string;
readingColorDark: string;
externalBibliography: Partial<{
biblAttributeToMatch: string,
elementAttributesToMatch: string[]
}>;
biblView: Partial<{
propToShow: string[];
showAttrNames: boolean;
showEmptyValues: boolean;
inline: boolean;
comaSeparated: boolean;
showMainElemTextContent: boolean;
}>;
analogueMarkers: string[];
sourcesExcludedFromListByParent: string[];
}

export type EditionImagesSources = 'manifest' | 'graphics';
Expand Down
20 changes: 20 additions & 0 deletions src/app/app.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,16 @@ import { TextSourcesComponent } from './view-modes/text-sources/text-sources.com
import { TextTextComponent } from './view-modes/text-text/text-text.component';
import { TextVersionsComponent } from './view-modes/text-versions/text-versions.component';
import { HandleImgErrorDirective } from './directives/handle-img-error.directive';
import { CriticalApparatusComponent } from './components/critical-apparatus/critical-apparatus.component';
import { AnaloguesComponent } from './components/analogues/analogues.component';
import { SourcesComponent } from './components/sources/sources.component';
import { SourceDetailComponent } from './components/sources/source-detail/source-detail.component';
import { SourceNoteComponent } from './components/sources/source-note/source-note.component';
import { QuoteEntryComponent } from './components/quote-entry/quote-entry.component';
import { AnalogueEntryComponent } from './components/analogues/analogue-entry/analogue-entry.component';
import { AnalogueDetailComponent } from './components/analogues/analogue-detail/analogue-detail.component';
import { BiblioEntryComponent } from './components/biblio/biblio.component';
import { BiblioListComponent } from './components/biblioList/biblio-list.component';

const routes: Routes = [
];
Expand Down Expand Up @@ -181,6 +191,8 @@ const DynamicComponents = [
VerseComponent,
VersesGroupComponent,
WordComponent,
QuoteEntryComponent,
AnalogueEntryComponent,
];

@NgModule({
Expand Down Expand Up @@ -227,6 +239,14 @@ const DynamicComponents = [
VersionPanelComponent,
WitnessPanelComponent,
XmlBeautifyPipe,
CriticalApparatusComponent,
AnaloguesComponent,
AnalogueDetailComponent,
SourceDetailComponent,
SourceNoteComponent,
SourcesComponent,
BiblioEntryComponent,
BiblioListComponent,
...DynamicComponents,
],
imports: [
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
<div class="source-container"
*ngIf="((analogue.sources.length > 0) || (analogue.extSources.length > 0)
|| (analogue.text.length > 0) || (analogue.extLinkedElements.length > 0))">

<div class="card-body app-detail-content source-detail-content" *ngIf="analogue.content.length > 0">
<span class="btn btn-sm transparent source-quote-button">☚</span>
<span class="source-quote-symbol">&#10077;</span>
<span title="analogue-text">
<ng-container *ngFor="let element of analogue.contentToShow">
<evt-content-viewer *ngIf="element.tagName !== 'ptr'"
[content]="element"
[editionLevel]="editionLevel"
[evtHtmlAttributes]="element?.attributes"
[attr.data-edition]="editionLevel">
</evt-content-viewer>
</ng-container>
</span>
</div>

<div class="card-footer app-detail-tabs" *ngIf="analogue.sources.length > 0
|| analogue.extSources.length > 0 || analogue.quotedText.length > 0">
<ul ngbNav #analogueEntryTab="ngbNav" class="nav-pills">

<li ngbNavItem="quotedText" *ngIf="analogue.quotedText.length > 0">
<a class="source-detail-btn" ngbNavLink>{{'quotedText' | translate}}</a>
<ng-template ngbNavContent>
<ng-container *ngFor="let quoteTxt of analogue.quotedText">
<ng-container *ngIf="quoteTxt.quote.type">
<evt-content-viewer [content]="quoteTxt.quote"></evt-content-viewer>
</ng-container>
<ng-container *ngIf="!(quoteTxt.quote.type)">{{quoteTxt.quote}}</ng-container>
</ng-container>
</ng-template>
</li>

<li ngbNavItem="refBibl" *ngIf="analogue.sources.length > 0 || analogue.extSources.length > 0">
<a class="source-detail-btn" ngbNavLink>{{'refBibl' | translate}}</a>
<ng-template ngbNavContent>

<ng-container *ngIf="analogue.sources.length > 0">
<h3 class="sources-cat">{{'quotedSources' | translate}}</h3>
<evt-biblio-list [data]="analogue.sources"></evt-biblio-list>
</ng-container>

<ng-container *ngIf="analogue.extSources.length > 0">
<h3 class="sources-cat">{{'analogueIn' | translate}}</h3>
<evt-biblio-list [data]="analogue.extSources"></evt-biblio-list>
</ng-container>

</ng-template>
</li>

<li ngbNavItem="xml" *ngIf="analogue.originalEncoding">
<a class="source-detail-btn" ngbNavLink>{{'xml' | translate}}</a>
<ng-template ngbNavContent>
<pre>{{ analogue.originalEncoding | xmlBeautify }}</pre>
<!-- children bibl element -->
<ng-container *ngIf="analogue.sources && analogue.insideCit">
<ng-container *ngFor="let sourceXML of analogue.sources">
<ng-container *ngIf="sourceXML.type.name === 'BibliographicList'">
<ng-container *ngFor="let intBib of sourceXML.sources">
<pre>{{ intBib.originalEncoding | xmlBeautify }}</pre>
</ng-container>
</ng-container>
<ng-container *ngIf="sourceXML.type.name !== 'BibliographicList'">
<pre>{{ sourceXML.originalEncoding | xmlBeautify }}</pre>
</ng-container>
</ng-container>
</ng-container>
<!-- external bibl element -->
<ng-container *ngIf="analogue.extSources">
<ng-container *ngFor="let extBiblXML of analogue.extSources">
<ng-container *ngIf="extBiblXML.type.name === 'BibliographicList'">
<ng-container *ngFor="let bibl of extBiblXML.sources">
<pre>{{ bibl.originalEncoding | xmlBeautify }}</pre>
</ng-container>
</ng-container>
<ng-container *ngIf="extBiblXML.type.name !== 'BibliographicList'">
<ng-container *ngIf="extBiblXML.originalEncoding">
<pre>{{ extBiblXML.originalEncoding | xmlBeautify }}</pre>
</ng-container>
</ng-container>
</ng-container>
</ng-container>
</ng-template>
</li>
</ul>
<div [ngbNavOutlet]="analogueEntryTab" class="tab-content"></div>
</div>

</div>

Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import { ComponentFixture, TestBed } from '@angular/core/testing';

import { AnalogueDetailComponent } from './analogue-detail.component';

describe('AnalogueDetailComponent', () => {
let component: AnalogueDetailComponent;
let fixture: ComponentFixture<AnalogueDetailComponent>;

beforeEach(async () => {
await TestBed.configureTestingModule({
declarations: [ AnalogueDetailComponent ]
})
.compileComponents();
});

beforeEach(() => {
fixture = TestBed.createComponent(AnalogueDetailComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});

it('should create', () => {
expect(component).toBeTruthy();
});
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import { Component, Input } from '@angular/core';
import { BehaviorSubject } from 'rxjs';
import { EditionLevelType } from 'src/app/app.config';

@Component({
selector: 'evt-analogue-detail',
templateUrl: './analogue-detail.component.html',
styleUrls: ['./analogue-detail.component.scss','../../sources/sources.component.scss'],
})
export class AnalogueDetailComponent {

private edLevel: EditionLevelType;

@Input() analogue;

@Input() set editionLevel(el: EditionLevelType) {
this.edLevel = el;
this.editionLevelChange.next(el);
}
get editionLevel() { return this.edLevel; }
editionLevelChange = new BehaviorSubject<EditionLevelType | ''>('');

stopPropagation(e: MouseEvent) {
e.stopPropagation();
}

}

Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<span class="{{ analogueClass }} {{ data.class }}"
(click)="toggleOpened$.next()"
[ngClass]="{opened: opened$ | async}"
[evtHtmlAttributes]="data?.attributes"
[attr.data-edition]="editionLevel"
[evtEditorialConventionLayout]="editorialConventionData"
(click)="toggleAppEntryBox($event);">

<ng-container *ngIf="data?.contentToShow.length > 0">
<ng-container *ngFor="let element of data.contentToShow">
<evt-content-viewer [content]="element" [editionLevel]="editionLevel"></evt-content-viewer>
</ng-container>
</ng-container>

<ng-container *ngIf="data?.contentToShow.length === 0"> <evt-note [data]="dataForNote"></evt-note> </ng-container>
</span>
<evt-analogue-detail
[editionLevel]="editionLevel"
[evtHtmlAttributes]="data?.attributes"
*ngIf="opened$ | async" [analogue]="data">
</evt-analogue-detail>
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing';

import { AnalogueEntryComponent } from './analogue-entry.component';

describe('AnalogueEntryComponent', () => {
let component: AnalogueEntryComponent;
let fixture: ComponentFixture<AnalogueEntryComponent>;

beforeEach(waitForAsync(() => {
TestBed.configureTestingModule({
declarations: [ AnalogueEntryComponent ],
})
.compileComponents();
}));

beforeEach(() => {
fixture = TestBed.createComponent(AnalogueEntryComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});

it('should create', () => {
expect(component).toBeTruthy();
});
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
import { ChangeDetectionStrategy, Component, Input, OnInit } from '@angular/core';
import { BehaviorSubject, Subject } from 'rxjs';
import { scan, startWith } from 'rxjs/operators';

import { EditorialConventionLayoutData } from '../../../directives/editorial-convention-layout.directive';

import { Analogue, AnalogueClass, Note } from '../../../models/evt-models';
import { register } from '../../../services/component-register.service';
import { EVTStatusService } from '../../../services/evt-status.service';
import { EditionLevelType } from 'src/app/app.config';

export interface AnalogueEntryComponent { }
@register(Analogue)
@Component({
selector: 'evt-analogue-entry',
templateUrl: './analogue-entry.component.html',
styleUrls: ['./analogue-entry.component.scss','../../sources/sources.component.scss'],
changeDetection: ChangeDetectionStrategy.OnPush,
})
export class AnalogueEntryComponent implements OnInit {

public _data: Analogue;

private edLevel: EditionLevelType;

@Input() set data(dt: Analogue) {
this._data = dt;
}

@Input() set editionLevel(el: EditionLevelType) {
this.edLevel = el;
this.editionLevelChange.next(el);
}
get editionLevel() { return this.edLevel; }
editionLevelChange = new BehaviorSubject<EditionLevelType | ''>('');

get editorialConventionData(): EditorialConventionLayoutData {
return {
name: '.analogues',
attributes: this.data?.attributes || {},
editionLevel: this.editionLevel,
defaultsKey: '.analogues',
};
}

get data() { return this._data; }

public analogueClass = AnalogueClass;

public dataForNote = {};

public opened = false;

toggleOpened$ = new Subject<boolean | void>();
opened$ = this.toggleOpened$.pipe(
scan((currentState: boolean, val: boolean | undefined) => val === undefined ? !currentState : val, false),
startWith(false),
);

toggleAppEntryBox(e: MouseEvent) {
e.stopPropagation();
this.opened = !this.opened;
}

closeAppEntryBox() {
this.opened = false;
}

stopPropagation(e: MouseEvent) {
e.stopPropagation();
}

/** If the element has no text then it's displayed as a note.*/
createNote(v): Note|{} {

return {
type: Note,
noteType: 'analogue',
noteLayout: 'popover',
exponent: v.path || '',
content: v.extLinkedElements.concat(v.extSources, v.sources) || {},
attributes: v.attributes || [],
}
}

ngOnInit() {
if (this.data.text.length === 0) {
this.dataForNote = this.createNote(this.data);
}
}

constructor(
public evtStatusService: EVTStatusService,
) {}

}
Loading