-
Notifications
You must be signed in to change notification settings - Fork 6
Implemented some pages of administration #113
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
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ahoj, skvělá práce, díky moc! Vidím, že ses v tom kódu webu slušně zorientoval a rovnou to rozjel ve velkém.
Mám pár poznámek, jedná se spíš o znovu-používání existujících metod atp., v rychlosti:
- tabulky se dají do dark/light módu stylovat automaticky pomocí
ksiTheme
direktivy - místo
confirm
používej prosímyesNo
zmodal.service.ts
- viz https://github.com/fi-ksi/web-frontend-angular/blob/main/src/app/components/shared/discussion-thread/discussion-thread-posts/discussion-thread-posts.component.ts#L150 - místo
alert
buď používej taky yes/no, nebo udělej nějaký mini-prompt modálek, nebo v případě erroru zavolejshowServerErrorModal
zmodal.service.ts
přičemž error vypíšeš jen do konzole
<a [routerLink]="['/', routes.routes.admin._, routes.routes.admin.waves._]"> Zpět na přehled</a> | ||
|
||
<div class=""> | ||
<img src="https://media1.giphy.com/media/v1.Y2lkPTc5MGI3NjExaWxremdsOW1mcmJtY3hxZ3BieTczZWN3ODB5MW8zY3BkcDVzeHl4ZyZlcD12MV9pbnRlcm5hbF9naWZfYnlfaWQmY3Q9Zw/VHOF8pfPZOt9p018zw/giphy.gif" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
je mi to líto, je to krásný gif, ale poprosím tě, abys nepoužíval externí obrázky. Externí obrázky zpomalují stránku a prozrazují tvoji IP adresu a fakt, že jsi na KSI webu ostatním službám.
[routerLink]="['/', routes.routes.admin._, routes.routes.admin.articles._, routes.routes.admin.articles.edit, '0']"> | ||
{{ icon.ADD }} {{ 'admin.articles.new' | translate }}</a> | ||
|
||
<table class="table table-striped table-hover table-responsive-md threads table-dark"> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Místo table-dark používej prosím ksiTheme
, které automaticky nastaví světlý/tmavý mód
<table class="table table-striped table-hover table-responsive-md threads table-dark"> | |
<table class="table table-striped table-hover table-responsive-md threads" ksiTheme> |
[routerLink]="['/', routes.routes.admin._, routes.routes.admin.waves._, routes.routes.admin.waves.edit, '0']"> | ||
{{ icon.ADD }} {{ 'admin.waves.new' | translate }}</a> | ||
|
||
<table class="table table-striped table-hover table-responsive-md threads table-dark"> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Místo table-dark používej prosím ksiTheme
, které automaticky nastaví světlý/tmavý mód
<table class="table table-striped table-hover table-responsive-md threads table-dark"> | |
<table class="table table-striped table-hover table-responsive-md threads" ksiTheme> |
[routerLink]="['/', routes.routes.admin._, routes.routes.admin.years._, routes.routes.admin.years.edit, '0']"> | ||
{{ icon.ADD }} {{ 'admin.years.newYear' | translate }}</a> | ||
|
||
<table class="table table-striped table-hover table-responsive-md threads table-dark"> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Místo table-dark používej prosím ksiTheme
, které automaticky nastaví světlý/tmavý mód
<table class="table table-striped table-hover table-responsive-md threads table-dark"> | |
<table class="table table-striped table-hover table-responsive-md threads" ksiTheme> |
} | ||
|
||
deleteArticle(article: Article): void { | ||
if (confirm(`Are you sure you want to delete article "${article.title}"?`)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Místo confirm
prosím používej this.modal.yesNo('discussion-thread.post.delete.confirmation')
(viz https://github.com/fi-ksi/web-frontend-angular/blob/main/src/app/components/shared/discussion-thread/discussion-thread-posts/discussion-thread-posts.component.ts#L150 ), je to lépe nastylované.
} | ||
}, | ||
error: (err) => { | ||
alert(`Error loading year: ${err?.message || err}`); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Místo alert
prosím používej this.modal.yesNo('discussion-thread.post.delete.confirmation') (viz https://github.com/fi-ksi/web-frontend-angular/blob/main/src/app/components/shared/discussion-thread/discussion-thread-posts/discussion-thread-posts.component.ts#L150 ), je to lépe nastylované. Případně zkus vytvořit vlastní modal utilitku jen na zobrazování popupů.
this.router.navigate(['/', this.routes.routes.admin._, this.routes.routes.admin.years._]); | ||
}, | ||
error: (err) => { | ||
alert(`Error: ${err?.message || err}`); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Místo alert
prosím používej this.modal.yesNo('discussion-thread.post.delete.confirmation') (viz https://github.com/fi-ksi/web-frontend-angular/blob/main/src/app/components/shared/discussion-thread/discussion-thread-posts/discussion-thread-posts.component.ts#L150 ), je to lépe nastylované. Případně zkus vytvořit vlastní modal utilitku jen na zobrazování popupů.
this.reloadYears(); | ||
}, | ||
error: (err) => { | ||
alert(`Error deleting year: ${err?.message || err}`); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Místo alert
prosím používej this.modal.yesNo('discussion-thread.post.delete.confirmation') (viz https://github.com/fi-ksi/web-frontend-angular/blob/main/src/app/components/shared/discussion-thread/discussion-thread-posts/discussion-thread-posts.component.ts#L150 ), je to lépe nastylované. Případně zkus vytvořit vlastní modal utilitku jen na zobrazování popupů.
yearId: number; | ||
|
||
form = this.fb.group({ | ||
index: [0, [Validators.required]], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Místo ročníku 0
nastav prosím jako výchozí o jedno vyšší index, než je teď maximální
this.cdr.markForCheck(); | ||
} | ||
|
||
ngOnDestroy() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FYI: Místo pamatování na ngOnDestroy
tak můžeš použít SubscribedComponent
, který má v sobě _subs
, které tohle dělají automaticky
Made this pages:
Please take a moment to look at the code if everything is OK.
Thx, NoTime