Skip to content

Commit

Permalink
Merge pull request #75 from uatisdeproblem/development
Browse files Browse the repository at this point in the history
Development
  • Loading branch information
uatisdeproblem authored Jan 20, 2024
2 parents bb26921 + cb04b00 commit e415899
Show file tree
Hide file tree
Showing 21 changed files with 338 additions and 131 deletions.
8 changes: 4 additions & 4 deletions back-end/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions back-end/package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"version": "1.8.1",
"version": "1.8.2",
"name": "back-end",
"scripts": {
"lint": "eslint --ext .ts",
Expand All @@ -10,8 +10,8 @@
"dependencies": {
"axios": "^1.4.0",
"date-fns": "^2.30.0",
"idea-aws": "^4.3.4",
"idea-toolbox": "^7.0.1",
"idea-aws": "4.3.4",
"idea-toolbox": "7.0.1",
"jsonwebtoken": "^9.0.1",
"xlsx": "https://cdn.sheetjs.com/xlsx-0.20.1/xlsx-0.20.1.tgz",
"xml2js": "^0.6.2"
Expand Down
20 changes: 20 additions & 0 deletions back-end/src/models/configurations.model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,22 @@ export class Configurations extends Resource {
* When displaying a user, which information to show.
*/
usersOriginDisplay: UsersOriginDisplayOptions;
/**
* Whether to hide the Q&A topics feature from the front-end.
*/
hideQATopics: boolean;
/**
* Whether to hide the opportunities feature from the front-end.
*/
hideOpportunities: boolean;
/**
* Whether to hide the voting feature from the front-end.
*/
hideVoting: boolean;
/**
* Whether to hide the badges (gamification) feature from the front-end.
*/
hideBadges: boolean;

load(x: any): void {
super.load(x);
Expand All @@ -68,6 +84,10 @@ export class Configurations extends Resource {
this.appLogoURLDarkMode = this.clean(x.appLogoURLDarkMode, String);
this.timezone = this.clean(x.timezone, String, DEFAULT_TIMEZONE);
this.usersOriginDisplay = this.clean(x.usersOriginDisplay, String, UsersOriginDisplayOptions.SECTION);
this.hideQATopics = this.clean(x.hideQATopics, Boolean, false);
this.hideOpportunities = this.clean(x.hideOpportunities, Boolean, false);
this.hideVoting = this.clean(x.hideVoting, Boolean, false);
this.hideBadges = this.clean(x.hideBadges, Boolean, false);
}

safeLoad(newData: any, safeData: any): void {
Expand Down
6 changes: 6 additions & 0 deletions back-end/src/models/votingSession.model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,12 @@ export class VotingSession extends Resource {
return e;
}

/**
* Get the list of voters sorted by name.
*/
getSortedVoters(): Voter[] {
return this.voters.sort((a, b): number => a.name.localeCompare(b.name));
}
/**
* Get the voters who didn't vote (absent).
* Note: either a voter is present for all the ballots or they are absents for all the ballots.
Expand Down
2 changes: 1 addition & 1 deletion back-end/swagger.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ openapi: 3.0.3

info:
title: ESN Assembly app
version: 1.8.1
version: 1.8.2
contact:
name: Matteo Carbone
email: [email protected]
Expand Down
8 changes: 4 additions & 4 deletions front-end/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions front-end/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "esn-assembly",
"version": "1.8.1",
"version": "1.8.2",
"author": "Matteo Carbone",
"homepage": "https://matteocarbone.com/",
"scripts": {
Expand All @@ -23,7 +23,7 @@
"@capacitor/core": "^5.2.2",
"@capacitor/network": "^5.0.6",
"@capacitor/push-notifications": "^5.0.6",
"@idea-ionic/common": "^7.1.4",
"@idea-ionic/common": "7.1.4",
"@ionic/angular": "^7.4.1",
"@ionic/storage-angular": "^4.0.0",
"@kolkov/angular-editor": "^3.0.0-beta.0",
Expand All @@ -32,7 +32,7 @@
"date-fns": "^2.30.0",
"date-fns-tz": "^2.0.0",
"docs-soap": "^1.2.1",
"idea-toolbox": "^7.0.1",
"idea-toolbox": "7.0.1",
"ionicons": "^7.0.0",
"qrcode": "^1.5.3",
"rxjs": "~7.8.0",
Expand Down
70 changes: 57 additions & 13 deletions front-end/src/app/tabs/configurations/configurations.page.html
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@
<ion-list-header>
<ion-label>
<h2>{{ 'CONFIGURATIONS.ENTITIES' | translate }}</h2>
<p>{{ 'CONFIGURATIONS.ENTITIES_I' | translate }}</p></ion-label
>
<p>{{ 'CONFIGURATIONS.ENTITIES_I' | translate }}</p>
</ion-label>
</ion-list-header>
<ion-item button detail (click)="app.goToInTabs(['configurations', 'events'])">
<ion-label>{{ 'CONFIGURATIONS.EVENTS' | translate }}</ion-label>
Expand All @@ -34,8 +34,8 @@ <h2>{{ 'CONFIGURATIONS.ENTITIES' | translate }}</h2>
<ion-list-header>
<ion-label>
<h2>{{ 'CONFIGURATIONS.DISPLAY_OPTIONS' | translate }}</h2>
<p>{{ 'CONFIGURATIONS.DISPLAY_OPTIONS_I' | translate }}</p></ion-label
>
<p>{{ 'CONFIGURATIONS.DISPLAY_OPTIONS_I' | translate }}</p>
</ion-label>
</ion-list-header>
<ion-item>
<ion-label position="stacked">{{ 'CONFIGURATIONS.APP_TITLE' | translate }}</ion-label>
Expand Down Expand Up @@ -125,18 +125,62 @@ <h2>{{ 'CONFIGURATIONS.DISPLAY_OPTIONS' | translate }}</h2>
translate
/>
</ion-item>
</ion-list>

<ion-list class="aList" *ngIf="pageSection === PageSections.USERS">
<ion-list-header>
<ion-label>
<h2>{{ 'CONFIGURATIONS.GIVE_BADGES' | translate }}</h2>
<p>{{ 'CONFIGURATIONS.GIVE_BADGES_I' | translate }}</p></ion-label
>
<h2>{{ 'CONFIGURATIONS.HIDE_APP_FEATURES' | translate }}</h2>
<p>{{ 'CONFIGURATIONS.HIDE_APP_FEATURES_I' | translate }}</p>
</ion-label>
</ion-list-header>
<p class="ion-text-center">
<ion-button (click)="openBadgesModal()">{{ 'CONFIGURATIONS.GIVE_A_BADGE' | translate }}</ion-button>
</p>
<ion-item>
<ion-checkbox
slot="end"
[(ngModel)]="configurations.hideQATopics"
(ionChange)="setVisibilityQATopicsFeature(!$event.detail.checked)"
/>
<ion-label>{{ 'CONFIGURATIONS.HIDE_QA_TOPICS' | translate }}</ion-label>
<idea-show-hint-button slot="start" hint="CONFIGURATIONS.HIDE_APP_FEATURES" translate />
</ion-item>
<ion-item>
<ion-checkbox
slot="end"
[(ngModel)]="configurations.hideOpportunities"
(ionChange)="setVisibilityOpportunitiesFeature(!$event.detail.checked)"
/>
<ion-label>{{ 'CONFIGURATIONS.HIDE_OPPORTUNITIES' | translate }}</ion-label>
<idea-show-hint-button slot="start" hint="CONFIGURATIONS.HIDE_APP_FEATURES" translate />
</ion-item>
<ion-item>
<ion-checkbox
slot="end"
[(ngModel)]="configurations.hideVoting"
(ionChange)="setVisibilityVotingFeature(!$event.detail.checked)"
/>
<ion-label>{{ 'CONFIGURATIONS.HIDE_VOTING' | translate }}</ion-label>
<idea-show-hint-button slot="start" hint="CONFIGURATIONS.HIDE_APP_FEATURES" translate />
</ion-item>
<ion-item>
<ion-checkbox
slot="end"
[(ngModel)]="configurations.hideBadges"
(ionChange)="setVisibilityBadgesFeature(!$event.detail.checked)"
/>
<ion-label>{{ 'CONFIGURATIONS.HIDE_BADGES' | translate }}</ion-label>
<idea-show-hint-button slot="start" hint="CONFIGURATIONS.HIDE_APP_FEATURES" translate />
</ion-item>
</ion-list>

<ion-list class="aList" *ngIf="pageSection === PageSections.USERS">
<ng-container *ngIf="!configurations.hideBadges">
<ion-list-header>
<ion-label>
<h2>{{ 'CONFIGURATIONS.GIVE_BADGES' | translate }}</h2>
<p>{{ 'CONFIGURATIONS.GIVE_BADGES_I' | translate }}</p>
</ion-label>
</ion-list-header>
<p class="ion-text-center">
<ion-button (click)="openBadgesModal()">{{ 'CONFIGURATIONS.GIVE_A_BADGE' | translate }}</ion-button>
</p>
</ng-container>
<ion-list-header class="ion-padding-top">
<ion-label>
<h2>{{ 'CONFIGURATIONS.ADMINISTRATORS' | translate }}</h2>
Expand Down
20 changes: 20 additions & 0 deletions front-end/src/app/tabs/configurations/configurations.page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,26 @@ export class ConfigurationsPage implements OnInit {
const alert = await this.alertCtrl.create({ header, message, buttons });
alert.present();
}
async setVisibilityQATopicsFeature(show: boolean): Promise<void> {
const newConfigurations = new Configurations(this.configurations);
newConfigurations.hideQATopics = !show;
await this.updateConfigurations(newConfigurations);
}
async setVisibilityOpportunitiesFeature(show: boolean): Promise<void> {
const newConfigurations = new Configurations(this.configurations);
newConfigurations.hideOpportunities = !show;
await this.updateConfigurations(newConfigurations);
}
async setVisibilityVotingFeature(show: boolean): Promise<void> {
const newConfigurations = new Configurations(this.configurations);
newConfigurations.hideVoting = !show;
await this.updateConfigurations(newConfigurations);
}
async setVisibilityBadgesFeature(show: boolean): Promise<void> {
const newConfigurations = new Configurations(this.configurations);
newConfigurations.hideBadges = !show;
await this.updateConfigurations(newConfigurations);
}
}

enum PageSections {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,8 @@ const FIRST_YEAR_FOR_COMMUNICATIONS = 2023;
</ion-item>
<ion-item button *ngFor="let communication of communications" (click)="openCommunication(communication)">
<ion-label class="ion-text-wrap">
<p *ngIf="communication.event">{{ communication.event.name }}</p>
{{ communication.name }}
<p>{{ communication.brief }}</p>
</ion-label>
<ion-note slot="end">{{ communication.date | dateTz }}</ion-note>
<ion-button
Expand All @@ -85,8 +85,6 @@ const FIRST_YEAR_FOR_COMMUNICATIONS = 2023;
ion-list.aList ion-list-header {
margin-left: 8px;
}
`,
`
ion-toolbar ion-buttons[slot='start'] ion-button {
margin-left: 8px;
}
Expand Down
44 changes: 23 additions & 21 deletions front-end/src/app/tabs/profile/profile.page.html
Original file line number Diff line number Diff line change
Expand Up @@ -22,27 +22,29 @@
<p>{{ app.user.getOrigin() }}</p>
</ion-label>
</ion-item>
<ion-list-header>
<ion-label><h2>{{ 'PROFILE.YOUR_BADGES' | translate }}</h2></ion-label>
</ion-list-header>
<ion-item lines="full" class="noBadges" *ngIf="badges && !badges.length">
<ion-icon slot="start" icon="sad-outline"></ion-icon>
<ion-label class="ion-text-wrap">{{ 'PROFILE.NO_BADGES' | translate }}</ion-label>
</ion-item>
<ion-grid class="badgesGrid">
<ion-row class="ion-justify-content-center ion-align-items-center">
<ion-col *ngIf="!badges">
<ion-skeleton-text animated></ion-skeleton-text>
</ion-col>
<ion-col *ngFor="let badge of badges">
<ion-img
class="tappable"
[src]="_badges.getBadgeImage(badge)"
(click)="_badges.openBadgeDetails(badge)"
></ion-img>
</ion-col>
</ion-row>
</ion-grid>
<ng-container *ngIf="!app.configurations.hideBadges">
<ion-list-header>
<ion-label><h2>{{ 'PROFILE.YOUR_BADGES' | translate }}</h2></ion-label>
</ion-list-header>
<ion-item lines="full" class="noBadges" *ngIf="badges && !badges.length">
<ion-icon slot="start" icon="sad-outline"></ion-icon>
<ion-label class="ion-text-wrap">{{ 'PROFILE.NO_BADGES' | translate }}</ion-label>
</ion-item>
<ion-grid class="badgesGrid">
<ion-row class="ion-justify-content-center ion-align-items-center">
<ion-col *ngIf="!badges">
<ion-skeleton-text animated></ion-skeleton-text>
</ion-col>
<ion-col *ngFor="let badge of badges">
<ion-img
class="tappable"
[src]="_badges.getBadgeImage(badge)"
(click)="_badges.openBadgeDetails(badge)"
></ion-img>
</ion-col>
</ion-row>
</ion-grid>
</ng-container>
<ion-list-header>
<ion-label><h2>{{ 'COMMON.ACTIONS' | translate }}</h2></ion-label>
</ion-list-header>
Expand Down
12 changes: 6 additions & 6 deletions front-end/src/app/tabs/tabs.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@
<ion-tab-button tab="dashboard">
<ion-label>{{ 'TABS.DASHBOARD' | translate }}</ion-label>
</ion-tab-button>
<ion-tab-button tab="topics">
<ion-tab-button tab="topics" *ngIf="!app.configurations.hideQATopics">
<ion-label>{{ 'TABS.TOPICS' | translate }}</ion-label>
</ion-tab-button>
<ion-tab-button tab="opportunities">
<ion-tab-button tab="opportunities" *ngIf="!app.configurations.hideOpportunities">
<ion-label>{{ 'TABS.OPPORTUNITIES' | translate }}</ion-label>
</ion-tab-button>
<ion-tab-button tab="voting">
<ion-tab-button tab="voting" *ngIf="!app.configurations.hideVoting">
<ion-label>{{ 'TABS.VOTING' | translate }}</ion-label>
</ion-tab-button>
<ion-tab-button tab="profile">
Expand All @@ -29,13 +29,13 @@
<ion-tab-button tab="dashboard">
<ion-icon icon="home"></ion-icon>
</ion-tab-button>
<ion-tab-button tab="topics">
<ion-tab-button tab="topics" *ngIf="!app.configurations.hideQATopics">
<ion-icon icon="chatbubbles"></ion-icon>
</ion-tab-button>
<ion-tab-button tab="opportunities">
<ion-tab-button tab="opportunities" *ngIf="!app.configurations.hideOpportunities">
<ion-icon icon="balloon"></ion-icon>
</ion-tab-button>
<ion-tab-button tab="voting">
<ion-tab-button tab="voting" *ngIf="!app.configurations.hideVoting">
<ion-icon icon="ticket"></ion-icon>
</ion-tab-button>
<ion-tab-button tab="profile">
Expand Down
Loading

0 comments on commit e415899

Please sign in to comment.