Skip to content

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Conversation

Ninjaondra321
Copy link
Member

Made this pages:

  • Years (display, edit)
  • Waves (display, edit)
  • Articles (only display)

Please take a moment to look at the code if everything is OK.
Thx, NoTime

Copy link
Member

@esoadamo esoadamo left a 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:

<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"
Copy link
Member

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">
Copy link
Member

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

Suggested change
<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">
Copy link
Member

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

Suggested change
<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">
Copy link
Member

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

Suggested change
<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}"?`)) {
Copy link
Member

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}`);
Copy link
Member

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}`);
Copy link
Member

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}`);
Copy link
Member

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]],
Copy link
Member

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() {
Copy link
Member

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants