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

mylife: add links to achievements (fixes #7442) #7471

Merged
merged 6 commits into from
May 30, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
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
Next Next commit
Add support for achievement item links
  • Loading branch information
Mutugiii committed May 29, 2024
commit 10d6bb109f747e08630cc810c6b883a889cfb8a9
Original file line number Diff line number Diff line change
Expand Up @@ -113,21 +113,23 @@ export class UsersAchievementsUpdateComponent implements OnInit, OnDestroy {
});
}

addAchievement(index = -1, achievement = { title: '', description: '', date: '' }) {
addAchievement(index = -1, achievement = { title: '', description: '', link: '', date: '' }) {
if (typeof achievement === 'string') {
achievement = { title: '', description: achievement, date: '' };
achievement = { title: '', description: achievement, link: '', date: '' };
}
this.dialogsFormService.openDialogsForm(
achievement.title !== '' ? $localize`Edit Achievement` : $localize`Add Achievement`,
[
{ 'type': 'textbox', 'name': 'title', 'placeholder': $localize`Title`, required: true },
{ 'type': 'date', 'name': 'date', 'placeholder': $localize`Date`, 'required': false },
{ 'type': 'textbox', 'name': 'link', 'placeholder': $localize`Link`, required: false },
{ 'type': 'textarea', 'name': 'description', 'placeholder': $localize`Description`, 'required': false },
],
this.fb.group({
...achievement,
title: [ achievement.title, CustomValidators.required ],
description: [ achievement.description ],
link: [ achievement.link ],
date: [ achievement.date, null, ac => this.validatorService.notDateInFuture$(ac) ]
}),
{ onSubmit: (formValue, formGroup) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,10 @@ <h3 i18n>My Achievements</h3>
</span>
<span class="achievement-date">{{achievement.date | date: medium}}</span>
</p>
<p mat-line *ngIf="openAchievementIndex === i">{{achievement.description}}</p>
<p mat-line *ngIf="openAchievementIndex === i">
{{achievement.description}}
<br><a href="{{achievement.link}}" target="_blank" class="styled-link"> - {{achievement.link}} </a>
</p>
<span mat-line class="achievement-buttons" *ngIf="openAchievementIndex === i"></span>
</mat-list-item>
</mat-list>
Expand Down
11 changes: 11 additions & 0 deletions src/app/users/users-achievements/users-achievements.scss
Original file line number Diff line number Diff line change
Expand Up @@ -44,4 +44,15 @@
}

}

.styled-link {
color: #007bff;
text-decoration: none;
font-weight: bold;
}

.styled-link:hover {
color: #0056b3;
text-decoration: underline;
}
}