Skip to content

Commit

Permalink
Add label to anonymous idea form
Browse files Browse the repository at this point in the history
  • Loading branch information
ilmartyrk committed Jan 27, 2025
1 parent a006783 commit d6f2e54
Show file tree
Hide file tree
Showing 5 changed files with 53 additions and 20 deletions.
6 changes: 6 additions & 0 deletions src/app/ideation/components/add-idea/add-idea.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,12 @@
<div id="post_idea_form_wrap">
<div class="form_header">
<span translate="COMPONENTS.ADD_IDEA.FOOTER_FORM_TITLE"></span>
<div id="anonymous_info_wrap" translate="COMPONENTS.ADD_IDEA.FOOTER_FORM_ANONYMOUS_INFO">
<div class="tooltip" tooltip>
<div class="content_title" translate="COMPONENTS.ADD_IDEA.TOOLTIP_ANONYMOUS_TITLE"></div>
<div class="content_description" translate="COMPONENTS.ADD_IDEA.TOOLTIP_ANONYMOUS_DESCRIPTION"></div>
</div>
</div>
<div id="close_mobile" class="mobile_show">
<button class="btn_small_close icon close_button mobile_show" (click)="close()">
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
Expand Down
22 changes: 21 additions & 1 deletion src/app/ideation/components/add-idea/add-idea.component.scss
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,6 @@
0px -12px 16px 0px rgba(50, 85, 112, 0.04);
overflow: auto;


@include mixins.tablet {
position: fixed;
bottom: 0;
Expand Down Expand Up @@ -204,3 +203,24 @@
}
}
}

.form_header {
display: flex;
align-items: center;
justify-content: space-between;
}
#anonymous_info_wrap {
display: flex;
flex-direction: row;
width: max-content;
justify-content: right;
padding: 8px 28px 8px 12px;
gap: 8px;
position: relative;
border-radius: 8px;
font-size: 14px;
font-style: normal;
font-weight: 400;
line-height: 20px;
background-color: var(--color-info-background);
}
7 changes: 7 additions & 0 deletions src/app/ideation/components/idea/idea-dialog.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,13 @@
</div>
<div class="vertical_line_separator"></div>
</ng-container>
<ng-container *ngIf="!idea.author">
<div class="name_wrap">
<div class="name" [innerHTML]="'COMPONENTS.IDEABOX.IDEA_NUMBER' | translate:{number: ''}"></div>
<div class="date">{{idea.createdAt | date: 'YYYY-MM-dd HH:mm'}}</div>
</div>
<div class="vertical_line_separator"></div>
</ng-container>
<button class="btn_small_plain" (click)="toggleFavourite()" *ngIf="(Auth.loggedIn$ | async)">
<div class="tooltip_item" tooltip pos="top" [noIcon]="true">
<div class="content_description" *ngIf="!idea.favourite"
Expand Down
34 changes: 15 additions & 19 deletions src/app/ideation/components/idea/idea.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import { TranslateService } from '@ngx-translate/core';
import { Argument } from 'src/app/interfaces/argument';
import { TopicService } from '@services/topic.service';
import { Folder } from 'src/app/interfaces/folder';
import { Idea } from 'src/app/interfaces/idea';
import { DomSanitizer } from '@angular/platform-browser';
import { IdeaReplyComponent } from '../idea-reply/idea-reply.component';
import { TopicIdeationService } from '@services/topic-ideation.service';
Expand Down Expand Up @@ -187,11 +188,17 @@ export class IdeaDialogComponent extends IdeaboxComponent {
this.idea.showReplies = true;
}
}
prevIdea() {
getIdeaIndex(ideas: Idea[]) {
let index = ideas.findIndex((item: Idea) => item.id === this.idea.id);
return index
}

loadIdea(next: number) {
this.TopicIdeaService.loadItems().pipe(take(1)).subscribe((ideas) => {
let index = ideas.findIndex((item) => item.id === this.idea.id);
if (index === 0) index = ideas.length;
const newIdea = ideas[index - 1];
let index = this.getIdeaIndex(ideas);
if (next < 0 && index === 0) index = ideas.length;
else if (next > 0 && index === ideas.length -1) index = -1;
const newIdea = ideas[index + next];
this.router.navigate(['/', this.Translate.currentLang, 'topics', this.topic.id, 'ideation', this.ideation.id, 'ideas', newIdea.id]);
this.idea = newIdea;
this.folders$ = this.TopicIdeaService
Expand All @@ -203,23 +210,12 @@ export class IdeaDialogComponent extends IdeaboxComponent {
this.notification = null;
})
}
prevIdea() {
this.loadIdea(-1);
}

nextIdea() {
this.TopicIdeaService.loadItems().pipe(take(1)).subscribe((ideas) => {
let index = ideas.findIndex((item) => item.id === this.idea.id);
if (index === ideas.length - 1) index = -1;
const newIdea = ideas[index + 1];
this.router.navigate(['/', this.Translate.currentLang, 'topics', this.topic.id, 'ideation', this.ideation.id, 'ideas', newIdea.id]);
this.idea = newIdea;
this.folders$ = this.TopicIdeaService
.getFolders({ topicId: this.topic.id, ideationId: this.idea.ideationId, ideaId: this.idea.id })
.pipe(take(1), map((res: any) => res.rows));
this.images$ = this.IdeaAttachmentService
.query({ topicId: this.topic.id, ideationId: this.idea.ideationId, ideaId: this.idea.id, type: 'image' })
.pipe(take(1), map((res: any) => res.rows));

this.notification = null;
});
this.loadIdea(1);
}

private _parseArgumentIdAndVersion(argumentIdWithVersion: string) {
Expand Down
4 changes: 4 additions & 0 deletions src/assets/i18n/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,10 @@
},
"ADD_IDEA": {
"FOOTER_MENU_TITLE": "Join the idea gathering",
"FOOTER_FORM_ANONYMOUS_INFO": "You are posting anonymously",
"FOOTER_MENU_BTN_ADD_IDEA": "Add your idea",
"TOOLTIP_ANONYMOUS_TITLE": "Anonymous posting",
"TOOLTIP_ANONYMOUS_DESCRIPTION": "Your idea will be posted anonymously. There will be no way to identify you.",
"FOOTER_FORM_TITLE": "Add your idea",
"PLACEHOLDER_ADD_STATEMENT_TO_IDEA": "Your idea heading",
"SUBJECT_CHARACTERS_LEFT": "Characters left: {{chars}}/{{charsLeft}}",
Expand Down Expand Up @@ -443,6 +446,7 @@
"LNK_CANCEL": "@:LNK_CANCEL"
},
"IDEABOX": {
"IDEA_NUMBER": "Idea {{number}}",
"OPTION_EDIT": "Edit idea",
"OPTION_FAVOURITE": "@:VIEWS.TOPICS_TOPICID.OPTION_FAVOURITE",
"OPTION_UNFAVOURITE": "@:VIEWS.TOPICS_TOPICID.OPTION_UNFAVOURITE",
Expand Down

0 comments on commit d6f2e54

Please sign in to comment.